Tasmota Fireplace on a witty cloud

Home
Photography
Projects
About me
Robots
Publications
Friends' pages:
Chris
Jeff
John
Minu
Raeed
Email me:
alex AT joni.ro


Share
Just a writeup of one of my latest projects.. emulating a fireplace with WS2812 LEDs

What's a witty cloud you ask? It's a flavour of ESP8266 microcontroller, with some additional things on board (3.3V regulator, light sensor, 1 RGB Led, etc).

Inspired by a friends work with an ESP + Arduino - Youtube video, I decided to do the same starting from an ESP module and Tasmota.

I already used Tasmota, and liked how it's built up and what you can do with it (it speaks MQTT - so I can interface it with my FHEM, it does Wemo and HUE emulation so it works with Amazon Echo/Alexa, and it's been running reliably for the last couple of weeks on about 10 devices).

DoW - Description of Work

For hardware I used a Witty Cloud, a WS2812 reel (2meters x 60LEDs/m = 120 LEDs), an aluminum frame, and accessories. I followed roughly the steps from here for connecting stuff.

Then I grabbed the latest Tasmota, and started coding away. Implementing the fireplace is quite simple, I followed roughly this code.
Final result looks like this: void Ws2812Fireplace(void) { #if (USE_WS2812_CTYPE > 1) RgbwColor c; c.W = 0; #else RgbColor c; #endif int i, flicker; float dimmer = 100 / (float)Settings.light_dimmer; for (i = 0; i < Settings.light_pixels; i++) { flicker = random(0,255); float fmyRed = (float)cmax(255 - flicker,0) / dimmer; float fmyGrn = (float)cmax(123 - flicker,0) / dimmer; c.R = (uint8_t)fmyRed; c.G = (uint8_t)fmyGrn; c.B = 0; strip->SetPixelColor(i, c); } Ws2812StripShow(); }

The hardest part was keeping in line with the Tasmota code, figuring out what settings exist, what to use. In the end it was about 3-4h of code reading, 20-30 min of code writing and testing.

I ran into some small problems:
Bug1 - If there is a PWM LED defined (in sonoff_template.h for Witty there was), you can't drive a WS2812 LED String.
Bug2 - The schemes are hardcoded in Tasmota, makes it a bit hard to spot (2-3 places to change).
Bug3 - The animations froze up periodically. I got around that with a couple of changes: no VDC ADC measuring, disabling the light sensor on witty, removing some unused services from the code (domotics, mDNS), used WS2812_DMA - connecting the WS2812 strip on pin GPIO03-Rx
Level shifting problems. In the end I ended up connecting the GPIO directly to the WS2812 LED strip, this has the disadvantage that the first LED doesn't always work, but the others after it work flawlessly. Probably a 3.3/5V levelshifter would be better
If one uses Amazon Alexa to scan for devices, and afterwards the devices' name changes - leads to problems. Removing a learned smarthome device is easiest from the alexa webpage (not the app!)


Results

You can watch a short video of running this - with Alexa commands in german.


Code

You can see the changes as a patch, or download the complete Tasmota sketch with my changes.




[æ]
Copyright © 2005-2011 Alex Joni