2 x 7 Seg LEDs On 8 Pins

Go To Last Post
11 posts / 0 new
Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

It works! I built a circuit to drive two 7 segment LEDS from an ATmega32, displaying a byte in hex.

Using a pair of transistors I can use 7 output pins to light the 14 leds with another output connected to the transistor bases.

I saw the idea on a web-page somewhere but designed the circuit myself. Simple for most freaks perhaps, but since I am learning electronics this was an accomplishment.

I had to insert the diode between ground and the transistors. In fact I added a second one; now there is no more "bleed over". Displaying an 8 on the right caused some of the left digit segments to glow somewhat.

Can someone explain why the diodes are necessary?

Thanks,
Jim

C: i = "told you so";

Last Edited: Thu. Mar 11, 2010 - 07:58 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Hi,

do you have a clue how the circuit "SEL" with the two transistors works?

No current limiting resistors...
All in all i´d say it´s a very dirty solution.

If you like a simple solution, why not throw away the lower transistor and the diodes and connect the cathode of the lower LED directly to the SEL_line? A current limiting transistor to the base of the (upper) transistor would be fine.

I´ve not tested it!!! but my thoughts are:
* with SEL = high: the transistor is low ohmic and the upper LED has GND at it´s cathode.
* with SEL = low: the lower led gets GND by the SEL_line

Klaus
********************************
Look at: www.megausb.de (German)
********************************

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Thanks Klaus,

I had current limiting resistors but the LEDs were too dim. Of course it's dirty but it works! I'll use this as a source of visual feedback for some A/D projects I have planned. (Since it works I'll assert that I have a clue how Sel works albeit a very modest one!)

Again, thanks for your comments; this will help me understand how this works. Unfortunately my oscope is not working so I am stuck with just the DVM.

Jim

C: i = "told you so";

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

If the seven segment leds are 'common anode', you could 'source' the 5v to the anodes using pnp transistors on the 5v line. You pull the base down with another output to turn one or the other on. The segments get pulled down with the avr outputs.

Imagecraft compiler user

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Hi

Quote:
Of course it's dirty but it works!

I dont´ say it doesn´t work, but i can´t see how the current knows it´s way when SEL = LOW.

Klaus
********************************
Look at: www.megausb.de (German)
********************************

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Bob: now I am using common cathode type but will try your suggestion on some common anode LEDs I have; I like the latter because their red color is easier for me to see.

Klaus: I am illiterate in electronics, but the circuit seems pretty simple to me. When SEL is high the NPN allows current flow through its LED while the PNP does not. When SEL is low the PNP allows current flow and the NPN does not. Thus current flows through each LED if DATA is high during its portion of the SEL signal (i.e. SEL high for NPN, SEL low for PNP). Perhaps this makes no sense and I just happened to wire/program the device to produce the desired result. Then I should go buy a lottery ticket! LOL

Jim

C: i = "told you so";

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Hi,

I recommend to buy a lottery ticket.

it works, but i think it´s not working the way you think.

disconnect the emitter of the PNP.

What do you think does happen?

I think it´s working the same way as before.

-->But why does it seem to work right?
The PNP´s collector to emitter gets never conductive.
You only use the PNP´s inside diode from cathode to base. emitter is useless.

--> Why dou you have problems without the (two) diode to GND?
this is because of the current flowing through the lower LED via PNP to the SEL and back to the AVR.
Now this is much current for the AVR and therfore the voltage on SEL is not 0V but something more than 1.2V
(depends on the number of diodes). with 1.2V at SEL and the NPN connected via diode to GND there is current to the base
of the NPN. the NPN gets (slightly) conductive.
Therefore you see the "ghost pattern" at the LED with the NPN. NOT otherwise round.

Current limiting resistors:
In the datasheets of the AVR and the transistor are maximum current specifications.
without the resistor you overload the AVR´s ouput stage as well as the tranistors base.
The circuit may fail sometime. minutes - days - years - who knows. But you are certainly out of specification.
(The AVR gets warm - doesn´t it? That´s allways a bad sign.)

Hope it wasn´t too much school-like. ;-)

Klaus
********************************
Look at: www.megausb.de (German)
********************************

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Klaus,

I showed my home project to our EE (I am s/w) and was read the riot act about LED drivers and using FETs for the switching etc.

You're comments are very sensible, and again thanks for the analysis. In fact, I have seen the behaviors you described, so you are very correct in your conclusions!

(Do I have to split the lottery winnings?)

Jim

C: i = "told you so";

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

50/50 is OK ;-)

Klaus
********************************
Look at: www.megausb.de (German)
********************************

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

cpluscon wrote:
When SEL is high the NPN allows current flow through its LED while the PNP does not. When SEL is low the PNP allows current flow and the NPN does not. Thus current flows through each LED if DATA is high during its portion of the SEL signal (i.e. SEL high for NPN, SEL low for PNP). Perhaps this makes no sense and I just happened to wire/program the device to produce the desired result. Then I should go buy a lottery ticket! LOL

Jim


I was sort of able to trace out most of your breadboard wiring and it looks like you actually have the circuit wired the way you think but, you drawing seem to be incorrect.

In your schematic only, you need to swap the emitter and collector of the PNP transistor. Then it all makes sense.

You do need to add about 100 Ohms worth of current limiting to help protect the AVR outputs from excessive current if one of the LEDs fail in a shorted condition. It would be best to put the current limiting resistor in the emitter part of the circuit.

You can avoid reality, for a while.  But you can't avoid the consequences of reality! - C.W. Livingston

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Nice job Carl, as usual. And thanks!

Jim

C: i = "told you so";