Measuring current range of max 30mA for a DC pulsed signal  - Page 1
Forum section: electronics / general

author: Houseman
author_rank: Regular Contributor
timestamp: March 04, 2021, 09:57:14 am
content: Hi folks.For the lab I am working in I need a as-simple-as-it-can-be but reliable circuit in order to measure with a microcontroller (maybe an AVR Atmega328P I am familiar with) the current in the range of 0 to maximum 30mA) of a pulsed DC signal that is high for 500us and low for 3500us. (can be even longer the low period - maximum is 25ms OFF)Since now the measurement is done using an oscilloscope and a known resistor value 1000Ohm in parallel but the idea is keeping it more efficient.I do not obviously pretend the final circuit. Maybe you can point me out what I have to look for (sample rate?) and suggest maybe some discrete package that does the measure and connect to the MCU via SPI or I2C.I have already looked from Analog Devices plenty of components but I do not simply know where to start in order to skim out the right device.Thank You all.Steve

author: Houseman
author_rank: Regular Contributor
timestamp: March 04, 2021, 11:21:53 am
content: Found just as an example this device:https://www.allegromicro.com/~/media/Files/Datasheets/ACS725-Datasheet.ashxWas thinking if it suited for my application.Regards

author: snarkysparky
author_rank: Frequent Contributor
timestamp: March 04, 2021, 02:51:08 pm
content: sense the current with a 10 ohm resistor 0.1% and filter the voltage across it with an RC filter.RC filter time constant something like 2 seconds if you can stand the delay. This will give the average current easily.If you need to know the peak current that is a different matter. Might suggest a peak detecting op-amp circuit.ideas herehttp://ww1.microchip.com/downloads/en/appnotes/01353a.pdfThe current sensor you linked has too high a scale for your 30ma measurement. Data sheet says noise output referred to input is 27ma RMS

author: Siwastaja
author_rank: Super Contributor
timestamp: March 04, 2021, 03:05:48 pm
content: Do you need the average current, or do you want to see the waveform i.e. measure the off-current and on-current separately? If the latter, how clearly do you want to see where the transitions are? For example, ATMega328P's ADC sampling at 10ksamples/s would show the 500us on-time as approximately five datapoints. Would this be suitable for you?For average current, use an easily available and easy-to-use ADC with as much sample rate as you (easily) get, then design the RC filter around that. For example, if you sample with the AVR ADC (which obviously will be the cheapest and easiest-to-use option) at 10kHz, maybe the cutoff frequency of the RC filter should be at 1kHz maximum, preferably even lower because of the slow rolloff of the 1st order RC filter. But going too far like 1 second time constant rarely is fruitful, you need very large R and C values which come with tradeoffs. Then further average with software, even a simple average works well and is easy to implement, but you can always upgrade to a "properly designed" FIR or IIR filter when you feel like you want to go further.To reduce power dissipation in shunt resistor (and the "burden" voltage drop), use a so-called "current sense amplifier". Those have low offset voltages and come with gains such as 50. A gain of 50 would enable you to use a 3.3ohm shunt resistor, that drops just 0.099V at 30mA, yet still get 4.95V output for the ADC. TI INAxxx series is fine but there are many others.

author: Houseman
author_rank: Regular Contributor
timestamp: March 04, 2021, 09:19:36 pm
content: First of all thank You so much for all the hints.At first approximation average current would be fine.Will let you know further when I will investigate deeper.Thanks again