Electronics & Circuits · Study deck

Analog vs. Digital Signals

Picture a water tank sensor that produces a changing voltage while a controller decides when to stop a pump.

Voltage Vera is your guide for this deck.

analogdigital
Voltage Vera, the module guide, in a scene from this chapter.
iotclass.org

After studying this chapter

Learning objectives

You will be able to:

  • Explain the difference between analog and digital signals and why conversion between them is necessary in IoT systems
  • Apply the Nyquist-Shannon sampling theorem to determine appropriate sampling rates for real-world sensor signals
  • Calculate ADC/DAC conversion values using standard formulas for temperature, distance, and motor control applications
  • Compare PWM and true DAC output methods and select the appropriate technique for a given actuator control scenario
iotclass.org

Major section

Start Simple

A neat number on a screen can still be wrong if the input range, output drive, or timing does not match the real circuit.

  • A microcontroller means the small computer on the board.
  • An analog-to-digital converter means a circuit that turns a voltage into a number; it is called an ADC.

Key terms

Pulse-width modulation
Pulse-width modulation means control made by changing how long a signal stays on; it is called PWM.
iotclass.org

Major section

Start Simple (continued)

A digital-to-analog converter (DAC) means a circuit that turns a number into a voltage or current.

  • Pulse-width modulation means control made by changing how long a signal stays on; it is called PWM.
  • An actuator means a part that creates a physical action.
  • This runway does not choose component values or prove electrical safety.
iotclass.org

Major section

In 60 Seconds

Analog-to-digital conversion is the essential bridge between continuous real-world sensor signals and discrete digital microcontrollers.

  • This series covers binary number systems, ADC/DAC operation, Nyquist sampling theory, and practical worked examples -- everything you need to understand how IoT devices read sensors and control actuators at the hardware level.
iotclass.org

Major section

Overview

Every IoT device that reads a sensor or drives an actuator must cross the analog-digital boundary.

  • This five-chapter sequence takes you from binary representation, to ADC behavior, to sampling constraints, to output generation, and finally to worked design calculations.
iotclass.org

Major section

For Kids: Meet the Sensor Squad!

Analog and digital are like the difference between a slide (smooth) and stairs (steps)!: Temperature Terry feels temperatures that go smoothly from cold to hot - like 20.1, 20.2, 20.3 degrees.

  • The more steps Andy uses, the more precise the translation becomes.
iotclass.org

Major section

Learning Path

The worked-examples chapter belongs at the end because it assumes you already understand binary representation, ADC limits, Nyquist sampling, and DAC/PWM output.

  • Quick Reference:: If you already know the theory, jump directly to Worked Examples and return to the earlier chapters only when a formula or design choice is unclear.
iotclass.org

Major section

Putting Numbers to It

The 12-bit ADC provides 4× better temperature resolution -- crucial for precision applications like laboratory environmental monitoring or medical devices where 0.1°C accuracy is required.

  • In practice, use 5× oversampling: $f_{sample} = 300$ Hz to avoid aliasing from harmonics.
iotclass.org

Major section

Phoebe's Field Notes: Why Bits and Samples Set the Limit

For this chapter's 5 kHz vibration limit, 12.5 kHz sampling gives a 6.25 kHz Nyquist boundary and 2.50 samples per fastest cycle.

  • A 12-bit, 3.3 V ADC has 0.806 mV bins, 0.233 mV rms ideal quantisation noise, and 74.0 dB ideal SNR.

Numbers to remember

5 kHzFor this chapter's 5 kHz vibration limit
12.5 kHz12.5 kHz sampling gives a 6.25 kHz Nyquist boundary
6.25 kHz12.5 kHz sampling gives a 6.25 kHz Nyquist boundary
iotclass.org

Major section

Key Concepts Summary

Formula: levels = 2^n.: Nyquist rate: The minimum safe sampling rate is at least twice the highest signal frequency.

  • Rule of thumb: about +/- 0.5 LSB.: PWM: A digital signal can behave like an analog output when the load responds to the average duty cycle.
iotclass.org

Major section

ADC Design for Vibration

Practical with anti-aliasing: 2.5× oversampling = 12.5 kHz: ESP32 ADC can sample at 83 kHz maximum → 12.5 kHz is well within capability.

  • Binary (Ch1):: ADC output is binary number requiring correct interpretation.
  • ADC (Ch2): 12-bit resolution provides ±0.010g quantization error, meeting the 0.01g requirement.

