Programming for the Nuimo Controller
Inside Bluetooth Low Energy for Connected Devices
We (Senic YC S13) have been developing our hardware product Nuimo — a freely programmable, wireless controller for connected devices.
We wanted to share our experience of using Bluetooth Low Energy including how a BLE connection works, an intro to our GATT profile, and ways you can advantage of the sensory inputs and LED matrix output of the Nuimo.
Input and Output for Nuimo
The Nuimo controller offers a number inputs that are easily mappable to computer applications or connected devices.
The four main sensor inputs include an analog ring that runs around the circumference of the device, capacitive touch, haptic click and a gesture sensor that allow a sweep motion over the device or upwards from the device. The Nuimo also features an 11x11 LED matrix that can show simple graphics through the face of the device.
Input: Turn of the High-Precision Ring (Rotate left and Rotate right)
Input: Capacitive Touch (4 different swipes: top-bottom, bottom-top, left-right and right-left)
Input: Gesture Control (Gesture up, Gesture down, Fly-over left and Fly-over right)
Output: LED Matrix Output
Understanding Bluetooth Low Energy
Nuimo connects via Bluetooth Low Energy (aka Bluetooth 4.0, BLE or Bluetooth Smart). Bluetooth Low Energy is a relatively new standard introduced in 2010. In contrast to other low power connection standards like Zigbee or 6LoWPAN, BLE is built into most smartphones, computers and smart hubs.
BLE is designed for the periodic transfer of small amounts of sensor data, requiring extremely low power consumption. BLE devices maintain a sleep mode most of the time until a connection has been initiated with a peripheral device. This makes BLE an excellent choice for wearables and other mobile hardware devices that rely on battery power.
Depending on the module, the peak current while sending data is about 10 mA. Due to very short initial connection times, the average current is as low as just a few uA. This makes it possible for devices to run on the power of just a coin cell battery for up to a few years.
Likewise, for a high-throughput stream of data (> 100 kbps), classic Bluetooth or Wifi may be better options — although they require more power than BLE.
How Bluetooth Low Energy Works
The BLE connection is created between two devices:
- A Central Device acting as the client that scans for and establishes the connection.
- A Peripheral Device acting as the server that ‘advertises’ for and accepts incoming connections.
The connection happens when the peripheral device sends out an advertising package that denotes it is prepared to accept data. The central device picks up this package and requests an exclusive connection with the peripheral device. The peripheral device stops advertising, accepts the connection and data can then be exchanged.
Nuimo is a peripheral device and acts as the server which can be paired with either your smartphone or computer as the central device.
Over the next months, we will be adding more direct integrations with the major smart home hubs. At the moment, 30+ applications and integrations are supported including Philips Hue, LIFX to Spotify and Sonos.
Advertising and Scanning
The advertising package from the peripheral device (in this case nuimo) has a data payload of up to 31 bytes and includes the basic header information. Header information can include things like name, service UUID or similar info to be transmitted. This means that data can already be received from the advertising device even without establishing a connection. Each package is sent at an interval ranging from 20ms to around 10 seconds — the shorter the interval, the faster the connection is established and the higher the power consumption.
A GATT Profile (or Generic Attribute Profile) defines the exchange model between devices connected with BLE. This GATT profile governs the connection and allows the devices to discover, read, write and push data. The data being pushed is encapsulated in a service which consists of one or more characteristics. There are a number of predefined GATT profiles and characteristics by the Bluetooth SIG. In the case of Nuimo we have created a custom profile for Nuimo.
The input for the four sensors in Nuimo are evaluated by a microcontroller which detects the type of gesture or input performed by the user (a turn left of the aluminum ring or swipe movement on the top surface for example).
The input gesture is converted into a GATT-based characteristic (to optimize the communication for low throughput)and is then transferred by BLE radio. In the reverse, the central device can send writable bits that controls the LED matrix display as an output.
In order to grow our community of developers interested in the Nuimo, we will open the access to our git repo and provide anyone with two sample applications; one native OSX app and a ruby application to start development. We will continue to add further examples, support and operating systems over the next months.
To read more on the hardware development of Nuimo see our blog post “How we built the Nuimo.” If you would like to develop for the Nuimo controller, you can pre-order Nuimo today and check out our newsletter
You can always find us to ask questions or share great ideas at firstname.lastname@example.org.
Who Are We?
We are Senic, a Berlin-based hardware and software startup building our first product — the Nuimo controller. We are a team of designers and engineers dedicated to building the future of interface for the home and office.