Bluetooth Matrix Display

1

Today I'm going to show you A 8x40 metric display that you can control through Bluetooth.

Bluetooth Matrix Display



i know Many people are in Confusion with a metric display.

Let's see how it works

first You need the matrix display for this project.

I used here 8x8 five metric displays.


8x8 Matrix Display


You can buy it online, or you can create it at home

After opening the metric display, we see that there are 8 pin each side

One of the sites is cathode and another site is Anode or you can called it row and column.


8x8 Matrix Display


8x8 Matrix Display

Mx7219 IC is used here to manage all these pins very easily or You can also called it a Shift Resistor.

Now you need to manage this IC, Positive, Negative, CLK, CS and DATA IN PUT.

MX7219 IC


Atmega 328p Microcontroller  is controlling all these metric displays


Arduino


To perform this IC properly  You must put the software in it

So I mounted it on the breadboard

 and I connect the data cable in Arduino nano and other end to my PC

And upload all the library files and the code

#1#    You will need the (Led Control) libraries to compile the sketch

http://playground.arduino.cc/Main/LedControl


#2#  MAX7221 Led display drivers
https://github.com/riyas-org/max7219


Code





/*
WIRING :
 pin 12 - DataIn of the first led matrix module
 pin 11 - CLK of the first led matrix module
 pin 10 - CS of the first led matrix module

 pin 9 : RX pin of the bluetooth module
 pin 8 : TX pin of the bluetooth module

 */



//Librairie for the LEDs matrix
#include "LedControl.h"

// virtual serial lib, used with bluetooth
#include <SoftwareSerial.h>

//How many matrixes we have ?
int MatrixNumber =5;


//virtual serial port bluetooth configuration
SoftwareSerial BT(8, 9);   //pin 8 : virtual RX    pin 9 :  virtual TX


// the delay between each screen display (ms)
int SpeedDelay = 12;


//total string lenght. The first message is 25 characters long (including spaces)
int LongueurChaine=25;


char incomingByte; //incoming data from the BT link


// the two pixels arrays
char Buffer[200];   //contient tout les pixels de TOUTE LA PHRASE
char Buffer_inverse[200]; //contient tout les pixels de TOUTE LA PHRASE, mais symetrises pour affichage sur ecran inverses

// the message array
char Phrase[50];

//here we set up the led matrix
LedControl lc=LedControl(12,11,10,MatrixNumber); 


