View Full Version : How to check a 12 bits ADC
flotulopex
- 26th December 2024, 19:04
I have a PIC with a 12 bits ADC resolution (16F18446).
I though, having some 10kΩ 10 turns potentiometer in my drawer, I would be able to visualize all 4096 points of the ADC measurement.
It dosen't.
Looking at the range via serial comm, I can see "holes" in the 0..4095 range like it would jump from i.e. 646 to 648 never showing 647.
My PIC has a lot of ADC features but I think I turned them OFF, all.
I have made some circuits with additional resistors hoping to reduce the ADC input range hence rising the résolution of the potentiometer itself, but it doesn't seem to do quite better.
Is there a way to "visualize" the whole ADC range of my PIC?
HenrikOlsson
- 26th December 2024, 19:34
This won't be an answer to question, more "food for thought".
Neither the ADC nor the pot is "perfect" (of course) and the ADC inside a $1.50 PIC will not be the best but it does have data specified the datasheet (https://ww1.microchip.com/downloads/aemDocuments/documents/MCU08/ProductDocuments/DataSheets/PIC16-L-F18426-46-Micorontrollers-with-XLP-40001985.pdf), page 632.
What's the linearity and "resolution" of the potentiometer? There are some mighty fine potentiometers out there but a cheap 10-turn is probably worse than the ADC. In theory, the resolution is "endless" but in practice it is not. 4096 "steps", even over 10 turns, is less than 0.9° of rotation of the wiper, can YOU resolve that accurately?
I suppose you could put an accurate voltmeter parallell with the ADC input and compare the voltage readings with the ADC readings? Does the voltage readings also skip the "647-value"?
Remember, if you have the pot across 3.3V then 1LSB of the ADC is 805uV (microvolt).
flotulopex
- 27th December 2024, 20:08
Thanks Hendrik, I obviously didn't think about that miserable ratio of 0.87 turns per resolution step :o
If the embedded ADC is not a gold medalist, what about a MCP3221; how do they compare?
Acetronics2
- 28th December 2024, 16:07
Hi, Flotul,
consider you have NO chance to get what you want with the internal ADC's of your Pic.
that said ... if you want a "quasi-linear " behaviour, try this inexpensive chip : https://fr.aliexpress.com/item/1005004147820909.html?spm=a2g0o.productlist.main.2 5.5ece4bc1pitBLd&algo_pvid=b9c75eda-4e6b-4872-bbe6-1d2579090c97&algo_exp_id=b9c75eda-4e6b-4872-bbe6-1d2579090c97-12&pdp_npi=4%40dis%21EUR%2116.93%2112.19%21%21%2117.2 2%2112.40%21%40211b61d017354018038678888e11bb%2112 000028193610733%21sea%21FR%210%21ABX&curPageLogUid=89wRz8vM5MGm&utparam-url=scene%3Asearch%7Cquery_from%3A
But, of course, you'll have to be extra careful with all its environment ... :rolleyes:
Alain
flotulopex
- 28th December 2024, 16:34
Hey Alain,
Thanks for the advice :wink:
What about the MCP3221 I have in my drawer? Is it worth a try or should I scrap them :confused:
I don't really know what to compare looking at ADCs.....
Acetronics2
- 29th December 2024, 08:51
Hi,Roger
as a common rule, you first consider you loose at least 2LSB for the ADC " normal " behaviour ( right shift twice ! ) - that's it. You can verify that carefully reading the ADC's datas and AN's...
you also could calculate the mean value for a significant number of samples ( takes time ! ). BTW, on the forum, there was a thread about " enhanced resolution " ( Darrel T.) ... but if signal changes slowly ... it's no more accurate !!! ;)
now, you have to care for the settling time of the ADC ...
at this point, you considered your input voltage is perfectly steady, and perfectly linear vs "pot" position as it has already been raised.
THEN, you can hope for a steady linear readout.
flotulopex
- 29th December 2024, 08:57
Charrette, ça en fait des "si"! :D
Thanks a lot Alain.
That's a lot of good info :wink:
Powered by vBulletin® Version 4.1.7 Copyright © 2025 vBulletin Solutions, Inc. All rights reserved.