Introduction: NodeMCU Humidity/Temperature Unit
In this tutorial we are going to show you how to setup your own temperature and humidity sensor.
We are going to use a DHT22 unit, which is a low-cost digital output relative humidity and temperature sensor. The device includes a capacative humidity sensor and a thermistor to measure air temperature
DHT22 Specifications
- Temperature Range: -40 - 125 ˚C (± 0.5 ˚C)
- Humidity Range: 0 - 100% (2.5%)
- Sampling Rate: 0.5 Hz Operating
- Voltage: 3 - 5V
NOTE: A slightly cheaper option than the DHT22 is the DHT11. Its specifications aren’t quite as good with a temperature range of 0 - 50˚C and 20 - 80% humidity range - but it might be suitable for what you need.
Step 1: Components
- NodeMCU
- DHT22 Sensor
- 10K Ohm Resistor
- LED
- 220 Ohm Resistor
- Push Button
- Bread Board. (We've used Adafruit Perma-Proto BreadBoards)
- Enclosure and cable gland
- 4x AA Battery holder & Batteries
Step 2: Wiring It Up
Here is the basic wiring diagram for the device. You can see what the final version looks like at the end of this instructable.
Whilst not needed we've included the push button in order to publish a manual reading.
Step 3: Source Code
For our weather sensor we are going to be posting data to the readiness.io service. For that we've created a readiness.io library which takes care of the wifi and service connections. We've also split out all the configuration variable in to a separate .h file.
You can download the full source code here
Step 4: The Finished Product
Here is what the finished product looks like. We've actually included the sensor on an external breakout board, so that we can keep the enclosure fully sealed and just leave the sensor exposed.
(We'll post some more photos of the unit - on site once its been deployed.)