Introduction: Arduino (SPI) 7 Bi-color LED Matrix Scrolling Text Display
Some time back, we came up with an instructable to build a 7 Bi-color 8x8 LED Matrix Scrolling Text Display. You may visit https://www.instructables.com/id/7-Bi-color-LED-Matrix-Scrolling-Text-Display/ for more detail.
In that instructable, we used the excellent LedControl library that has been specifically written for the MAX7219 which greatly simplifies the program coding for the project’s Arduino sketch. However, as this library uses normal digital output pins to control the display, fast and smooth scrolling text effect is not able to be achieved using normal Arduino boards if many LED matrices are cascaded together to make a long display. That is why we suggest to use the chipKit UNO32 micro-controller board which is based on the popular Arduino Open Source hardware platform to drive the display as it is much more capable of producing faster and better scrolling text effect than Arduino boards though it is a bit more expensive.
Arduino is currently one of the most popular open-source micro-controller hardware used by electronics hobbyists and it is a pity if the Arduino boards they already owned cannot be used for the project to produce fast and smooth scrolling text effect for long displays.
In this instructable, we will build another 7 Bi-color 8x8 LED Matrix Scrolling Text Display controlled by an Arduino Nano board in which messages and commands can be sent to it via Bluetooth using an Android Smart Phone. However, we will not be using the LedControl library for this project and instead will be using the SPI library to directly transfer instructions and data to the display. It may not look like a huge change to the project but using SPI for the interface offers impressive increase in data transfer speed which translates into fast and smooth scrolling text effect for the project and also reduces some complexity to the wirings as only 3 SPI lines are needed to drive the display instead of 6 previously.
To build this project, basic electronics component soldering skill and some knowledge on using the Arduino is required.
The reason for building a 7 LED matrices long display is that it is quite adequate for ease of reading scrolling text. The LED matrix we are using is around 60mm x 60mm in size for each matrix. Here, we have built a new enclosure for our display using clear acrylic tube with internal diameter of 64mm.
In this instructable, we will be repeating some of the sections from our previous instructable as we hope this instructable is as complete as possible by itself.
You may view the following YouTube video to see what we are building.
Step 1: LED Matrix Driver Module Assembly
The display is built using seven of the Bi-color (Red and Green) LED Matrix Driver Module kits from jolliFactory. Each of these modules uses two MAX7219 Display Driver ICs to drive a Bi-color LED Matrix. These ICs are excellent because they take a lot of work off the micro-controller and simplify the wiring and logic design. You can daisy-chain up these Bi-color LED Matrices to form a long display driven using only three SPI line pins on the micro-controller for the interface.
You can find this Bi-color LED Matrix Driver Module kit from here with information on the assembly of the kit. You may order this kit from Tindie.
This kit comes with all through-hole components and someone with basic soldering skills should be able to assemble it without much difficulty.
You may view the following YouTube video on the assembly of the Bi-color LED Matrix Driver Module kit.
Step 2: Wiring
After all the kits are completed, they are connected together to the Arduino board as shown (LED matrices not installed for better view).
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.
On Arduino Duemilanove/Uno and compatible boards such as the Nano the pins used are:
- MOSI - 11 or ICPS 4
- MISO - 12 or ICPS 1
- SCK - 13 or ICPS 3
SS - 10. You can use other digital pins, but 10 is generally used as it is next to the other SPI pins.
On Arduino Mega1280/2560 the pins are:
- MOSI - 51 or ICPS 4
- MISO - 50 or ICPS 1
- SCK - 52 or ICPS 3
- SS - 53.
On Arduino Leonardo, the SPI pins are on the ICSP header pins:
- MOSI - ICSP 4
- MISO - ICPS 1
- SCK - ICPS 3
Note that MISO, MOSI, and SCK are available in a consistent physical location on the ICSP header of Arduino boards.
The MAX7219 ICs used on the LED Matrix Driver Module does not fully support the standard SPI protocol. However, it is able to work with the Arduino software and libraries.
Using SPI for the interface between Arduino board and the display allows the entire display to be controlled with only 3 microcontroller I/O lines. Here, we use an Arduino Nano board to drive the display. You may instead use any other Arduino boards as long as the connections to the SPI lines are connected correctly.
Here, the Arduino Nano acts as a master and the display as a slave. As our display will not be sending any data to the master, there is no need to connect the MISO line. So the connections between the Arduino Nano and the displays are MOSI (Pin 11), SCK (Pin 13) and SS (Pin 10) at the Arduino side and Din, CLK and Load pins at the LED Matrix Driver Module respectively.
A HC-05 Bluetooth Wireless Serial Port Module is connected to the TX and RX pin of the Arduino Nano for Bluetooth communications between the display and the Android Smart Phone. The HC-05 module is configurable to operate in master or slave mode but is typically shipped to operate in slave mode which is the mode we need here. This Bluetooth Wireless Serial Port Module is not expensive, easy to work with and is quite easily available from online shops. You may instead use any Bluetooth Wireless Serial Port Modules you are familiar with.
Note that we employed a simple voltage level shift circuit (2Kohms and 1Kohms resistor) between the Arduino Tx pin and the HC-05 Rx pin as our Arduino is running at 5V and our HC-05 Rx pin is supposed to work at the 3.3V level.
Note the use of 10Kohms pull-down resistors on the DATA IN, CLK and LOAD input pins. When power is first applied to the micro-controller or when they are reset, their I/O lines float. The MAX7219 can see this as valid data and display garbage until the micro-controller gains control. The pull-down resistors prevent these problems. To reduce the part count for this project, you may try without the 10Kohms pull-down resistors for the DATA IN and CLK input lines.
Step 3: Arduino Sketch
Instead of using the excellent LedControl library that has been specifically written for the MAX7219, we will be using the SPI library to directly sent instructions and data to the display.
The micro-controller needs to be loaded with the Arduino sketch to run the display.
We used Arduino IDE V1.0.3 for our project. Download the Arduino sketch below which is used for this project. The sketch will work with up to 8 Bi-color LED matrices cascaded together. You may amend and enhance the sketch to suit your project.
** Note that before downloading sketch to the micro-controller, the connections to the TX and RX pins for the HC-05 Bluetooth Wireless Serial Port Module must be removed for the download to be successful.
Step 4: Testing the Display
Install the free Bluetooth spp pro Apps onto your Android Smart Phone, power up the display and establish Bluetooth communications between them. Then set up the Bluetooth spp pro Apps buttons for sending messages and commands accordingly.
See some examples of how we set up the configurable 'ClickMe' buttons for testing below:
Btn name: RED
Send val: (100)Scrolling in RED . . .
Btn name: GREEN
Send val: (200)Scrolling in GREEN . . .
Btn name: ORANGE
Send val: (300)Scrolling in ORANGE . . .
Btn name: RED*
Send val: (100)*
Btn name: GREEN*
Send val: (200)*
Btn name: ORANGE*
Send val: (300)*
Btn name: Speed Up
Send val: (00>)*
Btn name: Speed Down
Send val: (00<)*
Btn name: Dimmer
Send val: (0<0)*
Btn name: Brighter
Send val: (0>0)*
Btn name: jolliFactory
Send val: Powered by jolliFactory
Test the display by clicking on the buttons to send messages and commands to the display.
If you do not have a Bluetooth Wireless Serial Port Module connected, you may test the display by sending messages and commands via the Arduino's Serial Monitor.
Step 5: Display Enclosure
We will not delve into the very detail on building the display enclosure here.
We used a 500mm long clear acrylic tube with internal diameter of 64mm. A sheet of black textured vinyl sticker is used to wrap the clear tube with a window cut-out for the LED Matrix displays to be visible.
A 2mm thick flat blue tinted acrylic sheet is cut to size with 60mm height and length to cover the entire LED Matrix display. This is placed in front of the LED matrices to reduce glare.
No screws are used to secure the individual LED Matrix Modules. Corrugated plastic board is cut to size and slotted behind the LED Matrices to create a firm cushion between the LED Matrix Modules and the internal back wall of the tube.
Two plastic tube end caps are used to cover the ends of the enclosure. The Arduino Nano board and Bluetooth wireless Serial Port Module are placed in the internal hollow of one of the plastic tube end caps.
A small flat acrylic sheet is bent using a strip heater to act as a simple base for the display.
The pictures here shows the parts used to build the enclosure, the display partially assembled and the display fully assembled.
There are lots of handy and creative people out there and we are sure you will be able to create better enclosures for the display if you embark with this project.
5 People Made This Project!
We have a be nice policy.
Please be positive and constructive.