BT05 Bluetooth Module

The referenced BLExAR code from Makers Portal is not optimal in several ways. It was just the first link I found which used an HM10 and the iPhone app in simple send/receive fashion without all the more complex BLE communications protocol mentioned by Brazilino.

AFAIK you should be able to make the HM10 and the iPhone work together. You may want to explore different BLE Serial Terminal apps from the apple store.

I have downloaded a few different apps to try. When I press send from BLWxAR, the LED on the ARDUINO blinks, showing that something is reaching it, it just might not be in the correct format. I will experiment with the Makers Portal stuff. Thanks once again.

One way to help sort out your issues is to create a version of your code using input from the Serial monitor instead of input from the BLE module and phone. When I made a Serial version of your code (without the Matrix display code) I could get proper responses to input like B123 or S567.

Try this and see if your code works with Serial monitor input. Once you get the code to work from the Serial monitor, you can connect the HM10 to the hardware serial pins (0,1) and the module should duplicate the monitor input if the phone and module are communicating properly.


#include <MikroMatrix.h> // download library from https://github.com/Kashif2812/MikroMatrix

#define CLOCK_PIN 13       // CLK pin of MAX7219 module on arduino UNO Pin no 13
#define CHIP_SELECT 3     // CHIP_SELECT of MAX7219 module on arduino UNO Pin no 10
#define DATA_PIN 11        // DATA_PIN pin of MAX7219 module on arduino UNO Pin no 11
#define NUM_OF_DEVICES 4   // change this variable to set how many MAX7219's you'll use
#define RX       6        // connect arduino pin no 0 to HM10's TX pin
#define TX       7         // connect arduino pin no 1 to HM10's RX pin



char message[100];
int brightness;      // variable to hold the value of brightness
int Speed;           // variable to hold the value of speed


//MAX_7219 class for LED_Matrix and Seven Segment driver:
MAX_7219 MAX_7219_MODULE(DATA_PIN, CHIP_SELECT, CLOCK_PIN, NUM_OF_DEVICES );

//MikroMatrixapp class for Seven Segment applications
MikroMatrixapp Matrix(&MAX_7219_MODULE);

void setup() {
  Serial.begin(9600);                    // begin serial and set buad rate
  MAX_7219_MODULE.init();              // initializing hardware 
}


void loop() {

  Matrix.scroll_left(message);

  if (Serial.available())   // condition to check if any value avail on seril buffer
  {
    char C = Serial.read(); // read identifier character

    if (C == 'B')      // check that if identifier character is equal to "B"
    {
      brightness = Serial.parseInt();               // then incoming value will be equal to brightness
      MAX_7219_MODULE.set_intensity(brightness);  // write the value of brightness in brightness register
      Serial.println(brightness);  //added
    }


    if (C == 'S')   // check that if identifier character is equal to "S"
    {
      Speed = Serial.parseInt();   // then incoming value will be equal to Speed
      MAX_7219_MODULE.set_speed(Speed);   // write the value of Speed in speed setting function
      Serial.println(Speed);  //added
    }


    // note: For message identifier, use that character you are not using in your message

    if (C == 't')    // check that if identifier character is equal to "t"
    {
      memset(message , 0 , 100);      // function to clear message array for new message
      Serial.readBytesUntil('\r' , message , 100);    // function to receive new message from Serial and store in message array
      Serial.println(message); //added
    }
  }
}

I will give that a go, thanks for taking the time to do that, it is very much appreciated.

If that is true, I rest my case. It simply means that there are two idiots in this particular saga. I hate to admit it, but using pins 0,1 is not compulsory, it is just that you don't do that with software serial. See my previous. The reason why I suggested there that you stay with pins 0,1 is so that you can leave the actual Bluetooth out of the game and test the code with the serial monitor - see reply #23. This also enables you to bypass any vagaries with the BleXar app.

As I understand it, BLeXar is an IOS app that allows those who have inflicted themselves with an iPhone to use an HM-10 in the same way everybody else uses an HC-05, this to the point where the code is something we all know, love, and understand, which may go quite some way to explain why Cattledog thought you WERE using an HC-05.

If you take the approach in reply#23, you may then find the real problem lies in BleXar, which I understand is not too flash...

Thanks Nick,

I will try the suggestion from cattledog in post #23 to ensure I get information to the serial monitor. I have tried another app - Dabble again without success. I have managed to get a message to send to the terminal of BLExAR.

