# Measuring high frequency current with Adrunio

Is there a way to measure the current of a high frequency signal (100Khz) with an Ardunio? I am thinking that some form of analog circuit could be made whose input takes AC current and whose output is DC current (or voltage), and that this would be readable by any uM's analog to digital inputs.

Edit: The waveform is a sine wave; the output of a chopper stepper driver. The average current is required and I don't expect more than 2 amps of current.

• Can you give us a little more detail? What sort of waveform is the current, sinewave or something else? Do you need an average, RMS or peak measurement? What order of magnitude of current are you expecting? – Dave Tweed Oct 10 '12 at 21:00

You actually need to detect the envelope. It's useful to think of this as a demodulation problem, as that's what it is!

Send the current through a small sense resistor that feeds a difference amplifier or instrumentation amplifier. Then, feed that output through a precision full wave rectifier, followed by a low-pass filter.

If you don't rectify first, the low pass filter simply zeros everything out. Rectifying prevents this, giving a non-zero mean that moves with amplitude.

Similar processing is routinely done for electromyography signals (muscle-related electrical signals) which are very AC, but most folks are interested in some average activity. I've seen the rectification/low-pass arrangement called a "Paynter filter" in this particular case.

Filter at whatever corner frequency reliably tracks the changes you're looking for, then sample fast enough to avoid aliasing. Depending on what your corner frequency is, and what filter you use, you might have some phase distortion.

rectifier circuit from sound.westhost.com/appnotes/an001-f4.gif

As an aside, I've found this circuit to be trickier to use than it should be. Perhaps it needs faster diodes than I use, but a small cap across the feedback path of the first op amp seems to do wonders.

• I have a current sense device (ACS712) that I thought would be helpful. I think that it implements some of the circuit that I see above. So if I treat the signal as a "high current" demodulation then I should be able to measure it as voltage with this device if I first rectify the incoming signal? – user3045 Oct 11 '12 at 22:13
• The ACS712 (allegromicro.com/Products/Current-Sensor-ICs/…) has a bandwidth of 80KHz, and probably won't work very well at 100KHz. In any case,if you take the output of some sort of current sensor, full-wave rectify it using the circuit I posted, and then low-pass filter it, you should be able to sample that with the arduino to track your current – Scott Seidman Oct 12 '12 at 13:20

You don't specify what kind of signal that is, so I assume, for simplicity sake, that it does not go below microcontroller ground.

You must put your signal thru a resistor and use differential amplifier to measure voltage drop on this resistor. Then you have to amplify output and maybe shift it (if it's signal going below your arduino ground rail) using another opamp stage.

You can find op amps specially designed for this task, they are called current sense amplifiers.

But there is a problem - maximum ADC sampling frequency of atmega microcontrollers is 200KHz - two times the sampled signal - it's theoretically (lookup Nyquist sampling theorem) juuust enough to reconstruct the signal, but accuracy will be poor. If you are interested in average of current - you can pass output of differential amplifier thru RC low pass filter and sample that.

• So a current sense device plus sample as fast as you can? – user3045 Oct 11 '12 at 22:15
• yes, and sum while sampling – miceuz Oct 11 '12 at 22:18

I believe you could accomplish this with the use of an RMS-to-DC converter, which will give you the RMS current value of the analog signal input as a DC value, which can then be sampled and read by the Arduino. See this link: http://www.analog.com/static/imported-files/tutorials/MT-081.pdf.

Alternatively, you could rectify the analog signal to drop any negative components and sample the analog signal yourself to compute the current value. As miceauz said above, however, you will be limited by the sampling frequency of the Arduino. Using the RMS-to-DC converter will forego the problems with the sampling frequency.

Either use a shunt resistor or a current transformer with low winding ratio (like 1:50). Then rectify and filter, or simply use an RMS-chip such as AD734.

Or take a look at Si8501-C-S, which is an integrated circuit like the ACS712 but with a bandwidth to 500kHz.

• I cannot recommend the Si8501 unless you have access to the control signal. It is basically an integrator that needs a reset signal after each phase = serious timing problem w.Arduino. – Paamand May 19 '16 at 10:46