Go Down

Topic: Power meter with Pulsed Output? (Read 1 time) previous topic - next topic

aquadat0r

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.




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:

Code: [Select]

volatile unsigned long kWh = 0;

void ISR1()
    {
    kWh += 5;  // Each pulse represents 5 kWh
    }
Send Bitcoin tips to: 1L3CTDoTgrXNA5WyF77uWqt4gUdye9mezN
Send Litecoin tips to : LVtpaq6JgJAZwvnVq3ftVeHafWkcpmuR1e

aquadat0r


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:

Code: [Select]

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?

johnwasser

Code: [Select]

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;
    }
Send Bitcoin tips to: 1L3CTDoTgrXNA5WyF77uWqt4gUdye9mezN
Send Litecoin tips to : LVtpaq6JgJAZwvnVq3ftVeHafWkcpmuR1e

Go Up