Arduino SA
  • Learn @ Arduino SA
  • Arduino Introduction
  • Support
    • Setup your Computer
    • Adding Libraries
    • Setting up a ESP32
  • Arduino Robot Car
    • Arduino Bluetooth Car
      • What you will need
      • Circuit Diagram
      • Assembly the Car
      • Upload the Code
      • Bluetooth setup and Test
    • 4WD Obstacle Avoidance
      • Introduction
      • Component List
      • Assembly
      • Component Description
      • Circuit Diagram
      • Computer Setup
      • Line Tracking Mode
      • Obstacle Avoidance Mode
  • Arduino Kits
    • Smart Plant Watering Kit
      • What you will need
      • Wiring Diagram
      • The Code
      • Pics
    • Basic Starter Kit
      • Component View
      • Installing the IDE
      • Add Libraries
      • Blink
      • Button Control LED Delay Switch
      • Active Buzzer
      • Passive Buzzer
      • Servo
      • IR Remote and Receiver
      • Stepper Motor
      • Eight LED with 74HC595
      • LCD
      • Digital tube with Traffic Light Experiment
      • Four digit tube display
      • LM35D Temperature Sensor
      • LDR 5516 experiment
      • Flame Sensor
      • 8 * 8 LED Module
      • Controlling Stepper Motor With Remote
    • Super Starter Kit
      • Tutorials
    • Best Beginner Kit for Arduino
      • Tutorials
    • Uno R3 RFID Kit
    • WIFI ESP32 IOT Kit
    • Arduino School STEM Kit
    • Arduino Ultimate Starter Kit
  • Blocking Coding Lessons
    • Beginner Lessons
      • Setting up mBlock
      • Blinking an LED
      • LED Switching
      • LED Chasing
      • Traffic Signal
      • Buzzer
      • Buzzer + Push Button
      • LED + Push Button
  • Sensor Kits
    • 37-in-1 Sensor Kit
      • Joystick
      • Relay
      • Big Sound
      • Small Sound
      • Tracking
      • Avoid
      • Flame
      • Linear Hall Sensor
      • Touch
      • Digital Temperature
      • Buzzer
      • Passive Buzzer
      • RGB LED
      • SMD RGB
      • Two-Color 5mm
      • Two Color 3mm
      • Reed Switch
      • Mini Reed
      • Heartbeat
      • 7 color flash
      • Laser emitter
      • PCB mounted push Button
      • Shock switch
      • Rotary encoder
      • Light Cup
      • Tilt Switch
      • Rolling ball tilt switch
      • Photoresistor
      • Temp and Humidity
      • Analog Hall
      • Hall Magnetic
      • Temp
      • Analog Temp
      • IR Emission
      • IR Receiver
      • Tap Module
      • Light blocking
Powered by GitBook
On this page
  • Overview
  • Component Required:
  • Component Introduction
  • Connection Diagram:
  • Wiring schematic:
  • Physical wiring diagram:
  • Code:

Was this helpful?

  1. Arduino Kits
  2. Basic Starter Kit

Four digit tube display

In this lesson, you will learn how to use a 4-digit 7-segment display.

PreviousDigital tube with Traffic Light ExperimentNextLM35D Temperature Sensor

Last updated 3 years ago

Was this helpful?

Overview

When using 1-digit 7-segment display, please notice that if it is common anode, the common anode pin connects to the power source; if it is common cathode, the common cathode pin connects to the GND.

When using 4-digit 7-segment display, the common anode or common cathode pin is used to control which digit is displayed. Even though there is only one digit working, the principle of Persistence of Vision enables you to see all numbers displayed because each the scanning speed is so fast that you hardly notice the intervals.

Component Required:

  • 1 x Arduino Uno R3

  • 1 x 830 tie-points breadboard

  • 1 x 74HC595 IC

  • 1 x 4 Digit 7-Segment Display

  • 4 x 220 ohm resistors

  • 23 x M-M wires (Male to Male jumper wires)

Component Introduction

Four Digital Seven segment display

Connection Diagram:

Wiring schematic:

Physical wiring diagram:

Code:

int latch = 9; //74HC595  pin 9 STCP
int clock = 10; //74HC595  pin 10 SHCP
int data = 8; //74HC595  pin 8 DS

unsigned char table[] =
{ 0x3f, 0x06, 0x5b, 0x4f, 0x66, 0x6d, 0x7d, 0x07, 0x7f, 0x6f, 0x77, 0x7c
  , 0x39, 0x5e, 0x79, 0x71, 0x00
};

void setup() {
  pinMode(latch, OUTPUT);
  pinMode(clock, OUTPUT);
  pinMode(data, OUTPUT);
}
void Display(unsigned char num)
{

  digitalWrite(latch, LOW);
  shiftOut(data, clock, MSBFIRST, table[num]);
  digitalWrite(latch, HIGH);

}
void loop() {
  Display(1);
  delay(500);
  Display(2);
  delay(500);
  Display(3);
  delay(500);
  Display(4);
  delay(500);
  Display(5);
  delay(500);
  Display(6);
  delay(500);
  Display(7);
  delay(500);
  Display(8);
  delay(500);
  Display(9);
  delay(500);
  Display(10);
  delay(500);
  Display(11);
  delay(500);
  Display(12);
  delay(500);
  Display(13);
  delay(500);
  Display(14);
  delay(500);
  Display(15);
  delay(500);
}
961B
four-digit-display.ino