ESP32 S3 - 74HC595 4-Digit 7-Segment Display

Learn how to connect a 74HC595 4-digit 7-segment display to your ESP32 S3 and display numbers, text, and sensor readings using just three GPIO pins. This beginner-friendly tutorial covers everything from wiring and library setup to creating digital clocks, temperature displays, and counters.

What you'll build:

  1. A working 4-digit 7-segment display driven by the 74HC595 shift register on the ESP32 S3
  2. Integer and floating-point number displays with optional zero-padding
  3. A text and temperature display using degree symbols and custom characters
  4. A digital clock display in HH.MM format with a blinking colon separator
ESP32 S3 74HC595 4-Digit 7-Segment Display

Hardware Preparation

1×ESP32 S3 WROOM N16R8
1×USB Cable Type-A to Type-C (for USB-A PC)
1×USB Cable Type-C to Type-C (for USB-C PC)
1×74HC595 4-digit 7-segment Display
1×Jumper Wires

Or you can buy the following kits:

1×DIYables Sensor Kit (18 sensors/displays)
Disclosure: Some of the links provided in this section are Amazon affiliate links. We may receive a commission for any purchases made through these links at no additional cost to you.
Additionally, some of these links are for products from our own brand, DIYables .

Overview of the 74HC595 4-Digit 7-Segment Display

The 74HC595 4-digit 7-segment display is a serial-to-parallel shift register module that controls four LED digit displays using only three control pins instead of twelve. It is compatible with 3.3V logic levels, making it an ideal companion for the ESP32 S3. The module handles common anode configurations and supports digits 0–9, letters A–F, and a selection of text characters, along with built-in decimal points between digits.

Key Specifications

The module operates at 3.3V to 5V, making it fully compatible with the ESP32 S3's 3.3V output without any level shifting. It uses the 74HC595 shift register IC to accept serial data and latch it to the LED outputs via the register clock. Multiplexing across all four digits is handled automatically by the DIYables library — you call print() and the display updates instantly. Each digit contains seven LED segments plus one decimal point, giving you the building blocks for numbers, letters, and symbols.

The module exposes five essential pins. SCLK (SH_CP) is the serial clock pin that pulses data bits into the shift register one at a time. RCLK (ST_CP) is the register clock pin that latches the shifted data to the LED outputs. DIO (DS) is the data input pin that receives the serial data stream. VCC connects to your 3.3V supply, and GND connects to common ground.

Wiring Diagram

Connect the 74HC595 display module to your ESP32 S3 using the five-pin interface described below.

The ESP32 S3 operates at 3.3V logic levels, and the 74HC595 module works perfectly at this voltage, so no level shifting is required. Double-check VCC and GND polarity before powering on to avoid damaging the module.

Safety Notes

Do not connect VCC to 5V unless your specific module includes built-in level shifters, as exceeding 3.3V on the data lines can damage the ESP32 S3's GPIO pins. Ensure all jumper wire connections are secure — loose connections cause flickering or blank digits and can be difficult to diagnose. Always verify that the GND of the display module is connected to the GND of the ESP32 S3 to form a common ground.

Display Pin ESP32 S3 Pin
SCLK (SH_CP) GPIO12
RCLK (ST_CP) GPIO17
DIO (DS) GPIO18
VCC 3.3V
GND GND
The wiring diagram between ESP32 S3 74HC595 4-Digit 7-Segment Display

This image is created using Fritzing. Click to enlarge image

Library Setup

The DIYables_4Digit7Segment_74HC595 library abstracts all shift register timing and display multiplexing so you can focus on what to show rather than how to drive the hardware. Install it through the Arduino IDE Library Manager before uploading any of the tutorial sketches.

The following steps walk you through installation:

  1. New to ESP32 S3? Complete our Getting Started with ESP32 S3 guide first to set up your development environment.
  2. Connect your ESP32 S3 to your computer using the USB-C cable.
  3. Open the Arduino IDE software on your computer.
  4. Select ESP32 S3 from the board list.
  5. Choose the correct COM port for your ESP32 S3.
  6. Click the Libraries icon on the left sidebar to open Library Manager.
  7. Type "DIYables_4Digit7Segment_74HC595" in the search field.
  8. Find the DIYables entry and click Install.
  9. Select version 2.0.0 or later for best compatibility.
