One of the most interesting uses for gesture sensing is connecting real world user gestures to "virtual" systems such as apps or games which can receive those gestures and take almost infinite number of actions based on those inputs.This opens up a world of applications from the small, such as smart switches that control your home lights, to museum exhibitions, in-store marketing and even wide scale "Playable Cities" projects (for example under the Future Cities Catapult) Far too many application to mention in this simple blog post.
The Microchip MGC3130 Gesture IC looked perfect for this, so one of the first things I did when I received the MGC3130 Hillstar development kit for the Element14 roadtest was to try and connect it to "world" independently of the PC.
My technology of choice for connecting devices in the past 2 years has been Bluetooth Smart (I'll refer to it as Bluetooth Low Energy or BLE), an ultra low power, low latency, low cost, longer range version of Bluetooth - recently popularized by "iBeacon" proximity implementations. This lets me not only connect to computers (OSX, Linux and Windows 8) but also to any of the 4 major mobile operating systems: iOS, Android, WP8.1 and Blackberry. All this with minimal power draw (around 15mA peak in transmit, which is very brief, most of the time it's only a few μA in idle) and great easy integration with apps.
The Hillstar modular approach makes connecting to external controllers very easy. We simply remove the USB-to-I2C module and connect our controller directly to the I2C pins.
Now for the controller, I could have used an Arduino here (but note the MGC3130 uses 3.3V logic levels!) and a Bluetooth LE shield such as the one from RedBearLabs or Adafruit. However my go-to device for Bluetooth LE prototyping is still without a doubt the RFduino. For those who don't know the RFduino, it's a module that ported the Arduino environment to the ARM Cortex M0 processor that sits inside a Nordic nRF151822 Bluetooth Smart SoC. It works directly with the Arduino IDE (uses the same ARM compiler as the Arduino Due and now the Arduino Zero) and provides an easy to use Bluetooth LE stack on top. It runs on 3.3V (same as the MGC3130). It's also really really small:
It's not expensive, around £10 for one module or £15 if you want it mounted on a breadboard friendly PCB . The simplicity comes with limitations of course the biggest being that you can't create your own BLE protocol - or use encryption - so if you plan to get more serious with BLE you should check out something like one of the native Nordic nRF51822 development boards. Microchip themselves have also announced a Bluetooth Smart module, the RN4020, which I'm looking forward to trying when available. Still at the moment, you can't beat the RFduino for quick prototyping and proof of concept.
So here's my setup:
- Hillstar electrode board
- Microchip MGC3130 GestIC board
- RFduino DIP module (RFD22102)
- RFduino Double AAA battery shield (RFD22126)
- 2.54mm to 2mm pitch adapter cable (the MGC3130 is 2mm pitch)
For the Arduino code (that runs on the RFduino) I made some simple modifications to the Hover library since that board also uses the same MGC3130. The only tweaks were to make it work with the RFduino. Once the RFduino was programmed and connected to the Hillstar I ran the Hover example which prints the gesture events:
Success!
Inspired by the progress I added Bluetooth code to the Hover example to send the events via Bluetooth LE. This again was very easy, essentially you only need three function calls to have BLE working and sending data with the RFduino. It's that easy.
Once the RFduino was programmed I removed it from the USB and connected to the RFduino battery pack since I also wanted to try the Hillstar in battery powered, portable operation. I also was afraid of issues to do with lack of earth grounding but this wasn't a problem at all. The RFduino battery pack is excellent for this since it provides regulated 3.3V DC out of 2xAAA batteries.
Then I made a little iPhone app to illustrate the operation:
Again this worked very well and proved the MGC3130 Hillstar is ready to connect to devices and join the exciting world of apps!
The next step will be to work on power management, right not the circuit consumes around 22mA continuously which isn't ideal for battery runtime. The MGC3130 has a self wake-up mode which can can put itself to sleep and wake up when there's activity nearby, also triggering one of the EIO pins to wake up the host (RFduino). The EIO pins are available on the MGC3130 board but need to be soldered.
Other relatively simple plan in the near future is to connect the Hillstar to another device over the air (or multiple Hillstars) using the mesh-like Nordic GZLL protocol, which is supported in the RFduino concurrently with Bluetooth LE.
Finally I'll follow this up with an MBED library for the MGC3130 which will open up more Bluetooth LE possibilities, for example emulating HID (over GATT) modes.