4

I have an object with a series of led and I want to turn on and off these leds from my Arduino. The input of the LED circuit is 24v DC 100mA.

What I've done is the following:

  • I've cut a wire of this object and I connected one end to the collector and the other end to the emitter of a NPN transistor
  • I connected the base of the transistor to a digital output (through a 1k resistance)
  • I connected the power to the led series while the digital pin was LOW (actually completely disconnected)

But with no current on the base of the transistor, the LED has turned on to my surprise. I may have completely misused the transistor and other items. How do I fix this circuit?

  • Can you describe your circuit a little more? Did you put the transistor between the 24v supply and the LEDs? Also, are you using the same Ground for the Arduino and the external circuit? – Peter Bloomfield Feb 28 '14 at 11:25
  • I put the transistor between 24v supply and LEDs and I tried using the ground of 24v supply only and also using both the ground – Alessandro Feb 28 '14 at 11:32
  • 2
    A diagram or photo would be most helpful. I find words can miss out vital detail. – Cybergibbons Feb 28 '14 at 11:47
  • @Cybergibbons meta.arduino.stackexchange.com/questions/12/… – jippie Feb 28 '14 at 12:50
  • Thanks guys for the many advices. In the next days I'm going to completely rebuild this project, following jippie diagram, to avoid messing things. I'll let you know – Alessandro Feb 28 '14 at 15:17
6

If I understand your writeup correctly, this is what you have built:

schematic

simulate this circuit – Schematic created using CircuitLab

What you didn't mention in your question is that you made a connection from Arduino ground to the base of the transistor and the seconds circuit's ground connection. I drew the extra lead 'loose' for illustration only, but you see where it should connect. Current needs a return path, it is not sufficient to only have the forward path (from Arduino through R1 and base-Q1). The return path is emitter-Q1 to Arduino-GND.

Do notice though that the two batteries / power supplies must be floating with respect to each other otherwise you're going to short them out.

  • Note the transistor part number is just the standard partnumber from CircuitLab. I forgot to remove it and can't edit circuit any more. – jippie Feb 28 '14 at 12:49
  • From the comments, it sounds like Alessandro actually has the transistor on the other side of the LEDs. – Peter Bloomfield Feb 28 '14 at 13:28
  • @PeterR.Bloomfield one more reason to upvote meta.arduino.stackexchange.com/questions/12/… because that is not how I initially understood it. My transistor is "between 24v supply and LEDs" too ... it can be uderstood both ways. Apart from that this is the de-facto standard to solve the problem, unless ... – jippie Feb 28 '14 at 13:43
  • @jipple which transistor would you recommend for switching between a 5v and a 24v circuit? – Martin Oct 27 '15 at 9:39
  • I see you made a proper question on the stack from it, so I'll take it that you'll get some good answers there @Martin – jippie Oct 27 '15 at 16:08

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.