Supplier photo of an assembled infinity mirror light cube illuminated on a dark background.
Supplier photo
Temu affiliate offer ยท Project idea

Build an infinity light cube

Listing specifies 5-volt direct current. Soldering required; battery and glue not included.

View kit on Temu

Tricky Circuit may earn a commission through these links. Product ideas have not been bench-tested by Tricky Circuit and are not verified lesson parts lists.

Two Digits, One Segment Bus: Blank Before Switching

Two seven-segment digits can share seven Arduino outputs if only one digit is enabled at a time. The difficult part is the handover: changing segment data while the old digit is still conducting can draw a brief unwanted pattern. This experiment makes that order explicit and keeps currents small enough that a frozen loop is not an excuse to use a large pulse rating.

Use an original Arduino UNO Rev3 with Arduino AVR Boards 1.8.6, two exact Kingbright SC56-11EWA common-cathode displays and two onsemi 2N3904BU transistors. Complete supplied-code host tests execute the scanner, frame update and blanking order; the Arduino adapter is excluded from that build. No AVR target compilation, UNO execution, physical ghosting test or display brightness measurement is claimed.

A current budget that tolerates a stopped program

A seven-segment display contains separately connected light-emitting diode (LED) bars called a through g. The common cathode is their shared negative connection. Here one NPN bipolar transistor switches each display’s cathode to ground. NPN names its semiconductor regions; base current controls the collector-to-emitter path. It does not mean three charged terminals.

Use fourteen 2.2 kฮฉ resistors, one for every segment in each display, plus two 1 kฮฉ base resistors and two 100 kฮฉ base-to-emitter pulldowns. All may be rated at least 0.125 W. Separate segment resistors also avoid depending on how two parallel LEDs would share current during an accidental overlap. The pulldowns discourage a floating base while the controller starts; they do not guarantee every power sequence.

With an illustrative 5 V high output, 1.9 V LED drop and 0.2 V transistor drop, a lit segment current is about (5โˆ’1.9โˆ’0.2)/2200=1.32 mA. Those drops are conditional examples, not guaranteed at this small current. Even ignoring both drops gives a resistor-bound 5/2200=2.27 mA per branch, before supply and resistor tolerance. Seven branches are at most about 15.9 mA per digit under that model. If both digit switches accidentally conduct, each shared segment output supplies two separate branches: about 4.55 mA maximum by the same bound.

The base resistor limits a nominal 5 V source to under 5 mA even with zero base drop. Using the controller’s loaded high level and a plausible base drop gives a few milliamperes, deliberately strong relative to our small collector load. Saturation means the transistor is driven into a low collector-to-emitter voltage state. The transistor datasheet’s saturation values have specified collector/base test currents; they do not certify our board’s exact switching time. The LED’s 30 mA continuous and 160 mA restricted pulse ratings are stress boundaries, not our design currents. A two-digit scan near 50% duty does not qualify for the datasheet’s 0.1 ms, one-tenth-duty pulse condition.

Connect every named segment

DP means decimal point. Its separate pin stays open in this seven-segment experiment.

Two complete SC56-11EWA segment arrays with individual 2.2 kฮฉ resistors, shared UNO D2 to D8 named nets, separate 2N3904BU common-cathode switches from D9 and D10, 1 kฮฉ base resistors and 100 kฮฉ pulldowns.
Original circuit schematic. Matching D2โ€“D8 labels are the same shared nets; each display retains its own seven current resistors.
UNO net Segment Pin on each exact display
D2 a 7
D3 b 6
D4 c 4
D5 d 2
D6 e 1
D7 f 9
D8 g 10

For each row, the UNO net splits into two branches, each through its own 2.2 kฮฉ resistor to that display’s segment pin. Join display 0 cathode pins 3 and 8 to Q0 collector; join display 1 pins 3 and 8 to Q1 collector. Leave both decimal-point pins 5 open. Q0 base is driven from D9 through 1 kฮฉ; Q1 base from D10 through another 1 kฮฉ. Each base also has 100 kฮฉ to its own emitter. Both emitters and UNO ground join.

