ADC — Maple v0.0.11 Documentation

### Navigation

- next
- previous |
- LeafLabs |
- Index »

# ADC

Analog-Digital Conversion is the process of reading a physical voltage as a number. The Maple has a large number of pins which are capable of taking 12-bit ADC measurements, which means that voltages from 0 to 3.3V are read as numbers from 0 to 4095. This corresponds to a theoretical sensitivity of just under 1 millivolt. In reality, a number of factors introduce noise and bias into this reading, and a number of techniques must be used to get good precision and accuracy.

Contents

- Noise and Bias
- Function Reference
- Recommended Reading

## Noise and Bias

The biggest issues with analog to digital conversion are noise and bias. With the Maple line, we have tried to isolate the ADC pins and traces from strong noise sources, but there are always trade-offs between noise, additional functionality, cost, and package size. We’ve tried to enable good analog performance by isolating as many ADC pins as possible from digital noise on each board.

More information on these isolated pins is available in each board’s hardware documentation:

- Maple
- Maple RET6 Edition
- Maple Mini

That said, there are a number of more general things you can do to try to get good readings. If your input voltage changes relatively slowly, a number of samples can be taken in succession and averaged together, or the same voltage can even be sampled by multiple ADC pins at the same time.

Another important factor when taking a voltage reading is the reference voltages that the sample is being compared against. For Maple, the high reference is VDDA and the low reference is ground. This means that noise or fluctuations on either VDDA or ground will affect the measurement. It also means that the voltage you are trying to sample must be between ground and 3.3 V.

In the case of a variable reading, it is best if the voltage varies over the entire range of 0 through 3.3 V; otherwise, only a fraction of the sensitivity is being used. Some basic tools to accomplish this are resistor dividers and Zener diodes. However, operational amplifiers and other powered components can also be used if greater precision is required.

## Function Reference

- analogRead()
- pinMode()

## Recommended Reading

- Wikipedia: Analog-to-Digital Converter
- Arduino Analog Input Tutorial
- ST documentation:
  - Application Note on ADC Modes (PDF)
  - Application Note on ADC Oversampling (PDF)

### Navigation

- next
- previous |
- LeafLabs |
- Index »