Introduction: 8x8 Matrix Display With BT
I purchased a 4 panel 8x8 matrix from Ebay (China) a few months ago.
I was a tad disappointed when I realised it was hard wired side to side, not top to bottom for which most of the examples on the Net are written! See step 2.
I guess I could have modified the code (not sure how), but my usual laziness told me to look for something already written. I came across an example and stuck with it!
I played with fixed messages but then I decided I'd try programming the message via Bluetooth.
Then I wanted to save and retrieve messages !
There was a lot of trial and error but after a few hours coding I got it working.
I am still trying to find a practical use for it !! :-)
Step 1: The Display
As previously mentioned, the display is wired left to right, rather than top to bottom.
I'm sure other code could have been modified to compensate for this !
I don't remember where I downloaded the working code from, however, a search for "cosmicvoid matrix or LedControlMS.h" may help. The LedControlMS.h lib is required for this project.
The only part of this code I modified was the number of displays as it looks like it was set to 5, I just changed it to 4.
I have ordered another x4 display so I can see how it works with 8 matrices rather than 4!
Step 2: The Bluetooth Bit
Each time I play with a Bluetooth device, I always refer to this excellent instructable !
This Instructable will tell you all you need to know on how to set up and pair the HC-05 to a mobile phone or tablet.
I paired with a Samsung Galaxy 6 Edge and a Tab A with no problem.
I did alter the communication speed to 57600.
Step 3: BT Communication and the Program.
To communicate with the HC-05 I downloaded a free App from the Play Store, there a several available,- the one I chose is called Bluetooth Terminal HC-05 - it's an excellent App!
Once you have paired the HC-05 to a phone or tablet The following occurs.
When the arduino is reset, the program reads all of the messages stored in the EEPROM and displays them on the phone / tablet - see picture.
The information displayed is the Mem Location (0-9), Length of Message & the Message itself at each location.
I arranged the code to store up to a 90 character message at address 5 for Msg 0, 105 for Msg 1 .......905 for Msg 9.
Address 0, 100 .... 900 contain the message length.
The last stored / retieved message is displayed.
Sending anything to the Arduino via BT replaces the current message.
To store the displayed message (use "~" tilde), send ~0 to store at location 0, ~5 to store at location 5 etc.
To retrieve and display a stored message use "^" (carat), eg ^3 will load and display the message at Mem location 3.
When a message is stored or retrieved, the current memory location is stored at EEPROM address 1023 - this is used at power up to display the last message displayed.
Step 4: The Code & Power
As per usual, my code is a tidy as a teenagers bedroom, but I have lots of comments in there !
There may be some superfluous code as there was a bit of trial and error.
The display routine will display whatever is in array msg. The font is not complete so displaying some characters will cause unpredictable results !
If someone out there could tell me how to modify the $ sign for the £ sign or better still add it, then I would be extremely grateful!
It may be necessary to hard code a message into location 0 just to give a starting point, this can be overwritten when the program is up and running!
EEPROM.write(0,'5'); // length of msg stored at location 0
EEPROM.write(5,'L'); //msg stored at location 05
With no messages stored, on power up, the display will be unpredictable and the phone / tablet will display odd but consistent information because, as with most EEPROM's, the default data at every location is FF Hex (225 Decimal).
This prototype was built using an Arduino Uno, but I will use a pro mini for the finished project.
I intend to use 3 x 1.5v batteries, so to save power, I will turn off the HC-05 after selecting a message. Just disconnecting/reconnecting the power is not good enough as it will send garbled information to the display.
It would seem necessary to isolate the TR & RX pins before connecting / disconnecting the power!