ESP32 S3 74HC595 4-Digit 7-Segment Display library

Starter Sketch

The following code is the minimum required to get your 74HC595 4-digit display working with the ESP32 S3. It initializes the display and shows the number 1234 as soon as the board boots. The display.loop() call in the main loop keeps the multiplexing running so the digits remain lit continuously.

#include <DIYables_4Digit7Segment_74HC595.h> #define SCLK_PIN 12 #define RCLK_PIN 17 #define DIO_PIN 18 DIYables_4Digit7Segment_74HC595 display(SCLK_PIN, RCLK_PIN, DIO_PIN); void setup() { display.begin(); display.print(1234); } void loop() { display.loop(); }

display.begin() configures the three GPIO pins as outputs and prepares the shift register for communication. Because the display uses multiplexing to illuminate one digit at a time in rapid succession, display.loop() must be called as often as possible — use display.delay() instead of the standard delay() anywhere you need a pause so the display stays refreshed during the wait.

Tutorial - Display Integers

This tutorial shows how to display integer values on the ESP32 S3 74HC595 4-digit 7-segment display, including negative numbers and zero-padded output.

/* * This ESP32 S3 code was developed by newbiely.com * * This ESP32 S3 code is made available for public use without any restriction * * For comprehensive instructions and wiring diagrams, please visit: * https://newbiely.com/tutorials/esp32-s3/esp32-s3-74hc595-4-digit-7-segment-display */ #include <DIYables_4Digit7Segment_74HC595.h> // Pin configuration - change these to match your wiring #define SCLK_PIN 12 // The ESP32 S3 pin connected to the Serial clock pin of 7-segment display #define RCLK_PIN 17 // The ESP32 S3 pin connected to the Register clock / latch pin of 7-segment display #define DIO_PIN 18 // The ESP32 S3 pin connected to the Data (DS) pin of 7-segment display DIYables_4Digit7Segment_74HC595 display(SCLK_PIN, RCLK_PIN, DIO_PIN); int numbers[] = {0, 42, 1234, -5, -123, 9999}; int numCount = 6; int currentIndex = 0; bool showZeroPad = false; unsigned long lastChange = 0; void setup() { Serial.begin(115200); display.begin(); Serial.println("4-Digit 7-Segment 74HC595 - Integer Example"); } void loop() { display.loop(); // Must be called frequently to refresh the display if (millis() - lastChange >= 2000) { lastChange = millis(); if (!showZeroPad) { display.print(numbers[currentIndex]); Serial.print("Displaying: "); Serial.println(numbers[currentIndex]); currentIndex++; if (currentIndex >= numCount) { currentIndex = 0; showZeroPad = true; } } else { display.print(42, true); // Shows "0042" Serial.println("Displaying: 0042 (zero-padded)"); showZeroPad = false; } } }

Detailed Instructions

  1. New to ESP32 S3? Complete our Getting Started with ESP32 S3 guide first.
  2. Wire the 74HC595 module to your ESP32 S3 following the wiring diagram above.
  3. Connect the ESP32 S3 to your computer via USB-C cable.
  4. Open the Arduino IDE and select the ESP32 S3 board and correct COM port.
  5. Copy the integer display code and paste it into Arduino IDE.
  6. Click the Upload button to transfer the code to your board.
  7. Open the Serial Monitor to view output messages.
  8. Watch the 7-segment display cycle through different integers.
  9. Pro Tip: The second parameter in print(42, true) enables zero-padding for consistent-width displays.

Serial Monitor Output

Newbiely | Arduino IDE 2.3.8
──
File
Edit
Sketch
Tools
Help
ESP32S3 Dev Module
Newbiely.ino
···
8 Serial.println("Hello World!");
Output
Serial Monitor
Message (Enter to send message to 'ESP32S3 Dev Module' on 'COM15')
New Line
9600 baud
[2026-06-16 10:23:45] Displaying: 0 [2026-06-16 10:23:47] Displaying: 42 [2026-06-16 10:23:49] Displaying: 1234 [2026-06-16 10:23:51] Displaying: -5
Ln 11, Col 1
ESP32S3 Dev Module on COM15
2

The display cycles through various integers including zero, positive numbers, negative numbers, and zero-padded format.

Method Reference

