433mhz, infrared IR to and from MQTT on ESP8266

Is there any chance of a hm-10 clone work with the mqtt gateway? I just got a (not so) cheap one and discovered that it is a MLT-BT05. Not sure if it has all the necessary AT commands to make it work. I found some information about this clone here: https://blog.yavilevich.com/2017/03/mlt-bt05-ble-module-a-clone-of-a-clone/

thanks!

It could, try to connect to it by serial. Test the necessaries command to have a list of ble beacons and if successfull put these commands into ZgatewayBT instead of the standard ones.

Use serial connection with “Both NL&CR” instead of “No line ending” and 9600 baud rate on the original firmware and you can interrogate the module. Depending on the model, it might have some specific procedure for putting it into AT mode.

For clones, only flashing v540 mentioned also in the youtube video works as this firmware includes also the bootloader (the firmware for other versions above 540 from the manufacturer has only 248KB and I think it is due for original HM-10 modules).

Anyway, v540 on clone works with MQTT gateway.

Ignore my previous post about versions above 540 not flashing on clones.

Just need to run the specific command from HMConfigAssistant.exe to put it into update mode (AT+SBLUP). Then HMSoft.exe will be able to run (and firmware without bootloader can be uploaded).

Hey, that’s great! I had it on serial and had limited success in sending AT commands. Which commands should I use to scan/list ble beacons? @Petrica tried the AT+SBLUP and got nothing, so I’m not sure if it understand this command or not. Anyway, i will try the firmware upgrade.

Not really :slight_smile: I wasn’t paying attention to the instructions on how to update after flashing HM-10 thus I was stuck on v540 (command AT+SBLUP, which I was omitting, is the missing link as it is needed to put the device in upgrade mode on v540, thus after replacing original firmware).

In conclusion, steps are as following:
I. Initial flashing of HM-10 firmware
Solder the three pins to Arduino/Nodemcu and flash v540. All steps are described in the thread below. Nodemcu can be used instead of Arduino Uno/Mega, just need to modify pins in the CCLoader.ino sketch so that they match the ones from Nodemcu.

or in the Youtube video: https://www.youtube.com/watch?v=ez3491-v8Og

If everything worked fine, you now have a device with HM-10.

II. Updating HM-10 from v540
Soldering those three pins was needed to have access to the entire device memory and replace the original firmware with HM-10. Firmware v540 is needed for this as it is the only one available that includes also bootloader. Flashing any version above v540 with the above process will cause the device to brick (it can be re-flashed with v540, though; then the whole update process can be started again). For updates there is no further need for bootloader to be included with the firmware as it was already flashed with v540.

a) Download last firmware version from the manufacturer’s site (sometimes there are virus alerts when downloading the files…). Currently, the last version is v550.
The archive with the firmware includes also the two executable files needed for the flash (HMConfigAssistant - needed for the serial connection and HMSoft - for the flashing process). On the manufacturer’s site there’s also the pdf documentation of the upgrading procedure.
b) After playing around with AT commands in HMCofigAssistant.exe (select the proper com port and then click Open Com) send AT+SBLUP so it will enter update mode (note: the module will not respond to any other AT command until flashing is complete and led will stop blinking). Then close the Com port.
c) Open HMSoft.exe, select new firmware file, Com port and then click Load image.

The problem was that I haven’t read literally the instructions related to upgrading from the post mentioned above :slight_smile: :

For future update, the procedure are easier as you can now update the HM-10 via an USB to Serial converter, the firmware and the procedure are on the manufacturer website: www.jnhuamao.cn

Sole current issue is that the bluetooth module with HM-10 causes the host Nodemcu to restart (there is no trace in the serial connection of Nodemcu). I have several gateways in addition to the one with BLE (one with RF gateway on an Arduino Mega with ethernet shield and the others with IR gateway on Nodemcu for controlling AC/receiver/Xbox/etc) and another component for controlling MiLight bulbs (also on Nodemcu). For some 433mhz signals (from PIR sensors and light switches) or some commands sent to the light bulbs, the Nodemcu with BLE gateway restarts itself. Some time it works fine for a few days, then it restarts about 3-4 times per hour. I observed this on both v540 (which I had for some time) and v550.

1 Like

Thanks for the instructions! I did the first part: read the arduino forum instructions, soldered the pins and used a Arduino Uno to upload the CC2541hm10v540.bin file. The flashing seemed to work, but right after that the red led on HM-10 clone turned off. I tried to connect it directly to the usb-serial and it didnt respond to AT commands. A re-flashing procedure seems to work, and the ccloader reports success, also the led turned on during the flashing and then off again at the end. I didnt did the voltage divider and there was people saying it wasnt needed (the clone seems to have the voltage regulator). Maybe this could be the problem…

