Microcontrollers - Introduction to the Analog to Digital Converter (ADC)
This is where we can start to sense the environment. Want to know tilt (Or G's,
or acceleration)? Connect an accelerometer to the ADC! Want to know angular velocity?
I've probably already lost you with that one (it's not a household word/phrase).
Angular velocity is how fast you rotate something. Connect a gyro to the ADC! Want
to know light intensity? Well, there are many ways (ambient, direct, etc.) to detect
light, but we could conect a photo sensor, diode, or something like that to the
ADC! Want to know distance? Connect a sonic range finder, IR sensor, or laser range
finder to the ADC! The latter is probably a bit out of the pocket book range for
us (like the pun? It was totally intended!).
The ADC is perfect for these sensors, and I didn't mention all of the different
types of sensors. With the ADC, you can sense the environment (light, sound, distance,
gravity, acceleration, rotation, smell, gasses, other particles and even feeling
through pressure). Imagine all of the things you could do with all of these senses!!
In this video, we will investigate the function of the ADC (Analog to Digital Converter).
There is this very real little lady inside the AVR microcontroller listening to
you. She has this control panel and she makes transactions! She accepts voltage
currency. This is the legal tender of her realm, and she likes all kinds of analog
voltages! But she won't give you a voltage back, she will give you a number in return,
which is the currency of her AVR country. BUT!! She is a bit dishonest! she will
drop some change on "her" floor and you will get somewhere around what the exchange
rate is. I know, I know, this is so unfair, but that is just the way it is!
You have the option of receiving less of her number currency, or more in her number
currency. She can either ask for the 256 exchange rate, or the 1024 exchange rate.
For instance, if you elect the 256 exchange rate and you give her 2.5 volts of voltge
currency (with a top value of 5 volts), she will return to you 128 of her number
currency. Here is where she gets a bit dishonest: if you gave her 2.5002643 volts,
she will give you back the same 128 number curency. See? I told you, she is slick.
If you elect to use the 1024 currency exchange rate, then that 2.5 volts given to
her will return the number currency of 512. Are you doing the math in your head?
Yes, you are right, 512 is half of 1024, and 128 is half of 256, and yes, 2.5 is
half of 5. you provide her any portion of the voltage currency and she will match
the same proportion of her cnumber currency.