Partial success! The code in post #23 works fine in the serial monitor and if I connect the LED Matrix, it reflects what is on the serial monitor. If I then connect the HM-10 Module, I can send a message which appears on the serial monitor albeit with some random stuff at the end. However this only works while connected to the IDE, If I plug a battery in instead of the USB cable nothing works! It's pointing to the HM-10 module rather than anything else I think. Also if I close the serial monitor then open it again, nothing works, I need to upload the code again then open the serial monitor! Is this to be expected?

Observation, it looks like BLExAR can only handle 15 characters including spaces which is rather limiting. I tried the Dabble app but it would not work

Are you using an UNO or another board?

BLE has info pack size limitations, I don´t know how BLExAR deals with it.

Now it seems you have another issue, related to power consumption. How much amps do the LED Matrix need? What battery are you using?

I am using an UNO, and was plugging a 9V battery into the UNO. Not sure what current the LED matrix draws but it works fine with another project. I will try a new 9V battery or possibly an external battery direct to the LED Matrix and see how that goes. The ArduinoBlue app copes with longer strings though. Not over enamoured with the font though, I may need to see if I can edit or create my own if I get time.

9V battery can´t provide much current.

I would say that´s a better option.

No, No, No. If you mean a 9v PP3, just about any alternative that you can think of will be a better option. If you insist on using a PP3 and have no need for reliability or longevity, at least use something that actually provides power while you are trying to sort out Bluetooth.

I was thinking that I would use a 4 cell 2000mAh NiMH battery to feed the LED Matrix and the Arduino rather than use a 9V PP3. That would clear up any possible power issue.

4x1.2 = 4.8v, so no, not necessarily. But it is better than a PP3. Can't you use a wall wart?

I am in Scotland, what is a Walmart wart?

An AC/DC (not the band) adaptor, like the one used to charge cell phones.

A wall wart, for plugging in to an AC socket in the wall.

The big bit plugs into the wall and says 9v 1A. The other end plugs straight into your Uno. You probably already have one. If not, get one - that says 2A.

I see, that's a new term to me, and a power supply would be the best option for my finished project.

I did try my fully charged 4 cell battery and having tried a few apps, the one that works is Dabble.

So I now have a working project and thank you very much to all who contributed.

In an effort to tidy it up though, the font is very poor. In another project I modified a font file, it was a ***.h file and sat in the same folder as the ***.ino file. I tried creating a font file for this project but when trying to compile it threw up an error 'fontType_t' in 'class MAX_7219' does not name a type. Any idea what I might be doing wrong? See Code below:

#include <MikroMatrix.h> // download library from https://github.com/Kashif2812/MikroMatrix
#include "MyFont.h"

#define CLOCK_PIN 13       // CLK pin of MAX7219 module on arduino UNO Pin no 13
#define CHIP_SELECT 3     // CHIP_SELECT of MAX7219 module on arduino UNO Pin no 10
#define DATA_PIN 11        // DATA_PIN pin of MAX7219 module on arduino UNO Pin no 11
#define NUM_OF_DEVICES 4   // change this variable to set how many MAX7219's you'll use
//#define RX       6        // connect arduino pin no 0 to HM10's TX pin
//#define TX       7         // connect arduino pin no 1 to HM10's RX pin



char message[100];
int brightness;      // variable to hold the value of brightness
int Speed;           // variable to hold the value of speed


//MAX_7219 class for LED_Matrix and Seven Segment driver:
MAX_7219 MAX_7219_MODULE(DATA_PIN, CHIP_SELECT, CLOCK_PIN, NUM_OF_DEVICES );

//MikroMatrixapp class for Seven Segment applications
MikroMatrixapp Matrix(&MAX_7219_MODULE);

setFont(MyFont);

void setup() {
  Serial.begin(9600);                    // begin serial and set buad rate
  MAX_7219_MODULE.init();              // initializing hardware 
}


void loop() {

  Matrix.scroll_left(message);

  if (Serial.available())   // condition to check if any value avail on seril buffer
  {
    char C = Serial.read(); // read identifier character

    if (C == 'B')      // check that if identifier character is equal to "B"
    {
      brightness = Serial.parseInt();               // then incoming value will be equal to brightness
      MAX_7219_MODULE.set_intensity(brightness);  // write the value of brightness in brightness register
      Serial.println(brightness);  //added
    }


    if (C == 'S')   // check that if identifier character is equal to "S"
    {
      Speed = Serial.parseInt();   // then incoming value will be equal to Speed
      MAX_7219_MODULE.set_speed(Speed);   // write the value of Speed in speed setting function
      Serial.println(Speed);  //added
    }


    // note: For message identifier, use that character you are not using in your message

    if (C == 't')    // check that if identifier character is equal to "t"
    {
      memset(message , 0 , 100);      // function to clear message array for new message
      Serial.readBytesUntil('\r' , message , 100);    // function to receive new message from Serial and store in message array
      Serial.println(message); //added
    }
  }
}

