Arduino 8 Digit, 7 Segment BCD Counter using MAX7219
In Embedded system design, seven segment displays are playing a major role as numerical visual indications. Seven segment LED displays are brighter, more attractive and provide a far viewing distance as well as a wider viewing angle as compared to LCD displays. Its available wide dimensions (0.3 inch to 6 inch) and different colors (RED, GREEN, BLUE, ORANGE, WHITE). It can display digits from 0 to 9 and quite a few characters like A, b, C, d, E, e, F, n, o, P, t, u, etc. This intractable is about interfacing 8 digits of 7 segment display by using popular MAX7219 display driver with Arduino Uno.
Parts and components
- Arduino Uno board
- Max7219 4 Digit 7Segment Common cathode displays = 2 Nos
- Or Max7219 assembled board
Step 1: Schematic
- The MAX7219 display driver chip provides a 3-wire serial (SPI) interface to drive 7-segment LED displays (common-cathode type) up to 8 digits.
- The on-chip includes a BCD decoder, multiplex scan circuitry, segment and digit drivers, and an 8×8 static RAM to store the digit values.
- The DIN, LOAD and CLOCK pins of MAX7219 is connected with 4,3 and 2 digital IO pins of Arduino.
- Two (RED and BLUE) 4 digit, common cathode seven segment displays are connected to the drive pins on MAX7219.
- Otherwise, one can use the pre-assembled MAX7219 board with 8 digits, and connect the drive pins accordingly.
Step 2: Software
- The Arduino LedControl library is used for displaying digits on MAX7219.
- The count variable updated by one count, at every 500mS.
- The count_one variable which is duplicate of count, will be converted into BCD, and displayed at the 4,5,6 and 7th digits.
- The count_two variable which is multiplication 7 of count, will be converted into BCD, and displayed at the 1,2,3 and 4th digits.
- The count will be reset to zero once it reaches 9999.
- The project is successfully simulated by using the Proteus.
- The MAX7219 can be used for many embedded projects as numerical display.
Demonstrates the use of MAX7219 and 2 of 4×7 Segment display.
The Arduino circuit connection for 7219:
* MAX7219 DIN pin to digital pin 4
* MAX7219 LOAD pin to digital pin 3
* MAX7219 CLOCK pin to digital pin 2
e-mail:- [email protected]
// inputs: DIN pin, CLK pin, LOAD pin. number of chips
LedControl mydisplay = LedControl(4, 2, 3, 1);
unsigned int count = 0;
unsigned int count_one = 0;
unsigned int count_two = 0;
mydisplay.shutdown(0, false); // turns on display
mydisplay.setIntensity(0, 15); // 15 = brightest
mydisplay.setDigit(0, 0, 9, false);
mydisplay.setDigit(0, 1, 8, false);
mydisplay.setDigit(0, 2, 7, false);
mydisplay.setDigit(0, 3, 6, false);
mydisplay.setDigit(0, 4, 5, true);
mydisplay.setDigit(0, 5, 4, false);
mydisplay.setDigit(0, 6, 3, false);
mydisplay.setDigit(0, 7, 2, false);
JLCPCB – Prototype 10 PCBs for $2 + 2 days Lead Time
China’s Largest PCB Prototype Enterprise, 300,000+ Customers & 10,000+ Online Orders Per Day
Inside a huge PCB factory: https://www.youtube.com/watch?v=_XCznQFV-Mw