I am using a Nano and HM-10 BT that I bought off ebay. I suspect it's a clone. This is my first time using Arduino so I have been reading through many tutorials. My goal is to get 2 Nanos communicating via HM-10s. I'm using Martyn Currey's tutorial "HM-10 Bluetooth 4 BLE Modules". I followed the directions on wiring and used his sketch. I have 5V going to the EN terminal from previous tutorials/attempts and haven't disconnected it to match perfectly with the tutorial. I started off thinking I had an HC-05 and was REALLY screwed up for a while. Anyways, I can get the HM-10 to communicate with BLE scanner on my Note 8 using the serial monitor. It works from my phone to the HM-10 and from the HM-10 to the phone. It even sends emojis!
If I type "AT" in the serial monitor I get "OK". But it won't respond to commands. If I type "AT+NAME?" or any other command, there is no response. Am I missing something simple? I have the baud at 9600 and "Both NL & CR".
In the tutorial, there is no indication that this is necessary:
To see if the connections are correct we use the “AT” command. The “AT” command is used to confirm communication is working and all it does is return an “OK”. “AT” can also be used to break an active connection.
Enter “AT” (no quotes) in the text box and click Send. If everything is working you should see “OK”.
To check what firmware the HM-10 has, use AT+VERR?
Since you read him, you should do what Martyn tells you. I guess you have an HM-10 on a breakout board made for HC-0x, which is not unusual. HM-10 is in AT mode by default. The wire to EN is redundant, to the point where it may be connected to nothing but, just to be sure, you should disconnect it and try again.
I don't think it matters if it's a clone. You might have really screwed up, but I'm sure you haven't done any damage.
I noticed my module reports in BLE Scanner as "MLT-BT05". This does not match any of the tutorials I was using. I searched for this, and found more accurate AT commands here. AT mode is functional! I can issue commands, change the name, etc.
Of note:
SoftwareSerial works, AltSoftSerial does not. I couldn't get the OK from the AT command for AltSoftSerial, even though it would connect to the BLE Scanner and communicate both ways.
Nano pin D9 --> voltage divider --> Bluetooth RX
Nano pin D8 --> Bluetooth TX
5V is still connected to Bluetooth EN (it was still connected from previous attempts, I never removed it to try it without)
Type "AT+HELP" to get a list of the commands available. I found they are different from the link I posted above
To get two HM-10 modules to connect using the serial monitor:
Set one Nano to Master from the serial monitor by typing "AT+ROLE1"
That should change the blink rate on the Bluetooth module. It should blink twice as fast.
Initially I powered the slave from the same power source as the master because I wasn't sure if using USB from my laptop for both would screw up the connections. Turns out it doesn't matter. Both Nanos can be powered via USB cables.
From the serial monitor of the Master, type "AT+INQ"
It should respond with something like this: +INQ:1=0xC4F3123EE1CC
Type "AT+CONN1"
It should respond with +Connected and both lights should stay illuminated.
If after typing "AT+INQ" the response is only OK, it won't connect. Type "AT+RESET", then "AT+INQ" and see if it gives the proper result.
When these devices are going to be used out in the wild, my laptop will not be available. The Nanos need to connect automatically when powered up. I think the way to do this is by writing it into the sketch. I'll post the results if I figure it out.
The Bluetooth is supposed auto connect when powered up. Martyn talks about this in his tutorials. My clone doesn't mention autoconnect, and it doesn't respond to those commands. Martyn demonstrates how to manually connect to a Bluetooth device using AT commands in the sketch but I couldn't get it to work. So I ordered an original HM-10 board from Huamao (on Amazon) and that should take care of my autoconnect problems!
I received my Huamao HM-10, put it into Master mode and BEFORE I even had time to get nervous, it connected to the other clone board. Now I can move forward with the rest of my project!