Microcontrollers – Part 4: Analog-To-Digital Converter

   It’s time to meet again with our little friend: CPU Monkey – the “manager” of all processes into our virtual Microcontroller.

adc-1-hardware-pro

  

   Today the CPU Monkey will measures the analog signals, digitizing them by using the built-in ADC engine, and next to write the results into MCU’s structured memory array.

   Sounds sophisticated?  No, it doesn’t.  

   Let we begin with some theory.

   What the signals are ?

Signals: There is Analog and Digital Signals but they are nothing more than the way of representation of the Physical characters of processes.

   We are surrounded a lot of, continuously changing signals:  the ambient temperature, the humidity, the illumination levels, the atmospheric pressure, the sound pressure. the space radiations or even our weight if you wish. All these Signals are their basis are related the physics of the processes. Because of their uninterruptible character, we associate them as analog magnitudes
   Each Analog magnitude has its own measuring Unit – ordered and defined into the international system “Système International d’Unités” or  the International System of Units – known as the abbreviation “SI”.

   Let we return on to our example, or get the answers these questions:

  • What is the ADC ?
  • Now it works ?
  • How can we use it ?

   If the CPU Monkey  wants to measure them, It firstly needs “Digitizing” the analog signals.

   The physical quantities are measured by means of the variety of sensors – which output in the basic case is analog.

   There are and complex sensors  – with directly digitalized output. We can connect them directly with the microcontroller – because they are speaking the common “DIGITAL” language.

 

  Let we talk about the Analog signal output. let’s digitize the analog signal.

  How does it happen?

Example: The task of Our CPU manager – The little monkey is to measure in equal time intervals = {Tmeasure} an analog output value of temperature sensor.

   Let’s remember  – we said the CPU Monkey use the metronome for synchronizing its activities. Let we get an another metronome and name it: Metronome ADC Clock,  adjusted to fit exactly with Tmeasure.

  We mentioned there is on the MCU table the Multimeter – But it is not as known types user Multimeter – It is special.

  The Monkey’s ADC multimeter has an analog input and a Digital Output. For the easiness of description and understanding the explanation we will use the one BYTE / or 8-bit ADC Output.

  The Monkey’s ADC multimeter has one Byte result in its Digital Output. The Result is as the paper card with written on it the Hex format result.

 

One DATA Byte Can be filled with values from:

000 Decimal    =    0000 0000 Binary    = 00 Hex;    

…  to

a middle range value:

127 Decimal    =    0111 1111 Binary    = 7F Hex;

 

…  to

 

255 Decimal    =    1111 1111 Binary    = FF Hex.

byte-bit-1-hardware-pro

Now, we have the following:

   The CPU Monkey’s Multimeter Has the Reference Source: Its voltage is = 5.000V . The ADC’s smallest measured part is named:  LSB ( The Low Significant Bit ) . It has the “voltage” weight => Reference = 5V / 256 parts = >  1 LSB = 19.53 mV.  

  Example : If Measured Value is 127 DEC, it is equal to DC Voltage => (127 * 0.01953 )  = 2.48 V  ;

  Temperature Sensor (IC-LM35)  with an Analog output: Representing the Ambient or a measured temperature in Centigrade as related with simple linear approximated voltage.

  If there has need of measuring the negative Centigrade temperatures, you simply can add only a DC – offset. In our explanation we will saturate only with positive Centigrade measuring.

t˚C = LM35[Uout]  = 0mv + 10 mv/˚C ;

or :  

LM35[Uout] = +250 mV (0.25V)  at +25˚C   and

LM35[Uout] = + 1,500 mV (1.5V)  at +150˚C ;

  And now is the culmination – the CPU Monkey start digitizing the ambient temperature. 

  The result will be collected into the 16 “RAM cabinet’s drawers” – as we represented the imaginary MCU Random Access Operating Memory.

  Metronome ADC Clock said it is time to begin the measurement.

  Monkey get the printed card with the binary result from the output stage of its ADC multimeter, quickly open the first drawer, insert the card and quickly close it.

  After the next Metronome ADC Clock pulse, the CPU Monkey makes the same and place the result into the second drawer.

  And … 3, 4, 5… 14 , 15, 16 drawer  – until it fills and the end drawer.   

  This is Оur next written program into our imaginary MCU Project. 

  The data “stored”into the RAM Byte array “Drawers” is the statistic with 16 samples with Metronome ADC Clock defined period and it have the manner of changing the ambient temperature for this 16x period.

  If the time between two samples is too short, the data into the array is likely to be the same . Namely, for that reason, are involved the parameters of measured analog Unit.

  For slow-changing signals, it is not necessarily to have a several GSPS – Giga Samples Per Second  ADC sample rate. It is enough to have a statistics, actualized in few seconds.

  For quick changing signals is necessary gave a Quick sampling ADC engine. In the most cases, the internal MCU ADC provide the enough Computing Power and successful resolve it tasks.

  For ultra quick changing signals, and If the possibilities of MCU and ADC engine aren’t enough to solve the time problem, there are a variety of the powerful external ADC converters. 

 

And now, let’s release the CPU Monkey to relax.

Until our next meeting. 

 

Don’t Stop To Reinvent Yourself, Dear Explorers!

 

adc-2sba-hardware-pro

Related Link to AVR ADC

Related Link to ADC Topologies and performance

 

To Be Continued!

Leave a Reply