Hello,
has anyone been able to make the ili9341 1.8" work with Esphome, on a wemos d1 mini?
Hello,
has anyone been able to make the ili9341 1.8" work with Esphome, on a wemos d1 mini?
Got a link for that?
a link to the ili9341?
I don’t see a 1.8" ili9341. For the 1.8 it says st7735s.
You are absolutely correct, i didnt catch that. In that case did anyone manage to get the st7735s to work. Ill go try it as well
hello,
yep! with a esp-wroom-32 works great :
esphome:
name: capteur-douche
esp32:
board: esp-wrover-kit
framework:
type: arduino
# Enable logging
logger:
# Enable Home Assistant API
api:
encryption:
key: "/xxxxxxxxxxxxxKU+L/rxFE="
ota:
password: "xxxxxxxxx97a25"
wifi:
ssid: !secret wifi_ssid
password: !secret wifi_pwd
manual_ip:
static_ip: 192.168.1.xx
gateway: 192.168.1.1
subnet: 255.255.255.0
dns1: 192.168.1.1
fast_connect: on
power_save_mode: none
i2c:
sda: GPIO21
scl: GPIO22
scan: True
time:
- platform: homeassistant
id: time_ha
timezone: UTC-4
binary_sensor:
- platform: status
name: "Status Wifi Capteur DoucheHaut"
id: etatWCSDBDh
- platform: homeassistant
id: somebody_home
entity_id: binary_sensor.somebody_home
sensor:
- platform: wifi_signal
name: "WiFi Signal Capteur Douche Haut"
update_interval: 60s
id: signalWCSDBDh
- platform: bme280
temperature:
name: "Temperature Douche Haut"
id: temperature
oversampling: 16x
pressure:
name: "Pression Douche Haut"
id: pressure
humidity:
name: "Humidite Douche Haut"
id: humidity
address: 0x76
update_interval: 10s
- platform: adc
pin: GPIO36
name: "Luminosite Douche Haut"
id: illumination_douche_haut
unit_of_measurement: lux
update_interval: 5s
filters:
- lambda: return (( x * 3.3 / 10000.0) * 3000000.0);
on_value:
then:
- light.turn_on:
id: backlight_st7735_douche
brightness: !lambda |-
return id(illumination_douche_haut).state / 1000.0;
switch:
- platform: restart
name: "Restart Douche Haut"
font:
- file: "arial.ttf"
id: five8
size: 10
- file: "arial.ttf"
id: five15
size: 25
- file: "theboldfont.ttf"
id: boldf
size: 21
color:
- id: my_red
red: 100%
green: 15%
blue: 5%
- id: my_green
red: 0%
green: 100%
blue: 0%
- id: my_blue
red: 0%
green: 0%
blue: 100%
- id: my_white
red: 100%
green: 100%
blue: 100%
spi:
clk_pin: GPIO18
mosi_pin: GPIO23
image:
- file: "/config/www/images/HA/douche1.bmp"
id: my_image
type: RGB24
# resize: 128x160
output:
- platform: ledc
pin: GPIO15
id: backlight_douche
# Example usage in a light
light:
- platform: monochromatic
output: backlight_douche
name: "Backlight ST7735"
id: backlight_st7735_douche
default_transition_length: 3s
display:
- platform: st7735
model: "INITR_18BLACKTAB"
reset_pin: GPIO17
cs_pin: GPIO2
dc_pin: GPIO16
id: douche_display
rotation: 90
device_width: 128
device_height: 160
col_start: 0
row_start: 0
eight_bit_color: false
update_interval: 10s
pages:
- id: page1
lambda: |-
if ((id(illumination_douche_haut).state < 50) | (!id(somebody_home).state)) {
auto call = id(backlight_st7735_douche).turn_off();
call.perform();
} else {
auto call = id(backlight_st7735_douche).turn_on();
call.perform();
it.rectangle(0, 0, 159, 127, id(my_blue));
it.image(0, 0, id(my_image));
}
- id: page2
lambda: |-
if ((id(illumination_douche_haut).state < 50) | (!id(somebody_home).state)) {
auto call = id(backlight_st7735_douche).turn_off();
call.perform();
} else {
auto call = id(backlight_st7735_douche).turn_on();
call.perform();
it.line(0, 32, 160, 32, id(my_blue));
it.rectangle(0, 0, 159, 127, id(my_blue));
it.strftime(20, 10, id(five8), "%H : %M", id(time_ha).now());
it.strftime(75, 10, id(five8), "%d . %m . %Y", id(time_ha).now());
it.printf(25, 40, id(five8), "Capteurs Douche Haut");
it.printf(23, 40, id(five8), "______________________");
it.printf(10, 60, id(five8), "Temperature ......... %.1f °C", id(temperature).state);
it.printf(10, 70, id(five8), "Humidite .............. %.1f RH", id(humidity).state);
it.printf(10, 80, id(five8), "Pression ........... %.1f hPa", id(pressure).state);
it.printf(10, 90, id(five8), "Luminosite........... %.1f lm", id(illumination_douche_haut).state);
it.printf(10, 115, id(five8), "Wifi : %s", id(etatWCSDBDh).state ? "Online" : "Offline");
it.printf(100, 115, id(five8), "%.1f", id(signalWCSDBDh).state);
it.printf(130, 115, id(five8), "dB");
}
- id: page3
lambda: |-
if ((id(illumination_douche_haut).state < 50) | (!id(somebody_home).state)) {
auto call = id(backlight_st7735_douche).turn_off();
call.perform();
} else {
auto call = id(backlight_st7735_douche).turn_on();
call.perform();
it.rectangle(0, 0, 159, 127, id(my_blue));
it.line(0, 50, 160, 50, id(my_blue));
it.strftime(50, 40, id(five15), TextAlign::BASELINE_LEFT, "%H : %M", id(time_ha).now());
it.strftime(3, 95, id(five15), TextAlign::BASELINE_LEFT, "%d . %m . %Y", id(time_ha).now());
}
- id: page4
lambda: |-
if ((id(illumination_douche_haut).state < 50) | (!id(somebody_home).state)) {
auto call = id(backlight_st7735_douche).turn_off();
call.perform();
} else {
auto call = id(backlight_st7735_douche).turn_on();
call.perform();
it.rectangle(0, 0, 159, 127, id(my_blue));
it.line(0, 64, 160, 64, id(my_blue));
it.printf(50, 20, id(five15), "%.1f °C", id(temperature).state);
it.printf(45, 80, id(five15), "%.1f RH", id(humidity).state);
}
interval:
- interval: 5s
then:
- display.page.show_next: douche_display
- component.update: douche_display
i have a photoresistor powered to 3.3v, connected to GPio36 thats control the backlight of the screen, need a resistor 10k between Gpio36 to ground too.
You need to download the font files in .tts of the font i used in this config but you can used any font you want , just download them in esphome folder under config.
the screen light up only if somebody_home is true AND if the ambiant light is above 50 lux.
Enjoy
Thank you so much for the config Olivier, this helps a lot.
i see if i can use this on a d1 mini as well
nope, doent work, never succeed with a d1 mini
I got my idea from here,
https://www.printables.com/model/169291-case-for-esp8266-d1-mini-and-177-tft
he doesnt give his code?
I messaged him a few days back but no response.
so bad…no feedback doesnt help the community…
he replied yesterday, hes traveling at the moment, i will give you a update once i have it
This is the message:
Hi, this was definitely not my original idea, I can’t remember where I saw something similar - probably on Reddit… But anyways, I used this display: 1.8 1.77 Zoll TFT 128x160 SPI ST7735 Display Anzeige Arduino Raspberry Pi - MAKERSHOP.DE
On the TFT’s PCB there’s are 14 connection pads, but only the first 8 are used. I have them connected like this:
1 → G, 2 → 3V3, 3 → D5, 4 → D6, 5 → D3, 6 → D2, 7 → D1, 8 → D4.
And this is the basic code for the display I’m using in ESPHome (you might have to change the display model, depending on the version you have):
api:
output:
light:
display:
You can then pull basically what ever data from HA you want, for example something like this:
time:
…and then show it on the display using the lambda function:
lambda: |-
it.line(0, 35, 128, 35);
it.strftime(0, 0, id(font_big), "%H:%M", id(esptime).now());
I just used google to find the bits I needed, but everything’s really pretty simple. I think I used this as a starting point: Time & Temperature on OLED Display — ESPHome
I hope this helps to get you started.
thanks a lot!
but its not ili9341 lol
i already succeed with a st7735 1.44 and 1.77 without any problem, bit it doent work with an ili9341 display and a wemos D1 mini or boards with esp8266, i only succeed with an esp32
That is where i am stuck as well.
I cant get it to work with a d1 mini at all. He did somehow
would it be possible for you to share your code from the St7735 on a esp32? as i might just switch to that one if this one doesn’t work.
lol
my code is already a few post above
The docs do say
it is better suited for use with the ESP32.
For anyone interested, here is the code:
esphome:
name: display01
esp8266:
board: d1_mini_pro
# Enable logging
logger:
# Enable Home Assistant API3
api:
ota:
password: "0b4e2b317e57ed139ebc9b1a38a28d4d"
wifi:
ssid: !secret wifi_ssid
password: !secret wifi_password
# Enable fallback hotspot (captive portal) in case wifi connection fails
ap:
ssid: "Display01 Fallback Hotspot"
password: "iMF5pnYxPJaY"
captive_portal:
spi:
clk_pin: D5
mosi_pin: D7
font:
- file: 'arial.ttf'
id: font1
size: 14
- file: 'materialdesignicons-webfont.ttf'
id: icons
size: 40
glyphs:
- ""# mdi:wifi
- ""# mdi:wifi-alert
# Weather
- "" # mdi-weather-sunny
- "" # mdi-weather-night
- "" # mdi-weather-cloudy
- "" # mdi-weather-pouring
- "" # mdi-weather-snowy-rainy
- "" # mdi-weather-snowy-heavy
- "" # mdi-weather-windy-variant
- "" # mdi-weather-fog
- "" # mdi-weather-partly-cloudy
- "" # mdi-weather-night-partly-cloudy
time:
- platform: homeassistant
id: esptime
sensor:
- platform: homeassistant
id: inside_temperature
entity_id: sensor.living_room_temperature
- platform: homeassistant
id: outside_temperature
entity_id: sensor.outside_temperature
binary_sensor:
- platform: homeassistant
id: internet_status
entity_id: binary_sensor.internet_status
- platform: homeassistant
id: outside_status
entity_id: binary_sensor.motion_detector_garage_2
- platform: status
name: "Display01 Status"
text_sensor:
- platform: homeassistant
id: brigitte_location
entity_id: sensor.brigitte_location
- platform: homeassistant
id: day
entity_id: sensor.dayoftheweek
- platform: homeassistant
id: date
entity_id: sensor.shortdate
- platform: homeassistant
id: weather
entity_id: sensor.weather
color:
- id: red
red: 100%
green: 0%
blue: 0%
white: 0%
- id: green
red: 0%
green: 100%
blue: 0%
white: 0%
- id: blue
red: 0%
green: 0%
blue: 100%
white: 0%
- id: white
red: 0%
green: 0%
blue: 0%
white: 100%
- id: yellow
red: 100%
green: 100%
blue: 0%
white: 100%
graph:
- id: multi_temperature_graph
duration: 2h
x_grid: 10min
y_grid: 1.0 # degC/div
width: 87
height: 51
traces:
- sensor: inside_temperature
line_type: SOLID
line_thickness: 2
color: red
- sensor: outside_temperature
line_type: SOLID
line_thickness: 2
color: blue
display:
- platform: st7735
model: "INITR_18BLACKTAB"
reset_pin: D3
id: TFT
cs_pin: D2
dc_pin: D4
rotation: 0
device_width: 128
device_height: 160
col_start: 0
row_start: 0
eight_bit_color: true
update_interval: 5s
lambda: |-
// Print "Temperature" in top center.
it.printf(64, 0, id(font1), blue, TextAlign::TOP_CENTER, "Temperature");
// Print time in HH:MM format
it.strftime(0, 62, id(font1), TextAlign::BASELINE_LEFT, "%H:%M", id(esptime).now());
it.line(0, 63, 41, 63);
// Print inside temperature (from homeassistant sensor)
it.printf(128, 12, id(font1), TextAlign::TOP_RIGHT , "%.1f°", id(inside_temperature).state);
if (id(inside_temperature).state < 8) {
it.printf(128, 12, id(font1), blue, TextAlign::TOP_RIGHT, "%.1f°", id(inside_temperature).state);
}
if (id(inside_temperature).state > 25) {
it.printf(128, 12, id(font1), red, TextAlign::TOP_RIGHT, "%.1f°", id(inside_temperature).state);
}
// Print outside temperature (from homeassistant sensor)
it.printf(128, 37, id(font1), TextAlign::BASELINE_RIGHT , "%.1f°", id(outside_temperature).state);
if (id(outside_temperature).state < 8) {
it.printf(128, 12, id(font1), blue, TextAlign::TOP_RIGHT, "%.1f°", id(outside_temperature).state);
}
if (id(outside_temperature).state > 25) {
it.printf(128, 12, id(font1), red, TextAlign::TOP_RIGHT, "%.1f°", id(outside_temperature).state);
}
it.line(0, 38, 128, 38);
// Print Inside temperature.
it.printf(0, 24, id(font1), yellow, TextAlign::BASELINE_LEFT, "Inside");
// Print outside temperature.
it.printf(0, 37, id(font1), yellow, TextAlign::BASELINE_LEFT, "Outside");
// Print "Time" in top center.
it.printf(0, 37, id(font1), blue, TextAlign::TOP_LEFT, "Time");
// Draw the graph at position.
it.graph(41, 38, id(multi_temperature_graph));
// Print wifi status.
it.printf(0, 62, id(font1), blue, "Wifi");
it.printf(0, 74, id(font1), "%s", id(internet_status).state ? "Online" : "Offline");
it.line(0, 88, 40, 88);
// Print motion detector status.
it.printf(0, 87, id(font1), blue, "Motion");
it.printf(0, 99, id(font1), yellow, "%s", id(outside_status).state ? "Detected" : "Clear");
it.line(0, 113, 128, 113);
// Print vertical line.
it.line(57, 113, 57, 88);
// Print date status.
it.printf(58, 87, id(font1), blue, "Date");
it.printf(58, 99, id(font1), red, "%s", id(day).state.c_str());
it.printf(83, 99, id(font1), yellow, "%s", id(date).state.c_str());
// Print person status.
it.printf(0, 112, id(font1), blue, "Brigitte");
it.printf(0, 125, id(font1), yellow, "%s", id(brigitte_location).state.c_str());
//test
if (id(weather).has_state()) {
std::map<std::string, std::string> weather_state {
{ "sunny", "" }, // mdi:weather-sunny
{ "night", "" }, // mdi:weather-night
{ "cloudy", "" }, // mdi:weather-cloudy
{ "rain", "" }, // mdi:weather-pouring
{ "sleet", "" }, // mdi:weather-snowy-rainy
{ "snow", "" }, // mdi:weather-snowy-heavy
{ "wind", "" }, // mdi:weather-windy-variant
{ "fog", "" }, // mdi:weather-fog
{ "partlycloudy", "" }, // mdi:weather-partly-cloudy
{ "partlycloudynight", "" }, // mdi:weather-night-partly-cloudy
};
it.printf(92, 112, id(icons), weather_state[id(weather).state.c_str()].c_str());
}