Numbers to remember

12.5 kHzNyquist (Ch3): 12.5 kHz sampling prevents aliasing of 5 kHz signals.
5 kHzNyquist (Ch3): 12.5 kHz sampling prevents aliasing of 5 kHz signals.

Why it matters

Nyquist (Ch3): 12.5 kHz sampling prevents aliasing of 5 kHz signals.

iotclass.org

Major section

ADC/DAC Concept Map

Binary (Ch1) -> Digital representation: Requires number systems and base-2 thinking.

  • Bits and resolution -> Precision limits: Requires binary and powers of two.
  • ADC (Ch2) -> Sensor digitization: Requires both binary and voltage concepts.
  • Quantization -> Measurement error: Requires understanding resolution and step size.
  • Applied when checking whether a sensor system is accurate enough for its job.
iotclass.org

Major section

ADC/DAC Concept Map (continued)

Sampling rate (Ch3) -> Signal capture: Requires Nyquist theorem and frequency concepts.

  • Aliasing -> Signal corruption: Requires sampling and frequency understanding.
  • DAC (Ch5) -> Analog output: Requires binary and voltage conversion.
  • PWM (Ch5) -> Pseudo-analog output: Requires duty-cycle and frequency understanding.
  • SPI/I2C -> ADC communication: Requires digital protocol basics.
iotclass.org

Major section

Digital Logic in Analog Circuits

Long wire lengths, capacitive loads, and inductive coupling that are acceptable in low-speed digital circuits destroy the performance of analog signal chains.

  • Analog signal traces must be kept short (<5 cm where possible), isolated from digital traces, and guarded with ground pour to minimize capacitive coupling.

Numbers to remember

<5 cmAnalog signal traces must be kept short (<5 cm where possible)
iotclass.org

Major section

3.3V and 5V Logic Mismatch

GPIO outputs from 3.3 V microcontrollers (ESP32, STM32) do not reliably drive 5 V logic inputs that require VIH > 3.5 V.

  • Conversely, 5 V outputs connected to 3.3 V inputs can permanently damage 3.3 V ICs.
iotclass.org

Deck summary

Key takeaways

A neat number on a screen can still be wrong if the input range, output drive, or timing does not match the real circuit.

  • A digital-to-analog converter (DAC) means a circuit that turns a number into a voltage or current.
  • Analog-to-digital conversion is the essential bridge between continuous real-world sensor signals and discrete digital microcontrollers.
  • Every IoT device that reads a sensor or drives an actuator must cross the analog-digital boundary.
  • The worked-examples chapter belongs at the end because it assumes you already understand binary representation, ADC limits, Nyquist sampling, and DAC/PWM output.
iotclass.org

Retrieval practice

Recall check 1 of 2

Voltage Vera says: answer from memory, then check your reasoning.

Q1A 12-bit ADC has how many possible output values?

A1,024
B2,048
C4,096
D8,192
Show answer

Answer: C The number of output levels for an ADC is 2^n, where n is the number of bits.

Q2According to the Nyquist theorem, what minimum sampling rate is required to accurately digitize a 1 kHz signal?

A500 Hz
B1,000 Hz
C1,500 Hz
D2,000 Hz
Show answer

Answer: D The Nyquist theorem requires the sampling rate to be at least twice the highest frequency component: f_sample >= 2 x f_max.

iotclass.org

Retrieval practice

Recall check 2 of 2

Voltage Vera says: answer from memory, then check your reasoning.

Q3Place each conversion-chain element where it lives so you can trace where a physical signal becomes data and where data becomes physical action again.

APhysical world
BSensor
CADC
DMicrocontroller
EDAC or PWM
FActuator
Show answer

Answer: A Follow the loop from the physical world through sensing and digital computation to output conversion and actuation so you can diagnose the right interface.

iotclass.org

Print reference

Answers

Answer key.

  1. C · The number of output levels for an ADC is 2^n, where n is the number of bits.
  2. D · The Nyquist theorem requires the sampling rate to be at least twice the highest frequency component: f_sample >= 2 x f_max.
  3. A · Follow the loop from the physical world through sensing and digital computation to output conversion and actuation so you can diagnose the right interface.
iotclass.org