Computer Engineering is coming soon

We're still writing and reviewing the notes for every subject, and we'll open it when every subject is ready. Meanwhile you can practise aptitude, ask Aria about any subject, or see the branches that are ready.

IoT development boards: Arduino, Raspberry Pi, NodeMCU and ESP32

Comparison and exam-focused notes on four common IoT development boards—Arduino (Uno/ATmega328P family), Raspberry Pi (single-board computer family), NodeMCU (ESP8266-based), and ESP32—covering definitions, hardware features, I/O, programming syntax, examples, common mistakes and exam question types

Drafted with Aria, reviewed by the AiCanCode.org team · Updated . How we write and check our notes. Spotted an error? Use Give Feedback at the bottom of the page.

Why it matters

IoT engineers use development boards to prototype, test and deploy sensor and actuator nodes, gateways and edge applications quickly. Knowing the differences in processor type, I/O capabilities, power requirements and programming models lets you choose the right board for a task (low-power sensing, local processing, or Wi‑Fi/Bluetooth connectivity).

Key ideas

Start with simple definitions (each term is defined before use):

  • Development board — a printed circuit board (PCB) that hosts a processor or microcontroller and exposes input/output pins, power and programming interfaces so developers can prototype systems without designing a PCB from scratch.
  • Microcontroller — a single-chip computer optimized for embedded control: it integrates CPU, RAM, flash (program memory), timers, and peripheral interfaces (GPIO, UART, SPI, I2C, ADC) on one chip. Assumption: microcontrollers are intended for real-time, low-power control.
  • Microprocessor — a CPU core that requires external RAM and peripheral chips; used in richer operating‑system platforms. Raspberry Pi uses a microprocessor-class System on Chip (SoC).
  • GPIO (General-Purpose Input/Output) — digital pins configurable as input or output to read switches or drive LEDs/relays.
  • ADC (Analog-to-Digital Converter) — peripheral that measures an analog voltage and converts it to a digital number. Assumption: ADC range is 0..Vref and resolution is N bits giving integers 0..(2^N - 1). On Arduino Uno, the default analog reference is AVcc (~5 V); you can select INTERNAL (1.1 V) or EXTERNAL via analogReference() and the AREF pin.
  • PWM (Pulse-Width Modulation) — digital switching at a fixed frequency where the duty cycle (fraction of time the pin is HIGH) controls the effective average voltage for motors or LED brightness.
  • UART, SPI, I2C — serial communication protocols: UART is asynchronous byte-stream (Tx/Rx pins); SPI is high-speed master/slave full-duplex (SCLK, MOSI, MISO, SS); I2C is a 2-wire bus (SDA, SCL) supporting multiple devices with addressing.
  • Flash memory — non-volatile memory that stores program code. A board’s flash size limits how large programs and libraries can be.
  • Bootloader — small program in flash that allows programming the board over USB or serial without external programmers.
  • SoC (System on Chip) — a chip that integrates CPU cores, GPU (maybe), DMA, memory controllers, and I/O on one die (used in Raspberry Pi).

Now the boards and exact exam-style definitions/assumptions:

  • Arduino (Uno / ATmega328P family) — a microcontroller-based development board built around an 8‑bit AVR microcontroller (ATmega328P). It exposes digital pins (0–13), analog input pins (A0–A5), PWM outputs on some digital pins, 5 V operating level, USB-to-serial for programming, and a hardware timer architecture. Assumptions: 16 MHz clock, 10‑bit ADC, 5 V logic.

  • Raspberry Pi (single-board computer family) — a single-board computer built around an ARM-based SoC. It runs a full operating system (usually Linux), has USB/Ethernet/HDMI, and exposes 3.3 V GPIO pins. Assumption: no built-in ADC; use external ADC or HATs for analog inputs. Raspberry Pi is used where higher-level processing, networking stacks and storage are required.

  • NodeMCU (ESP8266-based) — a Wi‑Fi enabled microcontroller/module built around the ESP8266 SoC. It typically works at 3.3 V, has a single ADC channel, and supports programming via Lua originally or via the Arduino core (same setup/loop model). Assumption: Wi‑Fi available; ADC is single-channel 10-bit with an internal 0–1.0 V input range (note: some development boards like NodeMCU include a resistor divider to scale ~0–3.3 V down to the ADC input).

  • ESP32 — a more powerful microcontroller SoC: dual‑core Tensilica Xtensa CPUs (e.g., LX6/LX7 on classic ESP32 variants; ESP32‑C3 uses single‑core RISC‑V), integrated Wi‑Fi and Bluetooth, multiple ADC channels (12‑bit nominal), many GPIOs, hardware crypto, low‑power sleep modes. Assumption: 3.3 V operation, ADC non-linearity may require calibration.

