Problem driving seven seg display - Page 1
Forum section: electronics / beginners

author: dog80
author_rank: Regular Contributor
timestamp: November 01, 2013, 03:30:55 pm
content: 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?

author: Kohanbash
author_rank: Regular Contributor
timestamp: November 01, 2013, 03:42:06 pm
content: 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.

author: andtfoot
author_rank: Unknown
timestamp: November 01, 2013, 03:48:08 pm
content: 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-tranThe 2nd picture down shows a common anode setup, including the resistors I mentioned:

author: dog80
author_rank: Regular Contributor
timestamp: November 01, 2013, 04:07:00 pm
content: 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

author: c4757p
author_rank: Super Contributor
timestamp: November 01, 2013, 04:11:43 pm
content: 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.)Quote from: dog80 on November 01, 2013, 04:07:00 pmYou shouldn't do that - then we've got to figure out whether you omitted them on purpose or not.

author: codeboy2k
author_rank: Super Contributor
timestamp: November 02, 2013, 07:21:25 am
content: couldn't you just tri-state the output pin controlling the PNP? Then it can't sink base current anymore.

author: David_AVD
author_rank: Super Contributor
timestamp: November 02, 2013, 07:50:49 am
content: 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.

author: codeboy2k
author_rank: Super Contributor
timestamp: November 02, 2013, 10:24:40 am
content: Quote from: David_AVD on November 02, 2013, 07:50:49 amDoh! forgot about those. Hey OP.. use MOSFETS for this purpose... they make for much better switchesI 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?

author: blewisjr
author_rank: Frequent Contributor
timestamp: November 02, 2013, 12:36:55 pm
content: 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.

author: David_AVD
author_rank: Super Contributor
timestamp: November 02, 2013, 12:38:28 pm
content: 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.

author: Mr Smiley
author_rank: Frequent Contributor
timestamp: November 02, 2013, 06:26:36 pm
content: You could do it with three transistors and five resistors per digit;Assuming Common AnodeUse 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 supplyHope that makes sense