The selected onsemi TO-92, Transistor Outline package, has emitter pin 1, base 2 and collector 3. Confirm the manufacturer’s viewing orientation and actual body marking; a similarly named transistor can have a different lead order. A common-anode display is also a different circuit. Power only the UNO through Universal Serial Bus (USB), with wiring changed while unpowered. No external display supply or extra transistor load is connected to the outputs.

Blank, change, enable

Multiplexing means sharing connections over separate time slots. Duty cycle is the fraction of time a branch is enabled. One scan slot commands both digit switches off, waits 20 microseconds (ยตs), writes all seven segment levels, waits another 5 ยตs and enables one digit. A microsecond is one-millionth of a second. The next slot selects the other digit. The waits are a conservative experimental starting point, not a guarantee derived from a transistor test made under other base-drive conditions.

Ideal digit-enable and segment-pattern timing for displaying 42, showing both digits off before each segment update, 20 microseconds blanking and 5 microseconds settling before enable.
Original command-timing diagram. Physical transistor conduction and LED light must be observed separately; command LOW is not an instantaneous analog turn-off measurement.

With ideal 1000 ยตs slot calls and negligible other work, each digit is enabled for about 975 ยตs out of a 2000 ยตs frame: approximately 48.75% duty and 500 frames per second. Actual pin writes, loop delays and clock error change that result. A phone camera may show bands despite an apparently steady display; that is not a calibrated scan-frequency reading.

A new number is staged, then committed only before digit 0. Digit 1 therefore uses the same committed number as its partner. Without this frame boundary, an update between digit slots could momentarily combine the tens from one number with the units from another. This is a two-digit snapshot issue, distinct from changing a single LED.

Complete scanner and Arduino adapter

Create a multiplex_lab sketch folder, place an empty multiplex_lab.ino beside the downloaded C++ programming-language file and compile the entire folder for UNO before a real trial. That board-target build has not been performed here. The application programming interface (API), the board core’s callable functions, supplies digitalWrite(), micros() and the short delays. Download the complete program (ZIP; file: tricky-circuit-batch007-campaigns63-68/code/uno-two-digit-multiplex.cpp).

/* Original UNO Rev3, Arduino AVR Boards1.8.6. Save beside an empty
   multiplex_lab.ino in a multiplex_lab folder; compile the whole folder.
   HOST_TEST excludes the Arduino pin adapter, not the scanner being tested. */
#include <stdint.h>
const uint8_t MASK[10]={0x3f,0x06,0x5b,0x4f,0x66,0x6d,0x7d,0x07,0x7f,0x6f};
struct Pins {
 virtual void digit(uint8_t index,bool on)=0;
 virtual void segments(uint8_t mask)=0;
 virtual void wait_us(unsigned n)=0;
 virtual ~Pins(){}
};
class Scanner {
 Pins &pins;uint8_t next_digit,value,pending;uint32_t previous;bool stopped;
 void blank(){pins.digit(0,false);pins.digit(1,false);}
public:
 explicit Scanner(Pins &p):pins(p),next_digit(0),value(0),pending(0),previous(0),stopped(true){}
 void stop(){blank();pins.segments(0);stopped=true;}
 void begin(uint32_t now){blank();pins.segments(0);next_digit=0;value=pending;previous=now;stopped=false;}
 bool set_number(unsigned n){if(n>99){stop();return false;}pending=uint8_t(n);return true;}
 bool tick(uint32_t now){
  if(stopped)return false;
  uint32_t elapsed=now-previous;
  if(elapsed>20000){stop();return false;}
  if(elapsed<1000)return false;
  previous=now;blank();pins.wait_us(20);
  if(next_digit==0)value=pending;
  uint8_t numeral=next_digit==0?value/10:value%10;
  pins.segments(MASK[numeral]);pins.wait_us(5);pins.digit(next_digit,true);
  next_digit^=1;return true;
 }
};
#ifndef HOST_TEST
#include <Arduino.h>
class ArduinoPins:public Pins {
public:
 void digit(uint8_t index,bool on){digitalWrite(index?10:9,on?HIGH:LOW);}
 void segments(uint8_t mask){for(uint8_t i=0;i<7;i++)digitalWrite(2+i,(mask&(1u<<i))?HIGH:LOW);}
 void wait_us(unsigned n){delayMicroseconds(n);}
};
ArduinoPins pins;Scanner display(pins);
void setup(){
 for(uint8_t pin=2;pin<=10;pin++){digitalWrite(pin,LOW);pinMode(pin,OUTPUT);}
 display.set_number(42);display.begin(micros());
}
void loop(){
 static uint32_t last_change=millis();static bool alternate=false;
 uint32_t now_ms=millis();
 if(uint32_t(now_ms-last_change)>=2000){last_change=now_ms;alternate=!alternate;display.set_number(alternate?17:42);}
 display.tick(micros()); // Never automatically resumes after a >20ms gap.
}
#endif

