dougieh.com

BLED112 Bluetooth Low Energy Dongle

At WWDC last year I went to a pretty interesting Core Bluetooth 101 session (link requires an Apple Developer account) that covered the Bluetooth Low Energy capabilities of iOS. Prior to the session, I had no idea that newer iOS devices can communicate with other devices and systems via Bluetooth LE without requiring an MFI license from Apple. The iPhone 4S, iPad 3 and all newer devices ship with a Bluetooth 4.0 radio that supports BLE.

A Bluegiga BLED112 dongle Since then, I’ve been mulling over some ideas for projects with Arduino or Raspberry Pi communicating with iOS so I bought a Bluegiga BLED112 Bluetooth “integrated stack” dongle for $35 from Mouser to experiment with BLE in iOS.

The dongle is not a regular Bluetooth dongle - it doesn’t support talking to keyboards, mice and other regular Bluetooth devices - but it does provide a fully integrated Bluetooth LE stack on the chip itself. Basically, the dongle will appear as a serial device on your PC / Mac / Linux / Raspberry Pi and it provides a built-in API for working with BLE via a standard UART interface. The dongle also has a scripting capability where you can run scripts on the dongle itself rather than requiring an external CPU - I’m less interested in this feature but it’s pretty cool nonetheless.

An Apple USB Extension Cable The BLED112 is pretty small and feels a little fragile - its also a tight fit in most USB slots that I tried so I use mine by connecting it to an old Apple Keyboard USB extension cord. You can get similar small USB extension cords on Monoprice for less than a dollar and I’d recommend it as you will have to reboot the dongle during development (lots of plugging and unplugging).

My dongle shipped with a “thermometer” profile built in and was running v1.0.3 of the Bluegiga API (BGAPI). A quick dig around the Bluegiga forum (free registration required) and I upgraded to the latest “beta 2” build v1.1.0 which offers improved speed and stability.

Installing the BLED112 drivers in Windows

Although the BLED112 acts as a serial port when connected to Mac / Linux etc. it will require you to install drivers to interact with the dongle on Windows if you want to upgrade the firmware or install your own BLE GATT profile. I followed the following process on a Windows XP VMWare instance on my Mac to get the tools up and running:

  1. Download the Bluetooth Smart v.1.1.0 beta 2 Software Development Kit from Bluegiga and unzip the SDK to your C: drive - it will create a directory structure starting at C:\ble\
  2. Connect the BLED112 dongle to your USB port
  3. Windows will detect the new hardware and will prompt to install drivers - the regular dongle drivers are here: C:\ble\windrv\
  4. Once installed, the dongle will appear as a COM port called “Bluegiga Bluetooth Low Energy (COM X)” under Windows Device Manager.

BLED112 COM Port

Upgrading the BLED112

The docs on Bluegiga are pretty extensive but I found them a little tricky to navigate, so I’ve outlined the steps I followed here to upgrade my v1.0.3 dongle to the latest v1.1.0 (beta):

Note: these instructions require Windows and this kind of firmware update can brick the dongle - follow at your own risk!

  1. Install the dongle under Windows as above
  2. Launch the Bluegiga BLEGUI application from: C:\ble\bin\blegui2.exe
  3. In the BLEGUI main window, select “Bluegiga Bluetooth Low Energy (COM)” from the drop down at the top of the screen
  4. Click the “Attach” button to attach BLEGUI to the dongle
  5. Now we need to put the dongle into Firmware Update mode - in the BLEGUI menubar select “Commands -> DFU” which will reboot the dongle in DFU mode
  6. Windows will now detect the dongle as a new kind of USB device (it’ll show as a libusb (WinUSB) device in Device Manager) and will prompt you again for drivers - the DFU drivers are in the same location as the Windows drivers above: C:\ble\windrv\
  7. Once the drivers are installed, we now need the USB Vendor ID (VID) and Product ID (PID) of the dongle in DFU mode - this should be the same for you as it was for me, but to be sure navigate to the “libusb (WinUSB)” section of Device Manager and double-click the dongle. Under the description tab you should see a string that looks like “USB\VID_2458&PID_FFFE\1234” - this would give you a VID of 2458 and a PID of FFFE: BLED112 VID PID
  8. We’re now ready to flash the new firmware from the Windows command line so launch a cmd window (Start -> Run… -> cmd)
  9. The v1.1.0 firmware file will be in the following location: C:\ble\example\usbcdc\out.hex
  10. From the command line type the following to navigate to the firmware and flash to the dongle:
1
2
cd \ble\example\usbcdc\
..\..\..\bin\dfutool 2458:fffe out.hex

The new firmware will be written to BLED112 and if all goes well once the write hits 100%, the dongle will reboot in regular COM mode and Device Manager will refresh to show the dongle under the COM / LPT Ports section.

Comments