Introduction: Raspberry Pi Pico -- MX7219 Eight Digits of Seven Segment, Display, BCD Counter
This intractable is about interfacing eight digits of seven segment display by using popular MAX7219 display driver with Raspberry Pi Pico, and it can be programmed using Python, for BCD counting
Max7219 Video Link
Step 1: Abstract
The Raspberry Pi Pico is a tiny, fast, and versatile board built using RP2040 features a dual-core Arm Cortex-M0+ processor with 264KB internal RAM and support for up to 16MB of off-chip Flash. It provides wide range of flexible I/O options includes I2C, SPI, and uniquely Programmable I/O (GPIO) pins.
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 in 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 Raspberry Pi Pico, and it can be programmed using Python, for BCD counting.
Step 2: Reference
“Get started with MicroPython on Raspberry Pi Pico” by Gareth Halfacree and Ben Everard
Raspberry Pi Pico, Blink on board LED, Instructables / Youtube
MicoPython MAX7219, 8 digit, 7segment library
Step 3: Componets
Raspberry Pi Pico = 1 No
Micro USB Cable
Max7219 4 Digit 7Segment Common cathode displays = 2 Nos
Or Max7219 assembled module
Step 4: 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, CLOCK and CS pins of MAX7219 is connected with GPIO3, GPIO2 and GPIO5 pins of Raspberry Pi Pico.
Two 4-digit, common cathode seven segment displays are connected to the drive pins on MAX7219.
Otherwise, one can use the pre-assembled MAX7219 module with 8 digits, and connect the drive pins accordingly.
The MAX7219 module is powered with +5VDC (VBUS) and GND.
Step 5: MAX7219 Library
It is a MicroPython library for MAX7219 + 8 x 7digit display boards.
Download the lib max7219_8digit.py lib.
Open the RPi Pico as drive, and then copy the library into root directory.
The library provides
-- Initializing the device
-- Set intensity of the device
-- Write To Buffer functionality
-- Send the buffer to MAX7219 device for further processing.
Attachments
Step 6: Four Digit Up Count
The Raspberry Pi Pico “max7219_8digit.py” library is used for displaying digits on MAX7219.
The count variable is initialized with 9950, and added by one count, at every 100mS interval.
The count variable, will be converted into BCD, and displayed at the 4,5,6 and 7th digits.
If the count value reaches to 9999, then it will be reset to zero.
'''
Demonstrates the use of MAX7219, digits of 7 Segment display. * Demonstrate "4 Digit Up Count" at the interval of 100mS. * Starting with 9950 * Resets after it reaches 10000
The Raspberry Pi Pico circuit connection for MAX7219:
* MAX7219 VCC pin to VBUS * MAX7219 GND pin to GND * MAX7219 DIN pin to digital GPIO3 * MAX7219 CS pin to digital GPIO5 * MAX7219 CLOCK pin to digital GPIO2
Name:- M.Pugazhendi Date:- 08thJul2021 Version:- V0.1 e-mail:- muthuswamy.pugazhendi@gmail.com '''
# Import MicroPython libraries of PIN and SPI from machine import Pin, SPI
# Import MicoPython MAX7219, 8 digit, 7segment library import max7219_8digit
# Import timer library import time
#Intialize the SPI spi = SPI(0, baudrate=10000000, polarity=1, phase=0, sck=Pin(2), mosi=Pin(3)) ss = Pin(5, Pin.OUT)
#Initialize count variable with 9950 as initial value count=9950
# Create display instant display = max7219_8digit.Display(spi, ss)
# Unconditionally execute the loop while True: # Prefix "UP -" and add "count variable" as string temp = "UP -" + str(count) # Write the string into display buffer display.write_to_buffer(temp) # Write the buffer into MAX7219 display.display() # Increment the count count = count + 1 # Validate the count value. If exceeds 10000, reset it it zero. if count == 10000: count = 0 # Sleep for about 100mS. time.sleep(0.1)
Attachments
Step 7: Four Digit Down Count
The Raspberry Pi Pico “max7219_8digit.py” library is used for displaying digits on MAX7219.
The count variable is initialized with 50, and decremented by one count, at every 100mS interval.
The count variable, will be converted into BCD, and displayed at the 4,5,6 and 7th digits.
If the count value reaches to negative value (-1), then it will be reset to 9999.
'''
Demonstrates the use of MAX7219, digits of 7 Segment display. * Demonstrate "4 Digit Down Count" at the interval of 100mS. * Starting with 50 * Resets after it reaches 0, to 9999
The Raspberry Pi Pico circuit connection for MAX7219:
* MAX7219 VCC pin to VBUS * MAX7219 GND pin to GND * MAX7219 DIN pin to digital GPIO3 * MAX7219 CS pin to digital GPIO5 * MAX7219 CLOCK pin to digital GPIO2
Name:- M.Pugazhendi Date:- 08thJul2021 Version:- V0.1 e-mail:- muthuswamy.pugazhendi@gmail.com '''
# Import MicroPython libraries of PIN and SPI from machine import Pin, SPI
# Import MicoPython MAX7219, 8 digit, 7segment library import max7219_8digit
# Import timer library import time
#Intialize the SPI spi = SPI(0, baudrate=10000000, polarity=1, phase=0, sck=Pin(2), mosi=Pin(3)) ss = Pin(5, Pin.OUT)
#Initialize count variable with 50 as initial value count=50
# Create display instant display = max7219_8digit.Display(spi, ss)
# Unconditionally execute the loop while True: # Prefix "LOW-" and add "count variable" as string temp = "LO -" + str(count) # Write the string into display buffer display.write_to_buffer(temp) # Write the buffer into MAX7219 display.display() # Increment the count count = count - 1 # Validate the count value. If less than 0, reset it it 9999. if count == -1: count = 9999 # Sleep for about 100mS. time.sleep(0.1)
Attachments
Step 8: Alphanumeric Character Display
The Raspberry Pi Pico “max7219_8digit.py” library is used for displaying digits on MAX7219.
The 8 digits of possible alphanumeric charters are displayed at every 2 sec intervals.
'''
Demonstrates the use of MAX7219, digits of 7 Segment display. * Demonstrate to display alphanumeric character at the interval of 2S. The Raspberry Pi Pico circuit connection for MAX7219:
* MAX7219 VCC pin to VBUS * MAX7219 GND pin to GND * MAX7219 DIN pin to digital GPIO3 * MAX7219 CS pin to digital GPIO5 * MAX7219 CLOCK pin to digital GPIO2
Name:- M.Pugazhendi Date:- 08thJul2021 Version:- V0.1 e-mail:- muthuswamy.pugazhendi@gmail.com '''
# Import MicroPython libraries of PIN and SPI from machine import Pin, SPI
# Import MicoPython MAX7219, 8 digit, 7segment library import max7219_8digit
# Import timer library import time
#Intialize the SPI spi = SPI(0, baudrate=10000000, polarity=1, phase=0, sck=Pin(2), mosi=Pin(3)) ss = Pin(5, Pin.OUT)
# Create display instant display = max7219_8digit.Display(spi, ss)
# Unconditionally execute the loop while True: # Display "01234567" for 2 Seconds display.write_to_buffer("01234567") display.display() time.sleep(2)
# Display "89ABCDEF" for 2 Seconds display.write_to_buffer("89ABCDEF") display.display() time.sleep(2)
# Display "GHIJKLMN" for 2 Seconds display.write_to_buffer("GHIJKLMN") display.display() time.sleep(2)
# Display "OPQRSTUV" for 2 Seconds display.write_to_buffer("OPQRSTUV") display.display() time.sleep(2)
# Display "WXYZ -.." for 2 Seconds display.write_to_buffer("WXYZ -..") display.display() time.sleep(2)
Attachments
Step 9: Conclusion
The project is successfully completed with Raspberry Pi Pico and MAX7219 module.
The MAX7219 can be used for many embedded projects as numerical display.
Step 10: Video Links
UpCount.mp4
DownCount.mp4
AsciiDisplay.mp4
Visit the following you tube channel for further information and videos.
https://www.youtube.com/channel/UCY4mekPLfeFinbQHp...
If you enjoyed this instruct-able, then make sure you subscribe
Max7219 Video Link