0

I try to use beacon(HM-10) to broadcast my sensor's data, but there is a problem that I use a loop to write AT commands, after a while, it doesn't respond anything.

Here is the part of the code:

String pre = "AT+MARJ0x";
int sensorData = 0;

loop () {
  sensorData = getSensorData(); // always returns 100 ~180
  String atCommand = pre + sensorData; // ex: AT+MARJ0x100
  BTSerial.print (atCommand);
  delay (200);
}

It initially work successfully about 3-mins, and then it doesn't work and can't be sent any at commands. Can anybody help me fix this problem?

Sam Protsenko
  • 14,045
  • 4
  • 59
  • 75
Flowerhop
  • 41
  • 1
  • 4

1 Answers1

0

What you are trying is not possible with an Ibeacon. All you do is set-up the major number of Ibeacon data in your HM-10device over and over again with sensor data. major number is a part of the Ibeacon data spec: (source: https://developer.mbed.org/blog/entry/BLE-Beacons-URIBeacon-AltBeacons-iBeacon/)

Data Spec:

IBeacons broadcast four pieces of information:

  • A UUID that identifies the beacon.
  • A Major number identifying a subset of beacons within a large group.
  • A Minor number identifying a specific beacon.
  • A TX power level in 2's compliment, indicating the signal strength one meter from the device. This number must be calibrated for each device by the user or manufacturer.

    A scanning application reads the UUID, major number and minor number and references them against a database to get information about the beacon; the beacon itself carries no descriptive information - it requires this external database to be useful. The TX power field is used with the measured signal strength to determine how far away the beacon is from the smart phone. Please note that TxPower must be calibrated on a beacon-by-beacon basis by the user to be accurate.

enter image description here

For a HM-10 device AT-commands are normally only used to set-up the device, not for sending data. Google some examples and learn how to setup communication between BLE devices.

GrooverFromHolland
  • 971
  • 1
  • 11
  • 18