Community
OpenEnergyMonitor

Community

NodeMCU CurrentTransformer schematic


(Harrie Thijssen) #1

Hi all, totally newbie here.

I’m trying to determine Amps using a SCT-013 (15A/1V, builtin “burden” resistor) using a NodeMCU (ESP 12-E ). Pin A0 is a 10-bit ADC convertor, input ranges from 0V to 3.3V.
I understand the concept of a Voltage divider (to limit a device to a max of 3.3V), but how can I get my CT’s output to get to 3.3V?

Using https://openenergymonitor.org/forum-archive/node/156.html and https://www.amazon.com/YHDC-SCT013-015-Current-Sensor-Transformer/dp/B01CU055IE#feature-bullets-btf (for #turns = 1800) I get that the builtin burden resistor is ~42.4Ohm (15*sqrt(2)=21.21A, secondary peak current = 21.21A/1800turns = 0.011A; burden = 0.5V/0.011A = 42.4Ohm).

Is there a simple way to “map” the 0-1V (from CT) to 0-3.3V (input range on A0)? I would rather not reduce my already poor 10bit resolution to use a “fraction” (i.e. 1/3.3 = 30%) of the 3.3V input.

Thanks.


(Robert Wall) #2

Why not look at the “Learn” section instead - that is up-to-date, whereas the archive is, well, an archive?

If you really want to do that, you need to put an amplifier in between the voltage output of the c.t. and the ADC input, with a gain of about 1.1
But I don’t think you do, because you’re mixing the way voltages are measured - the c.t. output is 1 V rms assuming a sine wave (or something reasonably close), while the ADC input cannot exceed 3.3 V peak-peak. If you work the sums backwards, 3.3 V peak-peak comes to a little over 1.1 V rms.

That means your maths is wrong - without the amplifier, you would be using 1 / 1.1 of the available range of the ADC, which isn’t nearly as bad as you thought.

Personally, I wouldn’t worry about that.

And you don’t need to worry about calculating the burden resistor. Its purpose is the convert a current into a voltage, and that sum has been done for you already, by YHDC, when they specify the voltage output.


(Harrie Thijssen) #3

Thanks @Robert.Wall, I’m slowly catching on. I just joined the community and was not aware of the “learn” section.

What you’re saying is that the CT is 1V “rms”, which roughly “maps” to 3.3V “peak to peak”, correct?

When I do the math it translates to:

  • Vpeak2peak = Vp2p = 2*sqrt(2) * Vrms (see Wikipedia)
  • Vp2p = 2*sqrt(2) * 1 = 2.82V

Still a bit shy of 3.3V, but much closer. This is also what your “1.1” comes from: 3.3/2.82 = 1.16 ?

I’m planning to use a voltage divider for the 3.3V, resulting in 1.65V. I then will use a range of [1.65 - sqrt(2) , 1.65 + sqrt(2)] = [0.24V , 3.06V] which maps to [73.17 , 950.83] (based on ADC 10 bit resolution)

Thanks for the lesson, pls let me know if I got it right this time…


(Robert Wall) #4

Yes, you’re getting there.

Indeed - and that’s deliberate. You must always design for the worst case. Say your 3.3 V is low, your half-way bias that should be 1.65 V is now not only low, but it might not be exactly half way, the c.t. reads high, and suddenly “but much closer” can be too close, and you can’t measure right up to 15 A. You must allow for the components not being exactly the values they claim to be - your c.t. is ± 3% for example, so 15 A could be 2.913 V peak-peak, not the 2.818 V you expected.

The ADC – You add a bias of 1.65 V that should read 511, so the negative going half of the wave reads downwards towards zero (ideally, the negative peak should not quite touch zero), and the positive going half of the wave reads upwards towards 1023 (and likewise, ideally, the positive peak should not quite touch 1023). But as soon as you touch zero or 1023, you lose accuracy because the wave gets clipped.

And in case you’re worried about the 511, we subtract that afterwards in the emonLib library.

All this has assumed a nicely shaped sine wave. Your current almost certainly won’t be, if it’s ‘peaky’, the ratio of peak to rms won’t be √2, it will be larger, and all bets are off - other than if the wave hits 0 V or 3.3 V, the value you measure will be wrong.