Logging 3 photo-resistors

 

I have three photoresistors in my study that are measuring light coming from 3 directions and showing the live and historical data on the graphs below.

IMG_9037

How did I do it?

Simple circuit.  Here is how the Arduino is hooked up.  (The resistors are 10k.)

ConnectionDiagram

/* Simple test of the functionality of the photo resistor

Connect a resistor (around 10k is a good value, higher
values gives higher readings) from pin 0 to GND. (see appendix of arduino notebook page 37 for schematics).

—————————————————-

PhotoR 10K
+5 o—/\/\/–.–/\/\/—o GND
|
Pin 0 o———–

Similar setup for Pin 1 & Pin 2.

—————————————————-
*/

int lightLeftPin= A0;
int lightMidPin =A1;
int lightRightPin = A2;

int lightLeft, lightMid, lightRight;

void setup()
{
Serial.begin(9600); //Begin serial communcation
}

void loop()
{

lightLeft = analogRead(lightLeftPin);
lightMid = analogRead(lightMidPin);
lightRight = analogRead(lightRightPin);

Serial.println(“###BOD”);
Serial.print(“light_right,”);
Serial.println(lightRight);
Serial.println(“###EOD”);
delay(15000);

Serial.println(“###BOD”);
Serial.print(“light_mid,”);
Serial.println(lightMid);
Serial.println(“###EOD”);

delay(15000);

Serial.println(“###BOD”);
Serial.print(“light_left,”);
Serial.println(lightLeft);
Serial.println(“###EOD”);

delay(15000);
}

I then setup an account at ThingSpeak.com

And to connect the arduino to the internet I used my laptop and a program called Seriot.  It can be downloaded from:

 

nuewire.com/seriot/

This program will listen to the serial port and write the data to ThingSpeak.com

 

seriot

You can then use Restful API calls to get to the data and to chart it.

They have a nice ChartEditor

thingspeak.com/channels/23070/charts/

thingspeak-charteditor

ThingSpeak

 

Leave a Reply

Your email address will not be published. Required fields are marked *