// character lib
int fontDefinitions[480] = {
    0x00,0x00,0x00,0x00,0x00,/*space*/ // is 32 in ASCII
    0x00,0xF6,0xF6,0x00,0x00,/*!*/
    0x00,0xE0,0x00,0xE0,0x00,/*"*/
    0x28,0xFE,0x28,0xFE,0x28,/*#*/
    0x00,0x64,0xD6,0x54,0x08,/*$*/
    0xC2,0xCC,0x10,0x26,0xC6,/*%*/
    0x4C,0xB2,0x92,0x6C,0x0A,/*&*/
    0x00,0x00,0xE0,0x00,0x00,/*'*/
    0x00,0x38,0x44,0x82,0x00,/*(*/
    0x00,0x82,0x44,0x38,0x00,/*)*/
    0x88,0x50,0xF8,0x50,0x88,/***/
    0x08,0x08,0x3E,0x08,0x08,/*+*/
    0x00,0x00,0x05,0x06,0x00,/*,*/
    0x08,0x08,0x08,0x08,0x08,/*-*/
    0x00,0x00,0x06,0x06,0x00,/*.*/
    0x02,0x0C,0x10,0x60,0x80,/*/*/
    0x7C,0x8A,0x92,0xA2,0x7C,/*0*/
    0x00,0x42,0xFE,0x02,0x00,/*1*/
    0x42,0x86,0x8A,0x92,0x62,/*2*/
    0x44,0x82,0x92,0x92,0x6C,/*3*/
    0x10,0x30,0x50,0xFE,0x10,/*4*/
    0xE4,0xA2,0xA2,0xA2,0x9C,/*5*/
    0x3C,0x52,0x92,0x92,0x0C,/*6*/
    0x80,0x86,0x98,0xE0,0x80,/*7*/
    0x6C,0x92,0x92,0x92,0x6C,/*8*/
    0x60,0x92,0x92,0x94,0x78,/*9*/
    0x00,0x00,0x36,0x36,0x00,/*:*/
    0x00,0x00,0x35,0x36,0x00,/*;*/
    0x10,0x28,0x44,0x82,0x00,/*<*/
    0x28,0x28,0x28,0x28,0x28,/*=*/
    0x00,0x82,0x44,0x28,0x10,/*>*/
    0x40,0x80,0x8A,0x90,0x60,/*?*/
    0x7C,0x82,0xBA,0xBA,0x62,/*@*/
    0x3E,0x48,0x88,0x48,0x3E,/*A*/
    0xFE,0x92,0x92,0x92,0x6C,/*B*/
    0x7C,0x82,0x82,0x82,0x44,/*C*/
    0xFE,0x82,0x82,0x82,0x7C,/*D*/
    0xFE,0x92,0x92,0x92,0x82,/*E*/
    0xFE,0x90,0x90,0x90,0x80,/*F*/
    0x7C,0x82,0x82,0x8A,0x4E,/*G*/
    0xFE,0x10,0x10,0x10,0xFE,/*H*/
    0x82,0x82,0xFE,0x82,0x82,/*I*/
    0x84,0x82,0xFC,0x80,0x80,/*J*/
    0xFE,0x10,0x28,0x44,0x82,/*K*/
    0xFE,0x02,0x02,0x02,0x02,/*L*/
    0xFE,0x40,0x20,0x40,0xFE,/*M*/
    0xFE,0x60,0x10,0x0C,0xFE,/*N*/
    0x7C,0x82,0x82,0x82,0x7C,/*O*/
    0xFE,0x90,0x90,0x90,0x60,/*P*/
    0x7C,0x82,0x82,0x86,0x7E,/*Q*/
    0xFE,0x90,0x98,0x94,0x62,/*R*/
    0x64,0x92,0x92,0x92,0x4C,/*S*/
    0x80,0x80,0xFE,0x80,0x80,/*T*/
    0xFC,0x02,0x02,0x02,0xFC,/*U*/
    0xF8,0x04,0x02,0x04,0xF8,/*V*/
    0xFC,0x02,0x0C,0x02,0xFC,/*W*/
    0xC6,0x28,0x10,0x28,0xC6,/*X*/
    0xC0,0x20,0x1E,0x20,0xC0,/*Y*/
    0x86,0x8A,0x92,0xA2,0xC2,/*Z*/
    0x00,0x00,0xFE,0x82,0x00,/*[*/
    0x00,0x00,0x00,0x00,0x00,/*this should be / */
    0x80,0x60,0x10,0x0C,0x02,/*]*/
    0x20,0x40,0x80,0x40,0x20,/*^*/
    0x01,0x01,0x01,0x01,0x01,/*_*/
    0x80,0x40,0x20,0x00,0x00,/*`*/
    0x04,0x2A,0x2A,0x2A,0x1E,/*a*/
    0xFE,0x12,0x22,0x22,0x1C,/*b*/
    0x1C,0x22,0x22,0x22,0x14,/*c*/
    0x1C,0x22,0x22,0x12,0xFE,/*d*/
    0x1C,0x2A,0x2A,0x2A,0x18,/*e*/
    0x10,0x7E,0x90,0x80,0x40,/*f*/
    0x18,0x25,0x25,0x25,0x1E,/*g*/
    0xFE,0x10,0x10,0x10,0x0E,/*h*/
    0x00,0x12,0x5E,0x02,0x00,/*i*/
    0x02,0x01,0x01,0x11,0x5E,/*j*/
    0xFE,0x08,0x08,0x14,0x22,/*k*/
    0x00,0x82,0xFE,0x02,0x00,/*l*/
    0x3E,0x20,0x1C,0x20,0x1E,/*m*/
    0x3E,0x20,0x20,0x20,0x1E,/*n*/
    0x1C,0x22,0x22,0x22,0x1C,/*o*/
    0x3F,0x24,0x24,0x24,0x18,/*p*/
    0x18,0x24,0x24,0x3F,0x01,/*q*/
    0x3E,0x10,0x20,0x20,0x10,/*r*/
    0x12,0x2A,0x2A,0x2A,0x04,/*s*/
    0x00,0x10,0x3C,0x12,0x04,/*t*/
    0x3C,0x02,0x02,0x02,0x3E,/*u*/
    0x30,0x0C,0x02,0x0C,0x30,/*v*/
    0x38,0x06,0x18,0x06,0x38,/*w*/
    0x22,0x14,0x08,0x14,0x22,/*x*/
    0x38,0x05,0x05,0x05,0x3E,/*y*/
    0x22,0x26,0x2A,0x32,0x22,/*z*/
    0x00,0x10,0x6C,0x82,0x82,/*{*/
    0x00,0x00,0xFF,0x00,0x00,/*|*/
    0x04,0x02,0xFF,0x02,0x04,/*|, arrow*/
    0x82,0x82,0x6C,0x10,0x00,/*}*/
    0x08,0x10,0x18,0x08,0x10/*~*/
};



