HM10 + ESP8266 Unable to get OMG Working

Im guessing OMG is set to 9600, as I have used the bin file and there is no allwance to set up anything other than the web interface settings. I am new to all this and finding my way around things, so sorry to be a pain.!

No problem, we are here to help.

Is your HM10 3.3V or 5V powered?

Another possibility as we have done a lot of modifications regarding BLE on the development branch, could you try the v0.9.5beta?

Thanks, It is 5v powered, will try the beta later on and let you know the result

I get this result now with beta Bin file.
still no sign of BLE scans or devices?
[11:01:30]*WM: [3] Sent wifi save page
[11:01:30]*WM: [2] process connect
[11:01:32]*WM: [2] Connecting as wifi client…
[11:01:32]*WM: [1] STA static IP:
[11:01:32]*WM: [2] setSTAConfig static ip not set
[11:01:32]*WM: [3] WIFI station disconnect
[11:01:32]*WM: [1] Connecting to new AP:
[11:01:32]*WM: [3] Using Password:
[11:01:32]*WM: [3] WiFi station enable
[11:01:32]*WM: [3] enableSTA PERSISTENT ON
[11:01:32]*WM: [1] connectTimeout not set, ESP waitForConnectResult…
[11:01:36]*WM: [2] Connection result: WL_CONNECTED
[11:01:36]*WM: [3] lastconxresult: WL_CONNECTED
[11:01:36]*WM: [1] Connect to new AP [SUCCESS]
[11:01:36]*WM: [1] Got IP Address:
[11:01:36]*WM: [1] 192.168.1.210
[11:01:36]*WM: [2] disconnect configportal
[11:01:37]*WM: [2] restoring usermode STA
[11:01:37]*WM: [2] wifi status: WL_CONNECTED
[11:01:37]*WM: [2] wifi mode: STA
[11:01:37]*WM: [1] config portal exiting
[11:01:38]{“mqtt_server”:“192.168.1.111”,“mqtt_port”:“1883”,“mqtt_user”:“xxxx”,“mqtt_pass”:“xxxxx”,“mqtt_topic”:“home/”,“gateway_name”:“OpenMQTTGateway”}N: BLE interval: 55555
[11:01:38]N: BLE scans number before connect: 10
[11:01:38]N: Publishing only BLE sensors: false
[11:01:38]N: minrssi: 100
[11:01:39]N: Setup OpenMQTTGateway end
[11:01:39]W: MQTT connection…
[11:01:40]N: Connected to broker
[11:01:40]N: Subject: /SYStoMQTT
[11:01:40]N: Received json : {“uptime”:93,“version”:“v0.9.5-beta”,“freemem”:34584,“rssi”:-58,“SSID”:“xxxxxxx”,“ip”:“192.168.1.210”,“mac”:“50:02:91:5F:E5:0D”,“wifiprt”:0,“interval”:55555,“scanbcnct”:10,“modules”:“BTHADiscovery”}
[11:03:40]N: Subject: /SYStoMQTT

@1technophile, maybe we could add a check in the setup() function of ZgatewayBT to issue an “AT” command and listen for the “OK” response to confirm that the HM-10 is connected? It might help with future debugging.

Since a specific HM-10 firmware version is also required, we could query for that as well and display it to the log.

If we want to get real fancy, we might be able to set the BAUD rate in setupBT() as well by cycling though different SoftwareSerial speeds and issuing the AT+BAUDx command. It might make setup a lot easier.

