• 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.

About

Avatar for tomgidden @tomgidden started