Power An LED With A Transistor - General Electronics - Arduino Forum

Power an LED with a transistor Other Hardware General Electronics June 11, 2013, 10:09pm 1

Hi,

I would like to display the signal of a DCF77 receiver with an LED. It can't provide enough current for the LED. What works is use an ATtiny and put the input from one pin to the output of another.

I would like to do this with a transistor. This is my setup (source):

This somehow inverts the signal. It also inverts the signal at the output of the DCF receiver.

June 11, 2013, 11:48pm 2

This somehow inverts the signal.

A transistor will invert the "signal", at the transistor's collector. But, when the input to the transistor goes high and the transistor turns on, it pulls-down the "ground side" of the load and turns on the LED.

So, logic high = LED on. Normally, I'd say it's not inverted if a logic-high turns the LED on, but it depends on how your logic works... If logic-low is the "active" or "true" state, then you'd want the LED to turn-on when the signal goes low.

If the logic is reversed you can use a 2nd transistor to invert it again, or you can find a non-inverting buffer or driver chip.

Don't forget the current-limiting resistor in series with the LED.

It also inverts the signal at the output of the DCF receiver.

What?

June 12, 2013, 12:01am 3

DVDdoug: But, when the input to the transistor goes high and the transistor turns on, it pulls-down the "ground side" of the load and turns on the LED.

This is exaclty what's not happening. Signal goes up, LED turns off.

It also inverts the signal at the output of the DCF receiver.

What?

Without transistor: 800ms - Signal pin is LOW, 0V, Arduino reads 0 200ms - Signal pin is HIGH, 3.3V, Arduino reads 1

Whit transistor circuit: 800ms - Signal pin is HIGH, 3.3V, Arduino reads 1, LED is on 200ms - Signal pin is LOW, 0V, Arduino reads 0, LED is off broken signal

June 12, 2013, 12:32am 4

You must have a different configuration from what you think. Which transistor? Sure its NPN? Sure you have B,C,E connected right?

June 12, 2013, 8:45pm 5

I'm pretty sure they are connected according to the schematics and the datasheet (link in the first post).

Also, what happens depends on the value of the resistance that is connected to the base. The transistor also pulls down the input of the microcontroller so I can't get any signal at all.

June 13, 2013, 7:25am 6

When there's nothing applied to the base, the transistor is off, this gives a Logic High on the collector pin.

When voltage is applied, the net voltage at the collector is 0v because it's it's pulling in the ground terminal.

June 13, 2013, 7:34am 7

You need a resistor in seriese with that led.

June 13, 2013, 10:20am 8

Grumpy_Mike: You need a resistor in seriese with that led.

I added one. It inverts the signal at the base again.

When there's nothing applied to the base, the transistor is off, this gives a Logic High on the collector pin.

When voltage is applied, the net voltage at the collector is 0v because it's it's pulling in the ground terminal.

Any idea how to circumvent this? Do I need some kind of pulldown resistor?

June 13, 2013, 4:57pm 9

I added one. It inverts the signal at the base again.

NO! one in series with the LED ... it will invert nothing.

Any idea how to circumvent this?

Why are you obsessed with this inverting thing, just correct any inversions you perceive in the software.

Do I need some kind of pulldown resistor?

No if you want to invert the signal again use a second transistor, but it is totally pointless.

June 13, 2013, 5:51pm 10

NO! one in series with the LED ... it will invert nothing.

I didn't expect it to invert the signal. Thats just the point of this thread: It inverts the signal but it shouldn't...

Why are you obsessed with this inverting thing, just correct any inversions you perceive in the software.

The software/microcontroller part is no problem. But in addition to the software, I wanted to add an LED that displays the signal for debugging. Since the time data takes two minutes to receive, I would like to just "look" at the signal to see if it is correct.

All I want is the following: An led that turns on if the DCF77 receiver pin goes to 3.3V and turns off when it goes to GND.

As I said, I currently use an ATtiny (as shown in the picture) that simply maps the input of one pin to the output of another pin. This does exactly what I want to do with the transistor. I wouldn't use a transistor at all if the DCF77 receiver could provide enough current for the LED. I would just connect the LED between the signal pin and GND.

June 13, 2013, 6:09pm 11

hold on... you don't want to invert the signal?!

use an NPN and source the current from a 5v rail?

1k from pin out on the attiny to the base of the transistor. emitter is tied to ground. 5v to the anode (long leg of the led) the other leg cathode is tied to the collector, place a 300ohm resistor between to protect the led.

June 13, 2013, 7:54pm 12

An led that turns on if the DCF77 receiver pin goes to 3.3V and turns off when it goes to GND.

That is what all the circuits in this thread actually do! Where they say load, that is your resistor in series with the LED. Without a resistor you will drag your power rail down or burn the LED or transistor.

Topic Replies Views Activity
If it works, it works LEDs and Multiplexing 22 263 November 8, 2025
Transistors aren't being biased, code compiles fine, hardware issue? General Guidance 49 273 August 13, 2025
How can a transistor help and Arduino from getting fried General Electronics 9 669 February 10, 2024
IR transmitter not working LEDs and Multiplexing 31 403 November 28, 2024
LED turns on when resistor is touched General Electronics 16 1453 October 27, 2023
Unfortunately, your browser is unsupported. Please switch to a supported browser to view rich content, log in and reply.

Tag » Arduino Led Resistance Transistor Mpsd