void setupBT() {
  .
  .
  .
  //Set BAUD rate to OMG Rate
  softserial.begin(HMSerialSpeed);

  unsigned long startTime = millis();
  String response = "";

  // Confirm the BT device is responding, max wait = 1s
  softserial.print(F("AT" CR));
  while (millis() - startTime < 1000 && response.length() < 2)
  {
     if (mySerial.available())
     {
       response += mySerial.read();
     }
  }

  if (response.toLowerCase() != "ok")
  {
    Log.notice(F("ERROR - BT module didn't respond. Please check connections and BAUD rate." CR));
  }
  .
  .
  .
1 Like

@gdc,
Is your nodemcu soldered to the perf board or can you remove it? If you can remove it, or you have another nodemcu, or a Serial-to-USB adapter (preferred), could you disconnect your HM-10 from your current circuit?

  • Using the Arduino program, upload the blink sketch, or anything simple that doesn’t use Serial.
  • Unplug the USB cable and connect the 5v, GND, and the RX, TX on the HM-10 pins to the 5v, GND, TX, RX pins on the NodeMCU. (Note to swap the RX and TX)
  • Plug the board back into your computer and in the Arduino, open the Serial Monitor. On the bottom of the window, set the BAUD to 9600 and send an “AT” command. (You may need to change the line ending from ‘NewLine’ to ‘Carriage Return’ or ‘Both NL and CR’ to get a response.)
  • If you don’t see a response or you see garbled text, go through all of the BAUD rates and try sending “AT” again for each. (Common ones are 9600, 38400, 57600, 115200)
  • If you get a response from something other than BAUD 9600, send the command “AT+BAUD0” to set the BAUD rate to 9600.

Once you have changed the BAUD to 9600 or confirmed that it was already on 9600, unplug everything and then plug it all back into your original circuit.

Your idea to incorporate the checks into the setup is a good one.

I have plugged the HM10 into a serial adaptor at 9600 and queried the HM10
AT = OK
AT+VERS? = HMsoft V610
AT+BAUD? = OK+Get:0
So it appears the HM10 is set up correctly, just not being recognised and set up by OMG

I agree, it would simplify the user setup and reduce the number of problems.

Is it possible to use a Arduino Uno for BLE with an HM10. if so what files are needed,
I still cant get this to work :face_with_raised_eyebrow:

Could you launch these different commands (in this order) when the HM10 is connected directly:
AT+ROLE1
AT+IMME1
AT+RESET
AT+DISA?

And post the serial monitor extract?

OK+Set:1
OK+Set:1
OK+RESET
OK+DISASOK+DISCEOK+DISASOK+DISCE

When sending AT+DISA? the HM10 should answer the devices result that you have nearby, so seems that the issue is related to the HM10 itself.
Could you try to update its firmware?

I get this
OKOK+RESETOK+DISASOK+DISA:ëìm¾pRÏÿ ØfAû"ó¬%®2y±wÜsD‹!Y6
OK+DISA:õjhÅÐÿLý¥“¤âO±¯ÏÆëadx%
OK+DISA:õjhÅÐaHCETCIGOLI RDL51822
OK+DISA:F¹ªJ™¬ŸþŸþkhMxMXSbbzEtà
OK+DISA:F¹ªJ™¬
ÿàÁÊ™1e
OK+DISCE
Loooks a Bit strange but I do see a BLE in there

Hi,

Could you indicate the goal you would like to achieve with the setup, please?

I am trying to use USB BLE devices ( link: https://www.aliexpress.com/item/4001105228170.html?spm=a2g0s.9042311.0.0.3b274c4d4A7mXs) in our cars to sense our prescence coming and going from the property. ie: when we leave home it senses we have left and shuts the appropriate garage door associated with that vehicle, and when we come home it opens the appropriate garage door.
I have tried GPS prescence for this but it is too inaccurate and slow to update which makes it unusable.
Does the log I have put up look normal to you or is it corrupted?

It is normal as the HM10 output hexadecimal.

It is strange nevertheless that you get only one result. I think it will be worth trying to update the HM10.

Ahh updating to V709 got it working now seeing the BLE devices in the serial monitor and in HA, Yay :grinning:
How does one decrease the time between scans from one minute to say 15 seconds?
1 Minute is a bit too long for my application.

I have found the setting for scan times and set it to what I need, appears to be working fine, Many thanks for your assistance in getting this working, you have a great attitude .Cheers John

1 Like

I got this too:
> 19:12:36.959 -> OK
> 19:12:41.128 -> OK+Set:1
> 19:12:47.698 -> OK+Set:1
> 19:13:02.267 -> OK+RESET
> 19:13:15.347 -> OK+DISAS
> 19:13:16.067 -> OK+DISA:_⸮eux⸮e⸮L$⸮f⸮^⸮NǰK7⸮t⸮⸮⸮
> 19:13:16.352 -> OK+DISA:⸮⸮%rxH⸮
> 19:13:16.386 ->
> 19:13:16.386 -> ⸮L]m~⸮
> 19:13:16.597 -> OK+DISA:⸮e⸮⸮e⸮Ẇ⸮⸮⸮⸮7¹9⸮e⸮⸮
> 19:13:16.669 -> OK+DISA:⸮e⸮⸮
> 19:13:16.707 -> Mi Band 3⸮⸮
> 19:13:17.220 -> OK+DISA:̌⸮⸮⸮ְ⸮
> 19:13:17.255 -> ⸮⸮̌⸮⸮
> 19:13:17.292 -> OK+DISA:̌⸮⸮⸮ SWAN
> 19:13:18.876 -> OK+DISCE

I’m really stuck with this problem.
My story is: I set up a gateway with IR, RF, DHT, PIR and BT. Everything works except BT. I already changed firmware, communicated with BT via serial on the same ESP8266 that I use OMG and tested others two identical BT modules.
I don’t know where else to go.

Ahahaha
Ok! I understand that
“AT+ROLE1
AT+IMME1
AT+RESET
AT+DISA?”
is the new “abracadabra”!

Now it magically worked.

Screen Shot 2020-10-28 at 19.47.46

Thanks.

1 Like