Power meter with Pulsed Output?

Hi all,

I'm in desperate need of assistance. I have a Elster A100C power meter installed and operational in my house.

This meter as described in various other blogs, posts etc has an IRDA interface that can be interrogated for information. Additionally, the meter has an aux output that can be configured at factory time to be a pulsed output OR serial output packet the same way as the IRDA interface.

I'm unsure which configuration my meter has, but my assumption is that it has a pulsed output as described in the attached manual Section 14.

The manual also indicates the default pulse width is 100ms and 200p/kWh (=5Wh/pulse).

Can anyone please assist with how I could go about with using interups in measuring my power usage?

So far I am attempting to use the attachInterrupt(1, onPulse, FALLING) arduino function, but first of all, I'm unsure about whether I should use FALLING and secondly how to incorporate all the timings.

Thanks in advance.

143.pdf (1.33 MB)

With the pulse length being 100 mS there is almost no difference between using RISING and FALLING. Pick one.

All the interrupt has to do is add 5 to a global volatile unsigned long that keeps track of kilowatt hours:

volatile unsigned long kWh = 0;

void ISR1()
    {
    kWh += 5;  // Each pulse represents 5 kWh
    }

johnwasser:
With the pulse length being 100 mS there is almost no difference between using RISING and FALLING. Pick one.

All the interrupt has to do is add 5 to a global volatile unsigned long that keeps track of kilowatt hours:

volatile unsigned long kWh = 0;

void ISR1()
    {
    kWh += 5;  // Each pulse represents 5 kWh
    }

Thank you John, I would I then proceed to calculating the instantaneous power in Watt?

volatile unsigned int watts = 0;
const unsigned long wattMilliseconds = 5UL * 1000UL * 60UL * 60UL * 1000UL;  // 5 kWh in watt milliseconds.

void ISR1()
    {
    static unsigned long previousPulseTime = 0;
    unsigned long currentTime = millis();
    unsigned long elapsedTime = currentTime - previousPulseTime;
    previousPulseTime = currentTime;

    watts = wattMilliseconds / elapsedTime;
    }