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.
-
-
@pansen Agree and price is one thing but I would prefer a linear regulator for its stability and noise.
@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
-
@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.

Hello! It looks like you're interested in this conversation, but you don't have an account yet.
Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.
With your input, this post could be even better 💗
Register Login