Measuring 24VAC current using hall effect or current transformer sensor

Reloadron

Joined Jan 15, 2015
7,517
Hi Ron

Thanks, I will look further into this.

Data logging is no issue.

But can I not create a circuit to get a linear output from sensors which then goes into the ADC? Or am I miss understood these sensors. Bases on some YouTube video it's shows very simple aurdrino examples of monitoring.

This is something similar

https://www.instructables.com/Simple-3-Phase-Arduino-Energy-Meter/
OK let's take a look at the circuit. Remember what I mentioned about offset:

3 Phase Arduino.png
We draw 5 volts from the Arduino board and apply it to R1 and R2 in series, each is a 100K resistor forming a voltage divider. The junction of R1 and R2 affords us 2.5 volts. That becomes our offset. R3 is the burden resistor we mentioned earlier. The current transformer outputs a current so to get a voltage we give it a resistive load, That is R3. With these CTs they use a 56 Ohm burden resistor. The author used a Talema AC1030 which is a 30 amp CT you only need a 5 amp CT so you would want a AC1005 CT and a burden resistance of 100 Ohms. The turns ratio is 1000:1. So in the above schematic your R3 would be 100 Ohms and your CT part number would be a Talema AC1005. This is the CT data sheets for the CT used. The 10 uF cap is I believe for filtering. Any 10uF electrolytic cap rated for 25 Volts should work. The code assumes a constant 220 VAC and the author points that out. I was unsure of the phase to phase relationship but apparently it will work fine.

So yes, in your code you would change the voltage to 400 and the author covers scaling factors for calibration. Will this work? Yes, it likely will. The code derives the RMS values and while not the most accurate RMS measurements it should be close enough. Just keep in mind you are powering motors which are an inductive load. Will this be a highly accurate measurement plane? No but it won't break a bank. :)

Ron
 

Thread Starter

DJ_AA

Joined Aug 6, 2021
305
Thanks I will read more into this tommorow. My ADC is 3.3V, as I am using an Xmega. So does that mean by offset needs to be 1.65V?
 

Reloadron

Joined Jan 15, 2015
7,517
Thanks I will read more into this tommorow. My ADC is 3.3V, as I am using an Xmega. So does that mean by offset needs to be 1.65V?
Yes or close. You can use the same circuit but apply 3.3 volts to the top of the divider. Then choose a burden resistor that makes sure the AC voltage does not exceed +/- 1.65 volts. If you have a signal source like a function generator for a sine wave and a scope you could test things that way. You would simulate the CT output.

Ron
 

Irving

Joined Jan 30, 2016
3,887
Hi Ron

Thanks, I will look further into this.

Data logging is no issue.

But can I not create a circuit to get a linear output from sensors which then goes into the ADC? Or am I miss understood these sensors. Bases on some YouTube video it's shows very simple aurdrino examples of monitoring.

This is something similar

https://www.instructables.com/Simple-3-Phase-Arduino-Energy-Meter/
That would probably work.

My preference, however, would be to condition the AC voltage from the sensor into a DC value. Measuring the AC directly adds complexity because timing is critical to measure the peak. There are many ways to do this conditioning, but the easiest is a peak detector using an opamp, a diode and a capacitor; then you get a direct measure of the peak value, and being a sine wave the RMS value is simply 0.7 of that.
 

Thread Starter

DJ_AA

Joined Aug 6, 2021
305
That would probably work.

My preference, however, would be to condition the AC voltage from the sensor into a DC value. Measuring the AC directly adds complexity because timing is critical to measure the peak. There are many ways to do this conditioning, but the easiest is a peak detector using an opamp, a diode and a capacitor; then you get a direct measure of the peak value, and being a sine wave the RMS value is simply 0.7 of that.
Is there any example or documents we can read in regards to this?

As our primary focus is on the alerts, but the 3 phase detection is a bonus, we not looking for something that is 100% accurate.

Something more towards verification of the alerts and a little data analytics to judge the behaviour.


By the way, are there any ready made PCB with ADCs and connectors for the current sensors? Otherwise i can create a little demo PCB for them.
 

Reloadron

Joined Jan 15, 2015
7,517
Yes, you want a 10uF electrolytic cap

Next when Irving mentions:
There are many ways to do this conditioning, but the easiest is a peak detector using an opamp, a diode and a capacitor; then you get a direct measure of the peak value, and being a sine wave the RMS value is simply 0.7 of that.
He is getting at the use of what is commonly called a "precision amplifier circuit". Trying to use or rectify a low voltage AC has its problems. Using diodes for example in a full wave bridge will result in a forward voltage drop of the diodes. Typically 0.7 volt so with two diodes conducting in the bridge on alternate half cycles of the AC you get 0.7 x 2 = 1.4 volts of drop. If you read through the link you will see a precision peak detector circuit including exactly what Irving mentions.

