In this post I am going to detail how to create a real time data pipeline for processing sensor data. First we will connect the sensor and create the code to read it. I will use the DHT22 temperature and humidity sensor on the Raspberry Pi Zero WH. Then we’ll setup the real time data flow with Python and RabbitMQ. Finally we will use Flask and D3.js to display the data in a live dashboard in a browser.
Connect the HC-SR04 to Orange Pi
The HC-SR04 is a cheap and easy to use sensor, used to measure distance with ultrasound. It can be used in many projects where you trigger an action based on an object or person entering an area, like an “alarm”, as I showed in my previous post. Also, you often see this sensor as part of more interesting projects such as robots, like this one.
In my previous IoT project on the Orange Pi I showed how to read a DHT22 or a DHT11 temperature and humidity sensor. That project involved connecting the sensor to the GPIO pins and writing C code to read the sensor. In this example I will show you how do the same, but using Python code instead.