ThingSpeak with Arduino and Processing

Light Sensor and Motion Sensor Using ThingSpeak, Arduino, and Processing 15 Apr 2011



« Back to Posts


“Thingspeak.com” allows one to post information gathered by a networked device in real time.  I decided that I would test out the system with a simple light sensor. Then, I went further by developing a new Processing application which detects motion using a webcam and posts it to a ThingSpeak channel.

I’ve been working with microcontrollers for some time, but Thingspeak.com is a great way to connect those microcontrollers to the world.

Light Sensor Development

First, I made a simple program to learn how to send an HTTP GET request to thingspeak.com: thingspeaktest.zip. The program sends any numeric key press as a value to the thingspeak server.

Then I made the circuit to interface the light sensor to the Arduino.

Connecting the light sensitive resistor to the Arduino.
Connecting the light sensitive resistor to the Arduino.
Closeup of the finished circuit.
Closeup of the finished circuit.

The code I uploaded to the Arduino couldn’t be simpler:

Then, I modified my original processing app so that it forwards data received from the arduino to the server: click here to download

Screen Shot of Processing App
Screen Shot of Processing App

Motion Sensor Development

After making the system with the light sensor, I had the idea to make a motion sensor using a webcam.

The Processing application essentially does the following:

Screenshot of the Processing app displaying in the background the motion currently occuring in the frame.
Screenshot of the Processing app displaying in the background the motion currently occuring in the frame.

Results

Click here for a live graph of the light sensor data(Not active)

Click here for a live graph of the motion data. (Not Active)

My first bit of output from the system after leaving it running over night. Click for live graph of data.
My first bit of output from the system after leaving it running over night. Click for live graph of data.

After getting it to work, I checked the output after leaving it over night. I was surprised to find that in the dark, the output was a regular sawtooth wave. What is the source of this strange signal? Noize? No. I actually have a clock on the wall which displays the time as the number of dots illuminated for each digit. The sawtooth signal is due to the last digit of the time incrementing—pretty cool!




comments powered by Disqus