B4R Question [Solved] Question about AT-09 BLE bluetooth

Filippo

Expert
Licensed User
Hi,

I've been ordering my BLE modules from Aliexpess for a long time, and until a month ago I had no problems with them, everything works perfectly.
But for a month now, everything I order no longer works, although the Bluetooth modules look the same.
It is about 50 pieces of "AT-09 BLE Bluetooth 4.0" where the name and the baud can no longer be changed.

I've always used this script below to change the name and baud.
Maybe someone has already had the same experience here and has a solution, that would be great.

B4X:
#include <SoftwareSerial.h>
SoftwareSerial mySerial(2, 3); // RX, TX

void setup() {
  // put your setup code here, to run once:
  mySerial.begin(9600);
  Serial.begin(9600);
 
  sendCommand("AT");
  sendCommand("AT+NAMEMyName");
  sendCommand("AT+BAUD8");
}

void sendCommand(const char * command){
  Serial.print("Command send :");
  Serial.println(command);
  mySerial.println(command);
  //wait some time
  delay(100);
 
  char reply[100];
  int i = 0;
  while (mySerial.available()) {
    reply[i] = mySerial.read();
    i += 1;
  }
  //end the string
  reply[i] = '\0';
  Serial.print(reply);
  Serial.println("Reply end");
}

void loop() {

}
 

Filippo

Expert
Licensed User
In these 2 pictures you can see the difference between the good AT-09 and the bad. The bad ones have fewer AT commands than the good ones, so I am unable to establish a connection.

AT-09 bad:
1619427184119.png


AT-09 good:
1619427203164.png
 
Upvote 0

Filippo

Expert
Licensed User
I had a similar issue with a HC05. The name was impossibile to write, reported null name. Seems than the flash memory was non working.
I have already bought at various sellers at Aliexpress and even at Amazon, in total I have more than 60 pieces, and nobody works.
I do not know who should be shopping anymore.
 
Upvote 0

XorAndOr

Active Member
Licensed User
I've always used this script below to change the name and baud.

Hi, you can do a test, to see if the problem is in the code or it is the module.
Open the arduino serial monitor, sending the commands and also setting the nl \ cr.
my 2 cents
 
Upvote 0

Filippo

Expert
Licensed User
Hi, you can do a test, to see if the problem is in the code or it is the module.
Open the arduino serial monitor, sending the commands and also setting the nl \ cr.
my 2 cents
Thanks for your answer, but the problem is described here:

There are different AT-09 versions.
With version 4.1 it works, but with version 5.3 it does not work.
 
Upvote 0

f0raster0

Well-Known Member
Licensed User
Then you should buy the version 4.1, or it isn't available anymore?

Also, when buying from aliexpress, buy from an electronics shop or factory because they could answer your questions and help you. (Don't buy just from any shop)
Have you asked them about your situation?

Edit:
Your modules have the same hardware (chip)? can you post a picture.. maybe reprogramming them with the firmware that you need will solve the issues.
 
Last edited:
Upvote 0

Filippo

Expert
Licensed User
Then you should buy the version 4.1, or it isn't available anymore?
I have always bought it to the same seller, but for a month I always get the wrong one.
I suspect that version 4.1 is no longer built, or that a wrong series is in circulation.
Playing a new firmware on it is not that easy, you have to solder a few cables on the module.

Your modules have the same hardware (chip)?
It looks the same, but I look at it again exactly.
 
Upvote 0

Filippo

Expert
Licensed User
The modules look the same and the chip is also the same.
1619505978274.png
 
Upvote 0

Filippo

Expert
Licensed User
Ok, if I look at the modules exactly, then they do not look very the same.
 
Upvote 0

Filippo

Expert
Licensed User
Upvote 0

Filippo

Expert
Licensed User
Unfortunately, I already tried that, without success.

But I have now a German seller who sells to me with version 4.4.
All others with version 5.3 I can now throw away.
 
Upvote 0

Filippo

Expert
Licensed User
Problem solved!
The problem was in B4a in this line:
B4X:
BleManager.Scan2(Array(FFE0), False)

if you change this line like this, the BLE module will be found.
B4X:
BleManager.Scan2(Null, False)

Somehow these AT-09 modules work a little differently with firmware version 5.3 than with firmware version 4+.
 
Upvote 0

Filippo

Expert
Licensed User
Try it with:
B4X:
BleManager.Scan2(Array(UUID("FFE0")), False)



'utility to convert short UUIDs to long format on Android
Private Sub UUID(id As String) As String 'ignore
#if B4A
    Return "0000" & id.ToLowerCase & "-0000-1000-8000-00805f9b34fb"
#else if B4I
    Return id.ToUpperCase
#End If
End Sub
Hi Erel,
In my example, "FFE0" is defined as a variable, so it shouldn't make a difference, should it?
B4X:
    Private FFE0 As String = "0000ffe0-0000-1000-8000-00805f9b34fb"
 
Upvote 0

Filippo

Expert
Licensed User
Upvote 0
Top