Closed jaroslavas closed 1 year ago
The esp32 chip has some hw bugs (https://www.espressif.com/sites/default/files/documentation/esp32_errata_en.pdf), see section 3.14 for the isr issue. This is whay the implementation was done as it is. I do not have an oscilloscope to test this, maybe you have.
No I don't, but after a month of using it reported me less kWh than the power meter itself. I've made some changes in code and now after a week it shows exactly the same number as the meter itself :) I can make a pull request if you are interested.
Sounds great, please do a pull request.
@jaroslavas i'm interested to as im seeing the same, if you have some improvements please share :) @fvilmos thank you for your work, the power monitoring is really nice.
@SleepyBear-Ship-It I finally found time to push these few lines of code :D https://github.com/fvilmos/power_meter_mqtt/pull/4
@jaroslavas, thanks for your contribution!
Are you sure it works properly? Looking at
void IRAM_ATTR isr()
function, it takes the time of the first pulse, then waits for the seconds and counts power. This part looks ok. Then after power is counted, it setsbPulseDetected
tofalse
. This means, that when third pulse comes, it doesn't count the power, only starts waiting for the fourth pulse. Looks like it should miss about half of power consumption this way. Am I missing something?