Sciencemadness Discussion Board
Not logged in [Login ]
Go To Bottom

Printable Version  
 Pages:  1  2
Author: Subject: Stability and precision of Hall-based current sensors?
WGTR
National Hazard
****




Posts: 971
Registered: 29-9-2013
Location: Online
Member Is Offline

Mood: Outline

[*] posted on 17-11-2018 at 13:11


Yeah, I understand the situation. I once square-braided eight feet of 128 strands of copper wire by hand. It took me an entire week, but I didn't have much to do back then.

<disclaimer> This post is likely the theoretical ramblings of a neurotic chipmunk, and holds no weight whatsoever until verified thoroughly in a lab environment. I was never a TV personality, and never played one on TV. I am also not a lawyer, and never stayed at a Holiday Inn. <end disclaimer>


IMG_4623.JPG - 1.9MB IMG_4624.JPG - 1.7MB

If you want to roll your own current sense transformer for DIY reasons, I think it would work with a reasonable number of turns in the toroid. It doesn’t have to be 1,000’s of turns so far as I can tell, although one with 1,000 turns would ironically be easier to work with once it was all put together.

Based on memory, I have a ferrite toroidal core in the lab that gives about 10 x turns2 uH (Al= 0.000,01H/t2). The minimum cross-sectional area of the magnetic path is about 1 cm2, or 0.000,1 m2.

For a current sense transformer, we don’t want the voltage response to increase with frequency. Since an inductor has a frequency-dependent impedance, we want to minimize the effects of this element as much as possible. One way to do this is to swamp it out with a real resistance (i.e., a resistor), that is ideally not frequency-dependent.

Suppose that we have our ferrite toroid with a single turn primary. At 50Hz its impedance would be +0.003,142jΩ. If we want to “short” out this element, let’s say that we add a resistor in parallel that is about 100x less in value (0.000,033Ω). It becomes easier to see what happens when we mathematically convert this circuit to its equivalent series circuit. The resistor value is about 100x greater than the inductor impedance. It’s like the inductor isn’t even there.

We have to make sure that we aren’t saturating our toroidal core, otherwise the output voltage of our circuit won’t step linearly with the input current. If the 0.000,033Ω resistor is removed, then our inductor is unloaded. With 20ARMS at 50Hz going into the inductor, 0.06284VRMS appears across it. Solving for Webers and flux density in Teslas, we can see that with our current transformer unloaded, flux density is about 11 Teslas (accounting for the fact that our sine wave is bipolar, flux density would actually be half, at 5.5T). Since typical ferrite can handle around 0.3T before saturating, we are operating way into the non-linear region. This isn’t a safety problem because the transformer is in series with the actual load (air conditioner in this case), but the measurement would be meaningless.

If we re-add our 0.000,033Ω load resistor, then things change. Taking the value from our series equivalent circuit, our effective inductor impedance becomes 0.000,000,347jΩ, and the voltage across it at 20ARMS drops to 0.000,006,94VRMS. Flux density then drops to 0.001,25T maximum, about 300x lower than our saturation limit.

Great, now where to get a 0.000,033Ω resistor? Adding a 55 turn secondary gives a voltage transformation of 55, but an impedance transformation of 3,025. Shorting the secondary with a 0.1Ω resistor would reflect this value to the primary. The secondary winding itself may be 0.1Ω itself or even more, so take care to use sufficiently-sized wire to keep from both introducing a frequency-dependent measurement error, and raising the flux in the core. The primary turn itself may have more than 0.000,033Ω of resistance anyways, but this shouldn’t matter, as we’re measuring input current, not voltage. The current going through the primary winding won’t change noticeably regardless of whether its resistance is 0.000,001Ω or 0.1Ω.

Secondary output voltage across the 0.1Ω load would be low, 0.36VRMS max at 20ARMS in, and may need to be amplified for your application.

If you can sample your ADC using an ISR triggered by a timer, then you should be able to get samples at predictable intervals. Obviously, with only one ADC you won’t be able to sample both voltage and current at exactly the same time...but wait, you can. If you can determine the exact time between samples, then it’s possible to add an RC delay line to whichever measurement comes second. If you sample the voltage, and then 5ms later sample the current, then we need a 5ms delay on the current transformer output. This is not difficult to do. It would take at least a few RC stages, because we’re trying to emulate a lossless transmission line with a distributed resistance and capacitance. We don’t want the voltage response or delay to be sensitive to frequency within our bandwidth of interest. A single RC stage alone may provide enough shift for the fundamental frequency, but the harmonics may arrive too soon, and their amplitudes may be inaccurate.

Your ADC sample rate needs to be fast enough to capture the 50Hz fundamental, and whatever harmonics that contain significant enough energy to affect measurement accuracy. I'm not sure how high it would be necessary to go, maybe the 3rd or 5th harmonic. The utility transformer probably isn't going to pass much power above those frequencies. I would hope that any rapidly-switching inverter-type compressors would be reasonably well-filtered in the unit itself.




