Using Arduino to control 30 RGB LEDs

I want to control 30 anode RGB LEDs using just 3 PWM pins of the arduino. Each RGB LED will be the same color so they don't need to be individually addressable. I just want to be able to turn all 30 leds on/off, change their color, adjust their brightness, and perform different glow and pulse effects.

I know this can be done using MOSFETs but I'm unsure how everything would be wired and what the voltage and current requirements for the MOSFETs and my power supply need to be.

The LEDs Im using, have a forward voltage of 3 volts and direct current of 20mA except for the red color which has a 2 volt forward voltage and 20ma direct current.

Here is an image of what I think my connections should look like

I believe my MOSFETs would need to be able to handle 600mA of current continuously and my power supply would need to handle 1.8A of current. But I'm not sure what voltage the power supply needs to be or if these values are correct. I would like to power the whole setup using an outlet. I believe I need an LED driver as the power supply but am not sure of what type etc..

Any direction on this project would be appreciated. I am extremely new!

Welcome to the forums. Your current calculations are correct. Probably the easiest thing to do would be to purchase a 5V wall wart (ac/dc power supply) that is rated at 2A. Easy to get from amazon, etc.

If you go that route, your resistors for G and B need to be (5V - 3 V) / 20ma = 100 ohms and for your Red LEDs, (5V-2V) / 20ma = 150 ohms. These don’t have to be exact. You could probably use 220 ohm resistors everywhere (things may be a bit dimmer)

I know you say you don’t need them to be individually addressible, but using the WD2812 LEDs are very easy. No MOSFETs, no resitors, etc.

As for the MOSFETs, make sure you get TTL level compatible ones so the arduino can turn them on/off directly (Vgs < 5V) Something like this

I believe I need an LED driver as the power supply

No, just a normal constant voltage power supply.

Thanks for your help and the quick responses!

My last question is, how can I power both the Arduino and the leds from the same power supply?

My guess would be to connect the arduino in parallel with my leds somehow so that they both get 5v. And I would need to increase the rated current draw of the power supply so that it could accomadate the leds and Arduino?

Thanks for any additional help!

My guess would be to connect the arduino in parallel with my leds somehow so that they both get 5v.

What is the "somehow"? You just take a wire from the power supply and connect the + side to the +5V pin of the LEDs and the 5V Arduino pin. Do the same for the negative or ground of the supply, LED and Arduino.

And I would need to increase the rated current draw of the power supply so that it could accomadate the leds and Arduino?

Not current draw but current capacity. Yes but as the Arduino only takes the current of less than 2 LEDs it should not be a factor.

A common "newbie" mistake due to the plainly misleading Arduino tutorials, is to think the Arduino should be powered through the "barrel jack" or "Vin" or "Raw" terminals.

This is most inappropriate and particularly so once you start to connect the Arduino to other devices which require 5 V power.

The "Vin" pin or in fact the "barrel jack" which is the same with a diode, was provided to demonstrate the Arduino. Once you start connecting things that draw current, and that includes connecting things to draw current from the "5V" pin, you are playing with fire - or not! This is even worse for the Mega as it has more pins to connect things to! :astonished:

The on-board regulator - unless you use a variant such as the "RoboRed" (it has a proper switchmode regulator) - has no heatsink of significance. It may theoretically have a rating of 1 A, but only when bonded to a substantial heatsink. You can barely see it on the Arduino board. You will not get 1 A at 5 V from the board with any "Vin" voltage for more than a second or two before the regulator overheats - and hopefully shuts down peacefully. You may be lucky to get 150 mA. :roll_eyes:

The microprocessor and its peripherals operate from 5 V. If you have 5 V then you provide it to the "5V" terminal. You can fudge it by connecting something such as a USB charger to the USB connector but there is a 500 mA polyfuse on the UNO/ Mega and a diode on the Nano interposed.