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?


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.


MQTT: https://en.wikipedia.org/wiki/MQTT

Andreas Spiess: https://www.youtube.com/channel/UCu7_D0o48KbfhpEohoP7YSQ


Step 1: Install nodeJs on Pi. Refer :https://www.w3schools.com/nodejs/nodejs_raspberrypi.asp
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.

  • 2
    Hi Eknath, please use the edit functionality to merge your two answers. Afterwards you can delete one of them.
    – Helmar
    Jul 4 '18 at 8:28
  • 1
    Using angular for this project looks like an overkill. Simple express should be enough. For python, Flask framework is suitable. Jul 4 '18 at 19:22

Not the answer you're looking for? Browse other questions tagged or ask your own question.