Electric Imp is a technology company that provides connectivity for the Internet of Things. They offer perhaps the simplest way to enable any physical object to be connected to the Internet thanks to their “Imp” module, a powerful piece of hardware containing WiFi and a processor.

The imp001 is a memory card from-factor 802.11 node that can be easily configured to provide wireless access in your application.

In this guide you’ll learn how to read an analog input from your Electric Imp and send its value to Ubidots.



1.- The best way to become familiar with the Imp is to follow their Blinkup guide, which helps you link your device to your Electric Imp account:Blinkup Tutorial The most important thing to know is that the Electric Imp IDE is divided in three main windows: agent code, device code, and the log.

  • Agent code window: This code is run in the Imp cloud, not in your device. It allows you to do heavy processing, HTTP requests, store small amounts of data, etc.
  • Device code window: As the name suggests, this code WILL be run in your device. Here’s where you typically manage input/ouput pins that connect the Imp to the real world.
  • Log window: Very useful to understand what’s going on, both in the Agent and in the Device code.

2.- Hardware Setup

  • Connect one end of the photocell to “PIN9” of your Imp, and the other end to “3V3”.
  • Connect one end of the 1k resistor to “PIN9” of your Imp, and the other end to “GND”.

Send one value to Ubidots

After going through the Blinkup tutorial and setting up your Ubidots account, you can now program the Imp to send data to Ubidots by following these steps:

1.- In the Electric Imp IDE, you should see an empty workspace with one “Unassigned Device” in the left side. This means your Imp has been detected but is not yet assigned to any project:

2.- Click on “Create New Model” and assign your device to this model:

3.- Copy and paste the followings Agent and Device blocks of code:

NOTE: Please note that you should replace your TOKEN with the one from your Ubidots account.

Agent Code

#require "Ubidots.agent.lib.nut:1.0.0"

Ubidots <- Ubidots.Client("9DriKmYujOJZ2x637376xbFtaSLvq0");

local VAR_LABEL  =  "humidity";


device.on("saveValue", function(value) {
    Ubidots.sendToVariable(VAR_LABEL, value);
    server.log("Sending data to Ubidots");

Device Code

sensor <- hardware.pin9;

function mainLoop() {
    imp.wakeup(1.0, mainLoop);
    local value = hardware.pin9.read();
    agent.send("saveValue", value);


Here’s how it would look like after putting your code:

Did this answer your question?