What settings did you used for the serial monitor after flashing v540? If using serial monitor from Arduino IDE, with the original firmware it needed “Both NL & CR” however after flashing v540 it should be “No line ending”. In both cases a 9600 baud rate should be chosen.

Maybe the device works after all (have you tried using a bluetooth sniffer? after flashing it shows as HMSoft) and only the led is off. There is a post mentioned above referencing a problem with the led.

when upload the OpenMQTTGateway.ino

get this error:
Arduino:1.8.3 (Linux),:“Generic ESP8266 Module, 80 MHz, 40MHz, DIO, 115200, 4M (3M SPIFFS), nodemcu, Serial1, None”

In file included from /home/jxjhheric/桌面/OpenMQTTGateway-master/OpenMQTTGateway/OpenMQTTGateway.ino:42:0:
User_config.h:200: error: ‘D7’ was not declared in this scope
#define BT_RX D7 //ESP8266 RX connect HM-10 TX
^
/home/jxjhheric/桌面/OpenMQTTGateway-master/OpenMQTTGateway/ZgatewayBT.ino:39:27: note: in expansion of macro ‘BT_RX’
SoftwareSerial softserial(BT_RX, BT_TX);
^
User_config.h:201: error: ‘D6’ was not declared in this scope
#define BT_TX D6 //ESP8266 TX connect HM-10 RX
^
/home/jxjhheric/桌面/OpenMQTTGateway-master/OpenMQTTGateway/ZgatewayBT.ino:39:34: note: in expansion of macro ‘BT_TX’
SoftwareSerial softserial(BT_RX, BT_TX);
^
exit status 1
‘D7’ was not declared in this scope

My post was referring to modifying sketch needed for flashing HM-10 on bluetooth clones (the sketch is CCLoader.ino). Were you trying to modify the pins from Arduino in OpenMQTTGateway.ino to use it for flashing the bluetooth module?

no,i successful flash the CC2541hm10v540.bin follow your post

i just flash a new nodemcu with the OpenMQTTGateway.ino,and get the error

that‘s about OpenMQTTGateway.ino not CCLoader.ino

Do you have all the files (7 * ino and User_config.h) from the repository in the same folder? I needed to add IRremote.h and IRremoteESP8266.h from the Arduino library in the same folder with the sketches otherwise it won’t compile.

Did you modify also pubsub to allow for larger MQTT payloads (MQTT_MAX_PACKET_SIZE to 1024/512 in Arduino\libraries\pubsubclient\src\PubSubClient.h)?

When all files are loaded in Arduino IDE it should look something like this.

Do you have all the files (7 * ino and User_config.h) from the repository in the same folder?

YES there are all in the same folder

Did you modify also pubsub to allow for larger MQTT payloads (MQTT_MAX_PACKET_SIZE to 1024/512 in Arduino\libraries\pubsubclient\src\PubSubClient.h)?

Yes i modify MQTT_MAX_PACKET_SIZE to 512

Arduino IDE it now looks like

i don’t know why got the error

my nodemcu is V3

Then it is easy :slight_smile:

For flashing NodeMCU you need to use board NodeMCU 1.0 not generic

1 Like

yes,choose NodeMCU 1.0 not generic,then flashing is ok

but nothing get from “mosquitto_sub -t home/# -v”

  1. What is you HA configuration in regard of MQTT?
  2. What software do you use for MQTT? Did you use AllinOne install? As far as I’ve used, I had only troubles with the MQTT installed by default.
  3. What is the location of the MQTT? It is the same Rpi as the one used for HA? If yes, then you need to ensure there is no port conflict for 1883. Can you install Mosquitto on your separate Linux machine and test it? (you would need to reflash Nodemcu with the address of this new MQTT instance)
  4. What is the serial connection on the Nodemcu reporting in regard of the MQTT connection?

Rf/ir/dht all working greatly with the mosquitto installed with HA but ble no

serial connection on the Nodemcu shows connected with the mosquitto well

Could you show me a picture of your successful ble conf?

What does the serial monitor shows when connected to Nodemcu (using baud rate 115200)?

On the Nodemcu mine shows the following:

Sending BT data to MQTT
home/BTtoMQTT/314FFB8FEDE1 -060
home/BTtoMQTT/0024E4266306 -088
home/BTtoMQTT/546009F98C5B -070
BT sent by MQTT

In home/# the entries are only the values of RSSI (without the id of the BT device):
-060
-088
-079
thus the whole topic (for example: home/BTtoMQTT/314FFB8FEDE1 if you did not modify the sketch you downloaded, otherwise look for the configuration in the ino file) should be used to read for each device.

I’ve posted earlier HA configuration.

after reflash the firmware it‘s working

thank you so much bro

You’re welcome