Use ADC properly AVR MCU V4

Channel:
Subscribers:
594
Published on ● Video Link: https://www.youtube.com/watch?v=7eA2q49YGZM



Duration: 0:00
47 views
0


In this video, I will shed some light on how to code ADC properly and correctly.

ADC is easy for me that I have done an extensive amount of prototype boards, but it can be hard for most people, especially when you are using a very badly written library to interface with it. ADC as a concept is easy, and the actual code to power it is also easy, but in reality, getting good results requires one to fully understand absolutely every aspect of how the ADC really works on many levels.

First thing is on the hardware level, you want to have a good design and good tracing to avoid inducing noise into the system. It's simple as that, but unfortunately this also gets escalated very quickly for more demanding applications with a lot of noise. For this demonstration, I am using my V4 board with 2 ADC channels connected to 1 potentiometer and 4 voltage based buttons. This board is not necessarily the ideal board to demonstrate ADC, but its draw traces for the 2 channels are adequate for minimizing the amount of noise induced to the inputs.

Second thing or the main thing is on the software level. I am not going to explain every bit on how to code the ADC. The most important thing or should I say the most common issue is that ADC has so much unstable noise due to the fact that residual charges from the previous input channel source get mixed to the new ADC channel. In other words, a spacing in time is required before switching to a new input source. This is the absolute golden key, but there are many other decision choices that could impact how smooth, how accurate, and how stable the ADC readings are. ADC can be configured many ways, but many time, for your own application, there is only one or two most optimized configuration.

So good ADC code has a lot to do with timing. You need to know how many samples to make in one second for each input. This is the most basic. The driver code for the V4 can be found in its corresponding page. For my driver, I am using a 1kHz timing loop to manage these 2 input channels, and 2 spacing, so the rate for sampling is 1000 over 4 or 250 Hz for both the 4 buttons and the potentiometer, which is actually more than enough. ADC can be extremely complex, especially when you are exploiting all its capability on a system level, as there are many interconnected paths between each part of the MCU, but for simple basic reading, it’s still relatively easy.

That is it. Enjoy the rest of the video of me playing with the ADC potentiometer every accurately and responsively. This may not seem a lot, but it can be very impressive in a subtle technical way.




Other Videos By Flyandance


2025-07-08《女人心声》 淑女情歌精选 80-90年代跨越时空歌单 Old Maid Mega Hits playlist 许美静,郑秀文,辛晓琪,陈慧珊,苏慧伦,陈慧娴 - 华语歌后 国粤语
2025-07-06《黎明》 歌单全集 Leon Lai's Full Playlist 华语歌霸 情歌王子 四大天王 国粤语
2025-07-03《张国荣》 精选歌单 Leslie Cheung: Best Hit Playlist - 华语歌仙 永恒的哥哥 国粤语
2025-07-03《张学友》歌单全集 Jacky Cheung: Full Playlist - 情歌歌神 四大天王 国粤语
2025-06-30《流金岁月》 迷失精选歌单 - 中英文 - My Productive Favorite Playlist - A modern day Mixed Tape - All time best
2025-06-28Understand Ground in Main - Live and Neutral - High Voltage
2025-06-26Making a perfect cup of coffee quickly and cheaply - Nescafe Taster's choice 14 oz instant
2025-06-22My Guide on Pen - Based water, oil and gel - Recommended writing instrument Fountain Pen Aliexpress
2025-06-18Refill a Refill - Butane Gas 300mL to 18 mL
2025-06-14Master a Button - AVR MCU Code
2025-06-10Use ADC properly AVR MCU V4
2025-06-08How to use FDxICSP: World Fastest Self-Programmable Programmer Firmware update + Code upload AVR910
2025-06-08Site Update: CSS, new template, Minimalist Aesthetic - AVR MCU Assembly programming Electronics
2025-06-06My Ultimate General American English IPA Anki Deck - Pronunciation Vowels Consonants 美音英文 发音 口语 记忆卡
2025-05-07New Favorite Portable Gas stove Configuration with Campingmoon Z23-CB - Big heavy duty butane burner
2025-05-05Creating My Aesthetic Wallpapers for Mobile Android Apple Phone tablet San Francisco Photography Art
2025-05-04Pigs in Piggy Heaven - Pig Islands Compilation (Reason why you should not eat Pig Meat AKA pork)
2025-05-03TWRP Demo: Flash and Update my m7 from Android 6 to 11 - Lineage OS 18.1 - Android Guide ROM Root
2025-05-02中国象棋 之 天残决四 (王者之势) Endgame in Chinese Chess - Lightning Warfare
2025-05-01HTC One m8 2014 Phone in 2025 with lineage 20 (Android 13) Hacking, root, rom, OS update guide flash
2025-04-30Sharpening a Daiso Backsaw rip cut Handsaw and Testing Against hard wood