ADCs, DACs and sampling lesson plan
What a converter really gives you: aliasing, resolution and the LSB, R-2R and PWM DACs, the ADS1115, MCP3008 and MCP4725, and a 16-bit voltmeter that checks itself.
Objectives and materials
By the end, students can
- Sample below twice the signal and it lies.
- Codes, steps, bits, references and clipping.
- Binary weights from two resistor values, and why it needs a buffer.
- A pin and an RC filter: level, ripple and step.
- Sixteen bits and a gain amplifier against ten bits and speed.
- A 12-bit DAC on I2C, read back and compared with PWM.
- A 0 to 30 V meter with a divider, a self-test and a range you pick.
Materials for the whole unit
- 8-resistor network
- Arduino Uno R3
- Bench power supply
- Capacitor
- DAC, MCP4725
- Eight-channel ADC, MCP3008
- Function generator
- Multimeter
- Oscilloscope
- Resistor x 9
- Sixteen-bit ADC, ADS1115
- Slide switch x 5
Every part is already on the simulator’s bench, so there is nothing to buy or hand out. The counts are the most any one lesson uses, if you build it on real breadboards too.
Aliasing
Sample below twice the signal and it lies.
| Lesson | Time | What students do |
|---|---|---|
| Aliasing: when a fast signal looks slowAn Uno samples a sine from a function generator at a rate you pick and counts the cycles it sees: right below half the sample rate, wrong above it, with the Nyquist rule and the anti-alias filter that real converters put first. | 55 min |
|
Materials
- Arduino Uno R3
- Function generator
- Oscilloscope
Check for understanding
Each student finishes "Aliasing: when a fast signal looks slow" on their own, without opening the hints. The simulator checks 6 of its 6 steps as they go.
Then ask each one to explain, in a sentence or two, the last thing it asked of them: "The scope samples too".
Resolution and LSB
Codes, steps, bits, references and clipping.
| Lesson | Time | What students do |
|---|---|---|
| Resolution and LSB: the smallest stepA bench supply on A0: the code and the volts, one LSB of 4.88 mV, a change too small to see, fewer bits and bigger steps, the 1.1 V reference for finer ones, and what happens past full scale. | 55 min |
|
Materials
- Arduino Uno R3
- Bench power supply
Check for understanding
Each student finishes "Resolution and LSB: the smallest step" on their own, without opening the hints. The simulator checks 6 of its 6 steps as they go.
Then ask each one to explain, in a sentence or two, the last thing it asked of them: "Past full scale".
R-2R DAC
Binary weights from two resistor values, and why it needs a buffer.
| Lesson | Time | What students do |
|---|---|---|
| R-2R DAC: bits into volts with two resistor valuesFour slide switches drive a 10k and 20k ladder: each bit worth half the one above it, the LSB, full scale one step short of 5 V, a predicted code, and why a ladder needs a buffer. | 55 min |
|
Materials
- Bench power supply
- Multimeter
- Resistor x 9
- Slide switch x 5
Check for understanding
Each student finishes "R-2R DAC: bits into volts with two resistor values" on their own, without opening the hints. The simulator checks 6 of its 6 steps as they go.
Then ask each one to explain, in a sentence or two, the last thing it asked of them: "A load on the ladder".
PWM as a DAC
A pin and an RC filter: level, ripple and step.
| Lesson | Time | What students do |
|---|---|---|
| PWM as a DAC: a pin and a filterPin 9's PWM through a 10k and 10 uF low-pass: the duty sets the voltage, the pin still switches, a smaller capacitor shows the ripple, a predicted level, and the 19.6 mV step of 8-bit PWM. | 55 min |
|
Materials
- Arduino Uno R3
- Capacitor
- Multimeter
- Oscilloscope
- Resistor
Check for understanding
Each student finishes "PWM as a DAC: a pin and a filter" on their own, without opening the hints. The simulator checks 6 of its 6 steps as they go.
Then ask each one to explain, in a sentence or two, the last thing it asked of them: "One step of PWM".
ADS1115 and MCP3008
Sixteen bits and a gain amplifier against ten bits and speed.
| Lesson | Time | What students do |
|---|---|---|
| ADS1115 and MCP3008: buying more bitsA 16-bit ADS1115 on I2C and a 10-bit MCP3008 on SPI read the same input: a change only one of them sees, clipping past the range, a programmable gain that makes 0.1 V worth 12,800 counts, and the speed each trades. | 45 min |
|
Materials
- Arduino Uno R3
- Bench power supply
- DAC, MCP4725
- Eight-channel ADC, MCP3008
- Sixteen-bit ADC, ADS1115
Check for understanding
Each student finishes "ADS1115 and MCP3008: buying more bits" on their own, without opening the hints. The simulator checks 5 of its 5 steps as they go.
Then ask each one to explain, in a sentence or two, the last thing it asked of them: "Predict: the 1.024 V range".
MCP4725
A 12-bit DAC on I2C, read back and compared with PWM.
| Lesson | Time | What students do |
|---|---|---|
| MCP4725: a real DAC on I2CThe gallery's DAC sine: a 12-bit MCP4725 writes a 32-point sine, A0 reads it back, and pin 9 plays the same sine as PWM for comparison on the scope. | 45 min |
|
Materials
- Arduino Uno R3
- DAC, MCP4725
- Oscilloscope
Check for understanding
Each student finishes "MCP4725: a real DAC on I2C" on their own, without opening the hints. The simulator checks 5 of its 5 steps as they go.
Then ask each one to explain, in a sentence or two, the last thing it asked of them: "PWM beside it".
Boss build
A 0 to 30 V meter with a divider, a self-test and a range you pick.
| Lesson | Time | What students do |
|---|---|---|
| Boss: a 16-bit voltmeterAn ADS1115 meter for 0 to 30 V: wire a bussed resistor network as an 8:1 divider, tell the sketch the ratio, check it against an MCP4725 self-test, and pick the range that fits. | 55 min |
|
Materials
- 8-resistor network
- Arduino Uno R3
- Bench power supply
- DAC, MCP4725
- Eight-channel ADC, MCP3008
- Oscilloscope
- Sixteen-bit ADC, ADS1115
Check for understanding
Each student finishes "Boss: a 16-bit voltmeter" on their own, without opening the hints. The simulator checks 6 of its 6 steps as they go.
Then ask each one to explain, in a sentence or two, the last thing it asked of them: "Your change: a wider range".
Teach this unit as a class
Start a class from this course and its 7 lessons are assigned in one go, in order. Students join with a six-character code or printed login cards, and each one’s work comes back to you.
The class tools are free for 30 days for one class of up to 20 students, with no card. The lessons themselves are free either way.