Saturday, January 24, 2015

How to update the Firmware on the RedBear BLE Mini


RedBear Labs has built a fantastic small profile, low cost, Bluetooth Low Energy board which is perfect for prototyping or hobby IoT projects:

From their website:

You can now incorporate Bluetooth 4.0 Low Energy (BLE) technology easily in your project with our BLE Mini. BLE Mini requires only a serial port for communication so it supports all major development platforms that have UART interface including Arduino, Raspberry Pi, Netduino, BeagleBone etc. In addition, we provide you with access to all Ti's CC2540 I/O pins and the ability to upload firmware via USB, making the BLE Mini an ideal development/prototyping board for your BLE project/accessory/Appcessory.

To get the most out of the BLE Mini you’re probably going to want to install the latest firmware.  It turns out it’s a fairly straight forward process, but there are a few things worth noting.

1st – Download the latest Firmware

You can download the latest firmware from GitHub here:

For the BLE Mini we’re looking for a file labelled “Biscuit-UART-xxxxxxxx.bin”.  At the time of writing it’s “Biscuit-UART_20140409.bin” which was built in April, 2014.

2nd – Find a Windows 7 PC

Unfortunately the firmware update cannot be updated from Windows 8/8.1.  In the RedBear forums it states it should work from a Windows 7 Virtual Machine.  However, I tried it from within a VMWare Player Windows 7 VM, and although I was able to reach the BLE Mini, I wasn’t able to update the firmware.

Fortunately I still have my trusty little Acer 1810T running Windows 7, which I used to update the firmware.

3rd – Connect the BLE Mini to the Win7 PC

There’s one small black button on the top the BLE Mini, close to the Micro USB port.  Hold this down while  connecting your Mini via a regular USB Micro cable.

The first time you connect the BLE Mini this way, Windows will probably need to search for drivers.  Once you see the “Installing device driver software” popup in the system tray, leave the BLE Mini connected but you can let go of the button.


Once it’s installed you’re ready to move on, and you should see a new disk in the file explorer with a capacity of 240 KB.


4th – Update the Firmware

Now it’s simply a matter of removing the old .bin file and copying in the new one.  You may want to back up the old version “just in case”.

Just be warned, when I updated my two BLE Minis, they both rebooted after every file operation.  And I needed to repeat the process of holding down the button and reconnecting the BLE Mini to continue.  Otherwise it was a smooth and simple process. 

Again just replace the old .bin file with the new one, no need to rename the file, etc.


5th – Test it Out

Disconnect the BLE Mini and then reconnect it to a power source (without holding the button).  If the green light comes on you should be all set.  RedBear also has free iOS and Android BLE Controller Apps you can use to test functionality. 

The behaviour of the new firmware seems to be basically the same, with improved stability and connectivity, but the broadcast name has been changed from “Biscuit” to “BLE Mini”.  All of the services and characteristic GUIDs should be the same.

Now If something goes horribly wrong, there are instructions for resetting and reformatting the BLE Mini in the RedBear Labs forums:

If you’re not sure where to go next, I have some sample code to connect to the BLE Mini from Windows Phone 8.1 here:

And here’s an article introducing BLE communication between a similar BLE board from Seeed Studios using Android: 

And finally, when you’re ready for a bigger task, check out the Monkey Robotics project.  It has a ton of great code including a walkthrough to build a BLE controlled car using the RedBear BLE Mini, and connecting from a Xamarin Forms project:


Tuesday, January 13, 2015

Open the Settings app Programmatically from Xamarin iOS


When Apple released iOS 8, it came with a massive API update.  They released a number of new frameworks and over 4000 new APIs.  So needless to say, I’m still discovering new toys and tricks that released with the latest version.

A really cool feature included in iOS 8 is the ability to launch the built in settings app from within our applications; something we haven’t been able to do since iOS 5 (and was removed again in iOS 5.1).

This is useful for multiple reasons.  First, you can add app preferences and expose them through the settings app: 

However, this isn’t all that common, primarily because it required the user to leave your app and search through the Settings app.

But it also means we have quick way to push users to toggle things like permission to use location data.

Fortunately it’s also fairly easy to do, we simply need to create and open a NSUrl with the correct string: {app-settings:}.  And this is conveniently available as a static property on the UIApplication class.

Do note, this only works in iOS8 so if you’re app is compatible with older versions of iOS, you should check you’re running on iOS8 first; this will cause an exception on older versions.

if (UIDevice.CurrentDevice.CheckSystemVersion(8, 0))
var settingsString
= UIKit.UIApplication.OpenSettingsUrlString;
var url
= new NSUrl (settingsString);
UIApplication.SharedApplication.OpenUrl (url);