
You may shortly construct a DIY digital temperature and humidity sensor with an OLED show module to point out the temperature and humidity of your room. You may as well combine this DIY local weather sensor into your sensible dwelling automation software program, corresponding to a House Assistant server, to automate your HVAC unit (air-con), fan, or humidifier for temperature and humidity management.
Issues You Will Want
You have to the next parts to construct a wise DIY temperature and humidity sensor,
- An AHT10 high-precision digital temperature/humidity sensor
- A Wemos D1 Mini or NodeMCU board
- An SSD1306 128×64 OLED show
- Some jumper (DuPont) wires
- A 3D printed or any case to assemble the parts
- Soldering iron and tin
- A House Assistant server working on a Raspberry Pi or any suitable x86 or x64 {hardware}. If you wish to know extra, you’ll be able to find out about House Assistant and the way it works earlier than getting began.
Step 1: Put together the Firmware
You could compile and put together the firmware utilizing the ESPHome add-on in your House Assistant server. The steps are as follows:
- In your House Assistant server, go to Settings > Add-ons and click on the Add-On Retailer button.
- Seek for ESPHome and click on on the ESPHome add-on within the search outcomes. Don’t click on on ESPHome (dev) or ESPHome (beta).
- Click on the Set up button.
- After the set up, click on Begin. Additionally, allow the Begin on boot, Watchdog, and Present on sidebar choices.
- Click on Open Internet UI and click on +New Gadget.
- Sort the machine’s identify, corresponding to “climate-sensor”, and click on Subsequent.
- Select to Choose a particular board and choose the Wemos D1 Mini board from the record.
- Click on Subsequent > Skip. Select ESP8266 in case you are utilizing the NodeMCU board.
- Click on the Edit choice after which make the next modifications within the YAML editor window.
Add your Wi-Fi credentials:
wifi:
ssid: "YourWiFiSSID"
password: "WiFiPassword"
Then paste the next code just under the captive_portal: line:
web_server:
port: 80i2c:
sda: D2
scl: D1
scan: True
time:
- platform: sntp
id: my_time
sensor:
- platform: aht10
temperature:
identify: "Residing Room Temperature"
id: temp
humidity:
identify: "Residing Room Humidity"
id: hum
update_interval: 10s
- platform: uptime
identify: "Station Bureau Uptime Sensor"
- platform: wifi_signal
identify: "Station Bureau WiFi Sign"
update_interval: 30s
font:
- file: 'slkscr.ttf'
id: font1
dimension: 12
- file: 'BebasNeue-Common.ttf'
id: font2
dimension: 15
- file: 'arial.ttf'
id: font3
dimension: 15
show:
- platform: ssd1306_i2c
mannequin: "SSD1306 128x64"
reset_pin: D0
handle: 0x3C
rotation: 180°
lambda: |-
it.printf(64, 0, id(font1), TextAlign::TOP_CENTER, "Ravi Good House");
if (id(temp).has_state()) {
it.printf(127, 23, id(font3), TextAlign::TOP_RIGHT , "Temperature: %.1f°", id(temp).state);
}
if (id(hum).has_state()) {
it.printf(127, 60, id(font3), TextAlign::BASELINE_RIGHT , "Humidity: %.1f", id(hum).state);
}
Substitute “Ravi Good House” with your individual title. Upon getting added and up to date the code, click on Save after which click on Set up.
Select Plug into this pc from the record of choices after which await the firmware to compile. This may occasionally take 10-Quarter-hour.
As soon as the firmware is compiled, click on on the Obtain challenge button. This can obtain the compiled climate-sensor.bin file in your system.
Step 2: Flash the Firmware to D1 Mini or NodeMCU
For flashing the downloaded firmware on the D1 Mini or NodeMCU, you should utilize the online installer, or To flash the firmware, you should utilize the web-based flash instrument or ESPHome-Flasher instrument to your Home windows, Linux, or Mac system. Comply with the steps under to flash the firmware utilizing the web-based installer:
- After downloading the firmware, you will note the Open ESPHome net choice. Click on on it. This can open a brand new window.
- Click on the Join button, choose the COM port, after which click on the Join button. If the board isn’t detected, set up the CH240/CH341 drivers.
- Click on Set up > Select File and select the climate-sensor-factory.bin firmware file.
- Lastly, click on the Set up button. Look forward to the ESPHome net instrument to complete the firmware flash.
As soon as the firmware is flashed, go to the ESPHome dashboard and discover the climate-sensor.bin file. It ought to show the standing as ONLINE.
Step 3: Add Local weather Sensor to House Assistant Dashboard
Now you can add the local weather sensor to the House Assistant dashboard by following these steps:
- In your House Assistant server, go to Settings > Gadgets & Companies.
- The climate-sensor machine ought to be routinely found and visual. Click on the CONFIGURE button after which click on SUBMIT. This can add the machine to the ESPHome units record.
- Click on on climate-sensor listed below ESPHome after which click on the 1 machine hyperlink.
- Click on ADD TO DASHBOARD > View > ADD TO DASHBOARD. Select the specified room the place you need to add the sensor.
Step 4: Join the AHT10 to D1 Mini or NodeMCU
Confer with the next directions to attach the AHT10 temperature and humidity sensor to the D1 Mini or NodeMCU microcontroller board utilizing the jumper wires.
- Join the VIN pin of the AHT10 and OLED show to the 5V pin of the D1 Mini or 3.3V pin on the NodeMCU.
- Join the GND pin of the AHT10 and OLED show to the G pin on the D1 Mini or NodeMCU.
- Join the SCL pin of the AHT10 and OLED show to the D1 pin of the NodeMCU or D1 Mini.
- Join the SDA pin of the AHT10 and OLED show to the D2 pin of the NodeMCU or D1 Mini.
You have to a soldering iron to solder these parts. You may discover ways to solder earlier than trying this DIY challenge.
As soon as the AHT10 and OLED show are linked, you’ll be able to examine the temperature and humidity values on the OLED show and the House Assistant dashboard.
The values will change in real-time. Thus, you’ll be able to examine if it’s working correctly by blowing on the AHT10 sensor. Doing this can change the temperature and humidity values immediately. As soon as exams are profitable, you’ll be able to enclose the parts in a 3D-printed case corresponding to this one from Thingiverse.
You may as well arrange the Amazon Alexa or Google Assistant integration in House Assistant to obtain voice notifications and alerts when temperature or humidity ranges exceed or drops to a sure stage.
Your Digital Local weather Sensor Is Prepared
That is how one can construct a wise Wi-Fi-based digital temperature and humidity sensor to your room and combine it with the House Assistant server to create automation and set off different sensible units. As an illustration, you’ll be able to add automation to modify off an HVAC unit as soon as the temperature or/and humidity reaches or drops to a sure stage.