Electric Imp is a connectivity platform for connecting Wi-Fi devices to cloud services, much like RealTime.io and Iota Wi-Fi modules and Spark.io. Some Electric Imp module’s come in an SD card form factor and adds Wi-Fi connectivity to what’s connected to the Electric Imp module. Access to the Electric Module happens via the Electric Imp cloud and its APIs. While connectivity is simplified with the Electric Imp system, you will need a data service like ThingSpeak to complete the Internet of Things experience. Once data from Electric Imp devices are in ThingSpeak, you can easily build applications and interactivity with other devices and platforms.
Electric Imp to ThingSpeak Overview
Once an Electric Imp module is connected to a local Wi-Fi network, the module can post data to ThingSpeak via an “agent” running on the Electric Imp Cloud. Any data can be sent to ThingSpeak and then retrieved via ThingSpeak APIs.
Stuff You Will Need
- Electric Imp Wi-Fi SD Module (SparkFun / Adafruit)
- Electric Imp Breakout Board (SparkFun)
- Mini USB Cable
- 5v DC Power Supply
- Electric Imp Planner User Account
- Electric Imp BlinkUp App (download from Google Play or the App Store)
- ThingSpeak User Account (Sign In / Sign Up)
Step 1: Create ThingSpeak User Account
In order to get started, you will need to have a free ThingSpeak User Account. If you have a user account, sign in and move to the next step.
- Visit https://thingspeak.com
- To create a new ThingSpeak User Account, click Sign Up
- Sign in to ThingSpeak
Step 2: Create ThingSpeak Channel
ThingSpeak Channels are were data from Electric Imp will be stored. This procedure will create a blank channel ready for data from your Electric Imp Wi-Fi module.
- Sign into ThingSpeak
- Select Channels
- Click “Create New Channel”
- Enter a name for your channel, “Electric Imp Channel”
- Enter a name for Field 1, “Analog Input”
- Click “Update Channel”
Step 3: Assemble Electric Imp Breakout Board
- Solder headers into the Electric Imp Breakout board (SparkFun Tutorial)
- Jumper the power jumper to the USB side so that the breakout board can be powered with a USB cable
- Insert the Electric Imp module into the SD slot of the breakout
- Plug Mini USB cable into a 5v DC power supply and connect it to the breakout board
Step 4: Create Electric Imp User Account
- Visit ide.electricimp.com/login
- Sign in with your existing Electric Imp Account or sign up for a new Electric Imp User Account
Step 5: Register the Electric Imp to your User Account with the BlinkUp App
- Download and install the BlinkUp App (Apple App Store / Google Play)
- Sign into the BlinkUp with your Electric Imp User Account
- Enter your Wi-Fi info
- Select “Send BlinkUp”
- Hold phone to the edge of the Electric Imp Wi-Fi module
Note: If the BlinkUp fails, try checking the “Legacy BlinkUp Mode” option.
Step 6: Program Electric Imp via the Planner IDE
In this tutorial, we are going to send the Analog Input value from Pin 9 of the Electric Imp to a ThingSpeak Channel. In order to program the Electric Imp, sign in and copy the Electric Imp sample code into the Electric Imp Web-based IDE.
- Visit ide.electricimp.com/login
- Sign in with your existing Electric Imp Account
- Select the registered Electric Imp device
- Copy the “send_analog_input/agent.nut” example code into the Agent section
- Change the “X-THINGSPEAKAPIKEY” from “XXXXXXXXXXXX” to your ThingSpeak Channel’s Write API Key
- Copy the “send_analog_input/device.nut” example code into the Device section
- Click “Build and Run”
If everything is working correctly, you will see the analog input value from Pin 9 of the Electric Imp in your ThingSpeak Channel chart for Field 1.
Resources
- Electric Imp to ThingSpeak Source Code on GitHub
- Electric Imp Breakout Hookup Guide on SparkFun
- ThingSpeak Channel Documentation