Back in the day, we would study weather by making wind vanes out of wood and barometers to measure humidity and temperature. Now, we have Arduinos, pocket-sized micro controllers and computers, electronic sensors to do this. The good part is it’s so easy to do even for a child, and all you need to learn is just a search away. Another benefit is it’s affordability. You can buy the components on-line from Amazon, or Lazada.
I can now measure humidity and temperature electronically. And, to know if it will rain, humidity is one factor on predicting it.
Why bother making this if we have smartphone apps to do just the same? Well, those data came from sources only to a specific area and not specific to your place. Some parts of your city is raining and some parts are just cloudy, and they got those data only where they are situated in. Thus, this project.
These are the required components:
- Arduino Uno.
- 3 pins DHT11 Humidity and temperature sensor.
- Laptop or Raspberry Pi
Here is the schematics:
- You place the sensor on the breadboard.
- Attach black wire (whichever color you use), to the negative pin of the sensor. A minus (-) is indicated on the sensor and on to GND of the Arduino.
- Attach a white wire to the Output (the middle pin), and the end to Digital (2).
- Attach a red wire to the positive (+) pin of the sensor and the end to 5V.
- Download the source code: Source Code Zip File. Note: You need to install the Arduino IDE from https://www.arduino.cc
- Connect your Arduino to your laptop USB and upload the Arduino source code (it ends with the .ino file extension). For more info regarding setting up your Arduino, go to https://www.arduino.cc/en/Guide/HomePage
- Once uploaded, go to the Folder and open a Powershell. You can do this easily by pressing the shift key while right-clicking it and choose Open Powershell.
- Inside the folder with the Python script (.py), run this on the shell (without the quotes): “python .\humidity_and_temp_sensor_dht11_3_
If everything is connected properly, it will show the temperature and humidity in the Powershell console.
If it says, “error 101” then check your wiring. Your wires might be defective or not properly inserted on your breadboard. Replace your wires and move the sensor to another location on your breadboard.
Check the serial port where your Arduino is connected. In Arduino IDE, go to the menu and choose Tools->Port and see where it is connected. Go to Tools->Board Info to check if your Arduino is connected and working properly.
Check the Baud Rate if it is 9600.
Check if SimpleDHT Library is installed. Go to menu, Sketch->Include Library->Manage Libraries. Search for DHT (Simple DHT), and install it.
Some DHT11 3-pin sensors has different pin placements (There is even a four pin sensor). You can check it by looking at the label above the pins and it’s usually the plus and minus signs.
There you have it. A quick and easy way to learn more about your environment by using a temperature and humidity sensor and an Arduino.
If this is your first project, then “Congratulations!”
You can learn more about Arduinos from their official website and clicking the “Learn” link.
Or, you can visit Arduino Playground, there are some interesting ideas they have there: https://create.arduino.cc/projecthub
Please share: https://scienceinvent.com