Indeed tried a couple of cables and I succeeded…
Actually in following your steps. I flashed the device with initial esphome code and now I have a black screen.
Could you be so kind to link the original bin file you mentioned in the thread?
TY
Where did you get the fonts?
I get a
“unknown format” while loading them .
The fonts are in the correct folder
Triple check the font name matches (eg “GoogleSans-Medium.ttf” not “GoogleSans_Medium.ttf”). It is also possible that the fonts you have downloaded might be corrupt. You can always try loading them on the fly eg:
# gfonts://family[@weight]
- file: "gfonts://Roboto"
id: font_16
size: 16
Are you using my updated code that has
output:
- platform: ledc
pin: $bkpin
id: gpio_3_backlight_pwm
light:
- platform: monochromatic
output: gpio_3_backlight_pwm
name: "Display Backlight"
id: back_light
restore_mode: ALWAYS_ON
in it?
That is in the zip file with all the sample code - the link to it was in the Aliexpress listing and was/is here.
Thanks.
I ended up using the online option after consulting esphome doc.
I have tried to upload a colored gif and although animation at very slow pace goes on color is not there. (PS: the gif is colored. double checked)
Have you tried?
(The GIF :-))
Solved : I had to add type rgb to the image directive .
However the poor device has not enough memory for supermario
Interesting. I had thought about trying, but even if the processor is capable of supporting complex animations the screen itself is pretty small. Definitely feel free to keep playing, but personally I’ll probably stick with static images for the most part. Maybe just maybe I might look at less complex animations for weather (eg a glowing sun, or raining cloud) at some point.
It is only a single core processor, don’t expect too much.
Ah - I just updated esphome and got the same issue. It can be fixed as you noted by either downloading the driver and editing the display.py file, or you can also use
external_components:
- source: github://mcmanigle/esphome-components
components: ["gc9a01"]
In addition, you may start to see “Components should block for at most 20-30ms” messages. The drivers were potentially having this issue, but since 2023.7.0 it’s now being reported. You can choose to ignore them for now or block them from appearing:
logger:
level: DEBUG
logs:
component: ERROR
For what it’s worth I tried a smaller gif with the thought that at some point in time I might want to put some weather icons on the screen, and it worked fine eg:
# Some pretty images - not critical
animation:
- file: "icons/2051v2.gif"
id: clear_day
resize: 40x40
type: RGB565 #default is binary ie greyscale
# Need this bit now with esphome since 2023.7.0
image:
- file: "icons/2051v2.gif"
id: svgArt
and
lambda: |-
id(clear_day).next_frame();
it.image(100, 30, id(clear_day), COLOR_ON, COLOR_OFF);
it.strftime(120,80, id(font_16), id(my_blue), TextAlign::CENTER, "%A %b %d", id(esptime).now());
it.strftime(120,120, id(font_32), TextAlign::CENTER, "%I:%M %p", id(esptime).now());
it.printf(120, 170, id(font_32), id(my_green), TextAlign::CENTER, "Now: %.1f°", id(outdoor_temperature).state);
it.circle(120, 120, 115, id(my_red));
Any luck with the touch controller though?
No - I need to put aside some time to think about it properly. Got distracted by breaking changes breaking some of my code with my other sensors. Speaking of which, here’s the code I’m currently working with:
# V0.2 - 18/09/2023
# Compiled and tested on esphome 2023.8.3
substitutions:
devicename: wallwatch01
friendname: WallWatch01
location: master
board: esp32-c3-devkitm-1
repin: GPIO1
dcpin: GPIO2
bkpin: GPIO3
clpin: GPIO6
mopin: GPIO7
cspin: GPIO10
# Sorted out screen, Touch panel is next. Work in progress.
# SDA: GPIO4
# SCL: GPIO5
# INT: GPIO0
# RST: GPIO1 <- shared with screen
# Maybe https://registry.platformio.org/libraries/koendv/cst816t
# Note the following is a mock up and does not actually exist - yet
# touchscreen:
#platform: cst816t
#id: my_touchscreen
#clk_pin: GPIO5
#sda_pin: GPIO4
#int_pin: GPIO8
#update_interval: 50ms
#report_interval: 1s
#threshold: 400
#calibration_x_min: 3860
#calibration_x_max: 280
#calibration_y_min: 340
#calibration_y_max: 3860
#swap_x_y: false
esphome:
name: $devicename
friendly_name: $friendname
# libraries:
# # trying to get the touch screen to work
# - esphome/cst816t=https://github.com/koendv/cst816t
esp32:
board: $board
framework:
type: arduino
# Enable logging
# Change to error to avoid "Components should block for at most 20-30ms" messages - an issue since 2023.7.0
logger:
level: DEBUG
logs:
component: ERROR
# Enable Home Assistant API
api:
encryption:
key: !secret esphome_encryption_key
ota:
password: !secret ota_password
wifi:
ssid: !secret wifi_ssid
password: !secret wifi_password
# Enable fallback hotspot (captive portal) in case wifi connection fails
ap:
ssid: "Wallwatch01 Fallback Hotspot"
password: !secret fallback_password
captive_portal:
time:
- platform: homeassistant
timezone: "Australia/Melbourne"
id: esptime
# Test - see if the thing picks up BLE info
#esp32_ble_tracker:
#nope - locks up
#SpokeTooSoon - actually does work, kinda. Slows down the startup significantly then claims to scan but nothing is found
#Either is not supported or antenna is really weak. Suspect both.
sensor:
- platform: uptime
name: "$devicename Uptime"
- platform: wifi_signal
name: "$devicename WiFi Signal"
update_interval: 60s
- platform: homeassistant
id: outdoor_temperature
entity_id: sensor.gw1000_v1_7_6_outdoor_temperature
- platform: homeassistant
id: max_temperature
entity_id: sensor.brighton_east_temp_max_0
- platform: homeassistant
id: min_temperature
entity_id: sensor.brighton_east_temp_min_1
external_components:
# - source: github://pr#3625
# components: [ gc9a01 ]
# Use the following if you copy the component locally to say config\my_components\gc9a01 to edit
# - source: my_components
# components: [ gc9a01 ]
# Use the following if using a component on github
# - source: github://4cello/esphome@gc9a01 - has issues with latest esphome due to display.py
- source: github://mcmanigle/esphome-components
components: ["gc9a01"]
# Arduino code shows screen is a GC9A01 with CST816D touch screen
spi:
mosi_pin: $mopin
clk_pin: $clpin
#mosi = Master Out Slave In
#miso = Master In Slave Out or fermented bean paste. In this case, most likely the former rather than the latter. Doesn't matter as not used.
# Need to turn on backlight as by default is not on
output:
- platform: ledc
pin: $bkpin
id: gpio_3_backlight_pwm
light:
- platform: monochromatic
output: gpio_3_backlight_pwm
name: "Display Backlight"
id: back_light
restore_mode: ALWAYS_ON
# The following assumes you have the named fonts in config\fonts
font:
- file: 'fonts/GoogleSans-Medium.ttf'
id: font_16
size: 16
- file: 'fonts/GoogleSans-Medium.ttf'
id: font_24
size: 24
- file: 'fonts/GoogleSans-Medium.ttf'
id: font_32
size: 32
color:
- id: my_red
red: 100%
green: 3%
blue: 5%
- id: my_green
red: 3%
green: 100%
blue: 5%
- id: my_blue
red: 3%
green: 5%
blue: 100%
# Some pretty images - not critical
# Again assumes you have them in config\icons
# Do not use large or complex images as the poor processor will struggle
animation:
- file: "icons/2051v2.gif"
id: clear_day
resize: 40x40
type: RGB565 #default is binary ie greyscale
# Need this bit currently with esphome since 2023.7.0
# Otherwise you will probably get 'id' is a required option for [0] errors when trying to compile
image:
- file: "icons/2051v2.gif"
id: gifArt
display:
# - platform: ili9xxx
# model: gc9a01
# Above is for when or if this is merged into the ili9xxx platform
- platform: gc9a01
id: watchface
reset_pin: $repin
cs_pin: $cspin
dc_pin: $dcpin
# Rotate the screen so usb socket is pointing down
rotation: 90
# Print the date on one line in blue
# Print the current time on the next line, but in a bigger font and in default white
# Print the outside temp on the next line but in green
# Surround the lot by a red circle with centre at 120, 120 and a radius of 115 because why not
# Procrastinating now on the touchscreen, so instead added a second page and cycling between two screens because again why not
pages:
- id: page1
lambda: |-
id(clear_day).next_frame();
it.image(100, 30, id(clear_day), COLOR_ON, COLOR_OFF);
it.strftime(120,80, id(font_16), id(my_blue), TextAlign::CENTER, "%A %b %d", id(esptime).now());
it.strftime(120,120, id(font_32), TextAlign::CENTER, "%I:%M %p", id(esptime).now());
it.printf(120, 170, id(font_32), id(my_green), TextAlign::CENTER, "Now: %.1f°", id(outdoor_temperature).state);
it.circle(120, 120, 115, id(my_red));
- id: page2
lambda: |-
id(clear_day).next_frame();
it.image(100, 30, id(clear_day), COLOR_ON, COLOR_OFF);
it.strftime(120,80, id(font_16), id(my_blue), TextAlign::CENTER, "%A %b %d", id(esptime).now());
it.printf(120,120, id(font_24), TextAlign::CENTER, "Today Min/Max:");
it.printf(120, 170, id(font_32), id(my_green), TextAlign::CENTER, "%.1f/%.1f°", id(min_temperature).state,id(max_temperature).state);
it.circle(120, 120, 115, id(my_blue));
interval:
- interval: 5s
then:
- display.page.show_next: watchface
- component.update: watchface
Appreciate the work on this. I’ve also just gotten one hooked in to ESPHome with your help
I love playing with stuff like this, but I am wondering what i’d do with it. What is the use case?
For Me, I’m hoping to be able to have a couple of (ideally swipe-able) pages of buttons to control a few select entities as a little interface on my couch armrest.
Page of lighting toggles, climate control, maybe one for some sensors etc.
In time it would be slick to make it a little contextually aware.
Perhaps start with changing the active page automatically from a trigger. If a light turns on, it displays that page etc.
Yeah that’s quite a nice idea.
For me it is a side display for current setup of a complex esp based lamp-clock if no touch enabled.
Lamp Profile selection too if that will be enabled.
I researched a bit tonight. I could load a MicroPython for esp32 c3 but I was not able to compile a version with LVGL linked in nor to find a ready one.
Next step will be trying to setup a custom esphome component for the touch. The Arduino c lib is ther so it shall not be impossible
Support for c3 in LVGL and Python seems embrional plus as written it is a very weak processor . A pity as LVGL seems really nice
Let’s keep this thread up and going with news
For me the initial use case is as an inexpensive wall mounted control for my rooms that have the ability to turn on/off the heating/cooling ducts. I’d be able to see what the current room temperature is, either manually turn the duct on or off, or change the thermostat setting (the room temp would be provided via a separate sensor) so the duct would open or close depending on the set temp and if it’s heating or cooling. I do this now by using a controller with an e-ink panel and separate buttons, but this would be a lot cheaper. I have cabling in the walls (from the original controllers that I had to replace) to use to run power to them, so there would be no visible wires.
Later down the track I’m considering to use them to replace some wall mounted remotes I have to turn lights on/off. With these I could tap to toggle the lights, swipe up/down for brighten/dim, and swipe left/right to go to other screen(s) to do other things like control other lights, check current and forecast weather, etc.
Over and above that, a number of possible uses such as mounting them on a battery box and use them as a portable controller for around the house, in the backyard, etc… even in the car.
Ok, so I had a spare few mins and have been trying to convert the existing arduino code into the format that esphome wants and it’s doing my head in. I checked out discord to see if there was any guidance and all I found were a number of other people all asking for help with converting arduino code into esphome format with [crickets] as replies. Sigh. Just to make sure I wasn’t wasting my time I then tried adding in:
esphome:
name: $devicename
friendly_name: $friendname
libraries:
- "Wire"
includes:
- include/CST816D.h
and
i2c:
sda: $sdapin
scl: $sclpin
It happily compiled, and I could see in the log the following:
[17:56:22][C][i2c.arduino:053]: I2C Bus:
[17:56:22][C][i2c.arduino:054]: SDA Pin: GPIO4
[17:56:22][C][i2c.arduino:055]: SCL Pin: GPIO5
[17:56:22][C][i2c.arduino:056]: Frequency: 50000 Hz
[17:56:22][C][i2c.arduino:059]: Recovery: bus successfully recovered
[17:56:22][I][i2c.arduino:069]: Results from i2c bus scan:
[17:56:22][I][i2c.arduino:075]: Found i2c device at address 0x15
Not a huge step, but at least I know the code can compile and that the touch panel can be seen.
Where did you get that file from?