# CircuitPython Basics: Analog Inputs & Outputs

## Analog Signals

Primary: This guide is older. You'll want to refer to the guide CircuitPython Essentials which has an Analog IO pages and much more.

### CircuitPython Essentials - CircuitPython Analog In

[CircuitPython Essentials](https://learn.adafruit.com/circuitpython-essentials)
[CircuitPython Analog In](https://learn.adafruit.com/circuitpython-essentials/circuitpython-analog-in)
### CircuitPython Essentials - CircuitPython Analog Out

[CircuitPython Essentials](https://learn.adafruit.com/circuitpython-essentials)
[CircuitPython Analog Out](https://learn.adafruit.com/circuitpython-essentials/circuitpython-analog-out)
### CircuitPython Essentials - CircuitPython PWM

[CircuitPython Essentials](https://learn.adafruit.com/circuitpython-essentials)
[CircuitPython PWM](https://learn.adafruit.com/circuitpython-essentials/circuitpython-pwm)
https://www.youtube.com/watch?v=0pUBP0k5WD4

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.&nbsp;

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:

- [Microphones](https://www.adafruit.com/product/1063)
- [Photocells (light sensitive resistors)](https://www.adafruit.com/product/161)
- [Temperature sensors](https://www.adafruit.com/product/165)
- [Force-sensitive resistors](https://www.adafruit.com/product/166)
- [Flex sensors](https://www.adafruit.com/product/1070)
- [Thermistor (temperature sensitive resistor)](https://www.adafruit.com/product/372)
- [Ultraviolet light sensor](https://www.adafruit.com/product/1918)
- [Light sensors](https://www.adafruit.com/product/2748)
- [Distance sensor](https://www.adafruit.com/product/164)
- [Anemometer (wind speed sensor)](https://www.adafruit.com/product/1733)
- [Resistive touch screen](https://www.adafruit.com/product/333)
- [Ultrasonic distance sensor](https://www.adafruit.com/product/979)
- [Liquid level sensor](https://www.adafruit.com/product/464)
- [Potentiometer (variable resistor)](https://www.adafruit.com/product/356)

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

- [Simple LEDs and other lights](https://www.adafruit.com/category/90)
- [Speakers](https://www.adafruit.com/product/1898)
- [Transistors (to amplify signals)](https://www.adafruit.com/product/756)

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:

- [Simple LEDs and other lights](https://www.adafruit.com/category/90)
- [Servo motors](https://www.adafruit.com/product/169)
- [DC motors](https://www.adafruit.com/product/711)

- [Next Page](https://learn.adafruit.com/circuitpython-basics-analog-inputs-and-outputs/analog-to-digital-converter-inputs.md)

## Featured Products

### Circuit Playground Express

[Circuit Playground Express](https://www.adafruit.com/product/3333)
 **Circuit Playground Express** is the next step towards a perfect introduction to electronics and programming. We've taken the original Circuit Playground Classic and made it even better! Not only did we pack even more sensors in, we also made it even easier to...

In Stock
[Buy Now](https://www.adafruit.com/product/3333)
[Related Guides to the Product](https://learn.adafruit.com/products/3333/guides)
### Adafruit METRO M0 Express - designed for CircuitPython

[Adafruit METRO M0 Express - designed for CircuitPython](https://www.adafruit.com/product/3505)
Metro is our series of microcontroller boards for use with the Arduino IDE. This new **Metro M0 Express** board looks a whole lot like our&nbsp;[original Metro 328](https://www.adafruit.com/product/2488), but with a huge upgrade. Instead of the ATmega328, this Metro...

Out of Stock
[Buy Now](https://www.adafruit.com/product/3505)
[Related Guides to the Product](https://learn.adafruit.com/products/3505/guides)
### Adafruit Feather M0 Express

[Adafruit Feather M0 Express](https://www.adafruit.com/product/3403)
At the Feather M0's heart is an ATSAMD21G18 ARM Cortex M0+ processor, clocked at 48 MHz and at 3.3V logic, the same one used in the new&nbsp;[Arduino Zero](https://www.adafruit.com/products/2843). This chip has a whopping 256K of FLASH (8x more than the Atmega328 or 32u4) and...

In Stock
[Buy Now](https://www.adafruit.com/product/3403)
[Related Guides to the Product](https://learn.adafruit.com/products/3403/guides)
### Adafruit Feather M0 Basic Proto - ATSAMD21 Cortex M0

[Adafruit Feather M0 Basic Proto - ATSAMD21 Cortex M0](https://www.adafruit.com/product/2772)
Feather is the new development board from Adafruit, and like its namesake it is thin, light, and lets you fly! We designed Feather to be a new standard for portable microcontroller cores.

This is the&nbsp; **Feather M0 Basic Proto** ,&nbsp;it has a bunch of prototyping space...

In Stock
[Buy Now](https://www.adafruit.com/product/2772)
[Related Guides to the Product](https://learn.adafruit.com/products/2772/guides)
### Adafruit GEMMA M0 - Miniature wearable electronic platform

[Adafruit GEMMA M0 - Miniature wearable electronic platform](https://www.adafruit.com/product/3501)
The **Adafruit Gemma M0** is a super small microcontroller board, with just enough built-in to create many simple projects. It may look small and cute: round, about the size of a quarter, with friendly alligator-clip sew pads. But do not be fooled! The Gemma M0 is incredibly...

In Stock
[Buy Now](https://www.adafruit.com/product/3501)
[Related Guides to the Product](https://learn.adafruit.com/products/3501/guides)
### Adafruit Trinket M0 - for use with CircuitPython & Arduino IDE

[Adafruit Trinket M0 - for use with CircuitPython & Arduino IDE](https://www.adafruit.com/product/3500)
The&nbsp;Adafruit Trinket M0 may be small, but do not be fooled by its size! It's a tiny microcontroller board, built around the Atmel ATSAMD21, a little chip with _a lot_ of power. We wanted to design a microcontroller board that was small enough to fit into any project, and low...

In Stock
[Buy Now](https://www.adafruit.com/product/3500)
[Related Guides to the Product](https://learn.adafruit.com/products/3500/guides)
### Super Bright Red 5mm LED (25 pack)

[Super Bright Red 5mm LED (25 pack)](https://www.adafruit.com/product/297)
Need some really bright LEDs? We are big fans of these clear red LEDs, in fact we use them exclusively in our kits. They are very bright and have about 20degree LED beam. They go easily into a breadboard and will add that extra zing to your project.

- Pack of 25 clear red...

In Stock
[Buy Now](https://www.adafruit.com/product/297)
[Related Guides to the Product](https://learn.adafruit.com/products/297/guides)
### Through-Hole Resistors - 470 ohm 5% 1/4W - Pack of 25

[Through-Hole Resistors - 470 ohm 5% 1/4W - Pack of 25](https://www.adafruit.com/product/2781)
ΩMG! You're not going to be able to resist these handy resistor packs!&nbsp;Well, axially, they&nbsp;do all of the resisting for you!

This is a **25 Pack of 470Ω Resistors.** More specifically, they are **carbon film** , through-hole...

In Stock
[Buy Now](https://www.adafruit.com/product/2781)
[Related Guides to the Product](https://learn.adafruit.com/products/2781/guides)

## Related Guides

- [Adafruit Feather M0 Express](https://learn.adafruit.com/adafruit-feather-m0-express-designed-for-circuit-python-circuitpython.md)
- [Adafruit Metro M0 Express](https://learn.adafruit.com/adafruit-metro-m0-express.md)
- [Adafruit Trinket M0](https://learn.adafruit.com/adafruit-trinket-m0-circuitpython-arduino.md)
- [Adafruit Circuit Playground Express](https://learn.adafruit.com/adafruit-circuit-playground-express.md)
- [Porting an Arduino library to CircuitPython: VL6180X Distance Sensor](https://learn.adafruit.com/porting-an-arduino-library-to-circuitpython-vl6180x-distance-sensor.md)
- [Sensor Plotting with Mu and CircuitPython](https://learn.adafruit.com/sensor-plotting-with-mu-and-circuitpython.md)
- [Hello World of Robotics with Crickit](https://learn.adafruit.com/hello-world-of-robotics-with-crickit.md)
- [CPX Glowing Disembodied Hand](https://learn.adafruit.com/cpx-glowing-disembodied-hand.md)
- [Xenomorph Halloween Candy Bucket](https://learn.adafruit.com/xenomorph-halloween-candy-bucket.md)
- [Twinkly Earwarmer Headband](https://learn.adafruit.com/twinkly-ear-warmer.md)
- [NeoPixel Punk Collar](https://learn.adafruit.com/neopixel-punk-collar.md)
- [DIY Thermal Light Painting - Heat Map Photography](https://learn.adafruit.com/diy-flir-light-painting-heat-map-photography.md)
- [MIDI Solenoid Drummer](https://learn.adafruit.com/midi-solenoid-drummer.md)
- [Circuit Playground Powerpuff Girls Valentine](https://learn.adafruit.com/circuit-playground-valentine.md)
- [¡Bienvenido a CircuitPython!](https://learn.adafruit.com/bienvenido-a-circuitpython-2.md)
- [Using Servos With CircuitPython and Arduino](https://learn.adafruit.com/using-servos-with-circuitpython.md)
- [Data Logging with Feather and CircuitPython](https://learn.adafruit.com/data-logging-with-feather-and-circuitpython.md)
- [RGB LED Matrix Basics](https://learn.adafruit.com/32x16-32x32-rgb-led-matrix.md)
- [Python Virtual Environment Usage on Raspberry Pi](https://learn.adafruit.com/python-virtual-environment-usage-on-raspberry-pi.md)
