stm32f401ccu black pill ADC

Post here first, or if you can't find a relevant section!
Post Reply
hakam
Posts: 7
Joined: Fri Sep 30, 2022 2:45 pm

stm32f401ccu black pill ADC

Post by hakam »

dear all, i am facing 2 major problems in stm32f401ccu plz guide me
1) black pill is of 12 bit ADC but highest conversion i got 1023 of adc output in serial monitor, but i expected 4096.
2) ADC is looks highly stable when grounded but noisy whn connected to any other dc voltage
when i connect A0 pin to its ground pin it show 0 0 0 0 0 0 0 0 which it show it is very stable without fluctuation . also when i connect A0 pin to 3.3 volt or 3.3+ voltage then it gives steady value of 1023 without any fluctuation & looks highly stable but when i connect it to any other dc volage ( more than 0 and less than 3.3 volt )its value fluctuate a lot ex 820 to 880. i am applying only dc voltage through potentiometer.
plz guide me thnaks
GonzoG
Posts: 403
Joined: Wed Jan 15, 2020 11:30 am
Answers: 27
Location: Prudnik, Poland

Re: stm32f401ccu black pill ADC

Post by GonzoG »

ad. 1. switch to 12 bit mode: analogReadResolution(<bit_resolution>);
ad. 2. You ADC voltage reference is your power supply voltage. If it's unstable, you will have unstable readings.
If you're using any kind of AC/DC power supply, it will never give you absolutely stable output. Use batteries to get a stable voltage source.
And one more thing - ADC in STM32s is very sensitive and can detect current/voltage generated due to RF interference (eg. from AC mains or radio waves)
Post Reply

Return to “General discussion”