Exact statements and small derivations universities ask for:

  1. ADC conversion formula derivation (assumptions: linear ADC, N bits, input 0..Vref):

    • Definition: ADC maps analog voltage V (0 ≤ V ≤ Vref) to integer code C (0 ≤ C ≤ 2^N - 1).
    • Derivation: C = floor((V / Vref)·(2^N - 1)). Inverting: V = C · Vref / (2^N - 1).
    • State assumption: linear response, no offset, ideal ADC.
  2. PWM average voltage (assumptions: digital output switches between 0 and Vcc, switching frequency >> system time constant):

    • If duty cycle d ∈ [0,1], then average voltage Vavg = d · Vcc.
    • For driving an LED or motor with low-pass filtering (or inductance), effective voltage is approximated by Vavg.
  3. Ohm’s law and LED resistor selection (assumptions: constant diode forward voltage Vf, desired current I):

    • R = (Vcc − Vf) / I.
    • Include power rating check: P = I^2 · R.

Diagrams to draw (describe exactly):

  • Arduino Uno pinout diagram to draw: draw a rectangle representing the PCB in landscape. Mark the USB-B connector on the left short side and the barrel jack next to it. On the top edge, draw and label digital pins 0 to 13 left-to-right. Mark a small tilde (~) near pins 3, 5, 6, 9, 10, 11 to indicate PWM. On the bottom edge (from left) draw and label power header pins: IOREF, RESET, 3.3V, 5V, GND, GND, VIN. Place AREF at the top of the analog pin block near A0–A5 (as on Uno R3). On the right edge draw and label analog pins A0–A5. In the middle indicate the ATmega328P chip and a 16 MHz crystal. Label ICSP 6-pin header near the chip.

  • Raspberry Pi simple board diagram: draw a rectangle, place a 40-pin GPIO header on the top edge and label pins 1 (3.3V), 2 (5V), 3 (SDA), 5 (SCL), and GND pins (e.g., 6). Mark that all GPIO are 3.3 V logic. Note: write “no ADC built-in”. Draw USB ports on the left edge and HDMI on the right.

  • NodeMCU/ESP32 module: draw a small rectangle, mark a micro-USB connector, list available GPIOs, mark ADC pin(s), mark Wi‑Fi antenna region and the flash chip.

Formulas

(for programming and conversion — syntax to remember and key equations):

ADC conversion (ideal): V = C · Vref / (2^N - 1) where V is measured voltage (V), C is ADC code (integer 0..2^N - 1), Vref is ADC reference voltage (V). Applies to ideal ADC.

PWM average: Vavg = duty · Vcc where duty is fraction [0,1], Vcc is output HIGH voltage (V).

Arduino programming syntax to remember:

void setup() { /* run once */ } — initialization.

void loop() { /* run repeatedly */ } — main loop.

pinMode(pin, INPUT/OUTPUT); — set pin direction.

digitalWrite(pin, HIGH/LOW); — drive digital output.

int val = digitalRead(pin); — read digital input (0 or 1).

int raw = analogRead(A0); — read analog input (0..1023 on 10‑bit Arduino).

analogWrite(pin, value); — write PWM (value range depends on board; on Arduino Uno 0..255 maps to 0..100% duty).

Raspberry Pi (Python RPi.GPIO) syntax to remember:

import RPi.GPIO as GPIO;

GPIO.setmode(GPIO.BCM) — choose numbering scheme;

GPIO.setup(pin, GPIO.OUT);

GPIO.output(pin, GPIO.HIGH);

