Measure average current

I want to be able to measure a pulse unipolar with a DC offset (programmable) from 10mV to 250mV; maximum amplitude of 500mv square wave Variable duty cycle 10 to 50%.The frquency of the pulse is seletable from 10kHz to 100kHz. The measurement is a square wave from a resistor current shunt.

The idea I have is use an rms to DC converter IC and feed the DC output to a PIC 10 bit ADC clocked at 20MHz and do the math on the pic to get the average current then calculate the average power. I was wondering is this the best way to go about this or is their a better way? Looking at rms to dc IC's with 100 kHz + BW aren't exactly cheap.

Reply to
Hammy
Loading thread data ...

RC filter and measure the resulting voltage?

Sylvia.

Reply to
Sylvia Else

On a sunny day (Sun, 03 Oct 2010 12:43:42 GMT) it happened Hammy wrote in :

Interesting. For RMS simplest would be to have the pulse heat up something and measure temperature rise? Just joking. I have some 32 MHz 8 bit video flash digitiser chips laying about, one connected to a FPGA, could do mutiplications and additions in hardware to get RMS value. Maybe you could simply use an analog peak detector to get the amplitude, and count clock pulses to get the width, and multiply in a PIC 18F @ 64 MHz. This should work if the pulse amplitude only changes slowly.

Reply to
Jan Panteltje

Jan Panteltje wrote in news:i89uut$1rb$ snipped-for-privacy@news.albasani.net:

I could cheat the PIC will be setting the pulse frequency and duty and magnitude and range so I know what the value would be assuming everything works as it should.;-)So far it does but it would be nice to know for sure by being able to take an actual measurment.

I just thought it would be a nice feature to add to my programable load. That way I could display total power and avg current.But its looking like it might be to complex and to expensive to do so I might be having to settle with just the ability for DC mesurments.

I dont have FPGA hardware or experience using them,that is likely the way it should be done though.

The fastest rise times are about 100nS or so. Thanks its something I'll look into.

Reply to
Hammy

On a sunny day (Sun, 03 Oct 2010 14:19:58 GMT) it happened Hammy wrote in :

I actually ment pulse amplitude, given a flat top, over time, not rise time. I thought about it some more, maybe you can use the PICs analog comparator to detect the start of a 'pulse' (high level), then take one sample, use the analog comparator again to find the end of the pulse (low level), take one sample again (assuming a flat pulse top). In between count clock ticks... I have even done video black level sampling with the smallest PIC 12F that way. Deteced sync, detected V sysnc, waited some clocks, sampled Y into a capacitor with a 4053. Then later used that value by connecting that capacitor to an amp input, that PIC did not even have an ADC. If you have an ADC, the ADC sampling time is much shorter then the conversion time, you could perhaps wait for the 'conversion ready' interrupt.

Reply to
Jan Panteltje

Jan Panteltje wrote in news:i8a4qh$afs$ snipped-for-privacy@news.albasani.net:

[snip]

Thanks Jan you gave me a couple of ideas I can look into further.

The pulse amplitude is 500mV max. I'm using a 16F887 for know; it has 2 comparators and a 10 bit ADC.

Reply to
Hammy

I don't know why you can't just directly have the ADC input read it as is and do the math in code ?

The ADC most likely won't produce the exact square wave result but simply round it a bit how ever, all you're looking for is a change in amplitude from high to low/ low to high and just measure the Pk-PK values in code..

I did this a few years ago experimenting with a AM+FM type carrier protocol to pass information over short wave using a simple PIC with a ADC on board. The problem I ran into was some of the receivers in use didn't have a slow enough AGC if I extended amplitude change for too long. So a sync signal had to be applied with full amplitude with short frames.. Much like Analog Video..

Jamie.

Reply to
Jamie

Depends on whether he wants the average current or the true RMS. That depends on the details of his load.

