DIY PAR meter, Yeah you heard me - Page 12 - The Planted Tank Forum
 
LinkBack Thread Tools Display Modes
post #166 of 731 (permalink) Old 02-16-2012, 03:21 AM
Planted Tank Enthusiast
 
O2surplus's Avatar
 
Join Date: Jan 2010
Location: "Out West, in the Land of Fruits & Nuts"
Posts: 813
I think I must have done something right. After making a few mods to Mistergreen's code to match the lcd circuit that my controller uses, I uploaded the code and SHAZZAAAAM! It works-



Here's the modified code-
Code:
#include <LiquidCrystal.h> // modified by O2surplus

float average = 0;
float output = 0;
float factor = 1.52;
unsigned long time;
int counter = 0;
// create the LCD
LiquidCrystal lcd(8, 7, 5, 4, 16, 2);
// set up backlight
int bkl = 6; // backlight pin

void setup() {
  time = millis();
    // set up the LCD's number of rows and columns: 
  lcd.begin(16, 2);
  // Print a message to the LCD.
  lcd.print("2noodles PAR");
  pinMode(bkl, OUTPUT);
  digitalWrite(bkl, HIGH);
  
}

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

  //every second or 1000 millis
  if(millis() > time+1000) {
     //corrections to fit par
   average = average/counter;
   
   if(average <= 560) {
     factor = 1.55;
   } else {
     factor = 1.36;
   }
   //corrects for high PAR
   output = average * factor;
   
    // set the cursor to column 0, line 1
    // (note: line 1 is the second row, since counting begins with 0):
    lcd.setCursor(0, 1);
    // print the number of seconds since reset:
    lcd.print(output);
  
    //reset timer & counter to get ready for the next second.
    time = millis();
    counter = 0;
    average = 0;
  }
}
Next will be to order some boards, put a couple together, and send'em to Mistergreen for evaluation and testing.
O2surplus is offline  
Sponsored Links
Advertisement
 
post #167 of 731 (permalink) Old 02-16-2012, 03:45 PM
Planted Tank Guru
 
HD Blazingwolf's Avatar
 
Join Date: May 2011
Location: Chattanooga, TN
Posts: 4,907
when this gets done. i will buy one to support the hobby. i can't do math, or coding, or decide whci hway to wire and code a microprocessor. i understand these principles well, just don't have the knack for actually making a system. but i can take anythign apart and replicate anything done efficiently which includes prewritten code, and fully assembled systems
HD Blazingwolf is offline  
post #168 of 731 (permalink) Old 02-16-2012, 05:57 PM Thread Starter
No more Bow ties
 
mistergreen's Avatar
 
Join Date: Dec 2006
Location: Cincinnati
Posts: 15,773
I'll make sure it's calibrated to actual PAR numbers and then will post it on the S&S probably. It'll probably be $40 - $50 over-all... Not sure about encasing this in a project box or not for the sake of cost and assembly time. Maybe we'll leave that up to you guys.

mistergreen is offline  
post #169 of 731 (permalink) Old 02-16-2012, 07:16 PM
Planted Tank Enthusiast
 
O2surplus's Avatar
 
Join Date: Jan 2010
Location: "Out West, in the Land of Fruits & Nuts"
Posts: 813
Mistergreen- Can you think of anything, component wise, that should be added to the PCB? I was wondering if it would be prudent, to add another 1kohm pot inline with the 27kohm resistor, to allow for fine tuning of the signal coming from the photo diode? It's a simple matter to make any additions now, prior to the board production run.

Last edited by O2surplus; 02-16-2012 at 07:18 PM. Reason: corrected punctuation
O2surplus is offline  
post #170 of 731 (permalink) Old 02-16-2012, 08:20 PM Thread Starter
No more Bow ties
 
mistergreen's Avatar
 
Join Date: Dec 2006
Location: Cincinnati
Posts: 15,773
Quote:
Originally Posted by O2surplus View Post
Mistergreen- Can you think of anything, component wise, that should be added to the PCB? I was wondering if it would be prudent, to add another 1kohm pot inline with the 27kohm resistor, to allow for fine tuning of the signal coming from the photo diode? It's a simple matter to make any additions now, prior to the board production run.
That's actually a pretty good idea. I was going to adjust the code for fine tuning

mistergreen is offline  
post #171 of 731 (permalink) Old 02-17-2012, 03:54 AM
Planted Member
 
aaronbrown's Avatar
 
Join Date: Apr 2010
Location: st peter mn
Posts: 240
i want one when you get them up and operational just let me know the price and where to send it
aaronbrown is offline  
post #172 of 731 (permalink) Old 02-17-2012, 05:43 AM
Planted Tank Enthusiast
 
O2surplus's Avatar
 
Join Date: Jan 2010
Location: "Out West, in the Land of Fruits & Nuts"
Posts: 813
Ok - I added a 5kohm pot in line with the resistor. I dropped the value of the resistor to 24.9k ohms so that with the additional resistance provided by the pot, total circuit resistance can be varied from the 27k Ohm target + or - 2.5k. This should allow for an increased PAR sensor calibration range. Here's the latest PCB. I'll send the files out for production and have some boards by next weekend.
O2surplus is offline  
post #173 of 731 (permalink) Old 02-17-2012, 05:56 AM
Wannabe Guru
 
