Monitoring data from a cloud dashboard
In this first section of the chapter, we are going to connect a temperature and humidity sensor to our Raspberry Pi Zero board and send those measurements to the cloud. Later in this section, we are also going to learn how to visualize those measurements on a dashboard.
We first need to connect the DHT11 sensor to our Pi. First, place the sensor on the board, and then connect the 4.7k Ohm resistor between pin 1 and 2 of the sensor. Then, connect the first pin of the sensor to a 3.3V pin of the Pi, the second pin to GPIO4 of the Raspberry Pi, and finally the last pin of the sensor to a GND pin of the Pi.
The following image is the final result:
We are now going to see how to configure our Raspberry Pi Zero so it automatically sends data to the cloud. For that, we'll use Node.js to send data to a service called Dweet.io, which will allow us to easily store data online.
Let's first see the details of the code. First, we declare the modules that we will use...