The display alternates 42 and 17 every nominal two seconds. Each tick services at most one slot; a late loop does not fire a burst of catch-up enables. An observed gap above 20 ms blanks and stops the scanner until an explicit begin() or restart. The gap check cannot act while the program is frozen: one digit may remain continuously enabled until execution resumes. The deliberately small direct-current budget matters for that reason.

Unsigned subtraction handles an ordinary 32-bit microsecond-counter wrap. A pause concealing complete wraps cannot be reconstructed. Invalid numbers blank and stop the display instead of silently showing stale digits. General-purpose input/output (GPIO) writes do not report whether an LED actually lit, so software success is not a physical wiring diagnosis.

A useful handover experiment

  1. Record exact display/transistor markings and resistor values. With power removed, check each shared net, both cathode pins per digit and transistor lead order. Verify fourteen segment resistors, not seven accidentally shared between parallel displays.
  2. Start the original program. Check that 42 and 17 have the intended segment shapes and digit order. Stop power and fix mapping errors rather than rearranging live wires.
  3. If an oscilloscope or logic analyzer is available, compare D9, D10 and one segment net. Record the off interval, data change and enable order. Logic traces observe commands, not transistor collector current.
  4. In a disposable copy, compare shorter blanking with the original. Record actual ghosting, brightness and camera artifacts without claiming that a clean-looking display proves zero overlap.
  5. Use the host tests for late calls, invalid numbers and mid-frame updates. A deliberate 25 ms loop delay can illustrate the stop, but it does not test hardware power-loss behavior.

The blank worksheet (ZIP; file: tricky-circuit-batch007-campaigns63-68/code/uno-two-digit-multiplex-observations-blank.csv) has no fabricated readings. This is not a high-current display driver or a suitable way to power an arbitrarily larger module.

Challenge: can doubling peak current recover the lost brightness?

Not by assuming average current is the only limit. The LED pulse conditions, transistor drive, GPIO current groups, supply loading and a stuck-on fault all matter. This lesson keeps a low current that remains bounded in continuous conduction. A brighter design needs its own qualified driver and thermal/current budget.

Primary sources

The electronics lessons cover the resistor and transistor basics. Current manufacturer documents and targeted errata searches were reviewed; no separate applicable correction was identified, which is not proof of absence.

๐Ÿ“กBroadcast the signal โ€” amplify the connection.

Leave a Reply

Temu affiliate offers

Find your next electronics project

Explore these do-it-yourself project kits. Check the selected option, included parts and instructions on each offer.

Tricky Circuit may earn a commission if you buy through these Temu affiliate links. These are product ideas; they have not been bench-tested by Tricky Circuit and are not verified lesson parts lists.

Supplier photo of a breadboard, jumper wires and assorted electronic components in a plastic storage case.

Supplier product photo

Try breadboard experiments

Breadboard, wires and assorted parts. Arduino controller board not included.

View kit on Temu

Supplier photo of an assembled blue surface-mount soldering practice board with a circular ring of small lights.

Supplier product photo

Solder a chasing-light board

Surface-mount soldering practice. Battery and battery holder not included.

View kit on Temu

Supplier photo of an assembled two-wheeled line-following car with a blue circuit board, two motors and an empty battery holder.

Supplier product photo

Build a line-following car

Soldering and assembly required. Check battery and track requirements before buying.

View kit on Temu