Controlling 12v leds via ground switching

This is an add on to the other post I raised which was solved really nicely but technically a different problem. I would like to control multiple 12v leds via different arduino pins but the pcb I'm trying to control seems to have all leds fed by one of these transistors (any idea what the operating voltage is?) http://www.farnell.com/datasheets/43606.pdf

It seems for these LEDs that I need to switch the ground to light them. What's the best way of doing this with arduino?

but the pcb I'm trying to control

Do you have a schematic for this?

any idea what the operating voltage is?

The data sheet says the maximum voltage between collector and emitter is 100V.

Totally unsuitable part for an Arduino.
Needs to much base current to saturate with a reasonable amount of collector current.
Not much use if you need to switch more than a few hundred mA.

If you want advice, then tell us more about the LEDs (current) and their supply voltage.
Leo..

Ok, I've taken a bit of time and worked out the schematic and taken a couple of pictures of the unit I'm trying to control. The other unit I've tested has 12v LEDs which are lit by putting 12v to the corresponding pin in the harting connector. This unit however seems to have a transistor powering a positive rail that feeds all LEDs, then the LED is lit by grounding the corresponding pin on the harting connector.

I haven't checked the input voltages yet - but I would assume 12v since the other one is 12v. In which case - why the transistor??

Here's what I have:

why the transistor

Because is you sink a 12V source when it is off you pull up the output pin of the Arduino to 12V. That will fry the Arduino as it exceeds the maximum which is a touch over the supply voltage of the chip, normally 5V.

Also you can not sink more than 40mA without damaging the Arduino because of over current.

That circuit is wrong, you have connected the transistor’s emitter to the anodes of the LEDs. You should be connecting the cathodes to them and the emitter to ground. The anodes should be connected to 12V and each led should have its own current limiting resistor.

It would help if you labelled things on the schematic, like the power and ground, and where do all those LEDs go?

This is an add on to the other post I raised which

Which you failed to post a link to, so why mention it?

I just double checked with my multimeter and the circuit appears correct.

  • Base is connected via a couple of resistors to pin 7 which must be voltage in
  • Collector is connected directly to pin 5 which must be voltage in - I am not clear on why this is needed
  • Emitter is connected to the anodes of all LEDs

I checked the LEDs and they must have inbuilt resistors as there is nothing on the board but there is resistance across them varying with colour.

This was a working unit that came out of a production car. It used to be driven by an ECU box but I'm building an arduino based replacement for it and to add some new functions so I have to work with what I've got and control the LEDs as they were controlled before...

OK, so this unit does not use 12 V LEDs. The transistor is wired as a voltage regulator to deliver some voltage controlled by the unspecified "D1" down from the 12 V supply (pin 5). Pin 9 is ground. I have a suspicion pin 7 is either 5 V or 6 V. Can you read the markings on D1?

The cathodes of the LEDs are then switched to ground via a resistor for each - which you need to provide - to light them. Note that only three LEDs are ever simultaneously lit. You could control them with TPIC6B595s - and a 220 Ohm or similar resistor in each line.

Thanks very much Paul! Here's what I can see on the diode... It looks like it says 6b... and a symbol.. Any way I can test it to find out?

Are you sure I need a resistor for each LED? On the other board I tried 5v and nothing happened, tried 12v and the LEDs light up perfectly. There is resistance between the transistor the LED and ground so there must be resistance built in somewhere that I can't see, maybe in the wiring or the LEDs themselves? [EDIT] I just tested and this board seems to have 360 ohms between each LED and ground. The other board which uses 12v LEDs does not have any resistance on the LEDs, but the LEDs are all pairs of two in series. Does this mean that the other board will need resistors on the supply for each pair of LEDs?

I was undecided whether for the fan speed you lit a number of LEDs depending on speed or just one to show current speed but yes then one for the heat setting and one if AC is on (I think that's what the big one is)

So does that mean then that the transistor emitter is putting out 5-6 volts and the rest of the board (switches and potentiometers) are running on 12?

If the LEDs are running on 5 volts could I just use the arduino pins to switch to ground? I'm using a teensy 3.2 just for this job so plenty of inputs and outputs available...

450nick:
Thanks very much Paul! Here's what I can see on the diode... It looks like it says 6b... and a symbol.. Any way I can test it to find out?

"6b" does not mean much. Pin 9 is ground, you can put a variable supply on pin 7 through say, a 100 Ohm resistor and increase it while measuring the voltage on the diode. You will detect the point at which the voltage stops increasing which will tell you the Zener voltage. Alternatively, just supply 12 V to pin 7 via a 470 Ohm resistor and measure the diode.

Frankly, that circuit is very peculiar. 10 Ohms seems a very low value to bias a Zener and a 1k resistor in series wit the base of the transistor will severely limit its ability to provide a regulated voltage. That is why I suggested that it would not be appropriate to light more than the minimum three LEDs as the voltage will sag and the brightness vary with more LEDs in play.

450nick:
Are you sure I need a resistor for each LED? On the other board I tried 5v and nothing happened, tried 12v and the LEDs light up perfectly. There is resistance between the transistor the LED and ground so there must be resistance built in somewhere that I can't see, maybe in the wiring or the LEDs themselves? [EDIT] I just tested and this board seems to have 360 ohms between each LED and ground. The other board which uses 12v LEDs does not have any resistance on the LEDs, but the LEDs are all pairs of two in series. Does this mean that the other board will need resistors on the supply for each pair of LEDs?

You always need a resistor in series with the LEDs to control the current. There is really no such thing as a "12 V LED" as while you may have two or three in series to make a higher total conduction voltage, you will still need a resistor to limit the current.

These seem to be just the common variety of LEDs, so I doubt they have hidden resistors built in. I could be wrong!

450nick:
I was undecided whether for the fan speed you lit a number of LEDs depending on speed or just one to show current speed but yes then one for the heat setting and one if AC is on (I think that's what the big one is)

So does that mean then that the transistor emitter is putting out 5-6 volts and the rest of the board (switches and potentiometers) are running on 12?

I rather doubt the potentiometers will be running on 12 V as if they are connected to digital logic, the digital logic will be based on 5 V.

450nick:
If the LEDs are running on 5 volts could I just use the arduino pins to switch to ground? I'm using a teensy 3.2 just for this job so plenty of inputs and outputs available...

Yes, as long as the LED current is limited to 20 mA. I do find that circuit rather odd overall.

Right, I've re-drawn the diagram slightly to make it more clear. I also applied exactly 12v between pin 7 and pin 9 via a 470ohm resistor and the voltage across the zener is 5.55v.

So would I be ok to put 12v to both pin 5 and 7, and ground to pin 9 to test the circuit? I want to be very careful not to fry anything as these switchpacks are very hard to come by!

Solved!

I bought a new variable power supply today and what a nice tool it is! I put 12v to both pins as above and it turns out that everything on the board is running at 5.55V. The LEDs consume around 8mA each, so I guess I should be to control these directly from the Arduino.

Very pleased to have unraveled that mystery. Thanks for your help all in helping out, I would have really struggled without some pointers...!

I don't like the idea of 12 V on pin 7. Certainly OK on pin 5.

The voltage across R2 would be 6.45 V, the current therefore 645 mA and R2 would be dissipating 4.1 Watts while the Zener dissipated 3.6 Watts. I do not think either component is rated for that, either pin 7 should be connected to a lesser voltage (about 7) or a series resistor - say 100 Ohms 1 W - added in series.

Thanks for flagging that Paul. In terms of components I think using a resistor on 7 would be preferable. Your recommendation of 100ohms will work ok for me. Thank you again