Electrical – Connect a lot of LEDs together and control them with a microcontroller

ledmicrocontrollertransistors

I am trying to make a studio light that will have 12 segments. Each segment will look like this:

Breadboard

(10 LEDs (3.2v, 20mA), 2 connected in series then parallel to each other segment, 5 150 ohm resistors, 9 volt battery for mobility)

I plan to connect multiple batteries in parallel to achieve a constant voltage and accumulate current to power the LEDs for a longer period of time.

I've tested a single segment of this circuit and I am impressed with the results. What I want to do next is connect a Raspberry Pi to the circuit. I have not posted this on the Raspberry Pi forum because this question is geared more towards the actual electronic components. I understand that I need a component to connect the LEDs to the micro controller. I was thinking about using some sort of transistor or relay, but I have no idea how to pick the appropriate one.

Another problem arises because I am using 9v battery that will connect with a 5v circuit. I know some transistors require a common ground, and I do not know how else to connect it. I've found another answer here: Creating a common ground. I am unsure if the Raspberry Pi will be damaged by doing this.

To the point: How can I control multiple segments of lights with the Raspberry Pi.

Best Answer

NO DAMAGE WILL HAPPEN. To control each LED segment, you can use a MOSFET/transistor switch in the Battery-LED path, which is turned on/off by the raspberry pi. And yea, we will need a common star ground here. But, whatever current flows through the LED and resistor path, that current is NOT sunk back through raspberry pi to its ground. Instead, it is sunk through the external circuit of the transistor switch to the source of that current, which is the battery itself. So no damage will happen to our pi. Only the battery's current rating, and the transistor's current rating matter.

P.S This is something we have done at college :D