Send data between Raspberry Pi and ESP8266/Arduino
Posted: Wed May 27, 2015 3:18 pm
Pi is server running Python. Client is ESP8266 connected to Arduino UNO via RX/TX. ESP8266 is issuing AT commands.
Please see attached Python code for Raspberry Pi. Python code is not mine, it is adapted from Python foundation.
I get confirmation that the ESP8266 is connected to the Pi by the printout: "Connected by" followed by the ESP's address on my router.
Problem is the Python code hangs in the "data = conn.recv(1024) line. It's looking for something it is not getting - perhaps an EOF.
Here is an outline of the Arduino code:
dataToPi = "Hello World\0"; ---- \0 should be EOF. Don't know if ESP will handle this
connect to my router
AT+CIPSTART=0,"TCP",myRaspberry Pi address, 50007 ----- I get confirmation that it works from the Pi
AT+CIPSTATUS -- returns status 3
AT+CIPSEND=012 -- where 12 = length of Hello World +1 (dataToPi.length() does not count the \0)
Serial.println(dataToPi);
AT+CIPCLOSE
Tried a bunch of variations of the above to no avail.
Any Help will be appreciated. Thanks
Please see attached Python code for Raspberry Pi. Python code is not mine, it is adapted from Python foundation.
I get confirmation that the ESP8266 is connected to the Pi by the printout: "Connected by" followed by the ESP's address on my router.
Problem is the Python code hangs in the "data = conn.recv(1024) line. It's looking for something it is not getting - perhaps an EOF.
Here is an outline of the Arduino code:
dataToPi = "Hello World\0"; ---- \0 should be EOF. Don't know if ESP will handle this
connect to my router
AT+CIPSTART=0,"TCP",myRaspberry Pi address, 50007 ----- I get confirmation that it works from the Pi
AT+CIPSTATUS -- returns status 3
AT+CIPSEND=012 -- where 12 = length of Hello World +1 (dataToPi.length() does not count the \0)
Serial.println(dataToPi);
AT+CIPCLOSE
Tried a bunch of variations of the above to no avail.
Any Help will be appreciated. Thanks