Let me share my latest fun project. A freeform sculpture made with brass wires, D1 mini and some other components. It measures the humidity and temperature by two different sensors. It also has two indicator LED’s which show the battery percentage. The sculpture works on an 18650 battery which lasts for about two months.
I integrated the sculpture in Home Assistant by using Esphome with the following configuration:
esphome:
name: freeform sculpture
platform: ESP8266
board: d1_mini
on_boot:
priority: 100.0
then:
- if:
condition:
lambda: 'return ((id(voltage).state /3.3) * 100.00) > 50;'
then:
- logger.log: "The sensor value is above 85%! Turn green leds on"
- light.turn_on: green
- delay: 2s
- light.turn_off: green
- if:
condition:
lambda: 'return ((id(voltage).state /3.3) * 100.00) < 50;'
then:
- logger.log: "The sensor value is beneath 60%! Turn blue leds on"
- light.turn_on: blue
- delay: 2s
- light.turn_off: blue
wifi:
ssid: !secret wifi_ssid
password: !secret wifi_password
power_save_mode: light
fast_connect: true
# Enable fallback hotspot (captive portal) in case wifi connection fails
ap:
ssid: "Freeform"
password: "xxxxx"
captive_portal:
# Enable logging
logger:
# Enable Home Assistant API
api:
password: !secret ota_password
ota:
password: !secret ota_password
# Enable Web server.
web_server:
port: 80
deep_sleep:
run_duration: 29min
sleep_duration: 1min
i2c:
sda: D2
scl: D1
scan: True
dallas:
- pin: D5
binary_sensor:
- platform: status
name: "Freeform status"
sensor:
- platform: adc
pin: A0
id: "voltage"
update_interval: 15s
internal: true
filters:
- multiply: 3.3
- platform: template
name: "freeform_voltage"
unit_of_measurement: 'V'
icon: "mdi:battery-50"
update_interval: 15s
accuracy_decimals: 2
lambda: |-
return (id(voltage).state);
- platform: template
name: "freeform_battery_level"
unit_of_measurement: '%'
icon: "mdi:battery-50"
update_interval: 15s
accuracy_decimals: 2
lambda: |-
return ((id(voltage).state /3.3) * 100.00);
- platform: template
name: "freeform_battery_level_calibrated"
unit_of_measurement: '%'
icon: "mdi:battery-50"
update_interval: 15s
accuracy_decimals: 2
lambda: |-
return ((id(voltage).state /3.3) * 100.00);
filters:
- calibrate_linear:
# Map 0.0 (from sensor) to 0.0 (true value)
- 48.0 -> 0.0
- 81.15 -> 100.0
- platform: hdc1080
temperature:
name: "Freeform - HDC1080 Temperature"
id: temp
humidity:
name: "Freeform - HDC1080 Humidity"
id: humi
update_interval: 20s
- platform: dallas
id: "DS18B20_temp"
address: 0x00011939640DDB28
name: "Freeform - DS18B20 temperature"
accuracy_decimals: 2
output:
- platform: esp8266_pwm
id: green_led
pin: D7
- platform: esp8266_pwm
id: blue_led
pin: D8
light:
- platform: monochromatic
name: "green led"
id: "green"
output: green_led
default_transition_length: 3s
- platform: monochromatic
name: "blue led"
id: "blue"
output: blue_led
default_transition_length: 3s
I will add an BMP280 later.
I hope this post will inspire someone else to make a freeform sculpture. If so, please post your result!