HOWTO Change Espruino Bluetooth name and passkey

Posted on
  • (Ugh.. sorry, wrong user logged in)

  • If you have more than one Espruino with the standard HC-05 Bluetooth attached, it can be a little confusing as they may all have the same name, HC-05, appearing on the PC. Also, by default they'll have the same default passkey, 1234, which you'll probably want to change.

    You can reconfigure the name and passkey by connecting to the HC-05 Bluetooth module from the Espruino itself, but to do so you'll need to put it into Command Mode. NOTE: This change is persistent, in that if you change it to something weird or you forget the new passkey, you'll need to repeat all this to change it back. (Also, don't blame me if it goes wrong...)

    1. Wire Pin 34 on the HC-05 to 3.3V. I did this by temporarily soldering on a wire and clipping it to the 3.3V pin on the Espruino. The pin is the one at the top right corner when viewing the HC-05 with the squiggly antenna trace at the top. In other words, it's the pin marked with the orange dot here:

    2. Connect the Espruino via USB to your PC. As the HC-05's Pin 34 is high on reset, it should put the HC-05 into Command Mode.

    3. Connect to the Espruino via the Web IDE as normal.

    4. As you've connected via USB rather than Bluetooth, the HC-05 itself is now on Serial1, in Command Mode and configured at 38400 baud.

    5. Run:

    Serial1.setup(38400);
    Serial1.onData(function (d) {console.log(d.data);});
    Serial1.println('AT+PSWD:1701');
    Serial1.println('AT+NAME:Espruino1');
    

    Then:

    1. Power down, disconnect, unsolder the pin.

    2. Power up the Espruino via a power supply (rather than via PC's USB port)

    3. It should now be available to pair under the new name Espruino1 and passkey 1701!

    Additional note: at the time of writing, on Mac, the Web IDE won't list Bluetooth serial ports, due to a limitation in Google Chrome. Instead, you have to fool Chrome into thinking it's a USB serial port by creating a symbolic link.

    To do so, pair the device, start Terminal.app, and do something like:

    cd /dev
    ls tty*
    

    Recognise the desired tty (eg. tty.Espruino1-DevB if following the instructions listed above) and:

    sudo ln -s tty.Espruino1-DevB tty.usbmodem1701
    

    Refresh the Web IDE's connection list. It should show the device under the name tty.usbmodem1701. You'll need to replace the tty.Espruino1-DevB in the command above with the correct name chosen in the reconfiguration steps above.

  • Hi Tom,

    This is fantastic, thanks for the write-up! Would you mind if I copied that into the Espruino documentation?

  • Of course, and feel free to edit and clarify where necessary :)

  • Gah. Just to clarify: yes, that was me. For some reason, I can't log in as me other than via Chrome.

  • I did the following for the HC-06...

    Before paired, HC-06 is at the AT mode. So no soldering will be necessary.

    1. Connect the Espruino via USB to your PC. Be sure that the HC-06 isn't paired.

    2. Connect to the Espruino via the Web IDE as normal.

    3. Run:

    Serial1.on('data', function (data) {console.log(data);}); 
    Serial1.print("AT+NAMEEspruino");
    Serial1.print("AT+PIN1701");
    
    1. Power down and disconnect

    Note: The new name and password will become active after discharged all the energy of the module. If the module still has any energy, the old one is still active. In the test, for discharging all the system energy and activating the new password, we can connect the power supply PIN with GND about 20 seconds after the power is cut off. Generally, shutting down the device for 30 minutes also can discharge the energy.

  • Thanks! I'll have to try and see if that works on HC-05 as well.

    Is the module receptive to AT commands whenever it has no connection, or is it just the very first time?

  • Unfortunately that works just on HC-06 and HC-04.

    Yes, the HC-06 is in AT-Mode, whenever it isn't connected.

    More information can be found at...
    http://www.exp-tech.de/service/datasheet­/HC-Serial-Bluetooth-Products.pdf

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

HOWTO Change Espruino Bluetooth name and passkey

Posted by Avatar for user6304 @user6304

Actions