View user's profile View All Posts By User
Sulaiman
International Hazard
*****




Posts: 3595
Registered: 8-2-2015
Location: 3rd rock from the sun
Member Is Offline


[*] posted on 17-11-2018 at 13:20


@Vomaturge : you are correct, there is no need to terminate the cable at 50/60 Hz,
probably the 'optimum' burden resistance is chosen for maximum ADC input voltage at maximum anticipated current.




CAUTION : Hobby Chemist, not Professional or even Amateur
View user's profile View All Posts By User
Fulmen
International Hazard
*****




Posts: 1696
Registered: 24-9-2005
Member Is Offline

Mood: Bored

[*] posted on 18-11-2018 at 03:32


WGTR: You certainly know more than me about ct's. But that's part of my reasoning for making one, it's usually very educational.
Nevertheless I think I have come far enough to say that this is doable. I get decent sampling rates without any special tricks and the programming isn't too hard. Last time I played with the board my problem was C++. I'm no programmer, and something abut that language turned me off the entire thing. But sometimes you just have to let things simmer in the back of the brain for a bit.




We're not banging rocks together here. We know how to put a man back together.
View user's profile View All Posts By User
Fulmen
International Hazard
*****




Posts: 1696
Registered: 24-9-2005
Member Is Offline

Mood: Bored

[*] posted on 22-11-2018 at 22:57


What is the best approach for timing the sampling? Perhaps a "while" or "do while" loop?

Would this work for a 1ms sample interval?

timer = micros()
for (int i=0; i<n; i++){
while(micros()<timer+i*1000){};
voltage=analogRead(A0);
current[n]=analogRead(A1);
timestamp=millis();
}





We're not banging rocks together here. We know how to put a man back together.
View user's profile View All Posts By User
JJay
International Hazard
*****




Posts: 3440
Registered: 15-10-2015
Member Is Offline


[*] posted on 23-11-2018 at 00:14


You might want to stick a delay into that loop to reduce power consumption.



View user's profile View All Posts By User
DavidJR
National Hazard
****




Posts: 908
Registered: 1-1-2018
Location: Scotland
Member Is Offline

Mood: Tired

[*] posted on 23-11-2018 at 02:45


Quote: Originally posted by JJay  
You might want to stick a delay into that loop to reduce power consumption.


No - do not do that. You want to sample the input waveform as fast as possible for the reasons I detailed in a previous post. Most of the time is going to be spent in the blocking ADC read calls anyway.

More to the point - sticking a delay call in will not reduce the power consumption. All a delay call does is has the processor spin doing nothing useful for a given time. It does not turn off the processor. It is possible to do that, but it's more complicated than just adding in a delay.

The power consumption is going to be low enough for you to not care about it at all for a mains powered application. If it was a battery-powered device, then sure, you may want to consider power consumption. But it really doesn't make much sense to spend a lot of effort trying to shave off a few microwatts if it is mains powered.

[Edited on 23-11-2018 by DavidJR]
View user's profile View All Posts By User
Fulmen
International Hazard
*****




Posts: 1696
Registered: 24-9-2005
Member Is Offline

Mood: Bored

[*] posted on 23-11-2018 at 06:20


Agreed. As long as I don't burn the board I couldn't care less about the power consumption for this application. So, back to the topic. What would be the best way to control the timing?



We're not banging rocks together here. We know how to put a man back together.
View user's profile View All Posts By User
WGTR
National Hazard
****




Posts: 971
Registered: 29-9-2013
Location: Online
Member Is Offline

Mood: Outline

[*] posted on 23-11-2018 at 08:56


What board and processor are you using? Can you provide a link to the board that you have?



View user's profile View All Posts By User
Fulmen
International Hazard
*****




Posts: 1696
Registered: 24-9-2005
Member Is Offline

Mood: Bored

[*] posted on 23-11-2018 at 10:49


Right now I'm using the Duemilanove: https://www.arduino.cc/en/Main/ArduinoBoardDuemilanove

But I will probably switch to one of these in due time:
http://www.dx.com/p/produino-atmega328p-improved-pro-microco...




We're not banging rocks together here. We know how to put a man back together.
View user's profile View All Posts By User
WGTR
National Hazard
****




Posts: 971
Registered: 29-9-2013
Location: Online
Member Is Offline

Mood: Outline

[*] posted on 23-11-2018 at 12:04


OK, assuming the ATmega168 controller, here's a link to the datasheet:

http://ww1.microchip.com/downloads/en/DeviceDoc/Atmel-2545-8...

There's a list on page 88 of the various interrupts that are available for you to use. I've never used Atmel devices, but have used MSP430's and SiLabs devices. These are going to be very different in the types of features that they offer, but all micro-controllers operate in a similar basic way. I normally use C instead of C++ for things like this. You'll notice that the datasheet offers examples in both C and assembly.

