Electrical – How to use Esp8266 to communicate between Arduino and Raspberry Pi?

arduinocommunicationesp8266raspberry piwifi

I need to read 8 sensor values from Arduino and send it to Pi through Esp8266. Also after reading these data my pi will give back 6 other values (integers) which has to be received by Arduino again through same ESP8266.
The values that are sent to Pi will be received by a python script and the 6 other values will also be ganerated by the same python script.
I am confused on what could be the best method to proceed with this. So, far I have settled on using the Esp8266 as a server and pi as a client. But still I believe there would better options. please guide me

I know RF modules will be an better option here but I am not allowed to use it.

Best Answer

You need to configure RPi as WiFi client and need to configure ESP module which can serve two different URLs. If you send HTTP request to your ESP Server for querying for data. You will receive the request from RPi as a serial data on Arduino, against which you can reply back the values you wanted to send to RPi.

RPi will process those number and will generate another 6 values using 2nd URL and you will have all those 6 values in Arduino over serial communication.