void setup() {

    //matrix modules init
    for(int adresse=0;adresse<MatrixNumber;adresse++) {
        /*The MAX72XX is in power-saving mode on startup*/
        lc.shutdown(adresse,false);
        /* Set the brightness to a medium values */
        lc.setIntensity(adresse,4);
        /* and clear the display */
        lc.clearDisplay(adresse);
    }

//    BufferBuilding("Hi ! Sent me a message...", 25);   //first message on the led screen


    BufferBuilding("text", 4);   //first message on the led screen


    Serial.begin(9600); //we also set the normal serial link, for debug

    BT.begin(9600);      // bluetooth initialisation

    //we sent a message on the phone to tell the user that he can do someting...
    BT.println("Hi ! I'm waiting for a message. Type it and press SEND."); 

}



void loop() { 

    DrawText( LongueurChaine); //draw the message, in a loop


    //or, if we get something on the virtual bluetooth port...
    if (BT.available() > 0) {

        LongueurChaine = BT.available(); //incoming string lenght

        for  (int i = 0; i < LongueurChaine; i++) {

            // read the incoming byte:
            incomingByte = BT.read();

            Phrase[i] = incomingByte; ///store the character into the string array

        }

        //debug features, to check :
        Serial.print("Display: ");
        Serial.println(Phrase);
        Serial.print("Length : ");
        Serial.println(LongueurChaine);

        //buffers cleaning, to store the new message
        for(int k = 0; k < 200; k++) {
            Buffer[k]=0;
            Buffer_inverse[k]=0;

        }

        //we create the new buffers, so the new message will be drawn when leaving the sub
        BufferBuilding(Phrase, LongueurChaine);
    }

}



void BufferBuilding(char * stringToDisplay, byte stringLength)
{
    int i =0;

    //loop on every characters (on the string)
    for(int k = 0; k < stringLength; k++) {
        //here we call the characters library  
        int caract= k;   
        Buffer[i+0] =  fontDefinitions[((stringToDisplay[caract] - 32) * 5) + 0];  
        Buffer[i+1] =  fontDefinitions[((stringToDisplay[caract] - 32) * 5) + 1];  
        Buffer[i+2] =  fontDefinitions[((stringToDisplay[caract] - 32) * 5) + 2];  
        Buffer[i+3] =  fontDefinitions[((stringToDisplay[caract] - 32) * 5) + 3];  
        Buffer[i+4] =  fontDefinitions[((stringToDisplay[caract] - 32) * 5) + 4];  
        Buffer[i+5] =  B00000000;  //one blank column of leds between two characters
        i=i+6;
    }

    // here, we create a second buffer, to display the message on the switched matrixes
    for(int k = 0; k < stringLength*6; k++) {
        for(int i = 0; i < 8; i++) {
            bitWrite(  Buffer_inverse[k] ,i,  bitRead(Buffer[k] ,7-i) )   ;
        }
    }
}



