Split-Single-Phase-Energy-Meter icon indicating copy to clipboard operation
Split-Single-Phase-Energy-Meter copied to clipboard

Current and ADC voltage limits, and the PGA

Open raineth opened this issue 2 years ago • 2 comments

Howdy,

I recently picked up some of the SCT-024 200A CTs from your shop. I spent this evening debugging some weird measurement behavior where low currents (below 20-30A) were accurate, but higher currents started to look distorted and the readings would top out around 40-45A despite measuring 65A+ with a separate clamp meter. After some research and testing, I think I've root-caused the problem to a mis-read of the datasheet which has implications for both the single-phase and 6ch meters.

In the documentation and store pages for the 2ch, 6ch, and 6ch expansion boards, a maximum CT output of 720mA is specified (the docs for the 6ch board also mention a 1V maximum). The M90E32AS datasheet (sec 6.1) specifies a maximum ADC differential input of 720mV RMS, which means the maximum CT output (with the stock burden resistor) is only 720mV / 12Ω = 60mA RMS (or, tautologically, 0.72V RMS). The current revision of the boards will reach that at around 120A using the 200A CTs you currently sell and the lowest PGA gain of 1X.

Speaking of the PGA gain, that was the other half of my problem: the 2ch version of EmonESP has poor guidance in energy_meter.h, which led me to start out with a 4X PGA gain. Since the PGA sits before the ADC, the voltage after the PGA scaling must be ≤720mV RMS (reiterated in the M90E32AS application note, 4.2.4), so the 4X gain was effectively limiting me to 15mA of range. That would have hypothetically limited me to 30A, so I guess the IC can still make some sense of those out-of-spec voltages on the current-sensing inputs, but the response outside of the spec looks pretty non-linear to me.

Finally, after correcting my PGA gain to 1X, I discovered that the M90E32AS reports all currents as a 16-bit number of mA and therefore tops out at 65.535 amps. If higher range is needed, the measurement accuracy section (6.2.2) of the datasheet recommends e.g. halving the calibration value and doubling the current/energy register values. I am currently using esphome, so this was easy enough to implement with filters; however, afaict the EmonESP software does not support setting a multiplier to apply to the current/energy values for users needing >65.5A on a single channel.

So, here's what I'm proposing:

  1. The M90E32AS specs give us a pretty clear picture of what the PGA gain should be: 4X for CTs up to 15mA (assuming the current 12Ω burden resistor)/180mV, 2X for CTs up to 30mA/360mV, and 1X for CTs up to 60mA/720mV. The documentation surrounding PGA gain and maximum CT current/voltage limits should be updated to match.
  2. If you ever spin another revision of either board, perhaps it'd be worth using a lower value burden resistor and/or a voltage divider to facilitate CTs with higher current and voltage outputs.
  3. Support should be added to EmonESP for an arbitrary multiplier that's applied to all current and energy readings on given channel, which will enable support for currents >65.5A when the CT gain value is divided to match. After doing this in ESPHome, I'm seeing pretty reasonable data.

What do you think? Am I way off base here?

raineth avatar Mar 22 '22 19:03 raineth

Thanks for bringing this up. You're absolutely correct. The documentation & code comments needs to be updated/corrected. I'm sorry that it tripped you up initially!

  1. I'll correct this in the documentation/comments
  2. I'm thinking it may be useful to have a second set of selectable burden resistors on the PCB, so it can be selected for higher amperage CTs. This will be even more useful for the 6 channel meter, since it uses 22 ohm burden resistors
  3. For EmonESP/EmonCMS the multiplier can be set on the EmonCMS input fields (Inputs > wrench icon) for current and watts

CircuitSetup avatar Mar 25 '22 17:03 CircuitSetup

I believe I'm going to end up running into this exact issue with my own SCT-024 200A clamps and the recommended 4x gain as per comments in https://github.com/CircuitSetup/Split-Single-Phase-Energy-Meter/blob/master/Software/examples/Home_Assistant_MQTT/Home_Assistant_MQTT/Home_Assistant_MQTT.ino

I think I understand the software fix:

  • Use a gain of 1x.
  • Add a multiplier constant to all read values before sending over MQTT. A value of 3.05 looks sufficient to get to 199.88A (although I hope to never get anywhere close to this), so possibly a more reasonable value of 3 could be chosen.
  • Divide my calibration constants (that I re-compute based on the updated gain of 4x->1x) by the same constant.

In theory, should I be able to multiply my current constants by 4 (to factor out the 4x gain) and then divide by 3 (to scale to the correct value for the post-read multiplication)? I very much do not want to pull the CT clamps back off the feeders, but pulling the ESP32 out and making those adjustments would be trivial. Have I understood this correctly and completely?

DragonMinded avatar Jun 23 '22 04:06 DragonMinded