Go Down

Topic: Best way to control 4 led stips (Read 810 times) previous topic - next topic

DreamWaveBG

Jan 21, 2020, 02:34 pm Last Edit: Jan 21, 2020, 02:41 pm by DreamWaveBG
Hello, everyone.
I have an aquarium, which I want to illuminate with led strips. Since its 100x50 cm, I want to put 4 led strips on top, which should be controlled separately and be dimmable.
The led strips are by a local provider (VTac High Lumen SMD2835) 18W/m, 1.5A/m
I also bought a 100W power supply @ 12V
My arduino is an Arduino Mega 2560

What is the easiest and most cost effective way to control 4 such Led strips of 1 meter each ?

I know how to do it with an N channel MOSFET but get confused with picking the right ones for the task (I guess I'll need 4 of them). Can anyone give me an exact model that would be appropriate ?
I also know I might need resistors but don't know their values - any tips on that ?

Is there a circuit somewhere I can look at with more than one led strip (most I find are for RGBs and single strips)?

I might add 3 more strips in the future, so is a MOSFET even the best solution ?

Thanks in advance

SteveMann

The MOSFET is the best solution. I use the IRLZ44N in my projects where I need to control high current devices.
I've never dimmed an LED through a MOSFET, but I suspect that you would use PWM to drive the MOSFETS.

The Mega is way overkill for this.  My preferred project board is the Wemos D1 Mini or the NodeMCU.  Both use the ESP8266 processor and are compatible with the Arduino IDE. (And you can buy ten of them for the price of a Mega).

ESP8266 can generate PWM on all IO pins and it uses 10-bit resolution for PWM generation while the Mega uses 8-Bit Resolution.

Example code

PaulRB

#2
Jan 21, 2020, 04:02 pm Last Edit: Jan 21, 2020, 04:11 pm by PaulRB
Another suitable MOSFET would be STP16NF06L. Or a hundred others. The important thing is that it should be a "logic-level" MOSFET. That means it can be fully switched on by the low 5V or even 3.3V output of an Arduino pin.

Non-logic-level MOSFETS need a much higher voltage to switch them fully on. If you use one of those, the low voltage from Arduino pins will only partly switch them on, making the led strip dimmer than it should be, and making the MOSFET hot, shortening its life, possibly drastically shorter.

In general I'm a big fan of Wemos D1 mini, but in this case I have a warning. The PWM on ESP chips is, at least in part, software driven. And the chip has only one CPU core and other tasks to perform such as maintaining the WiFi connection. As a result, there is some jitter in the PWM signal it produces. At low brightness levels, it can be noticeable as a slight random flickering effect. Your fish may not notice, but you might find it annoying.

I do agree that you may find you want more than the standard 8-bit / 256-level PWM available on most Arduino. The difference between one level and the next, at the dimmest levels, will be quite noticeable. But 10-bit PWM is possible, I believe. On Uno, you can only have this on 2 of the 6 PWM pins, but on Mega, I think at least 4 10-bit PWM should be possible.

I do agree that you may find you want more than the standard 8-bit / 256-level PWM available on most Arduino. The difference between one level and the next, at the dimmest levels, will be quite noticeable.
Use the ProMicro (Leonardo compatible) board, it has 3 16 bit PWM channels available. I do not remember how many 16 bit pwm channels the Mega has. To use 16 bit pwm channels you either need to find a suitable library or do some timer programming yourself, the analogWrite will not use it. If you do not find a library for 16 bit pwm I can post some code for the ProMicro, I use it frequently.

Be careful with buying MOSFET transistors on EBAY, many of them are fake. They work, but are neither logic level or high current. You can also use a MOSFET driver (TC4427) before the MOSFET, then you do not have to worry about logic level and all the TO220 MOSFETs can handle more than enough current.
One MOSFET can easily drive 3 one meter LED strips as long as you want the same brightness on them.

DreamWaveBG

I am actually going to add a bunch of sensors and I wanted to have plenty of PINs - that's why I chose the Mega and I already got it.
Thanks for the replies, they were very useful.

I have made some code to handle 16 bit PWM, the Mega can control 11 channels:
Code and explanation

DreamWaveBG

I have made some code to handle 16 bit PWM, the Mega can control 11 channels:
Code and explanation
After executing the project with analogWrite and IRLZ44N, I found out what you mean - the changes are not smooth. This code will be really helpful.

Thanks to everyone that replied

After executing the project with analogWrite and IRLZ44N, I found out what you mean - the changes are not smooth. This code will be really helpful.
Just note that the code hooks all timers and 11 outputs, if you need need the timers/output for other stuff you will have to remove some lines from it. I do not believe that will be very difficult, the amount of code is fairly limited and it is easy to see what pins and timer are connected.

Go Up