Either way, random sampling would work. Just digitize the voltage across the shunt, using some sample rate that's asynchronous to the PWM. For average current, just do rectangular averaging or software lowpass filtering of the samples. For RMS, square the samples, average or filter, square root.

Nyquist rate issues don't matter, since the intent is to gather statistics on the waveform, not to reconstruct it. So the ADC sample rate doesn't need to be high. The ADC sample bandwidth does has to be relatively high to do RMS accurately.

John

Reply to
John Larkin

John Larkin wrote in news: snipped-for-privacy@4ax.com:

Its for a programable load I built. I want to add the ability to measure the current pulse. The pulse is square and can between 10mV to

500mV. The maximum frequency is 100kHz, minimum duty cycle is 10%. So a 1uS pulse width is the worst case.

By takeing the average current I can calculate the power dissapeted in the pass FET's.

Reply to
Hammy

How about cheap and dirty..sample at an appropriate rate and do everything in software (100 samples at 1.00V, next 100 a 2.00V, repeated measure = average of 1.50V).

Reply to
Robert Baer

But, what do you want to measure? Pulse height? Width? Shape? Spacing? Duty cycle? Timing jitter?

It's a known square wave, 'rms' is not any more informative than any other averaging scheme. What use is it to 'do the math'?

An op amp and diode set up to do a 'peak hold' into a voltmeter is ... simpler.

Reply to
whit3rd

whit3rd wrote in news:30b25055-40ed-4253-820e-1072ed20d789 @g18g2000yqk.googlegroups.co m:

It will be a square wave on a DC offset that can vary from 10 to 60% Vmax where Vmax is 500mV. The voltage signal is from a current shunt.I want the average so power dissapation can be calculated and displayed.

I've done some more research and the typical way to do it seems to be sample over a period and take the average of the ADC. But hey if you know of a simplier way to do it I'm all ears.

The way I was thinking of doing it was start sampling at the start of one period and stop at the end "do the math" to figure the average.

Its for an adjustable load I built for testing power supplies just another little feature I thought I would add. Its simple to calculate the power for DC I just sense the input voltage (scaled) using the PICS ADC and sense the current and voila I can display current voltage and power. I'm also displaying heatsink or case temp of the FETS. I want to do the same thing when I test PSU's with a load step.

I'm still looking into it.;-)

Reply to
Hammy

Dissipation meaning heat generation? If that is the case, is it the dissipation in the shunt resistor, or in a load resistor, or in a possibly nonlinear item (transistor or diode or somesuch)?

You cannot measure power with only a current measurement, it takes both current and voltage to compute the work being done. In all cases, current-versus-time and voltage-versus-time determinations WILL suffice. Only in a few special cases will 'average' current be useful.

A current shunt could as easily measure current into a battery for charging, or a motor... the flow of energy is all you can measure, not the heat generation in any completely unknown load.

So, this is a periodic repeating signal... and if you control the duty cycle the complete information in the shunt output is contained in its minimum and maximum voltages during a cycle. A quad op amp and some diodes and capacitors makes a peak-hold and negative-peak- hold circuit, you can read out steady voltages at leisure.

Reply to
whit3rd

whit3rd wrote in news:a0a92a6a-d818-41ce-a99f- snipped-for-privacy@d25g2000yqc.googlegroups.co m:

It is mosfets that I'm mesuring the power in.

Huh did you read my whole post? I'm sensing the input voltage its for a programable electronic load 300W countnous to 600W peak.

The load is 6 mosfets. The voltage across the FETs is the input voltage minus the shunt voltage. So P=(Vin - Vshunt)* Iavg.

Yep your right that is an option I never thought of.

Reply to
Hammy

Hammy wrote in news:Xns9E0846C26D577Hammyhamsterca@69.16.185.247:

[snip]

Actually P= Vin * I avg. I would want to display the power the PSU under test is delivering. [snip]

Reply to
Hammy

ElectronDepot website is not affiliated with any of the manufacturers or service providers discussed here. All logos and trade names are the property of their respective owners.