Quantities in real world can be measured and monitored in either analog or digital formats. Before getting into digital logic, let us understand what analog and what digital measurement is:
- Analog: Analog is measure of continuous and variable values, with respect to time. Some of the examples of analog measurement are Alternate Current, Analog watch, etc.
- Digital: Measuring discrete values or sequence of numbers is Digital measurement. They can commonly be measured with just a sequence of either 1 or 0 (We will see how in later part of this tutorial, Decimal and Binary conversions). Digital watch is a good example showing discrete values.
Simply put analog reads and measures continuous and changing values, while digital records changes in discrete steps.
We all know that most physical quantities in real world are analog in nature. However, strange but true many of us understands digital format much better. How many times have you preferred an analog scale over a digital scale, analog watch over a digital watch (not the style, but the ease of reading)? So, why do we prefer digital over analog? Let us find the advantages and disadvantages of Digital measurement over analog and then understand what and how of digital logic.
Advantages of Digital measurement:
- Design and Calculation is easier
- Programming over discrete digital values is more convenient than varying analog values
- Less expensive, more reliable and flexible in design and measurement
- Compatible with other digital systems
- Information storage and manipulation is easier
Just like any other good stuff in the world, digital measurement also comes with its own drawbacks. Some of them are:
- Since real world is analog in nature, it requires it to convert from Analog to Digital format for our understanding. If we need to analyze our result, we normally need to convert it back to analog which is an overhead.
- For some real world applications, we prefer continuous and precise values over discrete values.
In our robot world, we deal with more digital values than analog values. The inputs from most electronic components are analog which will be converted with an ADC (analog to digital converter) and measured or analyzed. E.g. Output from an LDR (Light Dependent Resistor), an Accelerometer, Sound Sensors are all analog which needs to be converted to digital format for calculation. Most, if not all microcontrollers have a built in ADC within.
Why do we need number conversion?
The digital components like microprocessor, microcontroller does not understand analog voltages and it requires digital values for computation or processing. Also if the values are in binary or in hexadecimal, complex calculations can be done using a microcontroller quickly and accurately.