Chlorophile's Avatar
 
Join Date: Aug 2011
Location: State of Emergency
Posts: 1,274
Quote:
Originally Posted by O2surplus View Post
Mistergreen- Can you think of anything, component wise, that should be added to the PCB? I was wondering if it would be prudent, to add another 1kohm pot inline with the 27kohm resistor, to allow for fine tuning of the signal coming from the photo diode? It's a simple matter to make any additions now, prior to the board production run.
I have no idea what that might do, but I am wondering if that is something that maybe the end user shouldn't be able to tweak?
What would the effect be of adjusting the potentiometer?
It seems it would be nice for us all to have identical equipment so our readings are comparable.
Again I don't know what the heck it does, but I am wondering.
Chlorophile is offline  
post #174 of 731 (permalink) Old 02-17-2012, 06:46 AM Thread Starter
No more Bow ties
 
mistergreen's Avatar
 
Join Date: Dec 2006
Location: Cincinnati
Posts: 15,773
When you build applications, you try to be flexible so not to paint yourself into a corner. Things are rarely fixed so a little calibration is needed but the end product should be standardized.

For instance, a 27k resistor isn't really 27k. It can vary from 26.6k to 27.2k or something like that. That affects the read out. So, having a pot, I can calibrate the read out to match actual par readings.

I have an apogee par sensor.

mistergreen is offline  
post #175 of 731 (permalink) Old 02-17-2012, 05:45 PM
Planted Tank Enthusiast
 
O2surplus's Avatar
 
Join Date: Jan 2010
Location: "Out West, in the Land of Fruits & Nuts"
Posts: 813
Ok everyone- I sent the PCB design files to SeeedStudio this morning. If everything goes smoothly, I should have 10 of the Pcb's in my hands in about 9 days. I'll then solder some of them up and send them out to Mistergreen for testing.

Mistergreen- Please send me a PM with your mailing address, when you have time.
O2surplus is offline  
post #176 of 731 (permalink) Old 02-17-2012, 07:39 PM
Planted Tank Guru
 
audioaficionado's Avatar
 
Join Date: Apr 2011
Location: Medford, Orygun
Posts: 2,202
Subscribed.

It will be nice for a DIY alternative to the $$$ least expensive units I've looked at.

Steve

45 gal tall high-tech : 2-23-12 update
Complete CO2 Leak Test : How to build a CO2 regulator

Never argue with a fool. Onlookers often can't tell the difference.
Growing older is mandatory, growing up is optional.
My advice is free and worth every penny.
audioaficionado is offline  
post #177 of 731 (permalink) Old 02-18-2012, 02:56 AM
Planted Member
 
mahko's Avatar
 
Join Date: Dec 2011
Location: Calgary
Posts: 174
Same. Subscribed. This looks really cool.
mahko is offline  
post #178 of 731 (permalink) Old 02-18-2012, 02:59 PM Thread Starter
No more Bow ties
 
mistergreen's Avatar
 
Join Date: Dec 2006
Location: Cincinnati
Posts: 15,773
Let's give this a name. How about "Close enough PAR".
O2Surplus, If you're going to upload the binary, can you change the 2noodles to that? It's 16 characters exactly

mistergreen is offline  
post #179 of 731 (permalink) Old 02-18-2012, 05:44 PM
Planted Tank Enthusiast
 
O2surplus's Avatar
 
Join Date: Jan 2010
Location: "Out West, in the Land of Fruits & Nuts"
Posts: 813
Quote:
Originally Posted by mistergreen View Post
Let's give this a name. How about "Close enough PAR".
O2Surplus, If you're going to upload the binary, can you change the 2noodles to that? It's 16 characters exactly
I can do that. I was going to name mine " H&H PAR" which is short hand for "Horse shoes & Hand Grenades". since you only have to be "close enough" with either to win .
O2surplus is offline  
post #180 of 731 (permalink) Old 02-18-2012, 07:53 PM
Algae Grower
 
Join Date: Nov 2011
Location: Winnipeg, Canada
Posts: 107
How does a person get a place on the waiting list for these?
tentacles is offline  
Reply

Quick Reply
Message:
Options

Register Now



In order to be able to post messages on the The Planted Tank Forum forums, you must first register.
Please enter your desired user name, your email address and other required details in the form below.

User Name:
Password
Please enter a password for your user account. Note that passwords are case-sensitive.

Password:


Confirm Password:
Email Address
Please enter a valid email address for yourself.

Email Address:
OR

Log-in









Human Verification

In order to verify that you are a human and not a spam bot, please enter the answer into the following box below based on the instructions contained in the graphic.



Thread Tools
Show Printable Version Show Printable Version
Email this Page Email this Page
Display Modes
Linear Mode Linear Mode



Posting Rules  
You may post new threads
You may post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

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