Last year, I started to collect the Christmas tree very late. Usually, the standard for each end of the year mode of closing projects in December was especially tense. In general, we began to decorate the tree with the child a couple of days before the new year. And the very first surprise when decorating a Christmas tree was with a New Year's garland, bought many years ago either in OBI, or in Kastoram. One of the three color channels completely went out, and the other worked at a reduced brightness. It was a Sunday, and at first I wanted to quickly go and buy a replacement. But then I remembered about the garland of their 25 controlled RGB-LEDs, bought once on Ali "to look", and so gathering dust in the box.
It was just that it was too boring to connect the garland to arduine and fill in the standard algorithms. Therefore, I decided to bring something new, fashionable. So that it would be interesting to please the child himself.
Therefore, it was decided to connect this garland to a smart home. My smart home works primarily on ESP8266 microcontrollers using the ESP / arduino and blynk libraries
. Your blynk server, local, is deployed on RaspberryPi 3.
As I wrote above, I didn’t have much time, so I limited myself to a few standard examples from the NeoPixel library. Switching between modes is carried out using a smartphone. I will place a link to sketches at the end of the article.
The garland is connected to the ESP8266 very simply, but strictly to certain GPIO, depending on the model of the module and the desired transmission speed
The library has comments on this subject:
// three element pixels, in different order and speeds NeoPixelBus<NeoGrbFeature, Neo800KbpsMethod> strip(PixelCount, PixelPin); //NeoPixelBus<NeoRgbFeature, Neo400KbpsMethod> strip(PixelCount, PixelPin); // For Esp8266, the Pin is omitted and it uses GPIO3 due to DMA hardware use. // There are other Esp8266 alternative methods that provide more pin options, but also have // other side effects. //NeoPixelBus<NeoGrbFeature, Neo800KbpsMethod> strip(PixelCount); // // NeoEsp8266Uart800KbpsMethod uses GPI02 instead // You can also use one of these for Esp8266, // each having their own restrictions // // These two are the same as above as the DMA method is the default // NOTE: These will ignore the PIN and use GPI03 pin //NeoPixelBus<NeoGrbFeature, NeoEsp8266Dma800KbpsMethod> strip(PixelCount, PixelPin); //NeoPixelBus<NeoRgbFeature, NeoEsp8266Dma400KbpsMethod> strip(PixelCount, PixelPin); // Uart method is good for the Esp-01 or other pin restricted modules // NOTE: These will ignore the PIN and use GPI02 pin //NeoPixelBus<NeoGrbFeature, NeoEsp8266Uart800KbpsMethod> strip(PixelCount, PixelPin); //NeoPixelBus<NeoRgbFeature, NeoEsp8266Uart400KbpsMethod> strip(PixelCount, PixelPin); // The bitbang method is really only good if you are not using WiFi features of the ESP // It works with all but pin 16 //NeoPixelBus<NeoGrbFeature, NeoEsp8266BitBang800KbpsMethod> strip(PixelCount, PixelPin); //NeoPixelBus<NeoRgbFeature, NeoEsp8266BitBang400KbpsMethod> strip(PixelCount, PixelPin);
Here is the last year's video that came out of it.
The child 6 years old was delighted, especially from the RGB Zebra. It seems to me that the developers have invented this element just for this case.
The Christmas tree stood and pleased for a long time, right up to March (the child had a birthday at the end of February and she wanted to boast to her friends).
Since “the ship took off so well”, in the future it was decided to add more lights. One more garland of 50 diodes was purchased. When connecting, I had to add 5V power from the opposite end of the garland, since she shone dimly and blinked. In addition, a couple of weeks ago my daughter and her mother decided to buy a star for the tree. They bought some of the most deshman Chinese in fix-prices, which also did not work. They handed me the words "here, dad, fix and hang on the Christmas tree!". Inside the star was a single diode, a battery and a switch, which turned out to be working, but with closed contacts. I opened the contacts, but this whole household was blinking with different colors (such are embedded into jumping silicone balls). By the way, I will be glad if someone explains to me how this diode works without a resistor and any circuit. The LED diode looks like the most common single-chip, it has one cathode and an anode in a transparent flask. It looks like this
In general, it was decided to remove the regular diode and insert 5pcs instead. from ws2811 garland. Accordingly, the sketch and blynk profile were slightly modified to support more lights and a star. The star received a personal zebra and was excluded from all animation algorithms. With the animation, the star did not like any of the households.
Next year I will add coordinate animation and maybe someone else from the readers will offer something.
→ Link to the library
Links to sketches:
If it is interesting, in the following articles I will tell about my vision of an inexpensive
smart home. At the moment, I have control of lighting, aquarium, climate, home theater using a smartphone, IR remote control, motion sensors, wall buttons and voice.