GPIO.cleanup() — release resources and return pins to inputs on program exit.

For ESP32/NodeMCU when using Arduino core, the Arduino syntax above is the same. For NodeMCU Lua original firmware, basic patterns: gpio.mode(pin, mode) and gpio.write(pin, value).

Worked examples

Example 1 — Choosing LED series resistor (typical short numerical proof):

Given: Arduino UNO Vcc = 5.0 V, LED forward voltage Vf = 2.0 V, desired LED current I = 15 mA.

Step 1: Use Ohm's law R = (Vcc − Vf) / I.

Step 2: Plug numbers: R = (5.0 V − 2.0 V) / 0.015 A = 3.0 V / 0.015 A = 200 Ω.

Step 3: Choose standard E12 value 220 Ω. Actual current I ≈ (5.0 − 2.0)/220 ≈ 13.6 mA; power dissipated P = I^2 · R ≈ (0.0136)^2 · 220 ≈ 0.041 W, so a 0.125 W (1/8 W) resistor is sufficient; 0.25 W provides extra margin.

Final answer (bold): Use 220 Ω, 0.25 W resistor.

Example 2 — ADC voltage read on Arduino Uno (10‑bit ADC):

Given: analogRead(A0) returns 512. Vref = 5.0 V, N = 10.

Formula: V = C · Vref / (2^N − 1) = 512 · 5.0 / 1023.

Compute: 512 · 5.0 = 2560; 2560 / 1023 ≈ 2.502 V.

Final answer (bold): 2.502 V (approx).

Example 3 — PWM duty → motor average voltage (Arduino):

Given: PWM analogWrite value = 192 on Arduino UNO (0..255 maps to 0..1 duty), Vcc = 5.0 V.

Step 1: duty = 192 / 255 ≈ 0.7529.

Step 2: Vavg = duty · Vcc = 0.7529 · 5.0 ≈ 3.7645 V.

Final answer (bold): ≈ 3.76 V average.

Common mistakes

  • Expecting Raspberry Pi to have analog inputs — it does not; students try analogRead and are surprised.
  • Using digitalWrite on input pins without pull-up/down handling, resulting in floating reads.
  • Forgetting ground common reference between sensors and board—measurements will be wrong if grounds are not common.
  • Mixing NodeMCU “D” pin labels with ESP8266 GPIO numbers; always consult the board’s pin map to avoid wiring/programming mismatches.
  • Not checking current limits: microcontroller GPIO pins are limited to only a few milliamps to ~20 mA typical (AVR absolute max 40 mA; many MCUs are lower); driving motors directly will damage pins—use a driver/transistor.

For your exam

Types of questions to expect:

  • Definitions and differences: microcontroller vs microprocessor, explain features of Arduino/ESP32/NodeMCU/Raspberry Pi.
  • Short notes: ADC operation and resolution, PWM and its uses, power considerations and safe connections between 3.3 V and 5 V boards.
  • Derivations: ADC conversion formula from first principles, PWM average voltage derivation.
  • Numericals: compute resistor for LED, convert ADC reading to voltage, compute PWM average voltage.
  • Programs: write an Arduino sketch to blink an LED, read analog sensor and print over serial, or write a Raspberry Pi Python snippet to toggle GPIO.
  • Diagrams: draw Arduino Uno pinout and label PWM pins, or Raspberry Pi 40-pin header with 3.3 V and GND pins.

What full-marks answers include:

  • Precise definitions (bold term then explanation), stated assumptions (Vref value, ADC linearity), step-by-step derivation and units, correctly labeled diagram as described, and final numeric answers with units and significant figures.

Quick check

  1. What is the formula to convert a 10-bit ADC code C to voltage if Vref = 5 V?
  2. Why must you not connect 5 V signals directly to Raspberry Pi GPIO?
  3. On Arduino Uno which function runs once at program start and which runs repeatedly?

Answers: 1) V = C · 5.0 / 1023. 2) Raspberry Pi GPIO are 3.3 V logic; 5 V may damage pins. 3) setup() runs once; loop() runs repeatedly.

Finished this topic? Mark it so your progress, study plan and readiness keep up.

Stuck on something here?