I’m confused re Pi GPIO current limits: some sites say 3mA per pin with a total of 50mA(?) for all pins.
Other tutorial sites show an RGB LED being powered directly from the GPIO pins.
Both can’t be right!
So, do I power my RGB LED’s (NB: multiple - 3 of) from a separate power source via MOSFET’s or directly from the Pi?
You didn’t mention what type of RGB LED’s you’re using but the below information should explain it all for you.
The documentation on the GPIO from the Raspberry Pi Foundation is below. It will explain why there’s so many different answers. The 50mA is referring to all the GPIO’s added up in total shouldn’t draw more than 50mA and the 3mA is per pin. Unfortunately that’s not correct either as the documentation will show you it’s 8mA (default) and up to 16mA per pin depending on the GPIO configuration.
The 50mA is from the Raspberry Pi power supply limitation. It’s documented here:
In general, I don’t drive LED’s from the GPIO although it is possible if you keep the current low enough but that means the LED will be dull or very dull depending on the driver configuration.
You can’t safely drive an RGB LED from a GPIO because they’re actually three LED’s in each pixel and they’re typically drawing up to 20mA each. When your RGB is white and 100% that’s around 60mA which is more than the Raspberry Pi’s GPIO supply can deliver. I’ve seen people drive a signle LED but you’re running the Raspberry Pi beyond it’s specified design.
You should be using a separate power supply that can deliver up to [number of pixels] x 20mA and rated for the voltage of your RGB LED. Depending on the setup you can often power the Raspberry Pi from the same power supply for 5V RGB LED’s.
The signal line can be driven directly from the Raspberry pi because it’s high impedance. The voltages are well within the range of typical RGB LED signal lines.
That confirms my suspicions that you shouldn’t power multiple LED’s directly from the Pi. (And, yes, I know 1 RGB LED = 3 “standard” LED’s.)