This suggests to me that measuring timing between pulses is the way to go. This allows instantaneous consumption to measured as best it can be. It's effectively using counting, but with a variable counting period which ensures a count of only 1.
If you want to measure more average consumption, per hour or per day, you have to decide is that for a particular period, the last day or hour is that one which passed by some time ago, or the last 24 or 1 hour measured back 'from now' ?
I'm guessing that ideally you'd want all data displays and to be able to switch between each without invalidating other displays. I suspect that ideally you need to store every pulse and its intervening period and then calculate using that data set. That could be quite demanding and require some large data storage.
A key factor is how accurate you want your data / results to be ? Should it match the meter reading exactly after a few months or are you happy with a less accurate system ?
Hi Hippy,
I'm a little confused about the first paragraph above...when you mention the count will always be "1"....However, after stewing it around in my mind last night, I'm thinking focusing on the time between pulses, rather than the number of pulses in a time period is the way to go as well.
Regarding the displays...yes, I may (pending approval of SWMBO) have more than one display in the house...so I'm thinking the transmitter side will simply send the time between pulses, nothing more...and all the math / calculations will be handled on the receivers.
With regards to accuracy, I'm not going to blow a fuse over it (ba-da-dum! Okay, bad pun)...the closer I can get it to line up with the meter, the better, but my real objective is to get a real-time feedback on power consumption to help me (and the kids) be more conscious of what we're using in the house...(with the added benefit of saving some $$ on the power bill, which I will roll right back into Picaxe chips!
)
Here is an idea I had last night...haven't coded it yet, but have a 18 hour shift coming up at work which will give me plenty of time to write code...
1: Set interrupt for meter pulse
2: Get first pulse, go to interrupt
3: Since this is first pulse, set seconds counter to 0 and return
4: Count elapsed seconds, store that variable in B1
5: Next pulse arrives
6: Interrupt knows this is pulse #2...takes elapsed seconds from B1 and stores in b2
7: Reset B1 to 0, Return, start counting elapsed seconds, store that in B1
8: Next pulse arrives...
9: interrupt knows this is pulse #3...takes elapsed seconds from B1 and averages with that stored in B2...transmits that number to the receivers
10: Reset all counters and start over again.
Some initial hurdles...yesterday, when I was testing my detector circuit...the heat-pump was on, and I think I had more than a pulse a second...so maybe I'd need to add some intelligence when pulses are coming in that fast, to switch to a "pulses within 5 seconds" scheme or something...just brainstorming there.
Well, Just some food for thought.
Brendan