Hi,
I like to share my first experience connecting Raspberry Pi , DHT11 (Temperature/ Humidity Sensor) using Node Red.
I.Things Needed :
1. Raspberry Pi 3 Model B+
2. DHT11 Sensor
3. Solderless board
4. 3 Male to Female Jumper wires.
II. Circuit Completion
Complete the circuit has shown below
III. Install necessary packages :
a) Download package : http://www.airspayce.com/mikem/bcm2835/bcm2835-1.56.tar.gz
b) tar zxvf bcm2835-1.56.tar.gz
c) Compile process :
cd bcm2835-1.56
cd bcm2835-1.56
./configure
make
sudo make check
sudo make install
d) After completing the installation of the BCM2835 library, we can install the Node-DHT-Sensor library:
sudo npm install node-dht-sensor
IV. Node Red Flow
a) Start Node Red : sudo node-red-start
b) Drag and drop the nodes as shown below and wire them
c) Configure the nodes as shown below :
Inject node :
rpi-dht22 node :
function node :
var temp = msg.payload;
var hum = msg.humidity;
msg.payload = "The Temperature at Chennai is : " + temp + " C humidity : " + hum + " %";
return msg;
Node Red Flow :
[{"id":"815e3de7.d095","type":"function","z":"ca6ebb28.cf4718","name":"function","func":"var temp = msg.payload;\nvar hum = msg.humidity;\n\nmsg.payload = \"The Temperature at Chennai is : \" + temp + \" C humidity : \" + hum + \" %\";\n\nreturn msg;","outputs":1,"noerr":0,"x":515,"y":205,"wires":[["9a83148c.58fd18"]]}]
IV. Executing the Node Red Flow
a) Click Deploy
b) Click the Inject node
c) Output will appear in the debug window
Now , you have successfully got the temperature & humidity from DHT11 Sensor.
Kindly share your comments to improve my posting.
No comments:
Post a Comment