Method Action Syntax
print(int) Display an integer value display.print(1234)
print(int, true) Display integer with zero-padding display.print(42, true)
loop() Refresh display multiplexing display.loop()
begin() Initialize display pins display.begin()

Tutorial - Display Floats

This tutorial demonstrates displaying floating-point numbers on your ESP32 S3 with automatic and fixed decimal places.

/* * This ESP32 S3 code was developed by newbiely.com * * This ESP32 S3 code is made available for public use without any restriction * * For comprehensive instructions and wiring diagrams, please visit: * https://newbiely.com/tutorials/esp32-s3/esp32-s3-74hc595-4-digit-7-segment-display */ #include <DIYables_4Digit7Segment_74HC595.h> // Pin configuration - change these to match your wiring #define SCLK_PIN 12 // The ESP32 S3 pin connected to the Serial clock pin of 7-segment display #define RCLK_PIN 17 // The ESP32 S3 pin connected to the Register clock / latch pin of 7-segment display #define DIO_PIN 18 // The ESP32 S3 pin connected to the Data (DS) pin of 7-segment display DIYables_4Digit7Segment_74HC595 display(SCLK_PIN, RCLK_PIN, DIO_PIN); void setup() { Serial.begin(115200); display.begin(); Serial.println("4-Digit 7-Segment 74HC595 - Float Example"); } void loop() { // Auto decimal placement display.print(1.5); // Shows " 1.5" Serial.println("Auto decimal: 1.5"); display.delay(2000); display.print(12.34); // Shows "12.34" Serial.println("Auto decimal: 12.34"); display.delay(2000); display.print(3.141); // Shows "3.141" Serial.println("Auto decimal: 3.141"); display.delay(2000); display.print(-1.2); // Shows "-1.20" Serial.println("Auto decimal: -1.20"); display.delay(2000); display.print(0.5); // Shows " 0.5" Serial.println("Auto decimal: 0.5"); display.delay(2000); // Fixed decimal places display.print(23.5, 1); // 1 decimal place: shows "23.5" Serial.println("1 decimal place: 23.5"); display.delay(2000); display.print(1.5, 2); // 2 decimal places: shows "1.50" Serial.println("2 decimal places: 1.50"); display.delay(2000); // Zero-padded display.print(1.5, 2, true); // Shows "01.50" Serial.println("2 decimal places, zero-padded: 01.50"); display.delay(2000); }

Detailed Instructions

  1. New to ESP32 S3? Complete our Getting Started with ESP32 S3 guide first.
  2. Copy the float display code and upload it to your ESP32 S3.
  3. Open the Serial Monitor to view what is being displayed.
  4. Watch the display cycle through floats with different decimal place settings.
  5. Note how auto-decimal adjusts automatically versus a fixed decimal count.
  6. Pro Tip: Use fixed decimal places for consistent sensor readings such as temperature or voltage.

Serial Monitor Output

Newbiely | Arduino IDE 2.3.8
──
File
Edit
Sketch
Tools
Help
ESP32S3 Dev Module
Newbiely.ino
···
8 Serial.println("Hello World!");
Output
Serial Monitor
Message (Enter to send message to 'ESP32S3 Dev Module' on 'COM15')
New Line
9600 baud
[2026-06-16 11:15:22] Displaying: 3.14 (auto decimal) [2026-06-16 11:15:24] Displaying: 98.6 (auto decimal) [2026-06-16 11:15:26] Displaying: 3.1 (1 decimal) [2026-06-16 11:15:28] Displaying: 3.14 (2 decimals)
Ln 11, Col 1
ESP32S3 Dev Module on COM15
2

Tutorial - Text and Temperature

This tutorial shows how to display text strings, temperature readings with degree symbols, and custom characters on the ESP32 S3 7-segment display.

