ADC readings from A9 and M4 giving "wrong" values

Discussion in 'UDOO NEO' started by jc_hex, Jun 20, 2016.

  1. jc_hex

    jc_hex New Member

    Joined:
    Jun 17, 2016
    Messages:
    4
    Likes Received:
    0
    Hello all,

    I am using udoo neo running udubuntu version: UDOObuntu_neo_v2.0rc1. I want to read this sensor http://ww1.microchip.com/downloads/en/DeviceDoc/21942e.pdf using the ADC inputs, but I am facing some issues.
    First I tried to read the sensor from A9 (using this tutorial http://www.udoo.org/docs-neo/Hardware_&_Accessories/ADC.html) and connecting its output directly to the ADC inputs (I have tried all of them from A0-A5 ). I noticed that the adc readings were not consistent with the ones I observed with a scope or a multimeter. Then, I tried to isolate the problem connecting the sensor output to a unit gain buffer, using an LM324AN opamp.
    I connected the sensor output directly to udoo's A0 input and to the buffer input, I also connected the buffer output to the udoo's A1 input.

    I got the following values:

    A9 Read with sensor
    Multimeter : A0 = 744 mV - A1 = 740 mV
    Scope mean = 739 mV both A0 and A1
    A0 = 823.388671364
    A1 = 769.409179210

    Then I tried to read using an arduino scketch on M4 and the analogRead(), I got:
    M4 Read with sensor:
    Multimeter = 734 mV both A0 and A1
    Scope mean = 736mV both A0 and A1
    A0 Sout = 767.80
    A1 Buffout = 756.00

    I found out that in order to get 12 bits precision in the M4 side, I needed to use analogReadResolution(12); otherwise abnalogRead() was giving 10bits resolution.

    To eliminate other options and other sources of the error I was getting, I tried to read a variable power supply from both A9 and M4 using the same methods I used for the sensor and I got:

    A9 Read with power supply
    Multimeter : A0 = 419 mV - A1 = 418 mV
    Scope mean = 420 mV both A0 and A1
    A0 = 431.835937232
    A1 = 434.252929418

    M4 Read with power supply
    Multimeter: A0 = 418 mV - A1 = 417 mV
    Scope mean = 416 mv both A0 and A1
    A0 Sout = 435.06
    A1 Buffout = 432.64

    In the end I tried to read using and Arduino Due just to see the differences from the Udoo Neo readings:
    Arduino Due with sensor
    Multimeter : A0 = 737 mV - A1 = 737 mV
    A0 = 733.96
    A1 = 726.71

    Arduino Due with power supply
    Multimeter : A0 = 419 mV - A1 = 418 mV
    A0 = 416.53
    A1 = 414.11

    So, it seems that the udoo is reading a tens of milivolts more than the real value both in A9 and in M4 side.
    When using the sensor, there is a clear difference between the values from the sensor, directly and when using the unit gain buffer. Could this be related with the impedance of the adc inputs? The bigger difference in the values is observed when using the A9 read. However when usign a pure arduino (Arduino Due) the difference in the values is bellow 10mV which is acceptable for such low values. Do you have any idea about what could be happen here?

    I have tried in two different udoo neo and with different sensors.

    Hope you can help with this.
    Cheers,
    J
     
  2. I Hate Google!

    I Hate Google! New Member

    Joined:
    Jun 20, 2016
    Messages:
    28
    Likes Received:
    17
    Regarding the accuracy I concur that the barometric sensor brick appears to be reading "low" too - not by much - a couple of degrees C and a few millbars low too. I put that down to calibration.

    For the ADC apart from a little bit of "wobble" equivalent to perhaps a 0.5 mV to my Neo reads 0v (grounded) and 3.29v (held to 3.3v) which is perfectly acceptable. The wobble can be probably put down to noise.

    12 bits (4096 values) isn't a terrific resolution so I don't believe we use the Neo for high-accuracy readings. Step calibration would give you a better read of course but it's a fiddly job and requires a high-accuracy reference which rather defeats the object.

    You mention using a unity gain op-amp to compensate for input impedance - but the device you're using has an output impedance of only 20R so that's not likely to help (good idea though) - any other variance is likely to be due to the 324. (I prefer the LM411 - single, JFET) as a jellybean for this sort of thing but the AD8244 is probably a better bet.

    The accuracy of the MCP9700/9701 isn't all that great either (+/- 1C at best and up to +/- 4C!) and it's designed for 1C/bit on an 8-bit DAC.

    I've used a diode to do a similar job - it's temperature coefficient is poorer (2mV/C) but it's linear and fairly consistent. See this for more: http://www.udoo.org/forum/threads/adc-thermometers-for-the-poor-man.4512/#post-20023

    I guess the real question is what are you hoping to achieve? In my experience all these devices are only a guide - but they are useful for switching stuff on an off at calibrated "temperatures" in this case. For that application, a diode and a resistor is just as a good - particularly as discrete thermistors (not ICs like you have here) feature rather non-linear NTC curves.
     

Share This Page