That is, as in “trials and tribulations”. I’m busy getting myself familiar with the ESP32 and ESPHOME to see how far I can push these devices now that the price is not a LOT more than the ESP8266.
Regular readers will know that years ago I and others developed “ESP-GO”, firmware to get the best out of the incredibly popular ESP8266 WiFi microcontrollers. I took a few wrong turns there, including avoiding the Arduino framework (the libraries therein tend to be bulky BUT that route has incredible support) which meant I could focus on my core strength – C – and that meant modifying just about every library out there… anyway that’s history – enough.
When I hit on ESPHOME (not to be confused with HOME ASSISTANT) only weeks ago, I started a re-think. I have a number of ESP-32 boards so I got myself a KeyeStudio “shield” or baseboard primarily because typical ESP32 boards have so few ground and 3v3 pins making R&D painful.
I’ve been using Tasmota firmware for a long time now with ESP8266, avoiding ESP32 like the plague because it cost so much more and so it seemed at the time, not providing a LOT more power (unless you need Bluetooth which I don’t).
I’ll be working on this for months but several things have come out of this so far. I’m into WS2812B RGB displays as I LOVE pretty colours. WLED firmware (if you don’t know what that is – look here) can handle incredibly smooth rainbows using these lserial LEDs (hundreds of them) on a lowly ESP8266 (for clarity I run mine on 3v3, get great brilliance and need NO level shifting or other hardware to run them). The ONLY issue with WLED is – that’s what it does – runs a strip of ws2812b – end of story – no buttons on the other IO pins, nothing.
Tasmota can run LCD and OLED displays as well as ws2812b lighting and is improving all the time, but right now on displays particularly, ESPHOME seems to have the edge, with a possible caviat. I just spent an entire day struggling with ESPHOME on an ESP8266, running a strip of 10 ws2812b lights and a display and getting visual juddering on the ws2812b LEDs.
I read various items on the web about hardware limitations and other excuses. so I dug into this one deeply. I ended up with an ESP8266 board doing nothing more than controlling a couple of relays (lighting) and running a strip of ws2812b LEDs in rainbow mode on the otherwise unused ESP8266 RX pin. The ESPHOME online documentation includes this mode “
ESP8266_DMA (default for ESP8266, only on pin GPIO3)” bearing in mind that GPIO3 is serial RX. BEAUTIFUL. But if I tried to run any kind of display, the rainbow still started to fall apart. Ok, limitation accepted.
SO, on advice from one of the guys in the ESPHOME DISCORD forum, I switched to ESP32 and there things started to unravel.
First things first, my handy KeyeStudio shield isn’t QUITE as handy as it looks as various ESP32 boards have different WIDTHS (I already knew there were ESP32-based boards with differing number of pins) so any chance of a universal shield is OUT. However by careful selection of ESP32 board I got a working development rig. Note that on the shields I mention (the designers must’ve been half asleep) once the pins are in, it is quite hard to read the pin names – on the underside are pin references for the actual ESP32 board but the expansion pin layout doesn’t entirely match. It does not help that pins on the ESP32 are multi-purpose AND there’s no room it seems to show all options so you still end up consulting online charts in the hope of matching pins to what you actually need.
Anyway, to cut the story short I was now ready with an ESP32 board with lots of 3v3 and ground pins, an external, adequate supply – I was going to get to the bottom of the juddering ws2812b LEDs issue if it killed me. The result? WELL, it appears that the NEOPIXELBUS component of ESPHOME is not given a higher priority than displays or indeed button presses (with debounce)… I STUMBLED on this when I realised that my CLOCK display on the ILI9341 had a 1-second update for seconds. Ok, you can get past that by only updating the LCD/OLED display every minute but that still means ws1812b display issues every minute – if that rainbow is not completely SMOOTH it isn’t worth using.
I’ve asked the question in the DISCORD ESPHOME forum if there is any way to give NEOPIXELBUS higher priority than other libraries – I’m not hopeful but we’ll see. Meanwhile as I now had a board with lots of power and ground pins I thought I’d wire up some real buttons and THAT triggered more memories.
Some years ago I bought some PCB touch buttons dirt cheap from AliExpress and I found I had a couple lying in a drawer. They need ground, 3v3 and have an output which goes straight to a GPIO pin. They work a TREAT with TINY PCB options for normally low, normally high and latching or momentary. WELL it turns out that AliExpress still have them and they are still dirt cheap – 10 for a couple of Euros once you add in the postage. AND they have a pretty light on the back (the front would have been better).
THEN I discovered (and used) a variation also lying in a drawer – photo included here (and shown in the video) and they are even BETTER and WELL under €1 each. Momentary or toggle. I think I’d prefer, instead of no light when off and a colour when pressed, some kind of border colour until pressed (so you could see them in the dark) but hey. The ads show a range of colours available and even RGB (though I doubt there is much control over the RGB).
Anyway – I’ve created a short video above to show what I’m doing – I hope you enjoy. Only one spelling mistake up to now and it’s in the video so we’re stuck with it 🙂