/* * This ESP32 S3 code was developed by newbiely.com * * This ESP32 S3 code is made available for public use without any restriction * * For comprehensive instructions and wiring diagrams, please visit: * https://newbiely.com/tutorials/esp32-s3/esp32-s3-74hc595-4-digit-7-segment-display */ #include <DIYables_4Digit7Segment_74HC595.h> // Pin configuration - change these to match your wiring #define SCLK_PIN 12 // The ESP32 S3 pin connected to the Serial clock pin of 7-segment display #define RCLK_PIN 17 // The ESP32 S3 pin connected to the Register clock / latch pin of 7-segment display #define DIO_PIN 18 // The ESP32 S3 pin connected to the Data (DS) pin of 7-segment display DIYables_4Digit7Segment_74HC595 display(SCLK_PIN, RCLK_PIN, DIO_PIN); const char* texts[] = {"HELP", "Hi", "COOL", "done"}; int textCount = 4; int currentIndex = 0; int phase = 0; unsigned long lastChange = 0; void setup() { Serial.begin(115200); display.begin(); Serial.println("4-Digit 7-Segment 74HC595 - Text and Degree Example"); } void loop() { display.loop(); // Must be called frequently to refresh the display if (millis() - lastChange >= 2000) { lastChange = millis(); if (phase == 0) { // Display text strings display.print(texts[currentIndex]); Serial.print("Text: "); Serial.println(texts[currentIndex]); currentIndex++; if (currentIndex >= textCount) { currentIndex = 0; phase = 1; } } else if (phase == 1) { // Display temperature 25 degrees C display.printTemperature(25, 'C'); Serial.println("Temperature: 25 C"); phase = 2; } else if (phase == 2) { // Display temperature 72 degrees F display.printTemperature(72, 'F'); Serial.println("Temperature: 72 F"); phase = 3; } else if (phase == 3) { // Display degree symbol using string with DEGREE_CHAR constant char degStr[5]; degStr[0] = '2'; degStr[1] = '5'; degStr[2] = DEGREE_CHAR; degStr[3] = 'C'; degStr[4] = '\0'; display.print(degStr); Serial.println("String with degree: 25 deg C"); phase = 4; } else { // Display string with dots display.print("1.2.3.4"); Serial.println("Dots: 1.2.3.4"); phase = 0; } } }

Detailed Instructions

  1. New to ESP32 S3? Complete our Getting Started with ESP32 S3 guide first.
  2. Transfer the text and temperature code to your ESP32 S3.
  3. Open the Serial Monitor to track what text and symbols are being displayed.
  4. Observe how letters appear on the 7-segment display.
  5. Note the small degree circle used for temperature displays.
  6. Pro Tip: Not all letters display clearly on 7-segment — stick to numbers and characters such as H, E, L, P, C, and O for the best results.

Serial Monitor Output

Newbiely | Arduino IDE 2.3.8
──
File
Edit
Sketch
Tools
Help
ESP32S3 Dev Module
Newbiely.ino
···
8 Serial.println("Hello World!");
Output
Serial Monitor
Message (Enter to send message to 'ESP32S3 Dev Module' on 'COM15')
New Line
9600 baud
[2026-06-16 12:30:18] Displaying: HELP [2026-06-16 12:30:20] Displaying: Hi [2026-06-16 12:30:24] Displaying: 72°F (temperature) [2026-06-16 12:30:26] Displaying: 22°C (temperature)
Ln 11, Col 1
ESP32S3 Dev Module on COM15
2

Tutorial - Time

This tutorial demonstrates creating a digital clock display on your ESP32 S3 with HH.MM format and a blinking colon separator.

/* * This ESP32 S3 code was developed by newbiely.com * * This ESP32 S3 code is made available for public use without any restriction * * For comprehensive instructions and wiring diagrams, please visit: * https://newbiely.com/tutorials/esp32-s3/esp32-s3-74hc595-4-digit-7-segment-display */ #include <DIYables_4Digit7Segment_74HC595.h> // Pin configuration - change these to match your wiring #define SCLK_PIN 12 // The ESP32 S3 pin connected to the Serial clock pin of 7-segment display #define RCLK_PIN 17 // The ESP32 S3 pin connected to the Register clock / latch pin of 7-segment display #define DIO_PIN 18 // The ESP32 S3 pin connected to the Data (DS) pin of 7-segment display DIYables_4Digit7Segment_74HC595 display(SCLK_PIN, RCLK_PIN, DIO_PIN); int hours = 12; int minutes = 30; bool colonOn = true; unsigned long lastToggle = 0; void setup() { Serial.begin(115200); display.begin(); Serial.println("4-Digit 7-Segment 74HC595 - Time Example"); Serial.println("Displaying 12:30 with blinking dot separator"); } void loop() { display.loop(); // Must be called frequently to refresh the display if (millis() - lastToggle >= 500) { lastToggle = millis(); display.printTime(hours, minutes, colonOn); colonOn = !colonOn; // Toggle dot separator every 500ms for blinking effect } }

