The lamp in action
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?
I like the idea of the couch armrest mounted controller, and my media chairs have USB power ports in the recliner button assembly. Switch the lights out, control the pause/play.
To get it really nice I would be forced to do some radical surgery on media chairs.
Permission will be denied. But I may be able to do something…
It was from the aliexpress listing. Just checked and the file isn’t there any more (http://pan.jczn1688.com/directlink/1/ESP32%20module/1.28inch_ESP32-24245012.zip). I’ll see if I can find the original and host it somewhere. Update - can find it here: ZFile
So have you lost it?
Nope. See above.
Trying to compile a micropython bin with lvgl libs included.
get stuck
If you want to try the steps are pretty easy
- install idf
- install micropython lgvl
If only it worked
step 1 is ok
I get the error when building lvgl enabled version (step 2)
Good luck, and keep us posted! Personally I’d like to have this working just using standard esphome for simplicity. I think we are very close - “just” need to get the driver migrated. Might not initially be able to support everything like swipe but if we can at the very least get touch working then that will be a huge step forward. I’ll try to set aside some time to look at it again this weekend.
I think this would be better if we can get openhasp to run on it. With the CST816D.h and CST816D.cpp files there may be a chance. Thanks for those.
Definitely don’t want to discourage you - agree that it would be nice to have that as an option. The ESP32-C3-Mini-1U does have a fairly decent 4MB of flash but the processor is also a pretty weedy single core with 400KB of sram and 384KB rom so I suspect it will struggle with openhasp. But again, go for it & let us know if you have any luck!
tonight I will try esphome custom component.
the library I saw (your link) exposes x,y coords clicks (single double long) and swipe
so if it goes it goes completely
I get the following in the logs
[ 313][E][esp32-hal-spi.c:227] spiAttachMISO(): SPI Does not hESP-ROM:esp32c3-api1-20210207
Build:Feb 7 2021
rst:0x15 (USB_UART_CHIP_RESET),boot:0xc (SPI_FAST_FLASH_BOOT)
Saved PC:0x4206a9d2
SPIWP:0xee
mode:DIO, clock div:1
load:0x3fcd6100,len:0x438
load:0x403ce000,len:0x918
load:0x403d0000,len:0x24e4
entry 0x403ce000
[ 305][E][esp32-hal-spi.c:227] spiAttachMISO(): SPI Does not have default pins on ESP32C3!
then nothing else.
However the display works (gif cycles)
Any clue?
Can you post the code you’re using to load the driver(s) as a custom component? If it’s complaining about SPI issues then that sounds like you’re also loading the screen driver as a custom component rather than the touch screen driver (which is i2c) and maybe you need to also pass to it the GPIO pins that it should use (which did take me a bit of mucking around to identify!). Could of course load both as custom components, but I’d just keep the screen driver using the gc9a01 external component as we know that at least works and try getting the touch screen driver working as a custom component…
FYI I’ve submitted a feature request to see if there is someone a little more experienced at this than I am who may be willing to either help or at least point us towards a guide for converting the driver we have…
upvoted on GitHub
To Cut the chase I flashed your exact code (apart wifi etc…)
Same result: no log and same error message.
Weird.
And now the weirdest part.
No logs on Chrome
Logs on Safari.
go figure it, as the error seems coming from esphome and have nothing to do eith the browser
Hallo guys, I got one of the aliexpress sold ready to go devices on ESP32 + ILI9341 2.4 TFT and CST820 Capacitive touch displays.
Managed to compile and upload working openHASP, but fighting with capacitive touch now.
Any ideas?
Welcome to the club:-)