Cirkit Designer LogoCirkit DesignerYour all-in-one circuit design IDE Launch Cirkit Designer App

Arduino UNO Controlled Seven Segment Display

View and Edit Project In Cirkit DesignerImage of Arduino UNO Controlled Seven Segment Display

Circuit Documentation

Summary

This circuit utilizes an Arduino UNO microcontroller to control a Seven Segment Display. The display is used to show digits from 0 to 9 in a sequential manner, with each segment of the display being controlled by the microcontroller's digital output pins. The circuit is designed to demonstrate basic control of a common anode seven-segment display.


Component List

Arduino UNO

Seven Segment Display


Wiring Details

Arduino UNO


Documented Code

// Define the pins for each segment
const int segmentPins[] = {2, 3, 4, 5, 6, 7, 8, 9};

// Digit patterns for 0-9 on a common anode display
const byte digitPatterns[10] = {
  0b11000000, // 0
  0b11111001, // 1
  0b10100100, // 2
  0b10110000, // 3
  0b10011001, // 4
  0b10010010, // 5
  0b10000010, // 6
  0b11111000, // 7
  0b10000000, // 8
  0b10010000  // 9
};

void setup() {
  // Set all segment pins as outputs
  for (int i = 0; i < 8; i++) {
    pinMode(segmentPins[i], OUTPUT);
  }
}

void loop() {
  for (int digit = 0; digit < 10; digit++) {
    displayDigit(digit);
    delay(1000); // Wait for 1 second
  }
}

void displayDigit(int digit) {
  byte pattern = digitPatterns[digit];
  for (int i = 0; i < 8; i++) {
    // Write HIGH to turn off the segment (common anode logic)
    digitalWrite(segmentPins[i], (pattern & (1 << i)) ? HIGH : LOW);
  }
}

This code initializes the segment pins as outputs and sequentially displays the digits 0 through 9 on the Seven Segment Display, with a one-second delay between each digit. The display logic is designed for a common anode configuration, where a HIGH signal turns off the segment.