Using CTs like this is not something I would suggest. I normally used a Current Transducer like several I linked to earlier. When running AC into a uC you first need to offset it unless the uC has a differential input. Even once you offset the AC out of the CT you are using code to tray and derive a good RMS value. The circuit posted earlier from an Instructable uses code as I mentioned. Problem is this is not a good way to measure a RMS voltage. That example they assume the voltage is unchanged and if I recall correctly take 200 samples of the incoming waveform, try to derive a peak value and then take that number and multiply in the code X 0.707. Will it give you a number? Yes. Will it be accurate or close? Absolutely maybe give or take. This is why I have never run an AC voltage which should be proportional AC current into an A/D converter. Some of this stuff is fine for hobby applications but I never would have used it in my industrial applications, especially in monitoring very expensive pumps.

While I don't know of PCB with A/D if I were you and I wanted to experiment inexpensive using the AC in approach I would likely invest a few bucks in an Arduino for example an Arduino Uno. Gives you six analog input channels or I believe you mentioned you had something using a 3.3 volt reference? The math is all in the code. You sample enough and get a peak of the sine wave. Then you multiply by 0.707 (the square root of two) and get an approximate value of the AC voltage. Personally I don't use this method but it is economical.

Ron
 

Thread Starter

DJ_AA

Joined Aug 6, 2021
305
Hi Ron

Thanks for your reply.

Just out of curiosity is there a reason why an electrolytic cap is required?

Just to confirm this the circuit you mentioned?
1647383672731.png

I will also need to check in detail, but I think my uC does support differential ADC, does using differential ADC simplify the circuit? would this simply mean i can connect output of the CT to the ADC without the resistors and cpacitors, providing the ADC can handle a peak 1V?

1647383751598.png

So for my example, the voltage will be 400V, under what circumstance would the voltage change, as the example code presumes 220V if I am correct?

From my understanding, the output of the CT, would be a voltage proportional to the current usage in that particular phase, wouldn't this be a simple linear output? Or have I missed understanding something.

So instead of performing multiple samples as shown in the example, what would be the better way to obtain the max current?

Then you multiply by 0.707 (the square root of two) and get an approximate value of the AC voltage. Personally, I don't use this method but it is economical.
When getting an approximate value of AC voltage, do you mean Power, as the voltage is known to be 400V?

I had a look at the code, they take about 200 samples, but every 3000ms(3 seconds). Wouldn't it is better to have the ADC run continuously, maybe in some type of interest and there output the updated values x every second?
Could there be a reason for 200 samples?
 

Reloadron

Joined Jan 15, 2015
7,517
OK before I forget. In the second circuit C1 is a filter. In the precision amplifier circuit the capacitor charges to E pk (voltage peak value) so we amplify and rectify and charge the cap to the peak value of the sine wave. Before all these new current transformers a CT looked like this.

Coil 3.jpg

The above is a cutaway view of a 50:5 CT. 50 Amps primary resulted in 5 amp secondary. There were also clamp on versions. Burden resistances were kept very low. Fractional parts of an ohm. This resulted in milli-volt drops across the burden resistor. A popular scheme was to use a precision op-amp circuit or in some cases digital and analog meters to measure the 0 to 5 amps from the CT. These worked well and were accurate. The secondary current was then simply scaled. In this example it would be Read 5 Display 50. This is how it was done in industry.

Later much more advanced variations came about. Commonly called Current Transducers. These were a CT but included additionally all the work done. A 50 amp ct would be powered on a 24 VDC buss and 0 to 50 amps became a 4 to 20 mA output or 0 to 20 mA or o to 10 volts or 2 to 10 volts or 0 to 5 volts or 1 to 5 volts., large choice in outputs all in a single nice package. Not cheap but nice and accurate.

So for my example, the voltage will be 400V, under what circumstance would the voltage change, as the example code presumes 220V if I am correct?
Normally the voltage wont change much. It all depends on facility power quality. Here is how things play out. I measure my line voltage on three phases, I also measure my line current of three phases. I multiply Voltage times current and I get power.This only works well for a resistive load but motors are an inductive loads opening more problems. Just measure the Current, if a pump has problems you will start to see imbalance,,

Much, much more to come. Took my nighttime meds and cant stay focused. Tomorrow I will finish this up.


Ron
 

Reloadron

Joined Jan 15, 2015
7,517
Another day in paradise begins. Yay.

So we read a voltage which is proportional to current. Power expressed in watts is Voltage times Current. In the prior example rather than measure voltage a value was just assigned in the code. That value was used to calculate the power in watts. This method will get a ballpark figure. I say this because if a motor were a purely resistive load this would true. However a motor is an inductive load and we are assuming a true sine wave. Without getting into all of this what you will get is a ballpark number. These details are omitted in most of the online tutorials.
I had a look at the code, they take about 200 samples, but every 3000ms(3 seconds). Wouldn't it is better to have the ADC run continuously, maybe in some type of interest and there output the updated values x every second?
Could there be a reason for 200 samples?
The reasoning for 200 samples (each sample is one repetition of the 50 Hz sine wave) is simply to make sure enough are taken to render an accurate peak value. I have seen similar code using 100 samples. Figure 50 Hz sine is a 20 mSec period. Most A/D like an Arduino are a 10 bit ADC so 1024 quantization steps. Also figure the sine has a DC offset of 1/2 VCC. With a VCC of 5 or 3.3 volts and using those as a Vref we start with about 512 bits we need to subtract in the math.

