Battery life of an EmonTH with an optical pulse sensor

I would like to install an “optical pulse sensor” to measure the pulses of an electricity meter. I want to do this measure with an emonTH because I have no AC power available.
How can I calculate the duration of the emonTH batteries?
Can I cancel the “optic pulse sensor” led to extend the battery life?

Greetings and thank you

Hello @onsar, @glyn.hudson has tested the battery life for temperature and humidity sensing at 3 years + as mentioned here: But this does not confirm the battery life on pulse counting only.

The firmware sleeps between pulses implementing a low power mode based on work by Eric Amann, see: emonth2/src.ino at master · openenergymonitor/emonth2 · GitHub

The pulse is detected with an interrupt that will wake up the EmonTh briefly, the battery life will therefore be partly proportional to the frequency of pulses.

Thanks Trystan for your reply
Looking at the features of the “Optical Utility Meter LED Pulse Sensor” page, the consumption of this device is 7.5mA @ 5V for duration of pulse (standard meter 100ms):

On the other hand, it is normal for electricity meters to generate a pulse every Wh consumed. This means that there will be periods in which a pulse will be generated every second (depending on the meter and consumption). This will significantly reduce battery life.
I think that a part of this consumption is due to the LED that has the Optical Sensor Meter.
Is it possible to obtain the scheme of this device? I would like to study if it is possible to disable the LED

Best regars

Unfortunately not. Megni have tried to do that, but no information was forthcoming. All the data that we have been able to obtain from the supplier is on the “shop” website. However, I have done some tests and if you search, you should be able to find a little bit more about how it behaves. But I don’t think it will help you directly.

Thank you very much Robert. I appreciate your answer very much
I believe that if we fed the optical sensor with an ATMEGA pin, it would be possible to cut off the power just when the interruption is received. This would prevent the device from continuing to consume energy but, I don’t know if it would shorten the life of the sensor or we would have other problems that I don’t know now.

How would you wake the processor to put the power onto the pin to receive the LED flash from your meter? :thinking:

I think the sensor consumes only when it receives the light pulse from the counter:
“Current Consumption - Pulse: 7.5mA @ 5V for duration of pulse (standard meter 100ms)”

It is possible to use a digital output to power the optical sensor. This is already done in emonTH to measure temperature with 18b20 sensors.
See the code: emonth2/src.ino at 37826d0a36628ec487852a02f98c531fe421859e · openenergymonitor/emonth2 · GitHub
When an interruption is detected, the power of this digital output is cut off for a period of time (= minimum time between pulses) and the interruptions are disabled. Once this time has elapsed, the optical sensor is fed again and interrupts are enabled (to avoid problems in the power transition).
I think this software would reduce the time in which the sensor is consuming intensity and therefore the energy consumption

OK, so you will turn the power off to the sensor immediately after you have detected the pulse, then you turn on the power when the meter’s LED should have turned off.

I think that should work. The possible problems are: if you do not turn the power on quickly enough, you lower the limit for the maximum pulse rate that you can detect, and if you turn the power on too soon, you count two pulses where there was only one.