Skip to main content

How To Add BlinkUp To Your Mobile App

What is Electric Imp’s BlinkUp Technology?

Optical BlinkUp

If you haven’t used an imp-enabled device before, you may be unfamiliar with the the BlinkUp™ process. Put simply, it’s a mechanism for transmitting data to an imp optically. It works by encoding the data — typically a device identification token and network configuration information — into a sequence of fixed values which are used to set the brightness of a mobile phone or tablet screen, a computer monitor or and LED.

The following short video shows BlinkUp in action, from the perspective of the end-user of your connected product:

BlinkUp supports two modes, one using maximum and minimum brightness transmitted at a fixed rate (60Hz), or a second using three values (maximum, mid and minimum) and uses embedded clock data so that BlinkUp operates as fast as the host device can drive the transmitter.

A photosensor on the imp-enabled device reads the optical signal — a sequence of flashes — and converts it back into useful information. The imp uses the data to connect and gain access to the Electric Imp impCloud™.

At the application level, the BlinkUp process centers on obtaining the information that will be transmitted — an enrollment token from the impCloud and, if required, local network access credentials from the end-user — then transmitting that data to the imp-enabled device.

Typically, the app will then periodically poll the impCloud to discover that the imp has connected and been permitted to access. When the poll response indicates that the device has been authorize to access the impCloud, the application also received the unique URL at which the device’s agent can be contacted the device’s unique ID. How this information is used, and where and whether it is retained will depend on the policy of the manufacturer of the device, and on the level of interaction between app and product. For example, the agent URL may be stored and used by the app to transmit commands from the end-user to the device.

This application-level BlinkUp flow is illustrated in the diagram below:

The BlinkUp flow

To add BlinkUp to a mobile app, you use Electric Imp’s BlinkUp SDK. This can be downloaded from the Dev Center here, in its Android and iOS forms (for mobile app development) and as a JavaScript library (for web-based apps). All key calls to the SDK must be authorized with a BlinkUp API Key, which is only made available to Electric Imp Customers, ie. companies and organizations who have a commercial relationship with Electric Imp. For more information on becoming an Electric Imp Customer, please contact us.

All customers will need to the use the BlinkUp SDK, if only to use it to drive the BlinkUp transmission process. The BlinkUp SDK also incorporates a UI for capturing log-in details for the end-user’s WiFi network, but this is optional, and customers may prefer to implement their own network capture UI.

For more information on supporting BlinkUp in your connected product hardware, please see ‘BlinkUp Tuning’. Though this document is aimed at helping hardware designers construct and then tune the optical circuit that will be built into their imp-based connected products.

Bluetooth BlinkUp

For imps which support Bluetooth LE (currently imp004m and imp006 only) it is possible to transmit device enrollment and network data to the imp by this means rather than the optical method. Support for Bluetooth BlinkUp is not integrated into impOS™ so it must be integrated into your application firmware which must therefore be capable of running as soon as your product is powered up for the first time (this is the default setting for the Electric Imp Connected Factory Process; see Application Firmware Loading) in order to load the Bluetooth sub-system’s own firmware, to activate Bluetooth and to serve the Bluetooth GATT services with which your mobile app will communicate.

Your app will still require the BlinkUp SDK, which is used to mediate an initial request for enrollment data and to perform post-BlinkUp polling. This occurs much as optical BlinkUp does, but here the SDK is not told to flash the mobile phone’s screen; instead, the app sends the enrollment data to the imp.

If you wish to try Bluetooth LE BlinkUp with your imp004m- or imp006-based product, we have some sample iOS app and device Squirrel code for you here. There is also a full guide on using Bluetooth LE with the imp004m for other roles.