instructables DHT22 Environment Monitor Instruction Manual

June 9, 2024
instructables

DHT22 Environment Monitor
Instruction Manual

DHT22 Environment Monitor

by taste_the_code
I started exploring Home Assistant and in order to be able to start creating some automation, I needed to have the current temperature and humidity values from my living  room inside so I can act upon them.
There are commercial solutions available for this but I wanted to build my own so I can better learn how Home Assistant works and how to set up custom devices with it and ESPHome.
The entire project is built on a custom-made PCB that I designed as a project platform for NodeMCU and was then manufactured by my friends at PCBWay. You can order  this board for yourself and have 10 pieces manufactured for just $5 at: https://www.pcbway.com/project/shareproject/NodeMCU_Project_Platform_ce3fb24a.html

Supplies:
Project PCB: https://www.pcbway.com/project/shareproject/NodeMCU_Project_Platform_ce3fb24a.html
NodeMCU development board – https://s.click.aliexpress.com/e/_DmOegTZ
DHT22 Sensor – https://s.click.aliexpress.com/e/_Dlu7uqJ
HLK-PM01 5V power supply – https://s.click.aliexpress.com/e/_DeVps2f
5mm pitch PCB screw terminals – https://s.click.aliexpress.com/e/_DDMFJBz
Pin headers – https://s.click.aliexpress.com/e/_De6d2Yb
Soldering kit – https://s.click.aliexpress.com/e/_DepYUbt
Wire snips – https://s.click.aliexpress.com/e/_DmvHe2J
Rosin core solder – https://s.click.aliexpress.com/e/_DmvHe2J
Junction box – https://s.click.aliexpress.com/e/_DCNx1Np
Multimeter – https://s.click.aliexpress.com/e/_DcJuhOL
Soldering helping hand – https://s.click.aliexpress.com/e/_DnKGsQf

Step 1: The Custom PCB

I designed this PCB to serve as a project platform after spending so much time soldering custom NodeMCU projects on prototyping PCBs.
The PCB has a position for NodeMCU, I2C devices, SPI devices, relays, a DHT22 sensor as well as UART and an HLK-PM01 power supply that can then power the project  from AC mains.

You can check a video of the design and ordering process on my YT channel.instructables DHT22 Environment Monitor - Figure
1

Step 2: Solder the Components

Since I don’t want to solder the NodeMCU directly to the PCB, I used female pin headers and soldered them first so I can then plug the Node MCU into them.
After the headers, I soldered the screw terminals for the AC input as well as for 5V and 3.3V outputs.
I also soldered a header for the DHT22 sensor and the HLK-PM01 power supply.instructables DHT22 Environment Monitor - Figure
2instructables DHT22 Environment Monitor -
Figure 3instructables DHT22 Environment Monitor -
Figure 4instructables DHT22 Environment Monitor -
Figure 5

Step 3: Test Out the Voltages and Sensor

Since this is the first time that I use this PCB for a project, I wanted to make sure that I haven’t messed up something so before connecting the Node MCU. I wanted to test out the board voltages that everything is OK. After rst testing out the 5V rail without the Node MCU plugged in, I plugged in the Node MCU to make sure that it was getting the  5V and also that it was providing the 3.3V from its onboard regulator. As a final test, I uploaded a sample sketch for the DHT22 sensor from the DHT Stable library so I could  verify that the DHT22 works properly and that I can successfully read out the temperature and humidity.

instructables DHT22 Environment Monitor - Figure 6instructables DHT22 Environment Monitor - Figure
7

Step 4: Add the Device to Home Assistant

Since everything worked as expected, I then proceeded to install ESPHome to my Home Assistant setup and I’ve used it to create a new device and upload the provided firmware to the NodeMCU. I had some trouble using the web upload from ESPHome to ash the provided firmware but in the end, I downloaded the ESPHome Flasher and  I was able to upload the firmware using that.
Once the initial firmware was added to the device, I modified the .yamlle for it to add the DHT22 handling section and re-uploaded the firmware, now using the over-the-air  update from ESPHome.
This went without a hitch and as soon as it was done, the device showed the temperature and humidity values in the dashboard.

instructables DHT22 Environment Monitor - Figure 8instructables DHT22 Environment Monitor - Figure
9instructables DHT22 Environment Monitor -
Figure 10

Step 5: Make a Permanent Enclosure

I wanted this monitor to be mounted next to my current thermostat that I have in my home for the pellet stove so I used an electrical junction box to make an enclosure. The  DHT22 sensor is mounted in a hole made in the electrical box so it can monitor the conditions on the outside of the box and not be a affected by any heat coming out  from the power supply.

To prevent any heat build-up in the box, I also made two holes on the bottom and top of the electrical box so air can circulate through it and release any heat.

instructables DHT22 Environment Monitor - Figure 11instructables DHT22 Environment Monitor - Figure
12instructables DHT22 Environment Monitor -
Figure 13instructables DHT22 Environment Monitor -
Figure 14

Step 6: Mount in My Living Room

To mount the electrical box, I used double-sided tape to stick the box to the wall and to the thermostat next to it.
For now, this is only a test and I might decide that I want to change this location so I did not want to make any new holes in the wall.

instructables DHT22 Environment Monitor - Figure 15

Step 7: Next Steps

If everything goes well, I might upgrade this project to act as a thermostat for my pellet stove so I could entirely ditch the commercial one. It all depends on how Home  Assistant will work out for me in the long run but we’ll have to wait to see that.
In the meantime, if you liked this project, be sure to also check my other ones on Instructables as well as my YouTube channel. I have many others coming in so please  consider subscribing as well.

Environment Monitor for Home Assistant With NodeMCU and DHT22:

References

Read User Manual Online (PDF format)

Read User Manual Online (PDF format)  >>

Download This Manual (PDF format)

Download this manual  >>

instructables User Manuals

Related Manuals