Mounting the circuit

The circuit is very easy to build onto a breadboard. Make sure you remove power from any of the hardware before mounting the circuit. The sensor fits vertically on a diagonal breadboard, fitting into four separate rows. The pins are from left to right; 1 to 4. The first pin is to 5 volts on your Arduino. The second pin is your data pin for connection to digital pin 2, the third pin on your sensor is not used, but your fourth pin is to ground on your Arduino. Connect a 10K ohm resistor between the first (VCC) and second (DATA) pin. That's it for your hardware.

The code

This code is named the DHTtester from Adafruit's DHT sensor library, compatible for the DHT11, DHT22 and DHT21. The code can be downloaded from the Github page: https://github.com/adafruit/DHT-sensor-library. It can also be copied into your Arduino IDE by the code below once the library is downloaded as it is one of its example codes. Within the first few lines of the code, it contains comments on defining your humidity sensor, whether it is the DHT11/22/21. Uncomment the line which specifies your sensor model by deleting the double slashes of your respective line. After the steps, you are ready to upload the code!

About the code

The code starts off with the DHT library being declared. Then, it defines the pin its connected to, and the board. It also has some additional comments stating important points and instructions. The next line which says DHT dht(DHTPIN, DHTTYPE);, this line of code initialises the sensor and makes sure it adjusts itself to work on multiple processors with various speeds; this is not needed anymore. It the goes to the void setup phrase of the code where we begin serial communication from the sensor to the serial monitor. The sensor sends a command print "DHTxx test!" to the serial monitor, then it starts the sensor. The code takes us to the void loop phrase now where we first wait 2 seconds before the readings of the humidity and temperature as well as the heat index gets processed. The serial monitor then prints the readings for us to read. The readings will be displayed into the serial monitor every two seconds. This sums up our project!

Amazing opportunities

Also, be sure to check out PCBWay, a leading manufacturer and distributor in PCB design and manufacturing. They have amazing prices and excellent quality in their services, so don't miss out on them! Plus, PCBWay has an amazing website, online Gerber viewer function and a gift shop so make sure to check out their links below:

PCBWay Free Online Gerber Viewer Function:  https://www.pcbway.com/project/OnlineGerberViewer.html

PCBWay Gift Shop: https://www.pcbway.com/projects/gifts.html

Enjoy! Contact us for any inquiries!