RGB LED strip controller with FastLED
-
Hi,
I built a 1m x 1,5m accoustic absorber with Basotect for the ceiling in my living room. To generate ambient lighting, I installed a non-smart analog 5m LED strip on the top side. My first attempt was to use PWM from arduino which resultet in visual steps when do slow fading. Next approcach was a 12bit PWM motor shield, resulting in 4096 steps which were smooth but I couldn't use the real good FastLED library. So I ended up with a P9813 RGB MosFET Board from ebay which represents a single pixel. (But can easily chained for several strips in the room.) FastLED is dithering between the 256 steps of the arduino and produces very smooth transitions.
Hardware:
- Arduino Nano (~5€)
- NRF24L01 (~2€)
- P9813 RGB MosFet Board from ebay (Full Color RGB LED Strip Driver Sensor v1.1 for Arduino STM32 AVR P9813) (4,29€)
- LM2596S DC-DC Step-Down Converter for 12V->5V (~1€)
- 5m RGB LED Strip ( < 10€)
- old 12V laptop power supply
Software:
My setup is a mqttClientGateway and a raspi with node-red.
To change color, you can send a RRGGBB string to mysensors-in/node-id/0/1/0/40
To change the fade time you can send a integer from 0 to 255 to mysensors-in/node-id/1/1/0/24
To persist the current settings to eeprom you can send a "1" (meaning bool "true") to mysensors-in/node-id/2/1/0/2
To set the brightness you can send 0 to 100 (V_PERCENTAGE) to mysensors-in/node-id/3/1/0/3https://github.com/rollercontainer/nanoP9813FastLEDMySensors/blob/master/main.cpp
This code is working. Nevertheless it could be a lot better. It is posted, to help people take code lines or inspirations out of it. I think, I change the setup to esp8266 because of the OTA flash ability.
Greetings
-
I think you might have left out the LM2596 since the Nano linear regulator should be able to cope with 12V.
-
Many say it's better don't push those regulators to the limit if you are unsure about the quality
-
@pansen I've burned out a couple nano's and pro mini's by supplying what was supposedly 12v from a wall wart.
So I would advise using a linear voltage regulator
-
@micah @gohan Yeah I could imagine nasty spikes from a cheap power supply can fry the regulator. I still find an LM2596 overpowered for this. At least take a 7805
-
for 0.65€ a piece you don't go broke if you buy some LM2596
-
Yeah I usually use some 78xx variant
-
@pansen Agree and price is one thing but I would prefer a linear regulator for its stability and noise.
-
but linear regulator would waste a lot of energy/heat, wouldn't it?
-
@gohan maybe, I don't know, I only pretend to be an electrical engineer in my spare time... Lol
-
well for powering a Nano there should not be that much heat dissipated, being a low power device
-
@AWI Was about to say that For a hobbyist it doesn't matter that much but switching regulators are quite nasty when it comes to EMI.
@gohan: A good rule of thumb is to assume that the voltage difference from input to output of the linear regulator will be converted to heat. So if you have a high current application or a high voltage difference a switching regulator is better. In case of running an Arduino (let's say it consumes 80mA@5V which is quite high) it's negligible: P=U*I=(12-5)*0.08=0.5W which should be dissipated without heatsink easily.
edit: ah you just answered yourself ;D
-
@pansen To add to that... these step down Power converter(boards) are not really suited for low power applications. Their efficiency is likely (much) worse than a linear regulator.
-
@AWI Ha, I forgot about that...I remembered that you actually need a minimum load on the output of the switching regulator for it to even run. I created a spreadsheet just taking into account the quiescent currents and assuming 70% effciency for the lm2596 (a "bit" optimistic. Datasheet says 80% at 3A load for 12V-5V operation). Quiescent current for the LM2596 is much higher.
Considering the mini pro takes about 12-20mA running, I am sure to opt for the 7805 or LM317 from now on (If there is nothing else drawing current). I think nano etc are comparable but the FTDI USB to serial converter probably adds some current that the mini pro is missing.