I'm working on my first ever PCB, and would like to include two 7-segment displays. The device will be powered from mains, so power consumption is not an issue. I have chosen the Broadcom HDSM-293L, with a forward voltage of 2.1V and a maximum current of 25 mA per segment.

The microcontroller I'm using is an STM32F030K6T6, which should be able to deliver 25 mA per pin.

To be able to show seperate digits on the displays I need to be able to toggle the common cathode outputs, but the uC can't sink the current of several LEDs into a single pin, so I'm using transistors for this purpose - a subject I'm not entirely comfortable with. Online tutorials have told me that BJP NPN's are suitable for the purpose, so I've chosen the ON Semiconductor MBT3904DW1T1G, a package of two such transistors suited for 200mA.

The below schematic shows how I've wired GPIOs from the microcontroller through 56Ohm resistors to each anode, and connected the cathodes to the collector of the transistors. I've also connected GPIOs through 1K resistors to the transistor gates.


Is this a sensible way of powering the 7-Segment displays? Are the components I've chosen suited for the task? And is everything correctly connected safe in terms of amount of current?

Thanks for any help!

EDIT: Several people in the comments pointed out that the maximum sourcable current across all the IO pins of the STM is 80 mA. To address this, I'd like to change out the LED resistors for 120 ohm ones, which should reduce the current draw for each segment to 10 mA for a maximum of 70 mA at a time (I don't need the dots).

  • \$\begingroup\$ I'm using transistors for this purpose - a subject I'm not entirely comfortable with -> Look into high/low side drivers :) Also take a look at the datasheet at page 44 - note ΣIIO(PIN) and the footnote (2) \$\endgroup\$ – Sorenp Oct 17 '19 at 12:26
  • \$\begingroup\$ Yes, 25mA on one pin. But with strict conditions. Please read the datasheet rating accurately. Also, I like to refer to this answer I placed earlier today. \$\endgroup\$ – Jeroen3 Oct 17 '19 at 12:31
  • \$\begingroup\$ Design concept is correct for multiplexing the display. However, the NPN selected is a poor choice. To sink up to 200mA, that part will need a very high base current. Select a Low Rds, Logic Level gate, N-channel MOSFET instead. I would use a part like AOD508 (or AOD514 if you don't need huge quantities) aosmd.com/res/data_sheets/AOD508.pdf or one with similar characterics as this is a bit overkill for 200mA. \$\endgroup\$ – CrossRoads Oct 17 '19 at 12:34
  • \$\begingroup\$ this wasn't asked, but did you know there are digital ICs that will manage driving a 7-segment display directly for you, with I2C or SPI interfaces, or BCD to 7 segment decoders. \$\endgroup\$ – vicatcu Oct 17 '19 at 12:46
  • \$\begingroup\$ @Sorenp I am using the high side to control segments and the low side to control the digit, is there anything wrong with that? The total power consumption is problematic, though, yeah... I'll make an edit to address that \$\endgroup\$ – Vegard Oct 17 '19 at 12:52

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.