Go Down

Topic: Control more leds with transistor (Read 1 time) previous topic - next topic

asuryan

Jun 16, 2011, 10:07 am Last Edit: Jun 27, 2011, 06:25 pm by asuryan Reason: 1
Hi!

Sorry if this a total noob question but I would like to PWM run more than one LED on a pin.
The fading of one LED is no problem I was able to write a library for this task.

I build this circuit:


As I said one Led is no problem but these 4 are not working any more. When I connect them directly
to the 12V they light up quite nicely so no problem here. Connected to the transistor the are constantly
very dim, no fading here. The strange thing is when I conncet the +5V from my FTDI breakout before the
emitter they are fading and running at full brightnes.


Thanks in advance!! :)

Magician

Change polarity Leds and battery, plus connect negative terminal battery to ground of arduino board.

asuryan

#2
Jun 16, 2011, 03:46 pm Last Edit: Jun 27, 2011, 06:25 pm by asuryan Reason: 1
Thanks very much!

Like this?


Please bear with me these are my first attemps with the arduino and electronics... ;)

Magician

Excellent. Have you already tested it?

retrolefty

Not sure that circuit will actually work. The four series wired leds have 3.2vdc forward voltage drop each, therefore the whole led string will require 12.8vdc before starting to conduct. You may have to break up the 4 led string into two led strings, each with it's own series current limiting resistor.

Lefty


asuryan

#5
Jun 21, 2011, 12:01 am Last Edit: Jun 27, 2011, 06:25 pm by asuryan Reason: 1
Thanks for your replies!

I tested it and it actually works (Ok only 3 Leds because they are brighter then. Thx, retrolefty)! Hurray! :)


But! I would really like to undrstand why?! Where does the GND from the Arduino board itself come from??
Is the GND some sort of reference for the transistor? I thought a transistor is like a switch, triggered by the
base so that the circuit from +12V to GND is closed? Why do I need the GND from the Arduino?
Where does the GND from the Arduino come from when I would like to build a standalone ATMega328 circuit?

I designed a little circuit (hope I made nothing wrong with the standalone ATMega wiring):


OMG... Im such a noob... please forgive me! :)
Thanks in advance!! :)


Grumpy_Mike

Ground doesn't come from anywhere, it is a refrence point. You need it to allow current to flow from the arduino, through the base to the emitter and back into the arduino. Without this path the transistor can't switch.

retrolefty

Quote
Where does the GND from the Arduino come


The originating source of GND is the negitive voltage terminal of the voltage source powering the arduino, either USB or through the external power connector. If using an additional external DC voltage source for powering external leds, motors, lamps, etc then both the external power source and arduino must have a wire connecting their two negative terminals.

As GM said, current flows in a circuit so there must be a complete current path which includes ground.

Lefty

asuryan

Ok, thanks very much guys for your input!

So in an standalone ATMega328 circuit (as seen above) I have to connect the negative main
voltage (12V that go directly to the Leds) with the regulated negative voltage (after the 7805)? Is this
correct (A wire in my ciruit design that goes between powersource and crystal straight up to the
negative voltage)?

Grumpy_Mike

Quote
after the 7805

The ground doesn't go through the regulator. Before or after it is the same place.
You have this right on your diagram.

asuryan

Ok guys I think I understand! :)

I would like to say a big "thank you" to you! Its very nice to be supported that way
especially when there are mostly "pro´s" who care about people with very low experience
in electronics but who are eager to learn something new!

Thanks a lot for support! :)


Go Up