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.

  • The next shows a neat display that leaves the true tank state in doubt.
  • The last compares low, middle, and full levels and asks what to do with noise, a lost sensor, and restart.
  • A microcontroller means the small computer on the board.
  • A digital-to-analog converter (DAC) means a circuit that turns a number into a voltage or current.

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)

An analog-to-digital converter means a circuit that turns a voltage into a number; it is called an ADC.

  • 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.
  • The goal is to help you choose the right converter settings and verify whether an interface is precise enough for the job.
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.

But the microcontroller only understands step numbers like 20, 21, 22.

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.

Recommended Order: Follow chapters 1-5 in sequence. 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

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: fsample=300f_{sample} = 300fsample​=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.

Let Eddie connect sample rate, Nyquist margin, bin width, and quantisation noise.

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.

Read these conclusions as one connected engineering argument: ADC: Converts analog voltage to a digital value.

iotclass.org

Major section

ADC Design for Vibration

Decision: A 12-bit ideal 3.3 V converter has 3.3 V / 4096 ≈ 0.806 mV per code, coarser than the ADXL1002's ≈0.264 mV change per 0.01 g at 3.3 V.

  • Binary (Ch1):: ADC output is binary number requiring correct interpretation.
  • PWM (Ch5):: LED dimming via PWM provides visual feedback without true DAC.
  • The ESP32 ADC's actual transfer depends on attenuation and calibration; ±0.01 g accuracy is not established without a validated signal chain.

Numbers to remember

5 kHzSignal frequency
5%ADXL1002 bandwidth
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.
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.

Always verify voltage level compatibility from the datasheet and add level shifters or voltage dividers where needed.

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.

  • An analog-to-digital converter means a circuit that turns a voltage into a number; it is called an ADC.
  • 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

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

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

A1,024
B2,048
C8,192
D4,096
Show answer

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

Q2For a signal reaching 1 kHz, what is the twice-bandwidth Nyquist boundary rate before practical filter margin?

A500 Hz
B1,000 Hz
C2,000 Hz
D1,500 Hz
Show answer

Answer: C Twice the 1 kHz signal frequency gives a 2,000 Hz Nyquist boundary.

Q3What samples and quantizes an analog sensor voltage into digital codes?

APhysical world
BSensor
CADC
DMicrocontroller
Show answer

Answer: C The ADC samples and quantizes the analog sensor voltage into codes.

iotclass.org

Print reference

Answers

Answer key.

  1. D · The number of output levels for an ADC is 2^n, where n is the number of bits.
  2. C · Twice the 1 kHz signal frequency gives a 2,000 Hz Nyquist boundary.
  3. C · The ADC samples and quantizes the analog sensor voltage into codes.
iotclass.org