Electronic Signals

6646

Analog and Digital Signals

In electronic circuits, a “signal” is a time-varying voltage or current that transports information. Signals are typically transported along wires carrying relatively low voltages (up to perhaps 3.3V) or low currents (perhaps a few milliamps). Most signals use voltage levels to convey information, but some “special case” signals that must work in noisy or high-speed environments use variable current levels to transport information.

Information in digital circuits is encoded using two voltage levels: a “logic high voltage” or Vdd, represented with a ’1’; and a “logic low voltage”, or Ground, represented with a ‘0’. The ‘0’ and a ‘1’ signal levels are actually a range of voltages – a ‘0’ is typically defined as a voltage between 0V and about 20% of Vdd, and a ‘1’ as a voltage between Vdd and about 80% of Vdd. This makes digital signals very noise tolerant – wide voltage swings that remain within the defined ranges will not change the logical behavior of the signal. In the figure below, even though the waveform has lots of noise, the red line shows the signal is still interpreted as a ‘0’ or ‘1’.

Figure 1. Digital noise immunity
Figure 1. Digital noise immunity

Analog circuits represent and manipulate information that is encoded as a continuous, time varying voltage or current. In an analog circuit, a physical quantity is represented by an instantaneous voltage on a wire that is proportional to the physical quantity. For example, an audio circuit might measure the instantaneous air pressure across a flexible membrane, and “transduce” the difference in air pressure into a voltage signal. The voltage level is directly proportional to the air pressure at any given time, and it can vary continuously between Ground and Vdd. The signal voltage is an “analog” of the physical quantity, and is therefore called an analog signal. When using analog signals, great care must be taken to minimize noise sources, since any noise on an analog signal interferes with the information being represented. In the graph above, the digital signal can “reject” noisy voltage excursions of up to 20% of the total voltage range. If an analog signal has any noise at all, even a fraction of a percent or less, that will degrade the information being transported, even to the point of making it unusable.

Some circuit input devices, like pushbuttons or slide switches, output two distinct voltages by design, so it is straight-forward to represent their outputs using digital signals. Some input devices, like microphones, light meters, or other transducers produce continuously varying voltages proportional the physical phenomenon they are sensing - these devices produce analog signals. Likewise, some output devices consume digital signals and produce outputs that are “on or off”, like LEDs that indicate certain states. And some output devices consume analog signals to produce a continuous range of outputs, like speakers that produce sound pressure outputs with variable frequencies and amplitudes, or motors that have variable rotation rates. (Note – it is often the case that analog voltages applied to output devices must be amplified before they can be used. For example, an analog signal produced by a 3.3V system does not have enough voltage to drive a DC motor – it would need to be amplified to provide more voltage and more current to the motor. There are several well-known and frequently used amplification solutions available, but they are mostly outside of this discussion. We will discuss a basic amplification circuit a little later).

Analog to Digital conversion

Analog input signals produced by a sensor or transducer must be converted to digital signals before they can be used in a digital device like a processor. An “analog to digital” converter circuit (ADC) receives an analog signal as input, and then produces a collection of digital signals (a bus) that together form a binary number that defines the analog signal amplitude at a given time. A typical ADC “samples” the analog signal at regular intervals, and produces and output stream of binary numbers that represent magnitude of the analog signal as it changes over time. The faster the analog input is sampled, and the more bits that are used to form the binary number that represents the analog signal, the more accurate the digital representation.

In the figure below, the leftmost drawing shows a vertical index with a 4-bit number and a 6-bit number. Each analog signal sample point must be mapped to the nearest available binary number – with 4 bits, there are only 16 possible numbers, so on average each sample point must be mapped to a number that is up to 1/32 of the total Vdd range away from its actual value. With 6 bits, the average errors are only ¼ as large. With 8 bits, the errors would be even smaller. Most ADC’s use 8, 12, or 16 bits. The middle figure shows that if too few sample points are used over time, there are many potential waveforms that could “fit” the same sample points. The rightmost waveform uses four times as many points, resulting in a much more accurate waveform representation with fewer possible alternatives.

Figure 1. Analog Signal Sampling
Figure 1. Analog Signal Sampling

There are many well-known ADC circuits and methods, and many IC manufacturers produce ready to use ADC devices that range from 8 bits through 24 bits, and from 10KHz sample rates through 1GHz+ sample rates. They range in cost from less than $1, to over $500 each. You can read the Wikipedia entry for a good overview.

Digital to Analog conversion

Often, a digital device (like a processor) that uses digital signals must produce an analog signal to drive a device that has a continuously variable output. There are several available circuits, methods, and devices that can be used to perform a Digital to Analog conversion (DAC). Many of these solutions use arrays of transistors and resistors to create an “R2R” ladder that creates an analog voltage from an input binary number applied in parallel to the input resistors. Again, you can read the Wiki page for more information.

One very low cost method that is often used to create analog outputs from digital sources is called “pulse width modulation”, or PWM. A PWM solution only needs a single digital output pin and a simple, low cost filter. PWM outputs are good for creating analog signals up to a certain frequency (well beyond audio range), so they are often used to drive motors, control the brightness of lights, or establish DC operating voltages for other circuits.