Page 1 of 1

Neo pixel

Posted: Thu Jul 18, 2019 12:35 pm
by Yammers
Hi there

Is it possible to use micro python to controll neopixel leds.

However I want to be able to do the following.

Example

Mode 1 christmass lights

Mode 2 rainbow mode

Ask google to turn on led strip in mode 1 mode one comes on flashing or twinkerling christmas ligjt show. Etc

Is this possible or would it need to be intergrated into home assistant any examples or videos of this working

Im looking for voice control and manual selection.

Re: Neo pixel

Posted: Thu Jul 18, 2019 9:25 pm
by OutoftheBOTS_
This is something that ESP32 running micro-python is able to do

Re: Neo pixel

Posted: Thu Jul 18, 2019 9:57 pm
by jimmo
In addition to the ESP32, the ESP8266 and micro:bit have built-in neopixel drivers.

I strongly prefer DotStars leds instead (APA102) because they don't require a driver, as long as your board supports SPI you can use them. (Which is every board). Also you can transmit data to them at a higher rate (so less delay between frames).

Note that both Neopixel and DotStars are 5V devices, so you need to take that into account as pretty much all the MicroPython boards are 3.3V. Neopixels do almost kind of work if you power them at 5V and use a 3.3V signal but it's much better to use a level shifter. e.g. 74AHCT125.

Also you might need to think about power supply if you have a lot of LEDs. But it's pretty easy to get high current 5V supplies. You generally don't need to run the LEDs at full brightness anyway, so for medium lengths you can get away with 2A USB chargers.

If you have many hundreds of LEDs then a consideration is whether your board is powerful enough to generate smooth animations. I have a strip of 150 LEDs controlled by an ESP8266 that took some tricks. Rainbow and twinkling is easy because you can just shift the previous frame around. ESP32 is more powerful and has more RAM so this is less of a problem. I've done smooth animations with ~1000 LEDs from a pyboard 1.1.

As far as remote control via HA or other, there are lots of options here. I'd probably start with this before you buy thr LEDs -- figure out how to connect up your MicroPython board to HA (maybe http post, mqtt, or other). Perhaps you could write a HA driver for https://github.com/peterhinch/micropython-iot if such a thing doesn't already exist. That would be really good.

I have a very simple ESP8266-controlled dotstar strip under the hand rail of the stairs in my house. It responds to HTTP requests that tell it what mode and brightness to be in. I added a driver to my home automation system that sends the HTTP requests at the right time (e.g. automatic dim at night time, mode change on button press, etc). It works well, and it's a great safety feature for the stairs! Also rainbow mode https://youtu.be/ieWj4hPjxR4

Re: Neo pixel

Posted: Fri Jul 19, 2019 7:06 am
by OutoftheBOTS_
I would always advise using ESP32 rather than ESP8266 because ESP32 is so so much more capable than the ESP8266 and is not much more to buy. I started with ESP8266 but for a number of my projects I kept hitting a wall then I switched to ESP32 and it broken all the walls I was hitting.

Re: Neo pixel

Posted: Fri Jul 19, 2019 8:21 am
by jimmo
Oh yeah, completely agree!! Definitely go with the ESP32 (or Pyboard D, if you're using DotStars). Most of my experience with this was before before the ESP32 was widely available.

Also I'm a really big believer in the sunk cost fallacy and have a drawer full of ESP8266s :p

Re: Neo pixel

Posted: Fri Jul 19, 2019 6:35 pm
by kevinkk525
As for home-assistant integration I can recommend my own project which has this specific goal, to connect an esp to home-assistant and even provide mqtt discovery so you don't have to configure each component in home-assistant.

https://github.com/kevinkk525/pysmartnode

However you'll have to write your own component for controlling the leds but that should be fairly easy if you use the templates provided.