What's the Difference Between Analog and Digital?
The Future is Digital?
We often hear about analog and digital in the context of communications, sound recording, cameras, TV, radio and other electronic devices. But what exactly is the difference and is digital better than analog? In this article I hope to shed light on the mystery.
How are Analog and Digital Displays Used?
Although it has nothing to do with the real distinction between analog and digital, these terms are often used to refer to the type of displays on clocks, measuring devices and electronic instruments. An analog display usually involves some form of pointer which indicates a value depending on its position or angle on a scale. Examples of analog displays are traditional watches and clocks, weighing scales, speedometers and old style moving coil or moving iron voltmeters and ammeters. See the photos below for examples.
A digital display indicates the value of a parameter directly by actually showing a number. This number can be produced on an LED, LCD or Nixie tube (cold cathode) display. Even the displays on old fashioned electromechanical cash registers could be thought of as digital, but the term is usually reserved for electronic devices.
Note the British English spelling of analog is "analogue"
What are Examples of Analog Displays?
On an analog display, the value is indicated by a line or pointer.
What are Examples of Digital Displays?
On a digital display, a value is displayed as a series of 1 or more numerical or alphanumerical digits.
What are Analog and Digital Signals?
Another distinction between analog and digital is in the field of electronics and signals. In the real world, many varying parameters can be considered as analog. So for instance the variation of temperature in a room over time is an analog quantity, as is the voltage of a battery as it discharges. The characteristic of an analog parameter or quantity is that its value varies continuously within a range. So the temperature in a room could vary anywhere between 10 and 20 degrees C.
The state of a light switch is either on or off. This is an example of a digital quantity. The switch doesn't exist in an in between state, it is either on or off. Digital technology is fundamentally based on this idea of on and off states of "switches"
What is a Signal?
The function of a signal is to convey information about the behavior of some phenomenon. An example is the output of a temperature sensor which provides information about the temperature in a room. The fluctuations in light level which travel down fiber optic cables are signals.(signals don't have to be electrical). The information could be a telephone conversation, Internet data or a TV program. The state of the switch in the example above, measured over time can be thought of as a digital signal.
What is a Sensor?
A sensor converts a real world parameter such as temperature, pressure or light level into a signal. This signal may then get amplified and/or processed before being used for some other purpose. Some examples:
- In instrumentation, the signal could drive a display indicating the value being measured. e.g. speedometer in a vehicle, temperature gage or voltmeter
- In communications, sound or pictures from microphones or cameras are converted to an electrical signal which eventually gets transmitted as radio waves
How Do Digital Signals Work?
A digital signal has two states or levels, high and low. The signals in a digital computer, or instrumentation such as a digital voltmeter are two state. A computer doesn't understand analog signal levels and just works on high and low states, effectively ones and zeros. For a more thorough explanation of this, and an explanation of the binary number system, see my hub Why is Binary Used in Computers?
What Does Sampling Mean?
Sampling a Signal
Sampling is a process which converts a real world signal to a digital format which can then be processed by a computer, instrumentation or other digital electronics technology.
- A digital multi meter (DMM) samples a voltage, converts it to digital, and the digital signals are used to drive a display
- An image projected by the lens of a digital camera, falls on the CCD (Charged Coupled Device) at the back of the camera. The image is converted to numbers and stored in the camera's flash memory
- A scanner scans a document. The resultant image is stored in memory
- A sound recording is made. The audio signal is converted to digital and saved on hard disk or printed onto a CD
What is an ADC?
As digital electronics and computers were developed, applications arose for reading signals from the real world. The process to do this is called sampling whereby an analog signal is converted to a binary number understandable by a computer. A device which does this is called an analog to digital converter (ADC). An ADC measures the level of the analog signal at regular intervals known as the sampling frequency. The voltage range over which the ADC works (e.g. 0 to 5V or 0 to 10V) is broken up into equally spaced ranges and a binary number assigned to each of these ranges. Each time the ADC samples the signal, it outputs a binary number representative of the level at the instant of sampling. These numbers can then be stored, used to drive a display, transmitted along a communication line etc. For a 3 bit converter (see diagram below), there are 23 = 8 possible binary numbers. In reality, ADC converters have 6, 12, 16 or even 24 bit resolution. (16 bit at 44kHz sampling rate is used for CD recordings). Obviously this means that there are lots more levels and the converter can resolve more detail in the signal.
A to D Converter Resolution
As I mentioned before, A to D converters typically have resolutions of 6 to 16 bits, although 24 bit converters are available.
The number of levels which a converter can resolve is equal to 2n , where n is the number of bits of the converter. So for a 6 bit converter there are 64 levels and for a 16 bit converter, there are 216 = 65,536 levels. A converter has an input range over which it works, e.g. 0 to 5 volts, and it is this range which is split up into equal ranges. So to get the most amount of "detail" out of a signal, the signal should span as much of this range as possible.
Minimum Sampling Frequency of a Waveform — The Nyquist–Shannon Sampling Theorem
The maths behind this theorem is a bit complicated, but basically it says that the sampling rate of a signal must be at least twice the highest frequency content of the signal. This is intuitively correct so for instance the slowly changing signal from a temperature sensor in a room would need to be sampled much less frequently than an audio signal from a microphone or video signal from a camera in order to preserve the rapid changes in the signal.
Reproducing a Signal - Digital to Analog Converter (DAC)
Once a signal has been sampled, several things can be done with it. In the case of instrumentation, e.g. a digital multimeter, data may not need to be stored. Instead the digital output signal of the ADC drives the display on the instrument (through intermediate driver electronics). Alternatively data can be stored in a computer as a set of numbers: in random access memory (RAM ), on a hard drive or on a CD or DVD. Sometimes a signal which has been sampled and stored must be reproduced. An example of this is an audio recording on a CD. A device called a digital to analog converter (DAC) is used to reproduce the original signal. The DAC does the same job as the ADC in reverse. Each binary number which was stored during the original recording is input to the DAC at a playback rate equal to the original sampling frequency. The output of the DAC is an analog voltage level. The signal is then filtered to remove the "staircase" effect due to sampling
Some electronic devices are almost purely digital and don't need to sample analog signals. An example is a digital watch or clock which makes use of a quartz oscillator. An oscillator is a system which does something at regular intervals, e.g. a swinging pendulum, or a flashing light. The frequency of a quartz oscillator is very stable and has a relatively low sensitivity to temperature unlike the components of a mechanical clock. The output of the oscillator is a square wave voltage, usually at 32,768 Hz. i.e. a digital signal. This frequency is a power of 2 and is chosen so that it can be successively divided by 2 by a digital counter to produce a 1 second pulse. Other counters then generate minute and hour outputs every 60 and 3600 seconds for driving the digital display. (Digital quartz watches can also have analog displays)
What are the Advantages of Digital Data?
Once a signal is sampled and the data is converted to a series of numbers in memory, lots of things can be done with it.
- Data can be stored and copied ad infinitum without degradation This is because numbers in memory or on digital media are stored in binary format as ones and zeros. In memory, electronic switches are either on or off, representing the storage of 1 or 0. This single piece of information is known as a bit. On a CD, either a 1 or 0 can be represented by a pit in the surface of the disk. Contrast this with an analog recording on tape (which could be audio or video). Low level signals get swamped by noise over time and noise also gets introduced during the copying process. This also applies to image recording on photographic media such as a negative. The process of storing data in digital format is in effect increasing the signal to noise ratio. There are no low level signals, just highs and lows. Digital electronics "decides" on whether a bit is high or low depending on whether it is within a high or low band of voltages (see below). Increasing the signal to noise ratio is somewhat similar to the idea of how the phonetic alphabet is used during radio communication to improve intelligibility. Each letter of a call sign is represented by a word - (EIF - Echo, India, Foxtrot) so that a transmission can be understood
- Data can be compressed Since data is stored as numbers, fancy algorithms can be used to compress the data. This is advantageous because data files can be made smaller and require less storage space (think JPEG and MP3 which are formats for storing and compressing images and sound). Digital TV and digital radio also makes use of these compression techniques (MPEG 4 compression for TV). The radio frequency spectrum is limited and only so many channels can be squeezed onto the spectrum. Compressing TV signals, narrows the required bandwidth for a channel so more channels can be squeezed into a frequency band ( which may be a good or bad idea! It reminds me of Bruce Springsteen's song, "57 Channels and Nothin' On)
What are the Disadvantages of Digital Data?
A decoding device is required Data which is stored on media is usually compressed, encoded and formatted in some way. Equipment to read and decode the archived data may not be available in the future. For instance if you have any 5 1/4 inch floppy disks with data on them, do you still have a computer which can read these disks? Yet it is even possible to read the information from books written hundreds of years ago and view the illustrations, or view photographs from the mid nineteenth century. It would also be relatively easy to build a machine which could play early wax cylinder phonographic recordings. This is obviously an issue for archivists of important information.
- Digital data is not necessarily durable While digital data on media is theoretically rugged and less likely to be degraded than an analog recording, in practice if the media is damaged, it may not be possible to read data (e,g, a seriously scratched CD). However an analog tape recording could probably be pieced together and played. Similarly a photograph ( a traditional non-digital type, which is in effect a two dimensional, analog, optical recording) can still be viewed if stained or damaged in some other way. The moral of the story is to always back up your digital data (and back up the back up!)
What are TTL and CMOS?
TTL (Transistor Transistor Logic) and CMOS (Complimentary Metal Oxide Silicon) are two technologies used to implement switches in the integrated circuits of digital electronic devices. CMOS has the advantage that it is low power which of course is important for battery powered devices. Digital ICs have input and output pins, and the voltages on these pins are within designed tolerance bands. For instance if a high output of a TTL chip is connected to the input of another TTL chip, the output voltage must be between 2.7 and 5 volts . Inputs between 2 and 5 volts are interpreted as high. Similarly a low output must be between 0 and 0.5 volts, even though anything between 0 and 0.8 is interpreted as low. This means that up to 0.3 volts of noise can be added to a signal without it being misinterpreted.
Questions & Answers
© 2014 Eugene Brennan