Stamp2 Cloud & Dew Sensor
everest
Posts: 141
All,
Given how much help I've gotten on the forum, I thought I'd post the code for my latest project, which is working just perfectly at this point. . .at least so far!! This project consists of a Sensiron temp/humidity sensor, and a 10 degree IR sensor, both stock units purchased from Parallax. The Sensiron is wired to pins 4 and 5, and the MLX90614 is wired to pins 1, 2, and 3. I've added a total of 6 LEDs to pins 10-15 to this as well to provide a nice visual indicator of the currently measure environmental conditions, those are option if you were add an LCD or just hook it to a computer to see the debug output, which shows all the measured environmental data.
This will ultimately be included in my observatory for the purposes of detecting adverse conditions to stargazing, specifically cloud cover and heavy dew/moisture. If the MLX90614 is pointed straight up in the air, the unit will report on the cloud conditions: cloudy, overcast, or clear. Pin 12 will light up if either clouds or heavy dew/moisture is detected.
The debug output includes:
Ambient Temperature
Ambient Humidity
Current Dew Point
Sky Temperature
Cloud Conditions
I've been testing the unit and it's extremely accurate, detecting all but the thinnest of clouds, but it usually even catches those. You can adjust the sensitivity as noted in the code.
I do have a question. . .I'm looking to make this code more efficient and use less space on my Stamp2. . .any suggestions along those lines (or anything else) would be much appreciated. Thanks!
-Jeff
Given how much help I've gotten on the forum, I thought I'd post the code for my latest project, which is working just perfectly at this point. . .at least so far!! This project consists of a Sensiron temp/humidity sensor, and a 10 degree IR sensor, both stock units purchased from Parallax. The Sensiron is wired to pins 4 and 5, and the MLX90614 is wired to pins 1, 2, and 3. I've added a total of 6 LEDs to pins 10-15 to this as well to provide a nice visual indicator of the currently measure environmental conditions, those are option if you were add an LCD or just hook it to a computer to see the debug output, which shows all the measured environmental data.
This will ultimately be included in my observatory for the purposes of detecting adverse conditions to stargazing, specifically cloud cover and heavy dew/moisture. If the MLX90614 is pointed straight up in the air, the unit will report on the cloud conditions: cloudy, overcast, or clear. Pin 12 will light up if either clouds or heavy dew/moisture is detected.
The debug output includes:
Ambient Temperature
Ambient Humidity
Current Dew Point
Sky Temperature
Cloud Conditions
I've been testing the unit and it's extremely accurate, detecting all but the thinnest of clouds, but it usually even catches those. You can adjust the sensitivity as noted in the code.
I do have a question. . .I'm looking to make this code more efficient and use less space on my Stamp2. . .any suggestions along those lines (or anything else) would be much appreciated. Thanks!
-Jeff
Comments
you save 1% of memory buy doing that
This can be put in a sub routine you had it three times in you· code
LOW 15
LOW 14
LOW 13
LOW 12
You may find·other thing that are the same and you do same thing
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
··Thanks for any··that you may have and all of your time finding them
·
·
·
·
Sam
Post Edited (sam_sam_sam) : 6/2/2009 4:06:34 AM GMT
Your if/else s can be optimized (and clarified) by making them elseif s:
-Jeff