Connecting a 7Segment with NPN

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

I've got a set of 4 Common Cathode 7 Segments. I am going to be driving them from an AtMega48 via an 4511.

Now, I've been reading up on Google and such, and it is suggested to use transistors to handle the power load.

So, this is what I came up with. Does that make sense? Each pin output of the 4511 to the 7 Segment has it's own transistor, but no resistor. The segment itselfs has a common ground. Only the first three are shown to make to picture somewhat more clear.

Also, I do not really understand, but both the VCC on the chips and the line to the transistors comes from the same source. I figure that it will then pull current directly from the power source, instead of through the MCU. Is that correct?

Attachment(s): 

Code, justify, code - Pitr Dubovich

Last Edited: Thu. Oct 18, 2012 - 07:20 AM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Your ATmega48 can drive four 7-segments by itself by multiplexing.
For low brightness, the AVR can drive the common cathode of each display.
For medium brightness, the AVR can drive the common cathode of each display with an NPN transistor.
For high brightness, the AVR can drive the common cathode of each display with NPN, each segment via PNP.

Any system must have resistors to set the required segment currents.

Using four 4511s + 32 resistors is hard work. You only need external transistors for high current / brightness.

David.

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

I actually need the pins for the Mega48 for other purposes as well, so I have the the 4511 chip hooked meaning I only use 4 pins to drive the segment. I then use another 4 pins to multiplex.

I have 4 segments, so otherwise I would have to use 4+7 = 11 pins, now only 8.

So, if I use some of your points I should;

Hook up resistors after the 4511
Hook up a NPN to each cathode

Like this?

Attachment(s): 

Code, justify, code - Pitr Dubovich

Last Edited: Thu. Oct 18, 2012 - 07:20 AM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Yes you have resistors in the right place. Your Q1 is pants.

If you are using the decimal point, you need 8+4 pins for AVR multiplex. I would seriously think about your other pin use.

I doubt if the 4511 can manage multiplexing the segments without external drivers. So life gets more complicated. Just checked. The 4511 can do 25mA. So one 4511 will be ok for low or med brightnes. And save you 3 or 4 AVR pins.

I would look up existing multiplex schematics on the internet. Then copy the proven design.

David.

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

I have looked up other desings, I can find one but that is for a common anode setup, I am trying to adjust that to a common cathode setup. Also, not using the point :)

Also, I am not a native English speaker, so the remark "Your Q1 is pants." leaves be kinda in confusion wether the transistor is in the right place or not.

Thanks for your insights so far.

Code, justify, code - Pitr Dubovich

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

Sorry about the "pants". To British people it means "what you wear under your trousers". To Americans it means trousers. Your Q1 circuit is NOT good.

Common anode is more convenient for an 8051 type of MCU.
The AVR can work with either polarity of displays. Just swap the polarities. However it is safer to find a real schematic of the right type for your displays.

NPN collector goes to common cathode
NPN emitter goes to GND
NPN base goes to AVR GPIO pin via a 1k resistor

David.

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

Okay, thanks for your help, I found a schematic, it's here: http://www.circuitstoday.com/wp-...

So based on that, I've got this. I am still puzzled however, where does the transistor get the power to amplify this? It gets it's current via the segment, it grounds to common. Or is it because of the resistor being there between IO and the segment?

Or simply put, this will give brighter leds then doing the circuit without a transistor?

Attachment(s): 

Code, justify, code - Pitr Dubovich

Last Edited: Thu. Oct 18, 2012 - 07:21 AM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Your circuit is fine. "circuitstoday" is double pants !

An AT89S51 can NOT source current.

Let's say that R1 is 68R as in your schematic. A typical 7-segment LED is 3.0V when lit. Hence 68R will allow 24mA. The typical VOH from the 4511 is 4.57V with a 5V supply. Since you have 4 displays, 24mA/4 is an average 6mA. This is a medium brightness.

Note that the common cathode will be taking 7 x 24mA when displaying "8888". So your AVR has no chance of sinking 165mA. Hence you need Q1.

I am surprised to see such errors in a schematic as "circuitstoday" example. Always choose a schematic from a real commercial product. e.g. a dev board.

David.

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

And that is why I ask here, instead of trusting the net. I just don't have the expertise to descern that myself.

Thanks for your concise explanation.

One final question, I do need 4 transistors for 4 7 segments right? One per common?

Code, justify, code - Pitr Dubovich

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

Yes. 4 NPN.

Most NPN can do 200mA. hFE > 100.

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

Awesome. Much thanks.

Code, justify, code - Pitr Dubovich

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

Last time I used an LED 7 segment, I just connected the anodes and cathodes to the mega (162, I believe).

The resulting display was so bright that I changed the program to assert the common lines 1/4 of the time. Ah, much better.

Gadget has been in use now 7 years.

If you don't know my whole story, keep your mouth shut.

If you know my whole story, you're an accomplice. Keep your mouth shut. 

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

So you used NO resistors at all ?

Did you use no digit driver transistors at all ?

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

Nope. Used "Pulse Width" to control average current. It's the heat that blows LED's and if you keep that down...

If you don't know my whole story, keep your mouth shut.

If you know my whole story, you're an accomplice. Keep your mouth shut. 

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

Can you please resize the pictures to about 800 wide? They take up about 3 screens of a 27" monitor as they are.

John Samperi

Ampertronics Pty. Ltd.

www.ampertronics.com.au

* Electronic Design * Custom Products * Contract Assembly

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

That's strange, could've sworn I did that, but somehow the wrong images got uploaded by me. Fixed that.

Code, justify, code - Pitr Dubovich

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

Thank you. :-) Much better now.

John Samperi

Ampertronics Pty. Ltd.

www.ampertronics.com.au

* Electronic Design * Custom Products * Contract Assembly