This recipe explain how to used LED matrix with an Arduino Nano to give life to your robot. Two configurations will be possible, the first which duplicates images on each led matrix and a second which can chain many matrix.
MAX7219 / Arduino Wiring :
In order to display something on the led matrix, we need to wire the MAX7219 to our Arduino using SPI protocol.
Serial Peripheral Interface (SPI) is a synchronous serial data protocol used by microcontrollers for communicating with one or more peripheral devices quickly over short distances.
With an SPI connection there is always one master device (usually a microcontroller) which controls the peripheral devices. Typically there are three lines common to all the devices:
• MISO (Master In Slave Out) - The Slave line for sending data to the master,
• MOSI (Master Out Slave In) - The Master line for sending data to the peripherals,
• SCK (Serial Clock) - The clock pulses which synchronize data transmission generated by the master
• SS (Slave Select) - the pin on each device that the master can use to enable and disable specific devices.
(SS pin is also often named CS for Chip Select)
On Arduino Duemilanove/Uno and compatible boards such as the Nano the pins used are:
- MOSI - 11 or ICPS 4 (DIN on MAX7219)
- MISO - 12 or ICPS 1 (Not used on MAX7219)
- SCK - 13 or ICPS 3 (CLK on MAX7219)
- SS - 10. You can use other digital pins, but 10 is generally used as it is next to the other SPI pins.
This finally give the following wiring schema :
Work in progress ...
Source code on github : https://github.com/Gookun/csarr-eyes