i'm making a digital clock. Right now the plan is to matrix them on a atmega328 using transistors. I figured i need a transistor on both sides or the current would be sinked/sourced by the atmega, which is not what i want.

I'd rather use the MAX7219 but i'm not sure if it's possible to use transistors, because i don't think the MAX7219 can handle the current.

I found the circuits here, i smushed them together, is this correct? Idk.

enter image description here

This is the led segment i'm using, there's four of them. So four 337 transistors, one for each digit. And seven 327 transistors, one for each segment. I will scan through the four digits and turn on the apropriate segment. enter image description here

So yea, please let me know if this is totally wacky or something else.

Edit : I guess this would be 1 digit. Sorry it's confusing to draw the whole matrix. I hope this clears it up. It's just a normal matrixing situation but with more leds. enter image description here

So normally it goes something like this : The cathodes of the leds are controlled directly by the atmega, but results in the atmega supplying the current. So my reasoning would be to put a row of transistors there instead, would that be correct? enter image description here

  • why are you using two transistors?
    – jsotola
    Mar 30 '20 at 0:25
  • Your schematic has two Q1's, which is confusing. Your schematic is not complete or it does not match your description. Please correct it so they match. The BC327 will be connected to the 7 segments and the BC337's to the (common) cathode of each digit, right?
    – StarCat
    Mar 30 '20 at 7:54
  • That's my question. Do i need two for each segment? Like i said in my OP, if i would use 1 transistor, the current would be sourced/sinked by the arduino. I need to leds to be powered seperatly. One of those should then be Q2, forgot to edit that. I can't match it to my description because i'm not sure if it's correct. It's a led matrix, but instead of individual leds, i need to turn on sets of 2 and 3 leds. The cathodes are controlled by the BC337, the anodes by the BC327. Mar 30 '20 at 16:09
  • I think this will work. Why don’t you test this on a breadboard? The value for R1 should be chosen such that the LEDs light up evenly. I would advise you to use different values for the clusters with two and three LEDs, or use one resistor per LED. You should take the (small) voltage drop from the transistors into account and calculate resistors accordingly.
    – StarCat
    Mar 31 '20 at 6:32
  • Since each LED is individual, I'm afraid that you can not put them in parallel. They will lit differently due to their own forward voltage. You might like to put them in series. Apr 1 '20 at 6:52

Since you're using a matrix of anodes and cathodes you need to connect/disconnect both ends of each LED.

You will probably multiplex these LEDs and only light one at a time. Are the LEDs high enough current that you can't either source or sink enough current for a single LED directly from Arduino pins? Most LEDs run on ≤ 20 mA, which an atmega328 can handle.

If you are trying to drive LEDs that need > 20mA then your plan to switch both the +5 and the ground with transistors should work. As StarCat said, you should consider the "on resistance" of your transistors as part of your calculation for the value needed for the current limiting resistors of your LEDs.


Or just use the MAX7219, specifically designed for 7-segment displays. It has an operating current spec of 330 mA, good for all segments and the decimal point on at the same time. A four-digit 7-segment display with a total of 32 LEDs allows 10 mA per LED assuming you have everything on at once.

Am I missing something?


Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.