The Planted Tank Forum - View Single Post - DIY PAR meter, Yeah you heard me
View Single Post
post #18 of (permalink) Old 11-10-2010, 04:03 PM Thread Starter
Children Boogie
mistergreen's Avatar
Join Date: Dec 2006
Location: Cincinnati
Posts: 16,743
I don't think I showed you how I'm reading the values so far.

It's all through USB... It's supplying the ardiuno power and a way for the ardiuno to communicate to my computer...
This is my serial monitor outputting the values.

The values jump/dance around like it's being hit by photons, kinda cool. So I wrote the code to find the average within every second...

unsigned long average = 0;
unsigned long time;
int counter = 0;

void setup() {
  time = millis();

void loop() {
  int sensorValue = analogRead(0);
  average += sensorValue;

  //every second or 1000 millis
  if(millis() > time+1000) {
    average = average/counter;
    //reset timer & counter to get ready for the next second.
    time = millis();
    counter = 0;
    average = 0;
Oh, I double checked the readings by going outside... Full sun will give me the maximum value of 1023.. In the shade, around 100-120.

mistergreen is offline  
For the best viewing experience please update your browser to Google Chrome