Wednesday, 21 January 2015

IoT London Meetup

I was a speaker at IoT London last night. This is a really popular meetup with over 4,000 members and as is apparently the norm for this meetup, last night's event was significantly over subscribed, so we had a full house. From a poll taken, the attendees were a diverse bunch; software people, hardware people, designers, investors and press.

Kicking things off.....

The IoT London format is that you get 10 minutes to speak and 10 minutes for questions. I'd chosen to deliver a summary of new Bluetooth features from the recent 4.2 release plus a few which are imminent and one which is further down the road map but important to IoT.

I used my Thalmic Labs Myo gesture controller to control my presentation for the first time and overall it went quite well with only a couple of glitches which I'm inclined to put down to user error. It's a tool and you have to learn to use it properly. It's a nice demonstration of a Bluetooth Smart device with a custom profile too.

Gesturing with Myo to advance to my next slide!

 In summary, I talked about the ways in which Bluetooth Smart devices can now be connected to the wider internet; via the new RESTFul APIs for gateways, using the HTTP Proxy Service or by implementing 6LoWPAN over Bluetooth using the Internet Protocol Support Profile. I also talked about security improvements including the adoption of the Elliptic Curve Diffie Hellman key agreement protocol for super-secure pairing and improvements in power efficiency relating to the resolution of private MAC addresses by trusted (paired) devices. Finally I mentioned the data throughput increase that 4.2 makes possible (up to 2.5 x faster) and gave a sneak preview of the standardisation work the SIG have kicked off relating to mesh networks over Bluetooth Smart.

Kirstin Hancock from Blue Maestro followed me and gave us an update on the Blue Maestro success story! And we closed with a talk from resin.io. I spent an enjoyable hour after the presentations were over, talking with a steady stream of people with all sorts of things to ask or discuss. A best of breed meetup I'd say.

Saturday, 10 January 2015

It's not just about sensors - controlling machines with Bluetooth Smart

I got sent a Securemote developer board from Delphian Systems recently. It's great for demos and includes a temperature sensor, some LED lights, a motion sensor, some relays, a water detector sensor and... a solenoid and a motor. I was messing around with the solenoid and motor this morning and thought I'd post a quick video to show the thing in action. Bluetooth Smart controlling machines. Think about that! :-)

Bluetooth Machine Control from Martin Woolley on Vimeo.


Wednesday, 7 January 2015

Controlling things with the Myo Bluetooth gesture controller

Controlling my Arduino with the Myo gesture controller


Last year I got myself a Myo gesture controller from Thalmic Labs and have enjoyed following the product's progress from beta. The firmware works well now and gestures are reliably recognised. I fully expect that Myo will be my standard means of controlling Powerpoint presentations this year.

I was thinking about IoT and the role something like Myo might play. The question was, whilst Myo is easy to use with PC applications, either using the canned capabilities it comes with or by writing your own scripts, could I use it to interact with miscellaneous inanimate objects like lights?

I did some investigation using some Bluetooth tools and discovered that Myo uses a custom Bluetooth Smart profile with a number of custom services.

Myo's GATT services


In terms of GAP roles, it's a GAP Peripheral and advertises. GATT Notifications are used to communicate movement and gesture data to a connected device.

Myo protocol trace showing notifications
 I decided it would be interesting to try to use my Myo to control LED lights on a circuit board via my Arduino. The first question I had to answer was what the architecture of my solution would be.

Thalmic Labs have not yet published details of their custom profile so writing GATT client applications which connect directly with Myo, which acts as a GATT server, is difficult unless you use one of their APIs, such as the one for Android smart phones or you write scripts for your PC which work with their Myo Connect service. I didn't really want to have an intermediate device in between the Myo and my Arduino but realistically, without spending time I don't have, trying to reverse engineer their notifications from protocol traces, I had no choice. So I decided to write an Android application using the Myo official API that the Myo device would connect to and communicate with and create a custom GATT profile of my own for the Arduino and which I could use to control some LEDs and an LCD serial display.

My solution architecture

So how does this work exactly? The Android app is connected to both the Myo and to my Arduino/BLE shield. The app receives gesture data via the Myo API, formed from GATT notifications which the Myo is transmitting. The Android app takes the gesture data and uses it to send "commands" to the Arduino, which I've equipped with a custom profile I called the Simple Controller profile. It has a custom service, the Simple Controller service, which has a single characteristic to which I can write a value, representing a command of some sort. In the service implementation in my Arduino sketch, I respond to the characteristic write events by switching on an LED according to the gesture the characteristic value represents and I write the name of the gesture to the LCD display. Simples!

The Simple Controller profile implemented in the Arduino

Whilst this isn't my first choice architecture I have to say, it does in fact work fine. I'm hoping Thalmic Labs will provide details of their custom profile at some point in the future though so I can take a second look at this use case and see if I can eliminate the Android proxy component. Not a bad start though!

Here's a video of the solution in action. Enjoy it right here or if you prefer, over in Vimeo.

Controlling things with the Myo Bluetooth gesture controller from Martin Woolley on Vimeo.