Fiverr gig
$15 — I will help you with your project and simulate it for you
Hire me
🤖 Arduino Projects

Arduino Seven Segment Display Interface

The Engineer PostMay 29, 20265 min read
Arduino Seven Segment Display Interface — Arduino UNO tutorial cover image

Welcome to this beginner-friendly Arduino tutorial on the seven segment display. By the end of the guide, you'll wire the module to an Arduino UNO, flash a short sketch, and read live values on the Serial Monitor — no prior electronics experience required.

What you'll learn

  • How the module works in plain language
  • The exact parts you need and how to wire them safely
  • The full Arduino IDE sketch with comments
  • Common issues and how to fix them
Arduino Seven Segment Display Interface — overview

Hardware you'll need

ComponentQtyNotes
Arduino Uno1ATmega328P based
7 Segment Display1Common Cathode/Anode
Resistors8330Ω
Breadboard1Full size
Jumper Wires10+Male to Male
Arduino Seven Segment Display Interface — wiring diagram

Arduino code

Open the Arduino IDE, paste the sketch below into a new file, install any libraries the sketch #includes (Tools → Manage Libraries), select your board and COM port, then click Upload.

#include "SevSeg.h"
SevSeg sevseg;
void setup()
{
  //Set to 1 for single-digit display
  byte numDigits = 1;

  //defines common pins while using multi-digit display. Left for single digit display
  byte digitPins[] = {};

  //Defines Arduino pin connections in order: A, B, C, D, E, F, G, DP
  byte segmentPins[] = {9,8, 7, 6, 5, 4, 3, 2};

  byte displayType = COMMON_CATHODE; //Use COMMON_ANODE for Common Anode display

  bool resistorsOnSegments = true; //‘false’ if resistors are connected to common pin

  //Initialize sevseg object. Use COMMON_ANODE instead of COMMON_CATHODE for CA display
  sevseg.begin(displayType, numDigits, digitPins, segmentPins, resistorsOnSegments);

  sevseg.setBrightness(90);
}

void loop()
{ 
   //Display numbers 0-9 with 1 seconds delay
   for(int i = 0; i <= 10; i++)
   {
     if (i == 10)
{
 i = 0;
}
     sevseg.setNumber(i);
     sevseg.refreshDisplay(); 
     delay(1000);
   }
}
Arduino Seven Segment Display Interface — reference image
Arduino Seven Segment Display Interface — reference image
Arduino Seven Segment Display Interface — reference image
Arduino Seven Segment Display Interface — reference image

How it works

The sketch initialises serial communication and the seven segment display driver in setup(), then in loop() it samples the sensor at a regular interval and prints the result to the Serial Monitor at 9600 baud. Open the Serial Monitor (Ctrl+Shift+M) after upload to see live readings.

Troubleshooting checklist

  • No readings: verify the baud rate in Serial Monitor matches the sketch (usually 9600).
  • Garbage characters: wrong baud rate or loose GND wire.
  • Library not found: install the exact library referenced in the #include line via Library Manager.
  • Sensor not detected (I²C): run an I²C scanner sketch to confirm the address.

What to build next

Once the basic readout works, try logging values to an SD card, sending them over Wi-Fi with an ESP32, or pushing them to a Blynk IoT dashboard. Pair this module with our simulator round-up to prototype the circuit before soldering.

Frequently Asked Questions

Q.What library do I need for the seven segment display?

Open Arduino IDE → Tools → Manage Libraries, then search for any library named in the sketch's #include lines and install the latest version.

Q.Why does the Serial Monitor show nothing?

The most common cause is a baud-rate mismatch — set the Serial Monitor to 9600 baud (bottom-right dropdown) so it matches Serial.begin(9600) in the code.

Q.Can I use this with an ESP32 instead of Arduino UNO?

Yes. The seven segment display works with any 3.3-5 V microcontroller. Just remap the wiring to ESP32 I/O pins and keep the rest of the sketch the same.

TEP

The Engineer Post

Embedded systems engineer and educator. Writes weekly tutorials at EmbedLab to help beginners ship real hardware.

Related projects

Browse all 50+ projects