Skip to main content
Associate II
March 2, 2024
Solved

ADC pot conversions not stable in STM32F103RCT6

  • March 2, 2024
  • 3 replies
  • 3343 views

I am using stm32f103rct6 controller board. I am not getting fixed ADC values for POT. I was used poll for conversion in ADC. Please attach code to get a fixed ADC value or else please address me for how to solve the problem.

Best answer by AScha.3

Connect a 100nF cer. cap from adc in to GND. (short connection.)

Helping to have a constant value for adc.

3 replies

raptorhal2
Lead
March 2, 2024

A few counts of noise is normal. What variation are you getting?

YeswanthAuthor
Associate II
March 3, 2024

It's continuously changing the values. The changing difference is 40 to 50. Like I want to get 2045 then i was getting the values 2013 to 2065.

raptorhal2
Lead
March 3, 2024

That is approximately 1%, somewhat high. But probably not a programming problem.

If you have access to an oscilloscope, check the input signal.

AScha.3
AScha.3Best answer
Super User
March 2, 2024

Connect a 100nF cer. cap from adc in to GND. (short connection.)

Helping to have a constant value for adc.

"If you feel a post has answered your question, please click ""Accept as Solution""."
YeswanthAuthor
Associate II
March 19, 2024

When I use 100nF cer. cap it will be Better.

Lead II
March 19, 2024

Sure, if you solder a 1F capacitor - it will be "rock-solid" (but you would measure just DC voltage).

You are not fixing the root cause (which might be an instable, noisy reference voltage, do you have a cap. on VREF?). Bear in mind: adding a cap on ADC input pin reduces your frequency you would be able to measure.

And: you can add also a "filter" (average) for several ADC samples (also reducing the bandwidth/frequency), instead of a cap.

As other people have pointed out here: your reference voltage, your power supply (VDD, AVDD) might be the main issue. With a large cap you can "smooth" all signals (remove noise), but if it is what you want to do? (just measuring DC at the end)

ONadr.1
Senior III
March 3, 2024

Data instability can also be caused by an unstable reference voltage for ADC, which is usually connected directly to the MCU power supply. This can be verified by periodically measuring the internal reference voltage source. If this measuring is unstable, the problem is in the reference voltage.