O'Reilly logo

Raspberry Pi For Dummies by Mike Cook, Sean McManus

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Exploring the Difference: Analog versus Digital

With a digital signal, everything is either on or off, no half measures. Indeed, many things work in this manner; for example, your radio is either on or off. It makes no sense for it to be anything else. However, this is not true of everything. For example, a light can be half on or dimmed. A volume control can be full on, full off, or somewhere in between. These are proportional controls.

Taking small steps

So how does a computer handle a proportional control? In a program, variables can take on any value you assign them. You can do the same with a voltage. However, the voltage is not continuously variable, but split up into small steps, or quantized. The number of small steps used is given by the resolution of the circuit. By combining several on/off signals, with each one contributing an unequal small voltage you can produce very close to whatever voltage you want. The circuit to do this is called a digital-to-analog (D/A) converter, and there are several different designs. Figure 17-1 shows one such method using four digital outputs, or as we say, four bits. Each switch is a digital output from the computer and can send current through a resistor or not, depending on whether the switch is open or closed. The important thing is the relative resistor values, not the absolute values.

9781118554234-fg1701.eps

Figure 17-1: Four switches and resistors make ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required