The old light of the refrigerator of our hackerspace was too boring.

The old light of the refrigerator of our hackerspace was too boring. Just add some WS2812b LED strips and a Teensy 3.1 board + ESP8266 WiFi module.

Now we can control the lights by MQTT (over web, smartphone, IRC, …)

here you can get the code - have fun
https://github.com/munichmakerlab/refrigerator-lights

Wouldn’t it be possible to do everything on the esp8266, FastLED now supports esp8266?

Yes it is possible. Have the same animation still running on esp8266 - but had not have time to change the cabling on the fridge. It is on my todo list since 2 month O:-)

FastLED is awesome on esp8266. I’m building a word clock based on apa102 leds with FastLED library, rtc, ntp, mqtt and many more

Can you share the code maybe please :slight_smile:

When I’m finished with the WordClock project - yes of course I will share the sources :wink:

Great, since I’m hunting around for some code :), since I’m not a coder and wouldn’t be able to write it from scratch I’m looking for pieces of code I could copy-paste together :smiley:

Let me know, if you have any questions. What exactly you want to make - maybe I have some code-snippets laying around :smiley:

Thanks, you are very kind :). I want to make a ws2812 strip+esp8266 controllable via mqtt so I can control it via home-automation software (for example currently I’m playing with Node-red, but I might also try Domoticz, Openhab)… There in Node-red I have a color-picker (color-wheel) so I’d like to pick to color of the strip, also if some animations would be available it would be extra cool :).

So far I have just sensors+esp8266 deployed around the house (with HCSR501 PIR sensors, Dallas temperature sensors and a bmp085 baro) - using “ESP Easy” firmware.

I’ve found this regarding mqtt+neopixels, maybe this is already the thing I want: https://gist.github.com/AdySan/bd23f7be5ca5a6a4563f

Btw how are you controlling your refrigerator lights, do you have some GUI, maybe something for android? For example this Node-red has a nice webgui for controlling such things which I can pull up on my mobile phone or computer. But would be nicer to have a native android mqtt gui app.

There are many ways to control it. We currently have a node-red binding for FlowDock (chat) and sending out MQTT messages.
So we can change the lights by typing some messages to IRC channnel or FlowDock chat and node-red will forward mqtt messages to the broker
The fridge subscribes some topics and changes the animations

So here - I do not use any GUI
but there are tons of GUIs out there

One good is also the Blynk project

Btw. the example you post is not that good on ESP - because it could be that the ESP reboots, because you do all the animation stuff inside the callback of the MQTT client.
So if you get new mesaages, it could be blocked and the stack will overflow…

It is better to just set any flags and store the topic and messsage to variabnle
and set a flag, that new message arrived

And inside the loop you check for new messages and do the processign and animations

Also please always check for new mesage flag inside effect loops and return if new arrived

So you are on the safe way and did not get any stack overflows - and it is always up to date :wink:

Blink is not so good, since they will start to offer a paid subscription and very limited options for free. I’m gonna need to think hard to understand your advices :smiley: :). Hopefully I’ll manage :), but doubtful :D.

It is really simple to understand. The ESP8266 is just one MCU with handle your source code and in additional the whole WiFi stuff. So they need time to handle the WiFi stack and IP data etc…
If you are blocking the loop with heavy functions that took many seconds - it could be, that the WiFi stack gets corrupted and the watchdog of the MCU is called > this forces a reboot of the ESP8266.
So I can say in total - the ESP8266 is not real RealTimeOS - because the WiFi stuff is also handled by the MCU.

The next version of the Chip called ESP32 has some improvements - they add 2 MCUs of each 160 MHz - one for the WiFi and BLE stuff and one for the user code.

So I really looking forward to get one of these killer chips - but not released yet

I talked to the developer of that code and he said that I maybe could make it better if I used a different library - https://github.com/Makuna/NeoPixelBus which uses DMA and therefore it should be better? What do you think? (So I don’t need to rewrite everything, since I probably wouldn’t know how)