HM10 + ESP8266 Unable to get OMG Working

Hi There, I have been trying to get OMG working in BLE mode on an ESP8266 with HM10 v607 connected. I have flashed Nodemcuv2-ble,bin and configured the web interface. HA sees the OMG integration but I cant see any BLE data on monitor or in HA. Serial monitor of boot is here, but it doesnt appear to set up BLE. what am I missing? Thanks John

Using ‘COM7’ as serial port.
Showing logs:
[20:00:21]r$[20:00:21]*WM: [2] Added Parameter: server
[20:00:21]*WM: [2] Added Parameter: port
[20:00:21]*WM: [2] Added Parameter: user
[20:00:21]*WM: [2] Added Parameter: pass
[20:00:21]*WM: [2] Added Parameter: name
[20:00:21]*WM: [3] Updated _max_params: 10
[20:00:21]*WM: [3] re-allocating params bytes: 40
[20:00:21]*WM: [2] Added Parameter: topic
[20:00:23]{“mqtt_server”:“192.168.1.111”,“mqtt_port”:“1883”,“mqtt_user”:“xxx”,“mqtt_pass”:“yyyyyy”,“mqtt_topic”:“home/”,“gateway_name”:“OpenMQTTGateway”}N: BLEinterval: 55555
[20:00:23]N: Minrssi: -100
[20:00:23]N: Setup OpenMQTTGateway end
[20:00:23]W: MQTT connection…
[20:00:23]N: Connected to broker
[20:00:23]N: Subject: /SYStoMQTT
[20:00:23]N: Received json : {“uptime”:2,“version”:“v0.9.4”,“freemem”:37256,“rssi”:-79,“SSID”:“xxxxxxx”,“ip”:“192.168.1.210”,“mac”:“50:02:91:5F:E5:0D”,“wifiprt”:0,“interval”:55555,“modules”:“BTHADiscovery”}

Could you verify the speed of the HM10 by using these tips ?

It may be due to a speed set to a higher or different baud rate compared to the requested 9600.

I have tried to do the speed check as per the instructions. With the default 115200 settings as you have set in the sketch it doesn’t work, but if I change the baud rate in the sketch to 9600 I can communicate with the HM10 and it returns 0 which is 9600. I then have to reflash the OMG binary to get it to communicate, but still get the previous logs result I sent yesterday.

115200 is the default OMG serial monitor speed not the HM10 one.
The HM10 one should be set to 9600.

Is OMG set to 9600 also ?

Could you post a photo of your setup please?

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.