HM-10 BLE Module - not working

Posted on
  • I soldered the HM-10 module to the Espruino according to this page: http://www.espruino.com/Bluetooth+BLE
    Actually I was switching back and forth between that page and the HM-05 page, and ended up accidentally soldering pin 34 as well. Then, trying to get the solder off, I soldered 33 too. I gave up at that point so those 2 pins are also currently soldered.

    I do NOT have pin 24 soldered (yet). That seems to be optional?

    Anyway, I plugged the Espruino in to my Mac via the USB cable and... I'm not sure what to do next. The AT commands:

    "Serial1.on('data', function (data) {console.log(data);});
    Serial1.print("AT")"

    Just return "Undefined". No other output.

    Questions:

    1. Where does power for the HM-10 come from? Is it just taken for granted that the user knows to hook some power up somewhere?

    2. Assuming there's power going to the HM-10 board from Espruino somehow: the HC-05 tutorial says "Simply pair with this module and enter the pairing code 1234.". Does that mean connect with my Mac's bluetooth capability? It's not appearing in the bluetooth list. I also tried with my iPhone 4s, it's not in that list either.

    3. Also on the HC-05 page, it says "Note: If you power the board from your PC's USB port, it will move the console to USB and you will get no response from the Bluetooth connection." So I tried just using a USB wall plug, but still the bluetooth connection isn't showing up on Mac or iPhone.

    4. I have pin 23 just soldered down to Espruino. I'm not sure what is happening in the picture on the HM-10 page with pin 23, it looks like a big blob of solder. And this makes it seem like it's optional, just for configuration: "In order to use pin 23, connect this pin via a switch to ground (defaul position of the switch is open). Also connect this pin via a resistor of 1k to 3.3V." If I do need to do something with this pin, do I really add the stuff to BOTH the ground and 3.3V?

    5. What are my next steps for troubleshooting this?

    Thanks.

  • HM-05 page? Do you mean HC-05 (http://www.espruino.com/Bluetooth)

    I don't have a HM-10 here to test with, but as far as I know (in answer to your questions)

    1. The power should come from the same place as in the HC-05 (the 2 corner pins near where pin A4. Most of the pads are not connected to anything, so it won't actually matter if you solder them - as long as they are not shorted together.

    2. Yes, even if you connect only the two power pins, I believe you should be able to pair it, so my guess is that somehow power is not connected up.

    3. That won't be an issue when writing Serial1.print("AT")/etc. What it's saying is that the 'console' - the thing you're writing commands into - will be on USB... But when you power from a wall supply it'll automatically move to Serial1, so you can program Espruino over bluetooth.

    Having said that, HM-10 is different because it's BLE, so I don't believe it'll directly emulate a serial port.

    1. He's connecting to the pin holes on the prototype area as a way to connect up the resistor/switch - which is why there seems to be a blob. The connection with the resistor and switch is so you can put short the pin to ground with the switch, but it will normally be at 3.3v. For now it might be worth forgetting the switch and just connecting the pin to 3.3v with a resistor.

    Pin 24 is optional, but as it's a status LED, it might help you find out what's going on.

    1. First port of call would be checking that the module has power - maybe look at the datasheet and find some gnd and 3.3v pins, and then check with a volt meter.

    Next I'd probably try and put the status LED on so you can see the state of the module.

  • OK, I just ordered a volt meter. Probably should have had one of those before now. :|

  • I never could get that HM-10 module working, so I replaced it with a new one which worked great on the first try. Oh well. I've gotten a few parts now that are just simply DOA.

    Anyway, next question. When Espruino is plugged in and powered by the computer's USB, I can successfully connect to and communicate back and forth between the Espruino and my iPhone across bluetooth. Based on the tutorial I used (http://www.espruino.com/Bluetooth+BLE), I've been reading from and writing to Serial1.

    The problem is when I disconnect from the computer and power Espruino from the wall. I can successfully connect to it from the iPhone over bluetooth (I know this because the blinking status LED on pin 24 goes to solid on), but there's no communication going back and forth.

    What is happening?

    Thanks!

  • In that case, the console will be moved to serial1 - could that be causing the problem you describe?

  • Ahh. That's likely... Try LoopbackA.setConsole() on onInit. That'll move the console from Serial1 so it doesn't get in the way of the HM-10.

    That'll make it hard to program the board a second time after you have saved the code (you need the reset + btn1 trick), so you could try checking process.env and only changing the console if it is not set to 'USB'.

  • OK, that worked. I check the magical "process.env" on onInit, and if CONSOLE === USB then then I move the console to LoopbackA. All works well. Thanks!

  • well done @lavamantis ;-) It would be extremely helpful if you could post a simple app sample to help people test the espruino when the HC-10 is attached. Thanks in advance.

    (If you wondering what this could be, a beacon is one obvious simple app)

  • Yes, that'd be great - I don't actually have an HM-10 to test with so I can't do this.

    Just a simple bit of code that I could stick on the BLE page would be extremely handy.

    However it looks like there's a good PDF on HM-10 iBeacons here - it looks like just sending the magic sequence of commands from the iBeacon Configuration bit should do it:

    Serial1.print("AT+RENEW\r\nAT+RESET\r\nA­T\r\n");
    setTimeout(function() {
      var major = "0x1234":
      var minor = "0xFA01":
      var name = "ESPRUINO";
      Serial1.print("AT+MARJ"+major+"\r\nAT+MI­NO"+minor+"\r\n");
      Serial1.print("AT+ADVI5\r\nAT+NAME"+name­+"\r\nAT+ADTY3\r\nAT+IBEA1\r\nAT+DELO2\r­\n");
      Serial1.print("AT+PWRM0\r\n");// Enable auto-sleep
      Serial1.print("AT+RESET\r\n");
    }, 1000); 
    

    Ideally we could come up with an HM10-iBeacon module or similar that'd handle this though. It looks like it should even be able to handle putting the Espruino + HM-10 into deep sleep modes when needed.

  • Post a reply
    • Bold
    • Italics
    • Link
    • Image
    • List
    • Quote
    • code
    • Preview
About

HM-10 BLE Module - not working

Posted by Avatar for lavamantis @lavamantis

Actions