profmason.com

January 7, 2008

Reading current with a PicAXE and MAX471

Filed under: Daily — profmason @ 10:42 pm

max471.JPGThe Max471 is a current sensing chip which is supposed to operate between 0 and 3 amps and produce an analog output proportional to current. Here is a link to the datasheet. max471-max472.pdf Here is an article on using the 471. 471article.pdf

What the 471 actually produces is a series of pulses which have an amplitude proportional to sensed current.

Here is a picture of the 471 output.471dso.jpg

471noise.jpg The pulses get pretty ragged at an output corresponding to 0.2 and 0.5 Amps. This means that the Average voltage is higher in this region then in the rest of the readout. This means that there is a substantial non-linearity in the current readout between 0.2 and 0.5 Amps. Ok, this can be fixed by putting a 0.1 uF capacitor across the gain resistor. This will smooth out any small irregularities in the signal.

To readout the signal using an ADC, you could use either a capacitor to smooth the pulses, an op amp integrator or a software solution. I spent some time trying the capacitive solution. I ended up using a 1 uF capacitor across the gain resistor, this gave some smoothing. In software, the ADC is readout 100 times and then the values are averaged. This means that the ADC is readout over ~ 20ms period which will sample several of the pulses.

Here is the smoothed pulse train: 471smoothed.jpg

Here is the schematic:

max471schematics.JPG

Taking data on ADC value vs current shows that the relationship is reasonably linear between .2 and 3 amps. Here is a graph of the ADV value vs. Current

471advvscurrent.JPG

Technically to find Current given the ADC value, you should plot Current vs. ADC value.  We can just invert the fit parameter.   This gives Current = 0.0202 ADC – .3365 A .  There is a standard deviation of 1.65% from the fit.  There is also a systematic uncertainty of +- 1 ADC value which is .02 Amps or 20 mA.

Here is the Picaxe code:

  •  ’Read a MAX471 Current sensor for output currents between 0.5 and 3 amps.

    symbol counter = b3
    main:
    w0 = 0
    ‘Read the ADC 100 times and accumulate the value
    for counter = 1 to 100
    readadc 0,b2
    w0 = w0 + b2
    next counter
    ‘Find the average of the ADC reads
    w0 = w0 / counter
    ‘Output current in mA = 20.33 * w0
    w2 = w0 * 20
    w2 = w0 / 3  + w2 – 336
    sertxd (#w0,”,”,#w2,13,10)
    goto main

No Comments »

No comments yet.

RSS feed for comments on this post. TrackBack URL

Leave a comment

You must be logged in to post a comment.

Powered by WordPress