I have included the .h file and set the font but get the error. This is the .h file code:

type or MAX_7219::fontType_t MyFont[] PROGMEM = // modern arabic
{
  'F', 2, 0, 0, 0, 255, 8,
  0,    // 0
  0,    // 1
  0,    // 2
  0,    // 3
  0,    // 4
  0,    // 5
  0,    // 6
  0,    // 7
  0,    // 8
  0,    // 9
  0,    // 10
  0,    // 11
  0,    // 12
  0,    // 13
  0,    // 14
  0,    // 15
  0,    // 16
  0,    // 17
  0,    // 18
  0,    // 19
  0,    // 20
  0,    // 21
  0,    // 22
  0,    // 23
  0,    // 24
  0,    // 25
  0,    // 26
  0,    // 27
  0,    // 28
  0,    // 29
  0,    // 30
  0,    // 31
  2, 0, 0,    // 32 - 'Space'
  1, 95,    // 33 - '!'
  3, 7, 0, 7,   // 34 - '"'
  5, 20, 127, 20, 127, 20,    // 35 - '#'
  5, 36, 42, 127, 42, 18,   // 36 - '$'
  5, 35, 19, 8, 100, 98,    // 37 - '%'
  5, 54, 73, 85, 34, 80,    // 38 - '&'
  3, 8, 7, 3,   // 39 - '''
  3, 28, 34, 65,    // 40 - '('
  3, 65, 34, 28,    // 41 - ')'
  5, 42, 28, 127, 28, 42,   // 42 - '*'
  5, 8, 8, 62, 8, 8,    // 43 - '+'
  3, 128, 112, 48,    // 44 - ','
  5, 8, 8, 8, 8, 8,   // 45 - '-'
  2, 96, 96,    // 46 - '.'
  5, 32, 16, 8, 4, 2,   // 47 - '/'
  5, 62, 81, 73, 69, 62,    // 48 - '0'
  3, 66, 127, 64,   // 49 - '1'
  5, 114, 73, 73, 73, 70,   // 50 - '2'
  5, 33, 65, 73, 77, 51,    // 51 - '3'
  5, 24, 20, 18, 127, 16,   // 52 - '4'
  5, 39, 69, 69, 69, 57,    // 53 - '5'
  5, 60, 74, 73, 73, 49,    // 54 - '6'
  5, 65, 33, 17, 9, 7,    // 55 - '7'
  5, 54, 73, 73, 73, 54,    // 56 - '8'
  5, 70, 73, 73, 41, 30,    // 57 - '9'
  1, 20,    // 58 - ':'
  2, 128, 104,    // 59 - ';'
  4, 8, 20, 34, 65,   // 60 - '<'
  5, 20, 20, 20, 20, 20,    // 61 - '='
  4, 65, 34, 20, 8,   // 62 - '>'
  5, 2, 1, 89, 9, 6,    // 63 - '?'
  5, 62, 65, 93, 89, 78,    // 64 - '@'
  5, 124, 18, 17, 18, 124,    // 65 - 'A'
  5, 127, 73, 73, 73, 54,   // 66 - 'B'
  5, 62, 65, 65, 65, 34,    // 67 - 'C'
  5, 127, 65, 65, 65, 62,   // 68 - 'D'
  5, 127, 73, 73, 73, 65,   // 69 - 'E'
  5, 127, 9, 9, 9, 1,   // 70 - 'F'
  5, 62, 65, 65, 81, 115,   // 71 - 'G'
  5, 127, 8, 8, 8, 127,   // 72 - 'H'
  3, 65, 127, 65,   // 73 - 'I'
  5, 32, 64, 65, 63, 1,   // 74 - 'J'
  5, 127, 8, 20, 34, 65,    // 75 - 'K'
  5, 127, 64, 64, 64, 64,   // 76 - 'L'
  5, 127, 2, 28, 2, 127,    // 77 - 'M'
  5, 127, 4, 8, 16, 127,    // 78 - 'N'
  5, 62, 65, 65, 65, 62,    // 79 - 'O'
  5, 127, 9, 9, 9, 6,   // 80 - 'P'
  5, 62, 65, 81, 33, 94,    // 81 - 'Q'
  5, 127, 9, 25, 41, 70,    // 82 - 'R'
  5, 38, 73, 73, 73, 50,    // 83 - 'S'
  5, 3, 1, 127, 1, 3,   // 84 - 'T'
  5, 63, 64, 64, 64, 63,    // 85 - 'U'
  5, 31, 32, 64, 32, 31,    // 86 - 'V'
  5, 63, 64, 56, 64, 63,    // 87 - 'W'
  5, 99, 20, 8, 20, 99,   // 88 - 'X'
  5, 3, 4, 120, 4, 3,   // 89 - 'Y'
  5, 97, 89, 73, 77, 67,    // 90 - 'Z'
  3, 127, 65, 65,   // 91 - '['
  5, 2, 4, 8, 16, 32,   // 92 - '\'
  3, 65, 65, 127,   // 93 - ']'
  5, 4, 2, 1, 2, 4,   // 94 - '^'
  5, 64, 64, 64, 64, 64,    // 95 - '_'
  3, 3, 7, 8,   // 96 - '`'
  5, 32, 84, 84, 120, 64,   // 97 - 'a'
  5, 127, 40, 68, 68, 56,   // 98 - 'b'
  5, 56, 68, 68, 68, 40,    // 99 - 'c'
  5, 56, 68, 68, 40, 127,   // 100 - 'd'
  5, 56, 84, 84, 84, 24,    // 101 - 'e'
  4, 8, 126, 9, 2,    // 102 - 'f'
  5, 24, 164, 164, 156, 120,    // 103 - 'g'
  5, 127, 8, 4, 4, 120,   // 104 - 'h'
  3, 68, 125, 64,   // 105 - 'i'
  4, 64, 128, 128, 122,   // 106 - 'j'
  4, 127, 16, 40, 68,   // 107 - 'k'
  3, 65, 127, 64,   // 108 - 'l'
  5, 124, 4, 120, 4, 120,   // 109 - 'm'
  5, 124, 8, 4, 4, 120,   // 110 - 'n'
  5, 56, 68, 68, 68, 56,    // 111 - 'o'
  5, 252, 24, 36, 36, 24,   // 112 - 'p'
  5, 24, 36, 36, 24, 252,   // 113 - 'q'
  5, 124, 8, 4, 4, 8,   // 114 - 'r'
  5, 72, 84, 84, 84, 36,    // 115 - 's'
  4, 4, 63, 68, 36,   // 116 - 't'
  5, 60, 64, 64, 32, 124,   // 117 - 'u'
  5, 28, 32, 64, 32, 28,    // 118 - 'v'
  5, 60, 64, 48, 64, 60,    // 119 - 'w'
  5, 68, 40, 16, 40, 68,    // 120 - 'x'
  5, 76, 144, 144, 144, 124,    // 121 - 'y'
  5, 68, 100, 84, 76, 68,   // 122 - 'z'
  3, 8, 54, 65,   // 123 - '{'
  1, 119,   // 124 - '|'
  3, 65, 54, 8,   // 125 - '}'
  5, 2, 1, 2, 4, 2,   // 126 - '~'
  5, 60, 38, 35, 38, 60,    // 127 - 'Hollow Up Arrow'
  0,    // 128
  5, 12, 18, 178, 2, 4,   // 129 - 'Arabic ?'
  2, 96, 32,    // 130 - 'Hamza'
  3, 1, 125, 1,   // 131 - 'Alef with madda above'
  2, 123, 1,    // 132 - 'Alef with hamza above'
  6, 3, 29, 34, 162, 162, 124,    // 133 - 'Waw with hamza above'
  2, 192, 95,   // 134 - 'Alef with hamza below'
  7, 56, 68, 64, 67, 89, 84, 36,    // 135 - 'Yeh with hamza above'
  1, 127,   // 136 - 'Alef'
  6, 28, 34, 160, 32, 32, 28,   // 137 - 'Beh'
  5, 56, 69, 68, 69, 56,    // 138 - 'Teh marbuta'
  6, 56, 68, 65, 64, 65, 60,    // 139 - 'Teh '
  6, 56, 68, 64, 66, 65, 58,    // 140 - 'Theh'
  6, 64, 34, 34, 162, 34, 28,   // 141 - 'Jeem'
  6, 128, 68, 68, 68, 68, 56,   // 142 - 'Hah'
  6, 128, 68, 68, 69, 68, 56,   // 143 - 'Khah'
  3, 64, 68, 56,    // 144 - 'Dal'
  3, 64, 69, 56,    // 145 - 'Thal'
  2, 128, 124,    // 146 - 'Reh'
  2, 128, 125,    // 147 - 'Zain'
  9, 56, 68, 64, 64, 60, 64, 60, 64, 60,    // 148 - 'Seen'
  9, 56, 68, 64, 64, 61, 64, 61, 64, 61,    // 149 - 'Sheen'
  10, 56, 68, 64, 64, 60, 68, 68, 68, 68, 56,   // 150 - 'Sad'
  10, 56, 68, 64, 64, 60, 68, 68, 69, 68, 56,   // 151 - 'Dad'
  8, 64, 64, 126, 68, 68, 68, 68, 56,   // 152 - 'Tah'
  8, 64, 64, 126, 68, 68, 69, 68, 56,   // 153 - 'Zah'
  5, 184, 68, 68, 68, 72,   // 154 - 'Ain'
  5, 184, 68, 69, 68, 72,   // 155 - 'Ghain'
  0,    // 156
  0,    // 157
  0,    // 158
  0,    // 159
  0,    // 160
  1, 64,    // 161 - 'Tatweel'
  9, 56, 68, 64, 64, 72, 84, 85, 84, 56,    // 162 - 'Feh'
  9, 120, 132, 128, 128, 152, 165, 164, 165, 120,   // 163 - 'Qaf'
  7, 48, 72, 64, 67, 65, 64, 63,    // 164 - 'Kaf'
  6, 96, 144, 128, 128, 128, 127,   // 165 - 'Lam'
  7, 248, 4, 60, 68, 68, 68, 56,    // 166 - 'Meem'
  5, 56, 68, 64, 65, 60,    // 167 - 'Noon'
  5, 56, 68, 68, 68, 56,    // 168 - 'Heh'
  5, 28, 34, 162, 162, 124,   // 169 - 'Waw'
  7, 56, 68, 64, 64, 88, 84, 36,    // 170 - 'Alef maksura'
  7, 28, 34, 160, 32, 172, 42, 18,    // 171 - 'Yeh'
  0,    // 172
  0,    // 173
  0,    // 174
  0,    // 175
  0,    // 176
  0,    // 177
  0,    // 178
  0,    // 179
  0,    // 180
  0,    // 181
  0,    // 182
  0,    // 183
  0,    // 184
  0,    // 185
  0,    // 186
  0,    // 187
  0,    // 188
  0,    // 189
  0,    // 190
  0,    // 191
  2, 48, 48,    // 192 - 'Zero'
  1, 126,   // 193 - 'One'
  4, 124, 2, 2, 2,    // 194 - 'Two'
  5, 126, 8, 6, 8, 6,   // 195 - 'Three'
  4, 52, 74, 74, 74,    // 196 - 'Four'
  5, 60, 66, 66, 66, 60,    // 197 - 'Five'
  4, 2, 2, 2, 124,    // 198 - 'Six'
  5, 62, 64, 64, 64, 62,    // 199 - 'Seven'
  5, 124, 2, 2, 2, 124,   // 200 - 'Eight'
  5, 12, 18, 18, 18, 124,   // 201 - 'Nine'
  0,    // 202
  0,    // 203
  0,    // 204
  0,    // 205
  0,    // 206
  0,    // 207
  0,    // 208
  0,    // 209
  0,    // 210
  0,    // 211
  0,    // 212
  0,    // 213
  0,    // 214
  0,    // 215
  0,    // 216
  0,    // 217
  0,    // 218
  0,    // 219
  0,    // 220
  0,    // 221
  0,    // 222
  0,    // 223
  0,    // 224
  0,    // 225
  0,    // 226
  0,    // 227
  0,    // 228
  0,    // 229
  0,    // 230
  0,    // 231
  0,    // 232
  0,    // 233
  0,    // 234
  0,    // 235
  0,    // 236
  0,    // 237
  0,    // 238
  0,    // 239
  0,    // 240
  0,    // 241
  0,    // 242
  0,    // 243
  0,    // 244
  0,    // 245
  0,    // 246
  0,    // 247
  0,    // 248
  0,    // 249
  0,    // 250
  0,    // 251
  0,    // 252
  0,    // 253
  0,    // 254
  0,    // 255
}; 

It was part of another font file but contained all that I needed and I tried to format it the same as my other project.

Or is there an easier way to include a font?

Well done on getting the bluetooth control working :grinning:

I would suggest that you start a new thread relating to the font selection. I think you would want to present a simplified example without the bluetooth. Provide good links to the library used.

Yes happy i eventually got there, with a bit of help of course.

I will start another thread for the font thing, thanks for the advice and for your help. :+1: