Fixed PIN pairing on Bluegiga BLE112 Bluetooth module

31. August 2015 11:30 by Jens Willy Johannsen
Categories: General

I needed to make a Bluetooth LE device that required a more secure pairing with the companion iOS app than just "Click Pair to connect…".

This can easily be implemented in BTLE using a bonded, encrypted connection with man-in-the-middle protection enabled. But the device needs either a display to show the code which should be entered on the iOS device, or a keypad to enter the code shown on the iOS device. If the device has neither, then only the "Just works" method can be used. And this will not prompt for a passkey/PIN code.

"But can't I just hardcode a PIN code in the firmware," I asked Google. And Google said, "No, fixed-passkey authentication is not supported in Bluetooth LE."

But it turns out that there is a solution: pretend the BTLE device has a display and specify a hardcoded passkey in the config.xml file. That way, instead of generating a random key to display to the user, the hardcoded passkey will be generated instead.

Read the entire post »

Comments 1 comment »

iBeacons ready

3. September 2013 11:42 by Jens Willy Johannsen
Categories: General

UPDATE: BLE112 firmware source code can be downloaded here: BLE112 iBeacon firmware. It should be pretty well documented so please try to figure it out yourself before asking :)

Here's a snap of the first two "production" iBeacons (not really production models but a lot prettier than the previous mess-o-wires prototype). They are based on BLE112 Bluetooth modules and contains nothing more than a coin cell battery, a tiny DIP switch for configuring the device identifier without re-flashing the firmware, a capacitor and a diode for reverse polarity protection when external power is used instead of the coin cell battery. And a BLE112 module, of course.

Click for larger image

Click for larger image


Here are the Eagle files for schematic and board:



The firmware source code can be downloaded here: BLE112 iBeacon firmware.

Comments 81 comments »

iBeacon working!

12. August 2013 0:05 by Jens Willy Johannsen
Categories: General

Yea and verily! I've successfully flashed a BLE112 with firmware that makes it behave as an iBeacon that can be used for iOS 7's Bluetooth LE location services.

By using a CC2540 USB Dongle and TI's SmartRF Packet Sniffer application and an iPhone running a sample app provided by Apple on the Development site, I reverse engineered the iBeacon protocol and made a firmware project for a BLE112 using a minimal GATT profile and a BGScript to set the custom advertising data required for a iBeacon.

I guess I'd better design a PCB for a minimal circuit containing a BLE112, a 3 V coin cell and a programming header.

The iBeacon in all its glory. And a bunch of unused wires.

The iBeacon in all its glory. And a bunch of unused wires.

Comments 8 comments »

iBeacons: iOS 7 and Bluetooth LE positioning

9. August 2013 9:14 by Jens Willy Johannsen
Categories: General

Apple has announced the introduction of Bluetooth LE-based positioning in their iOS 7 framework. Apps can now get notified when entering a region which basically is defined as being close enough to a BTLE beacon with a specific identifier.

The iOS framework already supports the concept of regions and notifications when entering regions, but until now the system has relied on GPS and WiFi positioning. Which will not be able to provide very accurate positioning data when used indoors.

Bluetooth LE-based positioning, however, will work just fine. And will be able to provide very accurate positioning data. Right down to "you are standing in front of this particular sculpture in the museum" or "you are standing at check-in counter number 18". Nice.

In keeping with the classic Apple way of doing things, Apple has decided not to use the existing Bluetooth Proximity Profile but do things their own way.

Since Apple has not published the specifications for the iBeacon protocol yet, I had to snif the Bluetooth packets from an iBeacon device (using a TI CC2540 USB Dongle and their SmartRF Packet Sniffer –

Apple puts all the required information into the advertising packets in a "Manufacturer Specific Data" field of connectable undirected advertising events.

Apple's iOS 7 pre-release documentation shows what properties are available for iBeacons (but I'm not going to tell you since that information is still under NDA) so they are fairly easy to spot in the advertising data and so it should be easy to copy – and if necessary modify – that data and put it into a BLE112 of my own.

I'll keep you posted as to how it works…

No comments No comments »