Electronic – Trying to design a switchable LED circuit with no experience or skill – please send help

ledraspberry pitransistors

I'm trying to design a circuit to connect with an Raspberry Pi and have no idea what I'm doing… apologies in advance for terrible descriptions of my problem.

I have some 1 watt LEDs (max fowrad voltage = 2 – 3.4 V, max forward current 350 mA).

I also have an RPi 3B+ model with a breadboard extension, which can deliver 3.3V or 5V with a max current of 50 mA supposedly.

I want to be able to selectively turn on one of three-six LEDs in a parallel circuit using some python code I've developed. My idea was to have a constant current LED driver split off into 3 transistors which are connected to the RPi and also connected to the LEDs. I was hoping this would allow me to select which circuit to activate based on the RPi GPIO outputs. I've attached a crude schematic diagram of what I was going for.

the questions are as follows:

  1. is this going to work?? I'm a chemist by training and trying to do this for a project and don't want to electrocute myself/burn my flat down

  2. the driver I bought supplies 12-24 V at 300 mA, which I now realise is between 4-5 times greater than the volts I need to drive a single LED… I was wondering – can I stick a resistor before/after the LED and the return to the driver? or someway of bringing the circuit voltage up to 12V for the driver to function? or is the best option to buy a different driver?enter image description here

Thanks for any help! happy to provide more info if necessary.

Best Answer

The LED powersupply you have is simply not the right thing.

It is a constant current powersupply.

It will try to always force 300 milliamperes of current through the load (the LEDs.)

To regulate the current, it varies the voltage:

  • If the current is too low, it will raise the voltage to force more current to flow.
  • If the current is too high, then it will lower the voltage so as to force less current through the load.

Your powersupply has limits, though. Its voltage can only vary between 12V and 20V.

That voltage is in all cases higher than the voltage your LEDs are rated for - just connecting the LEDs to that powersupply will destroy the LEDs.

That type of powesupply is intended to be used with multiple LEDs in series. If you put 7 of your LEDs with the 2V forward voltage in series (total of 14V,) then the regulator will work properly and supply 300 mA to the LEDs.

You have a few options:

  1. Get a constant current supply with a voltage range that includes the forward voltage of all your LEDs.
  2. Stack multiple LEDs in series for each color so that the total forward voltage for each color is within the working range of the powersupply you already have.
  3. Put zener diodes in series with each LED such that the sum of the zener voltage and the LED forward voltage is within range of the powersupply.
  4. Get a constant voltage powersupply (5V) and put a series resistor (or other current limiter) in series with each LED.

A series resistor as you have in your sketch is normally used with a constant voltage powersupply to limit the current.

In your case, the powersupply itself limits the current.

If you had a constant voltage powersupply of 12V, then a single resistor would not work properly for all LEDs. It would allow a different current for each color LED.


The way you have your NPN transistors would not work. The transistors should be between the LED and ground.

As you have it arranged, the signal from the Pi (3.3V when high) at the base of the transistors cannot reach the needed 0.7V above the emitter voltage (sum of LED forward voltage and the voltage drop across the resistor.)

The LEDs will not light, of only dimly.

Worse, you have no resistor between the transistor bases and the Pi GPIO pins. That would damage either the transistors or the GPIOs - Murphy's law dictates that the GPIOs on the (relatively) expensive Pi will sacrifice themselves to rescue the (relatively) cheap transistors.