I have looked through previous questions and not found an answer:
We have at least 3, and possibly 4 meters (Consumption meter in the house, generation meter in the garage, electric car charge meter(s) [7kW medium charge and 2.4kW "solar" slow charge] in the garage). There is usually only one pulse counting input on a emonTx, to be located in the garage and emonPi in the house, so it would only be the emonTx that needs the extra pulse counter inputs.
Has anybody else added pulse counter inputs?
Thanks
Re: More than 1 meter using optical pulse counting for emonTx
There is only one pulse interrupt input available in the Atmel ATMega 328P processor. The only way that I can see you being able to do this is with additional logic. You would need to make the 4 optical sensors feed 4 digital inputs, and at the same time combine all 4 into one interrupt. Then your ISR would have to detect which sensor(s) were active and increment the appropriate counter. That pre-supposes that you can find 4 digital inputs. There are 5 that could be used, one is the power for the temperature sensor, two are the DIP switches, and the final two are pads on the PCB. I suspect you might be better abandoning the idea of using the emonTx and use instead (or as well, if you need the analogue inputs of the emonTx for other things) perhaps a JeeNode or similar, but I have no experience of that. You'd still need the external logic unless you poll the inputs rather than rely on interrupts.
Re: More than 1 meter using optical pulse counting for emonTx
As Robert has noted, another approach would be to poll each of your optical sensors at a suitable rate so that you can detect when there is any change. I've used this technique for a single LDR-based sensor and it works perfectly with minimal processing overhead. I see no reason why additional sensors couldn't be used in a similar way.
The processing logic and a suggested sensor circuit are present in many of my early Mk2 PV Router sketches, the simplest of which is: http://openenergymonitor.org/emon/sites/default/files/Mk2_PV_Router_mini_3.ino_.zip
I may have some suitable hardware for this role, with plenty of spare ports for sensors. Send me a PM if this would be of interest.
Re: More than 1 meter using optical pulse counting for emonTx
Thanks for your reply Robert.
At present I'm unfamiliar with the Atmel ATMega 328P processor and had hoped that more I/O facilities suitable for counting existed unused within emonTx.
I will have to think again about how to handle the consumption data from the car charge meter(s). I can always read the long term result from the meter "manually" of course and use the CT input to give an approximate indication of charge rate.
(One of the problems of using the CT method might be that the car's switch mode charge controller puts out a lot of electrical noise, but it is possible that might cause problems at the house end anyway, so the development of some sort of filter might be necessary.)
Using "old tech" TTL I can build some external logic but, for the moment I'll look at other solutions.
Thanks again.
Fred
Re: More than 1 meter using optical pulse counting for emonTx
Thanks Robin
I'll think about your suggestion, and thank you for the offer.
At present I'm reluctant to add external complexity because it is some while since I used my soldering iron 'scope and logic probe in anger, and even longer since I did any programming. Its important for domestic peace that the system I'm buying is seen to work quickly. I can experiment later.
Thanks again.
Fred
Re: More than 1 meter using optical pulse counting for emonTx
Hi Robert
I replied thanking you for your help and advice but it hasn't appeared here. Don't know why.
Fred
Re: More than 1 meter using optical pulse counting for emonTx
Thanks for the thanks! I could see it. It was stuck in the moderation queue (along with another post from 8 hours ago). I and the rest of the moderators are having a day off, by the look of it!
(Did you look at JeeNode, by the way? That, polling the sensors, looks like a quick cheap solution.)
Re: More than 1 meter using optical pulse counting for emonTx
The 328P Arduino can support triggering of an interrupt on multiple pins, but you would need some logic to determine which pin was changed.
This page may help
http://playground.arduino.cc/Main/PinChangeInterrupt