Skip to main content
sbertuletti
Associate II
November 17, 2016
Question

ADC reading value

  • November 17, 2016
  • 6 replies
  • 1393 views
Posted on November 17, 2016 at 18:26

Why if i put a voltage equal to 1V to the ADC input of the microcontroller, i read a value equal to 1.4 V??

It seems that the Voltage_Actual_Value=0.7*ADC_Value

Thanks

#more-facts #!stm32-!adc #please.
    This topic has been closed for replies.

    6 replies

    AvaTar
    Senior III
    November 18, 2016
    Posted on November 18, 2016 at 09:26

    >Why if i put a voltage equal to 1V to the ADC input of the microcontroller, i read a value equal to 1.4 V??

     

    What makes you think so ?

    slimen
    Visitor II
    November 18, 2016
    Posted on November 18, 2016 at 09:30

    Hello,

    Which board are you using?

    You may refer to your product datasheet or reference manual for more clarification.

    Regards

    sbertuletti
    Associate II
    November 18, 2016
    Posted on November 18, 2016 at 09:36

    I used different boards: STM32F411RE_NUCLEO, STM32F401RE_NUCLEO and STM32L071 microcontroller. 

    AvaTar
    Senior III
    November 18, 2016
    Posted on November 18, 2016 at 10:48

    > Which board are you using?

    This is less a question of board(s) involved, but rather of missing knowledge at the O.P.'s side about the inner workings of an ADC.

    ColdWeather
    Senior
    November 18, 2016
    Posted on November 18, 2016 at 12:31

    If you read an ADC value out, you read no voltage but some number between 0 and 4095 (for 12-bit ADC). The weight of the lowest bit depends on the reference voltage Vref used by the ADC. In the most cases that is the VCC - the supply voltage of the CPU. Mostly 3.3V, some Discovery boards have 3.0V. Thus, the actual voltage measured by the ADC is

    V = Vref * ADC_Value / 4095

    for the Vref = VCC = 3.3V:

    V = 3.3 * ADC_Value / 4095

    The VCC can vary. To solve this, you can use alternatively the internal voltage reference Vint = 1.2V to find the weight of the lowest ADC bit out. Measure the Vint by the ADC, you'll get some number ADC_Int:

    Weight = Vint / ADC_Int = 1.2 / ADC_Int (volts per bit)

    then the measured external voltage would be

    V = Weight * ADC_Value = Vint * ADC_Value / ADC_Int

    and the VCC used as the Vref:

    VCC = 4095 * Weight = 4095 * Vint / ADC_Int = 4914 / ADC_Int .

    Check this on your boards.

    sbertuletti
    Associate II
    November 18, 2016
    Posted on November 18, 2016 at 12:57

    Thanks for the explanation. I'll check it on my board