Power an LED with a transistor

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.

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?

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

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

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.

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.

You need a resistor in seriese with that led.

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?

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.

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.

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.

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.