Coming 2/25: New Trailhead Login Experience & Account Merge. Check out all the details here!.

Set Up the Electric Imp Hardware

If you are using an impExplorer Kit:

First we need to assemble the impExplorer Kit. The kit comes with these components.

  • An imp001 card, which contains a Wi-Fi radio and the microcontroller in an SD card form factor, that drives all the logic for the board.
  • The impExplorer board into which the card is plugged.

Hardware Setup

  • Plug the imp001 card into the card slot on the impExplorer.
  • Power up your impExplorer Kit with the provided mini-B USB cable or the AA batteries.
  • The imp001 should now have power and be blinking amber (or red if it has been used before).

Assembled, it should look like this.

Assembled impExplorer Kit: the imp001 card in place (left) and the three AA batteries in the underside bay (right)

If you are using a Battery Powered Sensor Node:

  • Add batteries and power up your device, ensure the power switch is on.
  • The led on the front should now have power and be blinking amber (or red if it has been used before).

Battery Powered Sensor Node

Electric Imp BlinkUp

A challenge for connected products is being able to securely provision a device to a network without a user interface to enter credentials on the device. To solve this problem, Electric Imp uses an optical provisioning process called BlinkUp™, which securely provides a device with Wi-Fi access credentials and authenticates and enrolls it into the Electric Imp impCloud™ in a single step. This is done via the Electric Imp mobile developer app for this project and for other PoCs and prototypes. For production-level products, the BlinkUp functionality can be incorporated as an SDK in a customer’s mobile application or via JavaScript in a web browser.

  1. Launch the app.
  2. Sign in to your Electric Imp account.
  3. At the main menu, tap Configure a Device.
  4. Select Wireless.
  5. Enter your Wi-Fi credentials.
  6. Follow the instructions in the app to activate your device.
  7. After a successful BlinkUp, the app will show you your Electric Imp Device’s unique device ID. You will need this later.

When you enter your Wi-Fi details, the app may set the SSID field for you. It will enter the name of the network your phone or tablet is connected to. This may not be the one you wish to connect your impExplorer to; if not, just tap on the name to key in the correct SSID.

The impExplorer or BPSN needs to connect to a 2.4GHz 802.11n Wi-Fi network, so you will need to make sure one is available. This is especially the case if your phone is connected to a 5GHz network as the impExplorer or BPSN will not be able to connect to this. You may need to set up a separate or guest network to try this example. If in doubt, consult your network manager.

If you have any issues getting started with your Electric Imp account or device, please follow Steps 1 through 7 in the full getting started guide.

The Electric Imp Platform

What differentiates Electric Imp from traditional IoT approaches is that all components and services of a solution are designed, integrated, and managed together.

The Electric Imp IoT solution starts with the purpose-built impOS™, which provides secure cloud connectivity services to products, enabling users to concentrate on creating code to bring their products’ functions to life.

The impOS runs on an imp-Authorized module, which ensures silicon-level hardened security. The imp-authorized module is placed inside a device, component, or product and provides a powerful local compute capability and connections to application-specific sensors and actuators. The module also provides local intelligence and IP-based cloud connectivity via Wi-Fi, ethernet or cellular. The module is not manufactured or sold by Electric Imp, but instead available through Electric Imp’s hardware distribution partners.

The impModule connects securely to the impCloud agent, which is a fully programmable middleware. The impCloud agent enables custom in-flight data processing and integrations to the customer’s downstream cloud data and application services. This unique architecture delivers the flexibility necessary for real-world IoT solutions and is what makes scaling solutions effortless and automatic. The impCloud agent operate as the device’s front end to the Internet. It securely connects to Salesforce IoT via a high-performance cloud-to-cloud REST integration, letting you easily push data to and take commands from Platform Events.

In this example, the agent code receives data from the device and forwards it to Salesforce as a Platform Event, as the following diagram shows.

An Electric Imp Application: the device, running device code, connects to its agent in the impCloud. The agent, running agent code, is the device's front end to the Internet, and communicates with external resources such as Salesforce

Salesforce Smart Refrigerator device code:

When the code is deployed via the impCentral IDE to the device, impOS automatically restarts the device code and establishes a secure, managed connection to its paired agent. At a high level, the device code performs the following functions.

  1. Turns on the impOS power-save functionality to reduce battery use
  2. Initializes the temperature and humidity sensors (the light sensor is already initialized by impOS when the device boots)
  3. Starts a timer to fire events every READING_INTERVAL_SEC seconds
  4. On every timer event
    1. Read the temperature sensor value
    2. Read the humidity sensor value
    3. Determine if door is open (based on light sensor above threshold)
    4. Send a message (with values for temperature, humidity, door open) to the paired agent
  5. Repeat at #4 until new code is deployed or the device is powered off

Salesforce Smart Refrigerator agent code:

When the code is deployed via the impCentral IDE to the agent container, the agent code is restarted and connects to its paired device over a secure, managed connection. At a high level, the agent code performs the following functions.

  1. Includes the prebuilt Salesforce library for easy integration with the Salesforce Cloud.
  2. Authenticates with the Salesforce Cloud Smart Fridge Application using the CONSUMER_KEY and CONSUMER_SECRET.
  3. Registers a handler to receive messages from the device.
  4. On every received message from the device:
    1. Read the message values (temperature, humidity, door open).
    2. Create a platform event containing the device ID, timestamp, doorOpen flag, temperature and humidity values.
    3. Send the platform event to Salesforce via the Salesforce integration library.
  5. Repeat at #4 until new code is deployed.

We won’t check any of your setup. Click Verify Step to go to the next step in the project.