Bench NotesUno handbook

Seven-Segment Character Display: LAOS

Spell L-A-O-S on a common-cathode seven-segment digit with the same pins as LUCE.

IntermediateSeven-segmentResistor

Overview

Same wiring and program structure as LUCE, with a different set of patterns. Comparing the two shows that once the wiring is fixed, new characters are only a matter of new rows of 1s and 0s.

You will need

  • Arduino Uno R3 and USB cable
  • One common-cathode seven-segment display
  • 8 × 330 Ω resistors
  • Breadboard and jumper wires

Wiring

Uno pinConnects toNotes
2Segment a (top) through 330 ΩHIGH = lit
3Segment b (upper right) through 330 ΩHIGH = lit
4Segment c (lower right) through 330 ΩHIGH = lit
5Segment d (bottom) through 330 ΩHIGH = lit
6Segment e (lower left) through 330 ΩHIGH = lit
7Segment f (upper left) through 330 ΩHIGH = lit
8Segment g (middle) through 330 ΩHIGH = lit
9Segment dp (decimal point) through 330 ΩHIGH = lit
GNDDisplay common cathode (COM)Usually two COM pins; connect one or both.
Wiring for Seven-Segment Character Display: LAOSArduino Uno D2 to Common-cathode display segment a through 330 Ω; Arduino Uno D3 to Common-cathode display segment b through 330 Ω; Arduino Uno D4 to Common-cathode display segment c through 330 Ω; Arduino Uno D5 to Common-cathode display segment d through 330 Ω; Arduino Uno D6 to Common-cathode display segment e through 330 Ω; Arduino Uno D7 to Common-cathode display segment f through 330 Ω; Arduino Uno D8 to Common-cathode display segment g through 330 Ω; Arduino Uno D9 to Common-cathode display segment dp through 330 Ω; Arduino Uno GND to Common-cathode display COM (common cathode).Connections (each line is one wire)Arduino UnoCommon-cathode displayD2segment a330 ΩD3segment b330 ΩD4segment c330 ΩD5segment d330 ΩD6segment e330 ΩD7segment f330 ΩD8segment g330 ΩD9segment dp330 ΩGNDCOM (common cathode)
Original wiring diagram. Each line is one jumper wire; boxes on a line are series resistors.

How the pins are arranged

Read before wiring

The display must be a common-cathode seven-segment digit. Its common pin goes to GND and each segment lights when its Uno pin is HIGH (active-high). The pattern arrays list the eight segments in the order a, b, c, d, e, f, g, dp, which the sketch maps to pins 2 through 9: characterPatterns[i][segmentPin - 2].

Every segment needs its own resistor (220–1 kΩ; 330 Ω is a good default). Do not use a single resistor on the common pin: the brightness would change with the number of lit segments. On a common-anode display the logic is reversed (common to 5V, segment on when LOW), so this sketch would show the inverse of each letter. See Common anode vs common cathode.

Segment pin positions differ between display models. Check the datasheet for your part, or find each segment with a 5 V supply and a 1 kΩ resistor before wiring.

Diagrams

Segment-to-pin mapSeven-segment digit with segments labelled a (top), b (upper right), c (lower right), d (bottom), e (lower left), f (upper left), g (middle) and dp (decimal point). segment a to pin 2, segment b to pin 3, segment c to pin 4, segment d to pin 5, segment e to pin 6, segment f to pin 7, segment g to pin 8, segment dp to pin 9.agdfbecdpSegment → Uno pinapin 2via 330 Ωbpin 3via 330 Ωcpin 4via 330 Ωdpin 5via 330 Ωepin 6via 330 Ωfpin 7via 330 Ωgpin 8via 330 Ωdppin 9via 330 Ωcommon cathode (common pin to GND)
Segment names and driving pins (identical to LUCE).
Characters and their segment patternsThe display shows, one second each: L (segments d, e, f), A (segments a, b, c, e, f, g), O (segments a, b, c, d, e, f), S (segments a, c, d, f, g), then goes blank for half a second.L: 00011100A: 11101110O: 11111100S: 10110110
The four patterns from the sketch.

The sketch

seven_segment_laos.ino
int segmentPin;
int characterPatterns[4][8] = {
  {0,0,0,1,1,1,0,0}, // L
  {1,1,1,0,1,1,1,0}, // A
  {1,1,1,1,1,1,0,0}, // O
  {1,0,1,1,0,1,1,0}  // S
};

void setup() {
  for (segmentPin = 2; segmentPin <= 9; segmentPin++) {
    pinMode(segmentPin, OUTPUT);
    digitalWrite(segmentPin, LOW);
  }
}

void loop() {
  for (int characterIndex = 0; characterIndex < 4; characterIndex++) {
    for (segmentPin = 2; segmentPin <= 9; segmentPin++) {
      digitalWrite(segmentPin, characterPatterns[characterIndex][segmentPin - 2]);
    }
    delay(1000);
  }
  for (segmentPin = 2; segmentPin <= 9; segmentPin++) {
    digitalWrite(segmentPin, LOW);
  }
  delay(500);
}

How the code works

Note that O and the digit 0 use the same pattern, and S matches the digit 5. Seven segments can show only some letters clearly; K, M, V, W and X have no good form.

Review result: no changes were needed. Decoded patterns: A lights a, b, c, e, f, g; O lights a–f; S lights a, c, d, f, g. All correct for a common-cathode display wired a–dp to pins 2–9.

What you should observe

  • L, A, O and S appear for one second each, followed by half a second of blank display.
  • Inverted letters mean a common-anode display; scrambled shapes mean swapped segment wires.