When I've needed to use an on-board A-D converter, what I did was first set up an on-board count-up timer that would auto-reload with a pre-programmed value. This variable value allowed one to divide the system clock by a specific value, producing a specific time period that could be used to trigger ADC conversions. When the timer reached its maximum (0xFFFF) and rolled over to zero, it would trigger an ADC conversion and its own auto-reload. When the ADC conversion was complete, the ADC itself would trigger an interrupt, which was then serviced by the ADC ISR. You can see these various interrupt sources on page 88, and the ADCSRA and ADCSRB registers in the ADC allow you to set up auto-triggering from a timer source (pages 326 and 332).

As a "pro" tip, don't enable an interrupt unless you have the associated ISR in your code to service it. Some interrupts are cleared automatically when the ISR is called, others you may have to clear manually in the ISR so that you don't end up re-entering the ISR in perpetuity.

Page 332 shows you the different stimuli that are available to trigger an ADC conversion. It looks like you can use both a timer rollover to zero, and a comparator match.

You have your work cut out for you, but you have everything you need in this microcontroller to grab a sample from the ADC on a given input channel on a very specific time interval, at a maximum of about 15ksps.




View user's profile View All Posts By User
Fulmen
International Hazard
*****




Posts: 1696
Registered: 24-9-2005
Member Is Offline

Mood: Bored

[*] posted on 23-11-2018 at 12:32


Whoa, easy there. That's way out of my league for now, this is my first real attempt at this and I ain't no coder. It doesn't have to be perfect as long as I can use simple code.
I don't need absolute timing between sample sets as long as I can get them timestamped with a reasonable accuracy. I'm after average power consumption (testing efficiency at full power), so small timing errors shouldn't cause any problems.




We're not banging rocks together here. We know how to put a man back together.
View user's profile View All Posts By User
JJay
International Hazard
*****




Posts: 3440
Registered: 15-10-2015
Member Is Offline


[*] posted on 23-11-2018 at 18:44


Quote: Originally posted by Fulmen  
Agreed. As long as I don't burn the board I couldn't care less about the power consumption for this application. So, back to the topic. What would be the best way to control the timing?


WGTR really has it down, but if you change your mind, this is an easy approach that actually does decrease power consumption. It should be abundantly obvious that you shouldn't use delay(), but it's certainly not the only delay call that is available: http://www.kevssite.com/arduino-power-consumption-delay-vs-s...





View user's profile View All Posts By User
Fulmen
International Hazard
*****




Posts: 1696
Registered: 24-9-2005
Member Is Offline

Mood: Bored

[*] posted on 24-11-2018 at 00:48


Thanks. It might come in handy for future projects, but I won't use any time on it for this project.



We're not banging rocks together here. We know how to put a man back together.
View user's profile View All Posts By User
Fulmen
International Hazard
*****




Posts: 1696
Registered: 24-9-2005
Member Is Offline

Mood: Bored

[*] posted on 24-11-2018 at 10:43


I have to say this has been an eye opener when it comes to instrumentation. I am going to give the induction mag-stirrer (using 4 electromagnets and a stepper-driver) a try for sure, hell I might even rewire my dead ICA stirrer/heater for arduino. It has a DC motor and an optical counter, should be dead-easy to interface using cheap shields. The hotplate should be easy to figure out. Either replace or identify the temp sensor, then a SSR and a PID-library.

I've also been looking for an excuse to build test-equipment for rocket and propellant testing. The arduino should work well for data capture, and most sensors can be interfaced with existing shields. The only real investments will be a 10+MPa transducer and a decent load cell.




We're not banging rocks together here. We know how to put a man back together.
View user's profile View All Posts By User
wg48
National Hazard
****




Posts: 821
Registered: 21-11-2015
Member Is Offline

Mood: No Mood

[*] posted on 27-1-2019 at 17:25


Fulman: If you want a ready made front end for your project, there is a V,A.kW and kWh meter with a USB interface available on Banggood for £15.68. https://www.banggood.com/Peacefair-AC80-260V100A-Monitoring-...



Borosilicate glass:
Good temperature resistance and good thermal shock resistance but finite.
For normal, standard service typically 200-230°C, for short-term (minutes) service max 400°C
Maximum thermal shock resistance is 160°C
View user's profile View All Posts By User
wg48
National Hazard
****




Posts: 821
Registered: 21-11-2015
Member Is Offline

Mood: No Mood

[*] posted on 28-1-2019 at 02:32
V,A and Ah meter


I found a £4 V,A and charge meter on ebay usefull for charge monitoring of batteries or perhaps electrolysis experiments. The max V and A are high at 120V DC and 20A DC but apparently its auto-ranging down to two decimal place though I doubt it has a comparable accuracy. No USB interface but it is only £4.

https://www.ebay.co.uk/itm/120V-20A-Digital-DC-Voltmeter-Vol...

[Edited on 28-1-2019 by wg48]




Borosilicate glass:
Good temperature resistance and good thermal shock resistance but finite.
For normal, standard service typically 200-230°C, for short-term (minutes) service max 400°C
Maximum thermal shock resistance is 160°C
View user's profile View All Posts By User
 Pages:  1  2

  Go To Top