void DrawText( byte stringLength) {

    for(int k = 0; k < stringLength*6; k++) { 

        delay(SpeedDelay);


//delay(10000);
        //k is the column

        //buffer drawing
        for (int m = 0; m < MatrixNumber; m++) {  //loop on the matrix                     
            if (m % 2 ==  0) //check is the module is upside-down or not...
            {
                //here, the matrix is flipped upside-down                
                for (int i = 0; i < 8; i++) {  //loop on the columns
     
                      lc.setRow(m,7-i,Buffer[i+k+8*m]);
                }
            }
            else
            {
                //classical   
                for (int i = 0; i < 8; i++) {  //loop on the columns

                    
                       lc.setRow(m,i,Buffer_inverse[i+k+8*m]);
                }
            }
        }
    }

}












After uploading all the code, I connected all the wire to the matrix display

And I did a positive negative supply inside this display

And also I connected, 12 pin data input and 11 pin scl and 10 pin cs



Now the question is how can I manage it through Bluetooth

Well  for that I've used CH-05 bluetooth modules here

CH-06 Bluetooth

CH-05 Bluetooth


The Bluetooth module has six pins, including TE -RX- TX  positive negative and ENEBLE

I just need  RX and TX from them

Of course you need Positive Negative

 remember You need only 5 volts for this bluetooth, more than that, bluetooth will burn




After completing all the connections right. now I will connect  the USB power

And you can see that the welcome message is running very well in this matrix


CH-05 Bluetooth matrix 8x8 Arduino


Now it's time to connect with a phone

So I clicked on the Android Play Store

And I wrote serial terminal Via bluetooth 
CH-05 Bluetooth matrix 8x8


And I downloaded this software

Then I opened my phone settings

And I also turn on my phone's Bluetooth

 I found a device Whose name is HC-05


CH-05 Bluetooth matrix 8x8




I tried to connect this device. Right now the password was asked. I took permission from the 1234 Default  password.

After completing all this processes you have to open the software that you previously downloaded.

And you have to connect the Bluetooth back to the software

As soon as Bluetooth connection is done

and you can see the masg  “I’m waiting for your message.”



 I wrote here Hello YouTube and I sent it

And you see what I wrote, it's just being written in the display.

Arduino


The 8x8 display is very small and if you want to add more displays. Then what do you do

There is no problem  It is very easy

Each metric display has input on one side and output on the other side

What you need to do is. In this output another input must be added, and another output with another input and repeat this process for more matrix 

CH-05 Bluetooth matrix 8x8


In the same way you can add metric display as much as you want,

you need to wright the numbers of total displays you are using in the code


//How many matrixes we have ?

int MatrixNumber =5;


I hope you understand all things well






Even if you need to know something special, then enter your important question in the comments

I want to make it look beautiful 

I got a two-piece copper dot board

And some jumper wire 

and connect the jumpers where they are needed

After everything is finished, it looks like this



And all the matrix displays placed nicely in the board

And in the back, I put a male and female socket through which I can attach and undo it



And finally I put it here Arduino nano socket and bluetooth socket , And through which Bluetooth  and Arduino nano can easily be installed

Besides, I have used an on-off switch, through which I can stop and turn on all

for power source, I used a 3.7 volt li-po battery hear 

You can get 3.7 volts from this battery, but with this 3.7 volt you can not run all the processes

That's why I used the boot converter here, from which I've been supplying Seven Volts

buck converter


This volt is connected with the Arduino nano’s  vin pin

And lastly I used a lithium charger to charge that battery

After all the process is completed correctly. Now it's time to make it a perfect way to add it

here I had used  6 big screw and bolts

and put in all the screw in these holes

and tight it with some bolt 

and put the back panel and tight it with some bolts

after completing all the procedures  it is looking  very nice.

CH-05 Bluetooth matrix 8x8 display






CH-05 Bluetooth matrix 8x8 display with Arduino















Tags

Post a Comment

1 Comments

please do not enter any spam link in comment box

Post a Comment

#buttons=(Accept !) #days=(20)

Our website uses cookies to enhance your experience. Learn More
Accept !
To Top