What's the minimum update_interval I can use?

I want to try to build a power meter that manually calculates power angle and power factor based on voltage and current values sampled from a CT sensor and mains.

I found an example of Arduino code where someone watches the voltage and calculates the peaks of voltage and current to subtract the time difference between them getting the angle. I want to do this too but I’m curious how quickly I can sample the voltage and current sensors. I can use an ESP32 or and ESP8266.

Anyone know what the minimum is for update_interval?

Have a look at the “pzem” component in esphome it reports the pf by default

Thanks @sender. I saw that but I don’t want to calculate a single PF, which the pzem module would be perfect for. I want to build a unit to watch all circuits in the breaker box using one voltage sensor (really two, one for each rail) and several CT clamps. If I do the calculations myself, I can find the voltage peak and use it to calculate the PF for every circuit that is connected to it based on its current peak.

I’d like to do something like this guy did: https://solarduino.com/how-to-measure-power-factor-and-phase-angle-with-arduino/

An example diagram I borrowed from his blog post:

  1. He starts a timer at the first point (voltage going negative)
  2. Then when the voltage goes positive again he starts keeping track of the maximum voltage value he sees until it stops going positive – he captures this time delta from #1 as “voltage timing peak”.
  3. At the same time, he watches for the CT clamp current to go positive and also tracks its maximum value – he also captures this time delta from #1 as “current timing peak”.
  4. When the voltage passes zero again he calculates the time difference betweek current and voltage and that gives him the angle between the two.

It’s pretty ingenious and I think it should work as long as you can’t have more than 90° between voltage and current (I think that’s the limit). Anyway, this type of solution requires that you can sample the wall voltage/current very fast so you can get accurate difference of those peaks. I just don’t know what the limitation of ESPHome’s internal sampling is. All the code from this dude’s URL is straight Arduino inside the void loop() function, so it’s probably executing just about as fast as possible.

I know that the ESP32 devices are like 240MHz but I don’t know what’s allowed from an ESPHome perspective. Anyone know or do I have to trial and error it? :smiley: