This cactus is equipped with a screen (SSD1306) and soil moisture sensor connected to an ESP8266 board (In my case: NODEMCU V3), this will work with other diffrents boards models, you only will need a board compaible with ESPHome and an ESPHome instace running on your local server.
The sensor detects the soil moisture and sends the information to ESPHome, which will display on the screen the soil moisture, the current time and the cactus' expressions (happy, not too happy and angry).
Instrucctions:
You will need to print the 3 models. Please note that the SSD1306 display has several models and sizes, and it may not fit the pins of the model. In this case, you can cut them and use hot glue to fix it.
1 - Print the models
2 - Connect the components as shown in the following wiring diagram.
3 - In your ESPHome instance, create a new device and add the following code to your generated code and add to your ESPHome configuration directory the 3 pictures at the end of this description.
4 - You will be able to see you cactus angry!
This is the wiring diagram:
This is the code that needs to be added to you ESPHome device:
font:
- file: "gfonts://Roboto"
id: roboto_20
size: 54
i2c:
sda: 4
scl: 5
sensor:
- platform: adc
pin: A0
id: water
name: "Water level"
update_interval: 60s
unit_of_measurement: "%"
accuracy_decimals : 2
icon: "mdi:water-percent"
filters:
- lambda: return 100 - ((x - 0.24930) * 100 / 0.3802) ;
image:
- file: "angry.png"
id: angry
- file: "happy.png"
id: happy
- file: "notbad.png"
id: notbad
time:
- platform: homeassistant
id: time1
display:
- platform: ssd1306_i2c
model: "SSD1306 128x64"
reset_pin: 16
address: 0x3C
id: my_display
pages:
- id: page1
lambda: |-
if (id(water).state > 90){
it.image(0, 0, id(happy), COLOR_OFF, COLOR_ON);
}else if(id(water).state > 70){
it.image(0, 0, id(notbad), COLOR_OFF, COLOR_ON);
}else{
it.image(0, 0, id(angry), COLOR_OFF, COLOR_ON);
}
- id: page2
lambda: |-
it.printf(0, 0, id(roboto_20), "%.2f", id(water).state);
- id: page3
lambda: |-
it.strftime(0, 0, id(roboto_20), "%H:%M", id(time1).now());
interval:
- interval: 5s
then:
- display.page.show_next: my_display
- component.update: my_display
captive_portal:
Also you will need to add this photos to your ESPHome condig dir: