I need to connect some sensors wireless using an ESP8266 which transfers data over my home Wi-Fi network from sensor to Raspberry Pi. Now, I was told on the Raspberry Pi Stack Exchange that when using the ESP8266, there would be no need of physically connecting the sensor to the Pi using wires. But how to do that wireless? What is the code in Python?
closed as too broad by Bence Kaulics, Thisaru Guruge, Sean Houlihane, mico, Ghanima Jul 5 '18 at 20:55
Please edit the question to limit it to a specific problem with enough detail to identify an adequate answer. Avoid asking multiple distinct questions at once. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.
A powerful and simple communication protocol is MQTT.
MQTT is a protocol that is suitable for communication between low power devices like ESP8266 and Raspberry Pi. It is lightweight and simple to implement.
MQTT is a broker/Client system and there are libraries to ESP8266/Arduino as well as Python.
For the ESP8266/Arduino part, there are several instructive videos on Youtube by Andreas Spiess among others.
Andreas Spiess: https://www.youtube.com/channel/UCu7_D0o48KbfhpEohoP7YSQ
Step 1: Install nodeJs on Pi.
Step 2: Create REST Api by using angular 2-4 with database . Refer: https://www.sitepoint.com/angular-rxjs-create-api-service-rest-backend/ Step 3: configure WI-FI module and trigger the rest services through it. Elaboration: Rest Api is triggered through wifi module through which data of sensor was sent to the database through which you will able to do actuation.
NOTE: In python scenario the creation and triggering of REST Api is through python.