Hello All -
I tried this question/topic on the MySensors forum but I think my lack of ability to clearly explain my issue is falling short so I’ll try here.
While I am fairly confident in my electronics background (a bit rusty but this is simple stuff), my C++ skills are a decade++ old. I have zero Arduino experience.
What I’d Like to Do
[ol][li]Monitor water flow on my home’s “main” water supply[/li]
[li]Using Vera/PLEG, alert when water is running but shouldn’t be. (sprinklers off, etc) I will be sure to account for icemakers, humidifiers, etc[/li]
[li]Send an email and perhaps shut off an inline valve[/li]
[li] Use the following sensor: http://www.seeedstudio.com/wiki/G1%22_Water_Flow_Sensor in place of the light counter suggested by MySensor’s page at http://www.mysensors.org/build/pulse_water but hopefully use the same sketch due to my lack of Arduino coding knowledge.[/li]
[li]Use Hek’s wonderful work and Arduino to accomplish the above[/li][/ol]
Where I’m Currently At
[ol][li]Arduino IDE up and running[/li]
[li]Gateway/Radio Comms established using temp sensors as a test (among other radio tools along the way to troubleshoot)[/li]
[li]Now running the WaterMeterPluseSensor.ino and sucessfully added this to Vera[/li]
[li]Above sensor and ball valve are already plumbed (no leaks!) and working fine[/li]
[li]To bench test, I’m using a function generator on PIN 3 running at 10Hz (measured by a scope to be sure). According to the above link, this should give me around 48 L/min[/li]
[li]However, my current volumes reported via the sketch (and displayed in Vera) are around 21 L/min[/li][/ol]
I modified the WaterMeterPulseSensor.ino (found at the above link) to use a pulse factor of 4800. According to the spec sheet (link above) each liter should be 4.8Hz so when I look at the sketch, I see the following line:
double ppl = ((double)PULSE_FACTOR)/1000; // Pulses per liter
So that means, 4800/1000=4.8 Good, right?
I also modified the sketch to have a max flow of 400 because my count rate will be much higher than a meter’s wheel spinning.
Obviously, this sketch was never intended to read an interrupt this quick and I’m wondering if that’s where my problem is.
Can someone check my math/assumptions to see where I may be going wrong?