I have a sct-013-030 hooked up to a MCP3008 10 bit ADC and using emonlib to get Irms.
I have a reference voltage going into the MCP3008 at ~1V. I believe this should cause my readings of 0 - 1024 to be AC currents of 0-30 A essentially giving me a resolution of .02929 A.
If I set the offset to start at 512 I get very high values. If I start the offset at 0 I get values which make sense. I have my DMM hooked across the sensor to see how close I am getting to the correct “vin”.
So my question is why does having the offset such as it is in the library cause my values to be so off? Because my sensor is 0-1V and my ADC is 0-1V should I not need an offset?
How have you configured your MCP3008, and how are you biassing the input?
I think you might have a second problem here, if I understand you correctly.
You have a MCP3008. It expects an input over the range 0 V to 1.0 V.
Also you have a SCT-013-030. This gives you a 1 V rms a.c. output. That means the output swings, for a sine wave input current (which we have to assume you have, and which will be more or less true for large resistive loads like water heaters), from - 1.414 V to + 1.414 V.
It would seem to me that you are in danger of overloading your input a long time before you reach 30 A,
The direct answer to why the offset is in the library is explained in Learn. It’s necessary, with the Arduino / Atmel 328P input design, to bias the input to Vcc ÷ 2, and the offset in emonLib initialises the software offset so that there is not a sudden step when the sketch starts up. The software offset will self-adjust over time to exactly match the voltage offset applied to the input signal.
If you’re doing something different with your MCP3008 and its input, then that probably explains why it doesn’t work for you.
Okay let me clarify - I am trying to read 120 V 60 Hz AC current from the wall into an arbitrary load.
I have the MCP setup for single ended mode and I’m only reading channel 0. My CT positive goes into channel 0 and the ground goes into arduino ground (which the MCP is also connected to via it’s AGND and DGND pins).
I did notice a problem with my code in that my offsetI wasn’t global, so it would always reset. I’m going to see how the performance changes with that.
I see the problem you have highlighted about the voltage. So I’m only going to be sampling 70% of the positive side of the sine? I’m not sure how I can expand this range - especially into the negative?
I appreciate the help you’ve given.
Look at the ‘Learn’ section for how we bias the input.
As for the range question, two solutions are open to you. Use a 3.0 V reference, or add a second external burden resistor in parallel to bring the output voltage down to 0.333 V rms.
I don’t know the exact value of the internal burden, YHDC will select the value to calibrate the output, but with a rough calculation based on the assumption that the c.t. itself is a SCT-013-000, the internal burden will be
approx. 66 .6 Ω, and you want 22.2 Ω for the two combined, so you need 33 Ω in parallel.
The offsets are both private class members, so they surely cannot be resetting.
Okay I’ll check that out. I’ll see what happens if I change my reference.
Thanks for the help!