Hi, welcome to the first week of our group project.
This week I am researching the MAX7219 LED Dot Matrix shown below.
It is a small serial input display driver that uses microprocessors to control the 8×8 LED display and It operates off of 5v. It can power up to 64 individual LEDs over up to 7 cascaded (linked together) arrays.
The datasheet for the MAX7219 serial interface can be found here:
Link to the MAX7219 datasheet
Getting the MAX7219 Array Working:
To get the LED array working a library for the MAX7219 was used (GitHub Manual for LedControl Library). This enabled easy-use of the MAX7219 chip.
The functions we used to get the library working were:
LedControl(DATA-IN pin, CLK-pin, CS-pin, number of arrays) – This is to define our array object, listing the pin connections and the number of arrays that are cascaded
shutdown(array number, true/false) – This is used to switch on the matrix, since it is initially set to off.
clearDisplay(array number) – Used to wipe the data on the array
setRow(array number, array row, byte) – Used to set a whole row of LEDs at once, this was used to draw the faces
setLed(array number, array row, true/false) – Used to set individual LEDs, this was used in the scrolling light code.
Initially we just wanted to understand how to switch on and off LEDs so I tried making an LED scroll across the screen. To do so we used the following code:
Link to Our ArduinoCreate Code
Using a for loop between i = 0 and 7, we could set the array to colour the LED in column i. After this the LED before it had to be switch off, which was simple enough using i – 1. The only complex part was where the LED was 0 or 7. When it was 0, we didn’t need to switch of the LED before. If it was 7 we set a delay, then switched of the 8th LED.
A video of our first test:
Making our Matrix Smile 🙂
To make our matrix smile we needed to explore arrays of bytes. A byte is a binary number made from 8 bits (1s and 0s), which has a maximum value of 255: 11111111.
An array is simply a list of variables. In our case bytes. To create our face we needed two arrays, each of 8 bytes; one for the frowning face, one for the smiling face.
We could have figured out the bytes manually, however instead we used this online tool which creates the array for me: Byte Array Sketching Tool. All we had to do was draw on our smile and copy and paste the list of bytes over.
Our code for the smile Matrix is here: Code for the smiling matrix
Creating the images was fairly simple. Using a for loop like before we could get the row (0-7) from the pre-defined global variables. Then going through from i=0 to i=7 we got the byte for that row and wrote it to the MAX7219 using setRow().
Using a simple button circuit which we read from pin 6, we could get user input to make the matrix smile. In our final design we’ll use the IR sensor as the input signal.
Next week we’re creating our smiley face tip jar to encourage customers to tip.