Author Topic: Problem driving seven seg display  (Read 5481 times)

0 Members and 1 Guest are viewing this topic.

Offline dog80Topic starter

  • Regular Contributor
  • *
  • Posts: 64
Problem driving seven seg display
« on: November 01, 2013, 03:30:55 pm »
I am driving a common anode seven seg display with an Arduino. I am powering it up from a 9Volt battery.

The circuit topology is this:


The problem is that the PNP transistors do not turn off even when the Arduino pin is set high.

When I power everything from the USB, the circuit works as intended.

Obviously this is because the Arduino pin output is 5 Volts which is lower than 9 so the transistor keeps conducting. When powering from USB, everything is at 5 volts so it shuts down properly.

What topology should I implement so the PNP transistors can turn off while keeping the 9 Volt battery?
 

Offline Kohanbash

  • Regular Contributor
  • *
  • Posts: 175
  • Country: us
    • Robots for Roboticists
Re: Problem driving seven seg display
« Reply #1 on: November 01, 2013, 03:42:06 pm »
How about adding a voltage regulator (ex 7805)?

Also your circuit diagram is a bit off. If it is common anode all you need to do is drive the signal to ground (probably through a resister) to enable that portion of the display.
« Last Edit: November 01, 2013, 03:47:23 pm by sdk32285 »
Robots for Roboticists Blog - http://robotsforroboticists.com/
 

Offline andtfoot

  • Supporter
  • ****
  • Posts: 352
  • Country: au
Re: Problem driving seven seg display
« Reply #2 on: November 01, 2013, 03:48:08 pm »
Is there are reason for the two transistors?
Also, do you have any current limiting resistors for the LED and the transistor base?

I had a quick look around on Google, which brought up this page:
electronics.stackexchange.com/questions/83786/how-to-drive-a-12v-common-cathode-7-segment-display-with-5v-signals-and-bjt-tran

The 2nd picture down shows a common anode setup, including the resistors I mentioned:

 

Offline dog80Topic starter

  • Regular Contributor
  • *
  • Posts: 64
Re: Problem driving seven seg display
« Reply #3 on: November 01, 2013, 04:07:00 pm »
It is a multiplexed seven seg display so I need to control the cathodes and the anodes individually.

I do use resistors, I just ommitted them on the sketch for simplicity's sake
 

Offline c4757p

  • Super Contributor
  • ***
  • Posts: 7799
  • Country: us
  • adieu
Re: Problem driving seven seg display
« Reply #4 on: November 01, 2013, 04:11:43 pm »
I'd just put it all after a 5V regulator. The LEDs only run at about 2V, so the extra power has to be burned somewhere. Might as well be in the reg. But if you really want to run them off 9V, you can do this:

(Obviously I omitted the cathode drivers. Seems like you've got those figured out.)

I do use resistors, I just ommitted them on the sketch for simplicity's sake

You shouldn't do that - then we've got to figure out whether you omitted them on purpose or not.
« Last Edit: November 01, 2013, 04:17:32 pm by c4757p »
No longer active here - try the IRC channel if you just can't be without me :)
 

Offline codeboy2k

  • Super Contributor
  • ***
  • Posts: 1836
  • Country: ca
Re: Problem driving seven seg display
« Reply #5 on: November 02, 2013, 07:21:25 am »
couldn't you just tri-state the output pin controlling the PNP? Then it can't sink base current anymore.

 

Offline David_AVD

  • Super Contributor
  • ***
  • Posts: 2858
  • Country: au
Re: Problem driving seven seg display
« Reply #6 on: November 02, 2013, 07:50:49 am »
The output from the micro will swing from 0V to 5V (not 9V), so the top transistor will never turn off.

Tri-stating the output(s) won't help as the protection diodes are still there and will limit the pin level to Vcc + a diode drop.
 

Offline codeboy2k

  • Super Contributor
  • ***
  • Posts: 1836
  • Country: ca
Re: Problem driving seven seg display
« Reply #7 on: November 02, 2013, 10:24:40 am »
The output from the micro will swing from 0V to 5V (not 9V), so the top transistor will never turn off.

Tri-stating the output(s) won't help as the protection diodes are still there and will limit the pin level to Vcc + a diode drop.

Doh! forgot about those.  Hey OP.. use MOSFETS for this purpose... they make for much better switches ;)

I suspect you need to control the anodes and cathodes individually, as you say, because you have several groups of common anodes or cathodes... i.e. multiplexing 8 displays in 2 groups of 4 or something? is that it?
 

Offline blewisjr

  • Frequent Contributor
  • **
  • Posts: 301
Re: Problem driving seven seg display
« Reply #8 on: November 02, 2013, 12:36:55 pm »
First you need to check to see if your display is common cathode or common anode.

If you are using a Common cathode multiplexed display you need to drive a particular cathode to select the segment block you wish to update.  The best way I found to do this was with Some resistors and NPN transistors.  This will occupy 4 pins on the micro.  If your micro is small and you can't afford to use 7 more pins to drive the segments you can use 2 pins and a shift register to drive which segments to light up.  The general concept is to enable the Segment block pin you want by driving high and then drive high the pins which correspond to the segments in the block you want and then switch to the next block.  I believe I needed to use 10k resistors on the base of my NPN's and then I used 1k resistors on the led pins.  Choose your resistor based on how much current your display can handle when configuring the transistors if you drive too much you will blow out the display.  The data sheet should have all the info.

If your display is common anode well then I can't help you because they operate differently then the display I use someone else may know more about this type.
 

Offline David_AVD

  • Super Contributor
  • ***
  • Posts: 2858
  • Country: au
Re: Problem driving seven seg display
« Reply #9 on: November 02, 2013, 12:38:28 pm »
One way is to have the micro drive NPN transistors that in turn drive the PNP high side drivers.  You can buy high side driver chips that accept logic level inputs whilst having a (sometimes second) higher supply pin.
 

Offline Mr Smiley

  • Frequent Contributor
  • **
  • Posts: 324
  • Country: gb
Re: Problem driving seven seg display
« Reply #10 on: November 02, 2013, 06:26:36 pm »
You could do it with three transistors and five resistors per digit;

Assuming Common Anode

Use a NPN to turn on/off your pnp connected to your Anode, and use the other NPN to ground your Cathode.

You'll need a resistor divider between your 9v supply and the base of your PNP  transistor, the centre of the divider would go to the Collector or the first NPN transistor, and a resistor for the base of that NPN  transistor to the micro.

For the divider the resistor connected to the 9v supply could be 10k, it's only a pullup, the resistor going to the base of the PNP would control the base current when grounded by the driving NPN.

Then a current limiting resistor for your segment and a base resistor for the NPN puling the Cathode to ground.

So, for a single seven segment display (Common Anode including dp ) would be x1 PNP, x9 NPN and 22 resistors, for each additional display you'd add x1 PNP, x2 NPN and another 3 resistors.

A lot of trannys.

Multiplexing, just connect all common segments together.

CC are much simpler, as is a single supply

Hope that makes sense  :-//
 :)
There is enough on this planet to sustain mans needs. There will never be enough on this planet to sustain mans greed.
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf