# how can i use multiple 7 segment in tinckercad

I need to connect 5 (7 segments ) using tinckercad. and as we know that tinckercad doesn't have an arduino mega to use it's pins. so how can i do that without the a MEGA ?

• Multiplexing? No idea what tinkercad has / does. – Majenko Jun 11 at 21:28
• use a display module with a control chip – Juraj Jun 12 at 8:55

It sounds like you will need to multiplex them.

Assuming common cathode LEDs:

Set up a transistor for each digit that activates the ground for that digit. (Lighting all the segments of a digit will probably exceed the max current sink of one of your digital pins.) You may be able to drive a single segment directly from an output pin, assuming it's current draw is ≤20 mA. If the segments draw > 20 mA then you will likely need transistors for the segment drivers as well. (The max output of a pin on most Arduinos is actually 40 mA, and if the average current when multiplexed across 5 digits is < 20 mA, you might get away with drawing up to 40 mA per segment. I'd ask somebody with more electronics experience than me to confirm this.)

Write your code to switch one digit's ground on at a time, after turning on the desired anode (segment) pins. Cycle through the digits rapidly and they will all appear to be on at the same time.

The pseudo-code:

``````setup {
digit index = 0
turn all pins (segment anodes and digit cathodes) to open state
}

loop {
set up segments pins for digit[index]
Turn on cathode for that digit
short delay to allow segments of current digit to glow
turn off cathode (ground) of current digit
digit index = (digit index + 1) % num_digits
}
``````

The above would require a digital pin for each segment, and a pin for the ground of each digit. (7 + 5 = 12 digital pins total.) Without multiplexing, you'd need 7x5 = 35 digital pins, and would still have to make sure you didn't exceed the total current output limits of the Arduino. (35 segments x 20 mA/segment would be 700 mA total.) Most Arduinos have a total current output of no more than 200 mA across all pins, so you could not light up all the segments of more than 2 digits at once, assuming 20 mA/segment.)

Note that it might be easier to ignore all of the above and get a serial LED display driver like a MAX7219. You just need 2 digital lines to drive that, and it will control 8 8-segment digits (7 segments plus a decimal point at each position)