> I am currently building a digital voltmeter (3 x IN-14, 1 x IN-19A)
> using the 10 Bit ADC MAX1242 and the PIC16F627A as the controller. I
> would like to measure voltages up to 300V.
>
> Here is what I did:
>
> - Vref was conencted to the 5V logic supply voltage, buffered with
> 2.2uF and 100nF. The 5V are obtained from an 78ß5 regulator that is
> buffered with 100nF on both sides.
>
> - Vin is taken from a voltage divider consistong of R1 = 9.970MOhm, R2
> =
> 151kOhm, results in a factor of n = 0.0149. The resistors' values were
> measured within the working circuit. Addidionally, V_in has been
> buffered with 10nF due to the large impedance of the divider (see the
> datasheet of the MAX1242 
> here:http://datasheets.maxim-ic.com/en/ds/MAX1242-MAX1243.pdf)
>
> - I left /SHDN floating so that I could use the external 5V reference
> (see the datasheet).
>
> I am calculating the applied voltage as follows:
>
>   U_measured = n * U_applied
> ^ U_measured = U_ref / 1024 * Bits
>
> <=> U_applied = U_ref / 1024 / n * Bits
>
> With U_ref = 5V and n = 0.0149 I get
>
> U_applied = 0.327 V/Bit * Bits
>
> I programmed that into my controller with a normal floating point
> multiplication, fixed-comma-arithmetic will be implemented during
> optimization later. Checking the displayed voltage with my multimeter
> revealed that the voltages calculated my the uC are off by the factor
> 2; not exactly 2, but in the range.
>

A couple of things to check:
(1) is your multiplication routine working properly. Check it with
some dummy data, and also check the raw data coming from your ADC and
doing the calculations manually.

(2) This ADC communicates serially, so check to see that your SPI port
is sucking in the data correctly. It could easily be shifted by one
bit, + or -.

(3) Check that your reference really is 5V, and not the internal 2.5V
of the chip. It seems to have a pretty low impedance.

Finally, which way is it off by 2. Is it suppose to report 1V, but
reporting 2V, or 1/2V ?

This device is a SAR (successive approximation) ADC, which is usually
not used for this type of app. Multimeters usually use dual-slope ADCs
(analog integration - calculus - see last rant). This probably means
that your doing some kind of averaging, of multiple samples, in order
to smooth out the data. IIR and FIR filters are usually used for this
kind of thing, so that's another piece of code to check.

-- 
You received this message because you are subscribed to the Google Groups 
"neonixie-l" group.
To post to this group, send an email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/neonixie-l?hl=en-GB.

Reply via email to