Detailed Instructions

  1. New to ESP32 S3? Complete our Getting Started with ESP32 S3 guide first.
  2. Transfer the time display code to your ESP32 S3.
  3. Open the Serial Monitor to view timestamp updates.
  4. Watch the display show time in HH.MM format with a blinking separator.
  5. Pro Tip: Combine this with an RTC module for a fully working clock project.

Serial Monitor Output

Newbiely | Arduino IDE 2.3.8
──
File
Edit
Sketch
Tools
Help
ESP32S3 Dev Module
Newbiely.ino
···
8 Serial.println("Hello World!");
Output
Serial Monitor
Message (Enter to send message to 'ESP32S3 Dev Module' on 'COM15')
New Line
9600 baud
[2026-06-16 14:45:10] Displaying: 12.30 (dot ON) [2026-06-16 14:45:10] Displaying: 12 30 (dot OFF) [2026-06-16 14:45:11] Displaying: 12.30 (dot ON) [2026-06-16 14:45:11] Displaying: 12 30 (dot OFF)
Ln 11, Col 1
ESP32S3 Dev Module on COM15
2

Troubleshoot

Common issues when using the 74HC595 4-digit 7-segment display with ESP32 S3 and their solutions:

Issue Possible Cause Resolution
Display blank Wiring problem Check VCC, GND, and all three data pin connections
Display blank Power issue Verify 3.3V is present at VCC pin with multimeter
Wrong characters Anode/cathode mismatch Pass false as 4th parameter to constructor for common cathode modules
Flickering display delay() blocking loop() Replace all delay() calls with display.delay() to maintain multiplexing
Random segments Loose wiring Secure jumper wire connections and check for shorts
Dim display Low voltage Ensure stable 3.3V power supply to VCC pin
Upload fails Board in wrong mode Hold BOOT button while pressing RESET, then retry upload
No Serial output Wrong baud rate Set Serial Monitor to 115200 baud to match code
Code won't compile Library not installed Install DIYables_4Digit7Segment_74HC595 library version 2.0.0+
Port not found Driver issue Install the appropriate USB driver for ESP32 S3

Applications and Project Ideas

The ESP32 S3 paired with a 74HC595 4-digit display opens up a wide range of practical and fun projects, from simple counters to WiFi-connected instruments.

  1. Digital thermometer: Display room temperature from a DHT11 or DS18B20 sensor with a degree symbol.
  2. Countdown timer: Create a kitchen timer or event countdown with hours and minutes.
  3. Score keeper: Build a simple scoreboard for games or competitions.
  4. Stopwatch: Make a digital stopwatch with split-time capability.
  5. Voltage meter: Monitor battery voltage or power supply levels in real-time.
  6. Visitor counter: Count people entering through a door using an IR sensor.
  7. RPM display: Show motor speed for robotics or RC projects.
  8. Clock with WiFi sync: Build an NTP-synchronized clock using the ESP32 S3's built-in WiFi.
  9. Lap timer: Track lap times for slot car racing or running.
  10. Temperature alarm: Display temperature and blink when a threshold is exceeded.

Video Tutorial

Watch the step-by-step video walkthrough for this ESP32 S3 project below.

Challenge Yourself

Once you have the basics working, these progressive challenges will help you deepen your understanding of the 74HC595 display and the ESP32 S3's capabilities.

  1. Beginner: Modify the integer tutorial to count from 0 to 9999 continuously at one-second intervals.
  2. Beginner: Display your age or birth year on the screen with zero-padding enabled.
  3. Intermediate: Create a two-button counter with one button to increment and one to decrement the displayed value.
  4. Intermediate: Build a temperature display that alternates between Celsius and Fahrenheit every three seconds.
  5. Advanced: Make a WiFi-connected clock that gets the current time from an NTP server and displays it in HH.MM format with a blinking colon.
  6. Advanced: Create a countdown timer that accepts input from the Serial Monitor and sounds a buzzer when it reaches zero.

※ OUR MESSAGES

  • As freelancers, We are AVAILABLE for HIRE. See how to outsource your project to us
  • Please feel free to share the link of this tutorial. However, Please do not use our content on any other websites. We invested a lot of effort and time to create the content, please respect our work!