Yeah there are lots of multi sensor projects on internet; this one also had bits, pieces etc. from other projects. Was looking a way to implement ESPHome on my HA installation and i needed a light sensor. You can find much better designs and circuits online, however i wanted to share this here for the desperate…
What you need:
- Nodemcu v1.0
- AM2302 or DHT22 Temperature/Humidity Sensor
- TSL2561 Light Sensor
- RGB Led
- 128x64 OLED Display
Fritzing:
Box work (Tried to do it cutting acyrlic, failed miserably):
ESPHome Code:
esphome:
name: esp_multi1
platform: ESP8266
board: nodemcuv2
wifi:
ssid: "XXXXXXX"
password: "XXXXXXX"
# Enable fallback hotspot (captive portal) in case wifi connection fails
ap:
ssid: "Esp Multi1 Fallback Hotspot"
password: "XXXXXX"
captive_portal:
# Enable logging
logger:
# Enable Home Assistant API
api:
ota:
i2c:
sda: D2
scl: D1
scan: True
sensor:
- platform: tsl2561
name: "TSL2561 Ambient Light"
id: ambient_light
address: 0x39
update_interval: 60s
- platform: dht
pin: D7
model: AM2302
temperature:
name: "Living Room Temperature"
id: temperature
humidity:
name: "Living Room Humidity"
id: humidity
update_interval: 60s
light:
- platform: rgb
name: "Living Room Lights"
red: output_component1
green: output_component2
blue: output_component3
# Example output entry
output:
- platform: esp8266_pwm
id: output_component1
pin: D4
inverted: True
- platform: esp8266_pwm
id: output_component2
pin: D6
inverted: True
- platform: esp8266_pwm
id: output_component3
pin: D5
inverted: True
- platform: homeassistant
id: ha_time
font:
- file: 'Arial.ttf'
id: font1
size: 14
image:
- file: "lightbulb.png"
id: lightbulb
resize: 14x14
- file: "thermometer.png"
id: thermometer
resize: 14x14
display:
- platform: ssd1306_i2c
id: mydisplay
model: "SH1106 128x32"
reset_pin: D0
address: 0x3C
pages:
- id: page1
lambda: |-
it.image(0, 0, id(lightbulb));
it.image(0, 19, id(thermometer));
if (id(ambient_light).has_state()) {
it.printf(15, 0, id(font1),TextAlign::TOP_LEFT, ": %.0f lux",id(ambient_light).state);
}
if (id(temperature).has_state()) {
it.printf(15, 18, id(font1),TextAlign::TOP_LEFT, ": %.1f °C",id(temperature).state);
}
- id: page2
lambda: |-
it.strftime(0, 0, id(font1), "%d.%m.%Y , %H:%M", id(ha_time).now());
interval:
- interval: 5s
then:
- display.page.show_next: mydisplay
- component.update: mydisplay
Outcome:
3D Box:
STL File
Couldn’t print the 3D box, neither have 3D printer, nor an online print facility. So burning and making holes on a plastic box, it came out horrible; but hey it’s working for my first project