Happy with your Prusa printer? Earn $30 when you recommend us to your friend, family or shop with the updated Prusa Rewards Program. PS: They will get an extra Prusament spool!

Home Assistant / ESP Home Sensor Box v2 with Motion / Temp / Humidity / Lux

An easy-to-print and build ESP Home sensor box for Home Assistant.
94
398
3
4967
updated January 30, 2023

Description

PDF

This is the second design of my little home automation sensor box.  I've flashed it with ESPHome making it really easy to use in Home Assistant. Powered via the USB port on the Wemos D1..  doesn't work off a battery, this wasn't my intention. 

Printed in PLA+ or PETG,  no support required. 

Components used

Wemos D1 - UK https://amzn.to/3Hf3oSp USA  https://amzn.to/40e7mmP

DHT11 (Temp and Humidity) - UK https://amzn.to/3HJruWV USA https://amzn.to/3kHjMTV

AM312 PIR - UK https://amzn.to/3j8sBWI USA https://amzn.to/3jjuRdB

TEMT6000 Light Sensor - UK https://amzn.to/3Y9ZxN6 USA https://amzn.to/3jmO3qN

4 off - M3 x 5 countersunk screws.  These are used to secure the DHT11 and TEMT6000 sensors to the housing, and then 2 to screw the lid.

Once complete you need to program it.  I did this through the ESP Home addon in Home Assistant.  The first time you program it you need to connect it up via USB, after that you can update it via wifi.   First create a project, write a blank project to it, then add the following lines by clicking edit.  Make sure it's set as a D1 mini-board at the top.. 

 

esp8266:
  board: d1_mini

Then under the captive_portal: bit paste in the below.  This is where you also change the name of your sensors and update times.

captive_portal:
   
sensor:
  - platform: dht
    model: "DHT11"
    pin: D2
    temperature:
     id: "temperature"
     name: "Lounge_temperature"
     filters:
      offset: -1
    humidity:
     id: "humidity"
     name: "Lounge_humidity"
    update_interval: 10s
 
  - platform: adc
    pin: A0
    name: "Lounge_lux"
    unit_of_measurement: lux
    filters:
      - lambda: |-
          return (((x / 1000.0) * 4000000.0) -11.5);
    update_interval: 5s


binary_sensor:
  - platform: gpio
    pin: D1
    name: "Lounge_motion_sensor"
    device_class: motion

Pin D1 is critical for the PIR as it's using it's pulldown resistor as is A0 as this needs the analog input for the light sensor. 

I have put a small -1 offset in the temp sensor, this reduces the sensed value by 1.  Just play with this if you find its reading correctly.

I've played with the lux sensor a little trying to get it somewhere near my lux meter, it's not bad and should be good enough to see if you need to turn the lights on or not.

All in all, you should be able to build this for under $10 / £10 each.  I purchased enough to build 5 of these and have them placed around the house.

Possible V3 might include the DHT22, but I'm happy with the DHT11 to be honest. Also, I'm waiting on a microwave sensor to arrive from Aliexpress. 

Tags



Model origin

The author marked this model as their own original creation.

License