Current transformer voltage detector

I am using a 2000:1 coil around one leg of an AC main to simply detect the presence of current or not.

The coil leads are across a simple half wave rectifier (1n4148) with a 100 ohm resistor. I have a ESP32 as the test controller with code that reads A0 and prints the value every second. My scope reads 4.2v across A0 and ground.

The readings stay above 0 and will count up to 4095 and stay there for 20 or more ticks and then start slowly dropping to 0. It will stay at 0 for several counts then start counting up to 4095. The scope wave and voltage does not waver. What is going on that I'm not getting?

All I want to do is detect a value greater than 0 to determine current is on the main with a non-intrusive coil.

Thanks for the thoughts.

20:21:36.278 -> sensor = 0
20:21:37.305 -> sensor = 0
20:21:38.287 -> sensor = 0
20:21:39.298 -> sensor = 160
20:21:40.284 -> sensor = 416
20:21:41.317 -> sensor = 720
20:21:42.302 -> sensor = 944
20:21:43.287 -> sensor = 1149
20:21:44.271 -> sensor = 1264
20:21:45.302 -> sensor = 1476
20:21:46.284 -> sensor = 1633
20:21:47.314 -> sensor = 1742
20:21:48.293 -> sensor = 1884
20:21:49.273 -> sensor = 2031
20:21:50.300 -> sensor = 2163
20:21:51.285 -> sensor = 2303
20:21:52.318 -> sensor = 2409
20:21:53.302 -> sensor = 2518
20:21:54.285 -> sensor = 2655
20:21:55.318 -> sensor = 2761
20:21:56.293 -> sensor = 2879
20:21:57.278 -> sensor = 2991
20:21:58.313 -> sensor = 3115
20:21:59.302 -> sensor = 3219
20:22:00.285 -> sensor = 3303
20:22:01.318 -> sensor = 3423
20:22:02.300 -> sensor = 3503
20:22:03.281 -> sensor = 3568
20:22:04.313 -> sensor = 3691
20:22:05.300 -> sensor = 3711
20:22:06.303 -> sensor = 3827
20:22:07.292 -> sensor = 3835
20:22:08.317 -> sensor = 3951
20:22:09.301 -> sensor = 4011
20:22:10.284 -> sensor = 4063
20:22:11.311 -> sensor = 4095
20:22:12.294 -> sensor = 4095

Stayed at 4095 for 20 sec

20:23:20.286 -> sensor = 4095
20:23:21.270 -> sensor = 4095
20:23:22.301 -> sensor = 4095
20:23:23.287 -> sensor = 4095
20:23:24.315 -> sensor = 3409
20:23:25.298 -> sensor = 2733
20:23:26.280 -> sensor = 2275
20:23:27.312 -> sensor = 1776
20:23:28.299 -> sensor = 1328
20:23:29.283 -> sensor = 918
20:23:30.314 -> sensor = 578
20:23:31.298 -> sensor = 244
20:23:32.281 -> sensor = 2
20:23:33.310 -> sensor = 0
20:23:34.293 -> sensor = 0

The sea level fluctuates over time.

Really? No schematic and no code to review?

Please read How to get the best out of this forum (short version)

If you post your question as described in the sticky, more forum members will read it.

Hi,
Welcome to the forum.

Please read the post at the start of any forum , entitled "How to use this Forum".
OR
http://forum.arduino.cc/index.php/topic,148850.0.html.
Then look down to item #7 about how to post your code.
It will be formatted in a scrolling window that makes it easier to read.

Can you please post a copy of your circuit, in CAD or a picture of a hand drawn circuit in jpg, png?

Thanks.. Tom... :slight_smile:

So just a diode and resistor? So you are presenting 50 or 60 Hz half wave rectified to the pin? I don't believe you are getting a steady 4V2 at A0 based on your circuit description, doesn't make sense. Show us the trace and a schematic.

Anyway, assuming you do have what I think you have then you are measuring the voltage at different points in each half cycle so getting different outputs.

How many Amps are flowing through the mains when you read 4V2 at A0? Doesn't ESP32 have 3V3 inputs?

Hi,
What is the value of the current you are measuring?
What do you calculate your transformer output should be with the 100R burden resistor?

With the single diode, your output to the controller input will not start till you have 0.6 or 0.7V being developed and you will have that as an offset for the rest of your readings.

What model Arduino are you using?

Thanks.. Tom... :slight_smile:

You should always have the 100ohm burden resistor directly across the CT output .
If you put a single diode in series with its output before the resistor then , when the diode doesn’t conduct the CT will generate a very high voltage as it’s effectively open circuit . ( google “ open circuit CT”) .

After the 100ohm you need a full wave rectifier in parallel and capacitor to produce a steady DC voltage. ( assuming the voltage generated is sufficient)

the solution you seek is at openenergymon.org

you must correct from 5v as shown to 3v3 for the ESP

VOLTAGE

CURRENT

here is how to measure CURRENT

  • You're taking readings at approx every second.
  • There are 50 or 60 ac cycles in between.
  • As such, you are catching the signal at different points, sometimes creating a much lower sub frequency, sometimes stalling out, but otherwise highly distorted.

Since you're only detecting "presence" of ½ wave AC and not "measuring" ½ wave AC, then just take say 8 readings spaced about 3 ms apart ... if any readings are over a certain noise level (you decide) then AC is present.

EDIT: Before further testing, see reply#2 ... looks like some serious circuit corrections need to be made first.

Simple circuit to detect the presence of current using a current transformer. Connection "current" is supposed to go to an Arduino input pin (5V logic level).

Mine are 1:1000, principle remains the same. R12 may not be necessary (zener current limiting). C9 can be electrolytic instead of ceramic. R10 is there because I'm using the MISO pin that I also need for programming, this way its safe to program, otherwise C9 will cause problems. If you don't need this, R10 may be omitted.

Amend R13 to change your detection limit.

schematic.png

schematic.png

You should not ever never put a diode in the output of current transformer . When not conducting the transformer will generate a high voltage - enough to be hazardous or damage the windings .
The burden resistor should be upstream of any plug abs socket

Voltage transformers and current transformers are different.

“CT burden resistor is the resistor which will be connected across the current transformer terminal S1 and S2. The main purpose of the burden resistor is to protect the current transformer under open conditions. As we have seen earlier current transformer’ secondary should be always in a closed circuit to avoid extreme voltage built up in the second terminal.”

This topic was automatically closed 120 days after the last reply. New replies are no longer allowed.