Arduino 4-Digit 7 Segment Display 74HC595 Module

The 1st Arduino Playground in Greece - Open Source Hardware

4-Digit 7 Segment Display 74HC595 module

Available Languages Picture Picture

Introduction

Picture In this tutorial we will show you how to use the 4-Digit seven segment display with the Arduino UNO board. We will print on display the analog value from one potentiometer. This pcb module uses one 74HC595 IC (shift register) for every 7seg display digit. ​​Let's get started!​

What you will need - Hardware

​For this tutorial you will need:
  • Arduino uno
  • 4-Digit Seven Segment Display Module
  • Potentiometer 5kOhm

The Circuit

The connections are easy :4-Digit Seven Segment connection:
  • Vcc to Arduino 5V Pin
  • GND to Arduino GND
  • SDI to Arduino pin 2
  • CLK to Arduino pin 3
  • LOAD to Arduino pin 4
Potentiometer connection:
  • 1st leg to Arduino 5V
  • 2nd leg to Arduino A0
  • 3st leg to Arduino GND

The code

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54/* * 4 Digitl 7 segment display PCB board with (4) 74HC595 shift register ICs * Arduino Tutorial - www.Ardumotive.com * Dev: Michalis Vasilakis // Date: 23/1/2018 // Ver:1.0 */ #include <ShiftRegister74HC595.h> // create shift register object (number of shift registers, data pin, clock pin, latch pin) ShiftRegister74HC595 sr (4, 2, 3, 4); const int pot = A0; int value,digit1,digit2,digit3,digit4; uint8_t numberB[] = {B11000000, //0 B11111001, //1 B10100100, //2 B10110000, //3 B10011001, //4 B10010010, //5 B10000011, //6 B11111000, //7 B10000000, //8 B10011000 //9 }; void setup() { //blink(); } void loop() { //Read from Analog1 value=analogRead(pot); //Split number to digits: digit4=value % 10 ; digit3=(value / 10) % 10 ; digit2=(value / 100) % 10 ; digit1=(value / 1000) % 10 ; //Send them to 7 segment displays uint8_t numberToPrint[]= {numberB[digit4],numberB[digit3],numberB[digit2],numberB[digit1]}; sr.setAll(numberToPrint); //Reset them for next read digit1=0; digit2=0; digit3=0; digit4=0; delay(1000); // Read and print every 1 sec } //Blink void blink(){ for(int i = 0; i<2; i++){ sr.setAllHigh(); // set all pins HIGH delay(1000); sr.setAllLow(); // set all pins LOW delay(1000); } }
Download the code from here and open it with Arduino IDE.
4digit7seg595.zip
File Size: 4 kb
File Type: zip
Download File

Well done!

Picture You have successfully completed one more Arduino "How to" tutorial and you learned how to use the 4-Digit 7 Segment Display 74HC595 module.​I hope you liked this, let me know in the comments.
Picture

Search Engine

Picture

Licence

Picture

Help us to grow up!

Picture

Tag » Arduino 74hc595 7 Segment 8 Digit Library