Room Monitor for HomeAssistant
by TiagoSantos in Circuits > Arduino
1219 Views, 2 Favorites, 0 Comments
Room Monitor for HomeAssistant
After preparing a Raspberry Pi with Home Assistant to manage various spaces, I noticed that one of the basic information of each space is temperature and humidity. We can buy one of several sensors available on the market compatible with Home Assistant or build one of ours.
Requirements
I initially built a prototype on a breadboard to test the base connections and sensor reading. After being tested I defined the system requirements. This has to:
- Allow reading of multiple sensors, including i2c sensors
- Can be powered by battery or transformer
- Send information to a central location to be available in Home Assistant
- Have a low consumption, especially if it is battery powered
- Be as small as possible so as to go unnoticed
To meet the above requirements I have defined the following structure:
- The system is ready to read three sensors, one of which through i2c
- Allows you to define which power mode
- Send readings to an MQTT server in its topic so that Home Assistant can collect
- You must send the readings every hour and after that enter Deep Sleep
Prototype
Initially I expanded the base prototype to test the batteries. The system is ready to be powered by two 18650 batteries, although it only needs one. Using two increases the system autonomy and allows you to use sensors that consume more.
After the prototype was completed, I started building pcb on Autodesk Eagle. This is free to create PCBs up to 11 cm.
To create the PCD in Autodesk Eagle you need to create a project and within the project create a schema with the components and their connections.
After this is created we create the pcb. For this we use the button on the toolbar. Autodesk Eagle creates a pcb with all components and indicates their connections. Then you need to define the size of the pcb, position the components in place and make the connections between them (see more information here https://learn.sparkfun.com/tutorials/using-eagle-board-layout/all).
Create the PCB
Finally, it’s necessary to export the drawing to gerber format to be submitted for production. Because there are several possibilities, PCBWay provides a tutorial of the process (https://www.pcbway.com/helpcenter/technical_support/Generate_Gerber_files_in_Eagle.html) and which files are required to submit.
I then sent the drawing to PCBWay for production. Thanks in advance to PCBWay for all the support for the sponsorship.
The submission is made on the PCBWay website. When submitting, the cost is automatically made available. One option that should be ticked is “HASL lead free” so that the plates do not contain lead. After submission the production process is fast, taking 1-2 days.
Components
After receiving the PCB's from PCBWay, I started welding the various components. For this project the following components are required:
- Male headers
- Female headers
- 1 dual 18650 battery holder
- 1 Jumper
- 1 Wemos d1 mini
- 1 470uf capacitor
- 1 DC power Jack socket 5.5 x 2.1 mm
- 1 DHT22 sensor
- Jumper Cables
Assembly
I started welding the components on the PCB, which was a very simple process due to the preparation that PCBWay does.
After soldering and a final test, I started designing the box. This was modeled on Autodesk Fusion 360. The bottom, which houses the system and has the various inputs, and the top, which houses the DHT22. Several covers were also modeled for the inputs that will not be used. If necessary just remove each lid.
Code and Final Steps
Finally the code was uploaded to Wemos and installed on the spot.
The code can be downloaded from my GitHub Account.
Later I set up Home Assistant to collect the information on its topics to display in the dashboard.