cancel
Showing results for 
Search instead for 
Did you mean: 

Driving 7 segment Display with STM8 - enough current?

SLasn.1
Associate III

Hi again =)

I have a small project with an STM8 and I was thinking driving my 3-digit 7 segment display directly with the MCU in order to reduce the manufacturing price (I know some of these chips cost only a few cents but if I *can* do it directly from the MCU then is there a reason not to?).

This is my setup:

0693W000003OygRQAS.png

The display is common anode, and the transistors are PNP. Each blue label is directly connected to a pin on the MCU.

The MCU is a STM8L151G6U6.

The display datasheet says about 1.8V to 2.2V forward voltage and max 20mA current.

The datasheet of my STM8 says max 25mA per pin - so far so good. But it also says only 80mA on the VCC & VSS pins, and I only have one of each - if all 7 segments are on, the display will draw itself about 70mA of current which will all go through the VSS pin.

Then I also have 2 small LED's connected to the MCU, which will draw about 10mA of current, but this time from the VCC pin.

And clearly the MCU itself will draw a bit of current + a bit of current here and there on the other pins - my guess is that the limit of 80mA will probably be reached.

My questions:

1) Is it just overall a bad idea to drive the display directly from the/an MCU? (the code of the project is simple so CPU usage does not matter)

2) My first idea was to use 100 Ohm resistors - which will make it about 15mA per pin - and 107mA through VSS when all segments are on. What happens then - does the MCU simply limits the current or will it stop working correctly?

3) The display will be multiplexed, so the "peak" current will only be short and the average current will probably be lower than the maximum, does this change anything?

Thank you!!

Cheers

Simon

13 REPLIES 13
henry.dick
Senior II

if that's the situation you have to deal with, sounds like you have to use a driver - a dedicated IC, or transistors, on a per-segment basis. MCUs are simply not designed to drive that kind of load.

Using a mosfet would help in reducing the number of base resistors.

If you are using the display in a wide range of lighting conditions, consider PWM the signal as well.

Oh nice to know - I did not think about that, thanks!

Looking at the Vce sat voltage, it seems to be around 0.4V, so with that and maybe a few 100s of millivolts from the MCU the measured values make more sense now :)

Actually the tough thing is they always seem to give the Vce(sat) with a gain of 10. Looking at the PMBT3906 from NXP for example (https://assets.nexperia.com/documents/data-sheet/PMBT3906.pdf) :

0693W000003PPOoQAO.png

How will those values change with the Ic/Ib ratio?

In my case with 10k base resistors I get about 0.25mA base current, and with 2 segments on I get about 12 mA collector current, and with all the segments on about 50mA collector current - so I guess I have a ratio moving between 50 and 200.

Thanks for the ideas. I looked at it again today this time with a simple filter and if it is outside in the shade it is ok. I think I am going to go with the 220R resistors and make a few prototypes this way, see if it works ;)