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.
- 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.
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).
Electric Imp BlinkUp
- Launch the app.
- Sign in to your Electric Imp account.
- At the main menu, tap Configure a Device.
- Select Wireless.
- Enter your Wi-Fi credentials.
- Follow the instructions in the app to activate your device.
- 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.
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.
- Turns on the impOS power-save functionality to reduce battery use
- Initializes the temperature and humidity sensors (the light sensor is already initialized by impOS when the device boots)
- Starts a timer to fire events every READING_INTERVAL_SEC seconds
- On every timer event
- Read the temperature sensor value
- Read the humidity sensor value
- Determine if door is open (based on light sensor above threshold)
- Send a message (with values for temperature, humidity, door open) to the paired agent
- 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.
- Includes the prebuilt Salesforce library for easy integration with the Salesforce Cloud.
- Authenticates with the Salesforce Cloud Smart Fridge Application using the CONSUMER_KEY and CONSUMER_SECRET.
- Registers a handler to receive messages from the device.
- On every received message from the device:
- Read the message values (temperature, humidity, door open).
- Create a platform event containing the device ID, timestamp, doorOpen flag, temperature and humidity values.
- Send the platform event to Salesforce via the Salesforce integration library.
- 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.