Help needed for installation
Thank you for your great project.I want to use your code to build low power sensor network for home automation using 10-15 esp8266 devices as sender devices and Raspberry pi zero as receiver or gateway to internet. Right now I am using adhoc network to exchange 2 way data between 2 ESP8266 devices but it takes about 200 milliseconds to exchange 6 bytes of data. As I read on your hackaday project your solution is very fast. I have put my raspberry pi in monitor mode using https://re4son-kernel.com/download/re4son-kernel-current/ but I am confused about my next steps to use your code.
Can you please provide brief howto steps ? I do not know which code from this repo I have to use for sender ESP8266 ? Also what I need to do on raspberry pi ?
Please help me.
Thanks.
Hello,
I think a good start is to use this simple code, on the pi: https://github.com/thomasfla/Linux-ESPNOW/blob/master/ESPNOW_lib/src/main.cpp
this will echo each espnow packet received by the pi.
You could also run wireshark on the pi to check that you receive the espnow packet. It's a simple and usefull graphical tool.
I never ran this code on the pi, I would be interested to have your feedback!
On the esp side, you could have a look at this simple code: https://github.com/thomasfla/Linux-ESPNOW/blob/master/ESP8266_Echo/ESP8266_Echo.ino
My advice would be to modify it to only send data, in a first time. You could remove the 'send' call in the receive callback and put it in the main loop with a reasonable delay.
I tried to compile your code to raspberry pi and I get following error message:
/tmp/ccKgaZCh.o: In function `callback(unsigned char*, unsigned char*, int)':
espnow.cpp:(.text+0x68): undefined reference to `ESPNOW_manager::send()'
/tmp/ccKgaZCh.o: In function `main':
espnow.cpp:(.text+0x118): undefined reference to `ESPNOW_manager::set_filter(unsigned char*, unsigned char*)'
espnow.cpp:(.text+0x12c): undefined reference to `ESPNOW_manager::set_recv_callback(void (*)(unsigned char*, unsigned char*, int))'
espnow.cpp:(.text+0x13c): undefined reference to `ESPNOW_manager::start()'
/tmp/ccKgaZCh.o: In function `ESPNOW_manager::ESPNOW_manager(char*, unsigned char, unsigned short, unsigned char*, unsigned char*, bool)':
espnow.cpp:(.text._ZN14ESPNOW_managerC2EPchtPhS1_b[_ZN14ESPNOW_managerC5EPchtPhS1_b]+0x38): undefined reference to `ESPNOW_manager::set_interface(char*)'
espnow.cpp:(.text._ZN14ESPNOW_managerC2EPchtPhS1_b[_ZN14ESPNOW_managerC5EPchtPhS1_b]+0x8c): undefined reference to `ESPNOW_manager::set_filter(unsigned char*, unsigned char*)'
espnow.cpp:(.text._ZN14ESPNOW_managerC2EPchtPhS1_b[_ZN14ESPNOW_managerC5EPchtPhS1_b]+0xa0): undefined reference to `ESPNOW_manager::set_filter(unsigned char*, unsigned char*)'
/tmp/ccKgaZCh.o: In function `ESPNOW_manager::set_channel(unsigned short)':
espnow.cpp:(.text._ZN14ESPNOW_manager11set_channelEt[_ZN14ESPNOW_manager11set_channelEt]+0x28): undefined reference to `ESPNOW_packet::set_channel(unsigned short)'
/tmp/ccKgaZCh.o: In function `ESPNOW_manager::set_datarate(unsigned char)':
espnow.cpp:(.text._ZN14ESPNOW_manager12set_datarateEh[_ZN14ESPNOW_manager12set_datarateEh]+0x28): undefined reference to `ESPNOW_packet::set_datarate(unsigned char)'
/tmp/ccKgaZCh.o: In function `ESPNOW_manager::set_src_mac(unsigned char*)':
espnow.cpp:(.text._ZN14ESPNOW_manager11set_src_macEPh[_ZN14ESPNOW_manager11set_src_macEPh]+0x20): undefined reference to `ESPNOW_packet::set_src_mac(unsigned char*)'
/tmp/ccKgaZCh.o: In function `ESPNOW_manager::set_dst_mac(unsigned char*)':
espnow.cpp:(.text._ZN14ESPNOW_manager11set_dst_macEPh[_ZN14ESPNOW_manager11set_dst_macEPh]+0x20): undefined reference to `ESPNOW_packet::set_dst_mac(unsigned char*)'
collect2: error: ld returned 1 exit status````
Thanks
For anyone else seeing this, you need to compile the program with the included Makefile (it contains compile instructions basically).
From the project home directory, cd into /ESPNOW_lib and then just execute make in the terminal. A new directory - bin will be generated as a sibling to the src directory.