This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

MSP432P401R: MSP432P401R launchpad unstable ADC reading issue.

Part Number: MSP432P401R

Hi all,

I am trying to do a temperature sensor by using PT100 RTD and msp432p401r launchpad. To sense the voltage across the RTD, I used a voltage follower that is built by an opamp. The problem that I am currently facing is the ADC readings are not consistent.

The ADC settings are listed below,

1. ADC start of conversion is triggered every 10ms.

2. ADC is set as 14-bit, the ADC clock frequency is 48MHz/6=8MHz, The sample-hold-time is 128bits which is about 21.33us.

3. The voltage reference of the ADC is 1.2V.

I try to read the ADC result 20 times and store them in an array. I found that the difference between the maximum and minimum value is more than 100 which represents roughly about 7mV voltage difference.

My question is that are there any method that can reduce the inconsistency? 

Regards,

David

  • Hello Jian

    Can you please share the schematic of the external voltage follower circuit you have, the range of output voltage from the PTD?

    Instead of using output of the voltage follower if you provide a constant DC voltage then what is the result? Also please share the program code that you are using?
  • If you are only taking readings every once in a while, you can put in an RC filter to smooth things out.

    While the max-min of your twenty readings might be 100, what is the standard deviation? Can you just keep a running average of the 20 readings?
  • Hi Amit,

    Thanks for reply.

    The schematic of the voltage follower is attached. The range of the output voltage is roughly 100mV~400mV. And I tested the output voltage with a multi-meter, it was very stable.

    At the beginning, I didn't use a voltage follower for buffering. I thought the unstable reading may related to the impedance of the voltage divider. However, after I add the voltage follower, it didn't help much. I am thinking maybe I didn't set the controller right.

    The code that used to setup the ADC peripheral is,

        ADC14->CTL0 &= ~(ADC14_CTL0_ENC);
    
        /* Setting reference voltage to 1.2V  and enabling reference */
        REF_A_setReferenceVoltage(REF_A_VREF1_2V);
        REF_A_enableReferenceVoltage();
        REF_A_enableReferenceVoltageOutput();
    
        ADC14->CTL0 |= ADC14_CTL0_SHP;
        ADC14->CTL0 |= ADC14_CTL0_DIV__8;
        ADC14->CTL0 |= ADC14_CTL0_SSEL_3;
        ADC14->CTL0 |= ADC14_CTL0_CONSEQ_1;
        ADC14->CTL0 |= ADC14_CTL0_SHT1__128;
        ADC14->CTL0 |= ADC14_CTL0_SHT1__128;
        ADC14->CTL0 |= ADC14_CTL0_MSC;
    
        ADC14->CTL0 |= ADC14_CTL0_ON;
    
        // A0 ADC input select, P5.5; Vref=1.2V
        ADC14->MCTL[0] |= ADC14_MCTLN_INCH_0;
        ADC14->MCTL[0] |= ADC14_MCTLN_VRSEL_1;

    Regards,
    David
  • Why are you enabling the reference voltage output?

    "Outputs the reference voltage to an output pin.
    This function is used to output the reference voltage being generated to an output pin. Please
    note, the output pin is device specific. Please note, that giving ADC12 module control over the
    REF module, the state of the reference voltage as an output to a pin is dependent on the controls
    of the ADC12 module. Please note, if the REF_A_isRefGenBusy() returns REF_A_BUSY, this"

    Are you using it for something else? If not, is there anything connected to that pin?
  • Hello Jian,

    Thanks for the wiring schematic. Unfortunately a DMM has a very low sampling rate so any fast moving signal may not be detected by a multimeter. Did you try connecting a constant voltage source to the P5.5 pin?

    Also you are using direct register access instead of the driverlib functions (bound to have some issues e.g. ADC14_CTL0_SHT1__128 is being set twice). Instead you must set ADC14_CTL0_SHT0__128 for MEM0 where your sample is residing.
  • Hi Keith,

    I am not sure whether the 100 difference is standard deviation.

    I sort the 20 reading from small to big and average of the 10 readings in the middle. But still, I couldn't get a satisfied result. I tried to compare the average result every 1 second. It is still not very stable.

    I tried to use RC filter with 1Hz cut-off frequency. It didn't help. Actually, the voltage at the ADC input is very stable.

    Regards,
    David
  • Hi Keith,

    For getting the test results I mentioned, there is no connection on the reference pins.

    I guess the 3.3V from the launch pad might not be very stable. So I want to use the reference voltage as the power source of the voltage divider. This may give me a better result.

    Regards,
    David
  • I am pretty sure that the reference output is buffered, so it should be OK. But if you put a filter on the pin and your DMM sees no variation, then it seems unlikely that 3.3 variation is the problem.

    You could be seeing 50Hz/60Hz power line interference which the DMM in DC mode is very good at filtering out Measure the AC voltage with the DMM.

    Have you tried plotting the 20 samples (or more!) to see if there is a pattern, like a sine wave?
  • Hi Amit,

    Thank you for picking up the error, I have changed it.

    The constant voltage source that I have is a LM336 2.5V voltage reference. I change the ADC reference to AVCC 3.3V. And the difference between the minimum and maximum becomes about 20. It does reduce the difference.

    I think I will try to build some low pass filter with different cut-off frequency.

    Regards,
    David
  • Hi Keith,

    I samples show random pattern. I will try to add more filters and see what will be the result.

    Regards,
    David

**Attention** This is a public forum