Sign In SIGN UP UPGRADE

Electric Imp + Photoresistor

Photoresistor splash image

Getting started

The Electric Imp is a really unique microcontroller. It's really simple to set up WIFI and get it talking to the cloud. We'll show you how to hook up a light sensor to your Imp, and start visualizing some data! We'll be using the plotly REST API, and a simple HTTP request library on the IMP. If you have any issues, don't hesistate to reach out to the Plotly Community!

Materials

  • Electric Imp
  • Electric Imp breakout board (April board or Sparkfun board)
  • Photoresistor
  • 10k resistor
  • Hookup wires
  • Half-size breadboard
Photoresistor Parts

Hooking it up

PHOTORESISTOR PIN1 Imp 3.3V
PHOTORESISTOR PIN2 10K Resistor Imp GND
PHOTORESISTOR PIN2 Imp PIN8

Photoresistor hookup

Software

Grab the Agent and Device .nuts here:

The script

Copy and paste the Agent and Device nuts to the respective section in the Electric Imp IDE. Don't forget to change the user credentials in the agent.nut payload to your own!

local payload = {
    un = "username",
    key = "api_key",
    origin = "plot",
    platform = "electricimp",
    args = http.jsonencode(data),
    kwargs = http.jsonencode(layout),
    version = "0.0.1"
};

Wrapping it up

Save and run the code! You'll get a URL for your graph in the Imp's console. Check it out to see your data!