Analog inputs and outputs are important for interacting with many types of sensors and other devices. This guide will explore what an analog signal is and how it differs from digital signals, how to read analog signals, and how to output analog signals with CircuitPython.

Analog Signals

Analog signals are different from digital signals in that they can be any voltage and can vary continuously and smoothly between voltages. An analog signal is like a dimmer switch on a light, whereas a digital signal is like a simple on/off switch. 

Digital signals only can ever have two states, they are either are on (high logic level voltage like 3.3V) or off (low logic level voltage like 0V / ground).

By contrast, analog signals can be any voltage in-between on and off, such as 1.8V or 0.001V or 2.98V and so on.

Analog signals are continuous values which means they can be an infinite number of different voltages. Think of analog signals like a floating point or fractional number, they can smoothly transiting to any in-between value like 1.8V, 1.81V, 1.801V, 1.8001V, 1.80001V and so forth to infinity.

Many devices use analog signals, in particular sensors typically output an analog signal or voltage that varies based on something being sensed like light, heat, humidity, etc. Some examples of sensors with analog outputs:

The are also some devices that can be controlled by analog signals or varying voltages:

And there are some devices that are controlled by a special type of analog-like signal called a pulse-width modulated, or PWM, signal. You’ll learn more about PWM signals at the end of this guide, but some devices that can be driven by a PWM signal are:

This guide was first published on Sep 02, 2017. It was last updated on Sep 02, 2017.

This page (Analog Signals) was last updated on Oct 15, 2021.

Text editor powered by tinymce.