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.

ESPHOME

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.

ESPHOME FORUM on DISCORD

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 boards.. they are not all the same. 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.

As an aside, I just received a KEYES ESP-32 board from Banggood – indeed the same as the Keystudio board but red which makes the lettering easier to read – maybe a later model?… Bangood refer to it as a Keyes ESP32 Core Board Development Expansion Board. Here it is….

KEYES ESP-32 Development Board

Worth a look.

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 (2.6-6v) 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. (though I didn’t make a note of how to change from normally high to normally low, sadly).

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 from AliExpress. AND they have a pretty light on the back (the front would have been better).

HOWEVER as I just discovered, there are no options on the AliExpress buttons (WHAT??) as (November 2021) they just arrived… so touching them once turns them on, touching again turns them off – not quite what I had in mind – which takes me to my new Banggood postbag – containing a sample that DOES have toggle-momentary options – see the Banggood site link for more info.

I just checked out a random YouTube video and it seems others have discovered these – in the video of 2016 they were just under £3 so Banggood’s price isn’t that far off – and LO – it seems I commented on them 4 years ago in that very same video. Both I and the English guy doing the video had figured out what the link was for but it seems that neither of us got to the bottom of the normally high/normally low option at that time and he did not describe the chip number. I can’t read it on my samples. That same fellow also talks about essentially the same switches and offers ideas on masking to make them do what you want – but as he’s RS sponsored I don’t think you;d wan to see their pricing – unbelievable. As for masking, not a bad idea is black masking tape on the switches, pre-cut-out for areas you need lighting up – OR reversed out printing on thin, clear adhesive-backed sheet.

This keeps getting better – it seems that CNX blog wrote about these switches after reading my original blog entry on the subject (it’s all coming back now)

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 🙂

Facebooktwitterpinterestlinkedin