hey guys, I'm reposting this from the old forum (It didn't process that I'd have to move it over... d'oh). here's the link to the original: http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl?num=1295845813
and here's the original text:
Hey guys, I just thought I'd post my largest sketch yet (11714 bytes
) that I've written that both compiles and does what I want. you know, probably. I haven't tested it in the field yet, but initial reports come back good! I put it into all different tabs, so I guess I'll paste one below the other? ah well.
Also, I'll let you know that I commented the code for the first time especially for this, I wouldn't have otherwise.
As I commented it, I noticed some stuff that could be better (bottom/top factoring etc) so I changed it, so no promises that it'll work. I'll also end up putting the methods' code into the loop rather than call them once each time, I just did that to keep it nice and neat.
Anyway, the purpose of this is to monitor my house's hot water system. We have some solar collectors up on the roof that heat our water with a backup regular heating element if it's cloudy for a couple days or something. I (my dad) thought it would be fun to monitor the system, see when stuff is on & off, see what temperature it is, and it would be so easy to do w/ arduino right? anyway, a year and a bit later, here's the finished code, fingers crossed. What it does is connects to a flash drive with a VDIP1 module and logs the times when two heat pumps and a heating element turn on and off and also logs the temperatures of two water pipes every five minutes. The heat pumps are both at 24VAC so I threw a diode in line with each (I might make a full wave rectifier if I feel like being productive) and voltage dividers to step it down. I'll probably end up changing it from a digitalRead to an analogRead because it'll pick up the AC better. The heating element is 240VAC so I just stuck a cell charger in there that brings it down to 5v and I'm reading that. I'm using two LM35s for the temperatures with the same setup as I wrote in a playground page a while back... http://www.arduino.cc/playground/Main/LM35HigherResolution
, basically just using internal analog reference.
I found that working with Strings with the VDIP1 generally saved my some headaches, so that's why they're all over the place in the code. I dunno if they actually make it better, but it gave me better results. Also, let me say something about the VDIP1. I HATE IT. IT'S THE WORST. I picked up electronics about a year and a half ago and the VDIP1 has definitely been the most infuriating part of it. If you're going to go with datalogging, I'd go with an SD card or something, just because the VDIP1 is so darn picky in my experience.
phew! Comments, questions, feedback, etc? After all this work, I'd like some sort of validation from people who know more than zip about programming, from my fam it's just "oh that's nice all those little brackets and stuff"
 code to follow, I've exceeded the maximum length.