Code:
 RMSCurrent[i] = ((maxCurrent - 516)*0.707)/calib[i];    //Calculates RMS current based on maximum value and scales according to calibration
    RMSPower[i] = 220*RMSCurrent[i];    //Calculates RMS Power Assuming Voltage 220VAC, change to 110VAC accordingly
    if (RMSPower[i] > peakPower[i])
    {
      peakPower[i] = RMSPower[i];
I am not sure why the author used 516 verse 512?

Ron
 

Thread Starter

DJ_AA

Joined Aug 6, 2021
305
Hi Ron

Thanks

So C1 is 10uF?

Thank you for the information, this is apricated very much.

So those CT, which are powered on 10 V or 24V are still used? As you mentioned, they are all in a single package, so this could be an option as well.

I will just measure the current as suggested.

So as per your second post yesterday, in regards to voltage, I presume we can read the voltage on the pump and use that in the calculation of power.

So in regards to 200 samples, how often should then be called? Should this be every 1 second or 3 seconds, as shown in the examples? So I am correct in understanding that I need to take 200 samples within a 20ms period or simple take as many samples every 20ms to find the max and min? I
 

Reloadron

Joined Jan 15, 2015
7,517
Yes, a 10 uF electrolytic is what they use.

Yes, if you know pump voltage and current you can just calculate power. If the voltage is stable you can get power. Long as it's close enough for your needs.

Yes, those CTs using mostly 24 VDC are still used and the popular approach in industrial applications. Moving on from the older CT those were my go to. They work great and include a price tag to match. :) Originally in the old 1960s designs we had the old style CT designs. Here is an example.
Current_Transformer.jpg

Least I forget there is a slick trick you might have a use for. The center of the doughnut is the primary but one can wrap several turns as a primary. Here is an example.
60 to 5 CT 3 Turn Primary.png

This may work with some of the CTs you might be looking at. Using 3 turns through the primary I now have a 20:5 CT.

How often to refresh is up to you. Try a few things in the code and see what works best. Figure it this way, a 50 Hz AC sine wave is only a 20 mSec period. Relatively slow for any A/D. Nice thing about code is you can easily tweak to suit.

Ron
 

Thread Starter

DJ_AA

Joined Aug 6, 2021
305
Yes in the UK it is 50Hz. For ADC tht is very slow,i belive ADC work in Khz

Does that mean, for duration of 20ms i would need to read the ADC otherise, if take 200 samples very quick, there is risk of missing the peak or mimum?
 

Reloadron

Joined Jan 15, 2015
7,517
Looking at the code:
void readPhase () //Method to read information from CTs
{
for(int i=0;i<=2;i++)
{
int current = 0;
int maxCurrent = 0;
int minCurrent = 1000;
for (int j=0 ; j<=200 ; j++) //Monitors and logs the current input for 200 cycles to determine max and min current
{
current = analogRead(currentPins); //Reads current input and records maximum and minimum current
if(current >= maxCurrent)
maxCurrent = current;
else if(current <= minCurrent)
minCurrent = current;
}[/CODE]
It looks like the author samples 200 cycles getting max and min. That's just a small chunk of the code. My guess is there are several ways to go about it.

Ron
 

Reloadron

Joined Jan 15, 2015
7,517
Pretty slick chip and offers 16 single ended or 8 differential channels. Not to mention an I2C bus tossed in. I began a career with vacuum tube theory and today is mind boggling. Hell, just since I retired 9 years ago in May the changes are incredible.

Ron
 

Thread Starter

DJ_AA

Joined Aug 6, 2021
305
Pretty slick chip and offers 16 single ended or 8 differential channels. Not to mention an I2C bus tossed in. I began a career with vacuum tube theory and today is mind boggling. Hell, just since I retired 9 years ago in May the changes are incredible.

Ron
Yes this seems to be good ADC, it's also got various calibrations and gain features.

This device would give 8 current sensor, from which I need 6.

So am I correct in understanding this is a direct connection? Or is there additional circuit needed?
 

Reloadron

Joined Jan 15, 2015
7,517
My read is it's pretty straight forward. I have not studied the data sheet in detail. Vref + and Vref - can be tied to VCC and GND and about all you need to do is read the chip. The chip has programmable gain which is nice. I don't see whay it would not work for your applications.

Ron
 

Thread Starter

DJ_AA

Joined Aug 6, 2021
305
My read is it's pretty straight forward. I have not studied the data sheet in detail. Vref + and Vref - can be tied to VCC and GND and about all you need to do is read the chip. The chip has programmable gain which is nice. I don't see whay it would not work for your applications.

Ron

Thanks, I mean the current sensor I presume can directly connect each wire to a channel.

I will create s small PCB for this device
 
Top