Table of Contents

Electronics Reference: Arduino & Embedded Prototyping

HARDWARE SAFETY & LOGIC LEVEL MANDATE: Classic Arduino boards (`Uno`, `Nano`, `Mega`) operate at `5.0 V` logic, whereas modern boards (`ESP32`, `Nano 33`, `Zero`, `Due`, `RP2040`) operate strictly at `3.3 V` logic. Always verify GPIO logic voltage tolerance, observe per-pin current limits (`20 mA – 40 mA` max), and never drive motors, relays, or solenoids directly from GPIO pins.

1. Arduino Board Comparison Matrix

Select the appropriate Arduino or Arduino-compatible microcontroller board based on logic voltage, processing speed, memory, and hardware peripherals:

Board Model Microcontroller Logic Voltage Clock Speed Flash / SRAM Digital / PWM / Analog Pins Hardware Serial / Buses
Arduino Uno R3 `ATmega328P` (8-bit AVR) 5.0 V 16 MHz 32 KB / 2 KB 14 Digital (6 PWM), 6 Analog (10-bit) 1× UART, 1× SPI, 1× I2C
Arduino Uno R4 WiFi / Minima `Renesas RA4M1` (32-bit ARM Cortex-M4) 5.0 V 48 MHz 256 KB / 32 KB 14 Digital (6 PWM), 6 Analog (14-bit), 1× DAC 1× UART, 1× SPI, 1× I2C, 1× CAN, Wi-Fi/BLE (R4 WiFi)
Arduino Nano (Classic) `ATmega328P` (8-bit AVR) 5.0 V 16 MHz 32 KB / 2 KB 22 Digital (6 PWM), 8 Analog (10-bit) 1× UART, 1× SPI, 1× I2C (breadboard-friendly)
Arduino Mega 2560 `ATmega2560` (8-bit AVR) 5.0 V 16 MHz 256 KB / 8 KB 54 Digital (15 PWM), 16 Analog (10-bit) 4× Hardware UART, 1× SPI, 1× I2C
Arduino Pro Micro / Leonardo `ATmega32U4` (8-bit AVR) 5.0 V (or 3.3V/8MHz) 16 MHz 32 KB / 2.5 KB 20 Digital (7 PWM), 12 Analog (10-bit) Native USB HID (emulates keyboard/mouse/joystick)
Arduino Nano ESP32 / ESP32-S3 `ESP32-S3` (Dual-Core 32-bit Xtensa) 3.3 V (Not 5V tolerant) 240 MHz 16 MB / 512 KB 14 Digital (all PWM), 8 Analog (12-bit) 2× UART, 1× SPI, 1× I2C, Wi-Fi, Bluetooth LE
Arduino Nano RP2040 Connect `RP2040` (Dual-Core ARM Cortex-M0+) 3.3 V (Not 5V tolerant) 133 MHz 16 MB / 264 KB 20 Digital (all PWM), 8 Analog (12-bit) 2× UART, 2× SPI, 2× I2C, onboard 6-axis IMU & Wi-Fi

2. Powering Arduino Boards Safely

Understanding the difference between `VIN`, the DC Barrel Jack, `5V`, and `3V3` pins prevents burnt onboard voltage regulators:

3. GPIO Pin Modes, Current Limits & Interfacing

3.1 Absolute GPIO Current Limits

3.2 Floating Inputs & Pull-Up / Pull-Down Resistors

A digital input pin configured as `pinMode(pin, INPUT)` with nothing connected acts like a tiny antenna, picking up static electricity and stray electromagnetic fields—causing random `HIGH`/`LOW` readings:

3.3 Analog Input (ADC) & PWM Output (`analogWrite`)

4. Hardware Pins & Communication Bus Map (Uno / Nano)

Keep these dedicated hardware pins clear when assigning general-purpose digital I/O:

Pin(s) Hardware Function Design Restriction / Notes
`D0 (RX)` & `D1 (TX)` Hardware `UART` Serial Connected to the USB-to-Serial bridge (`CH340` / `ATmega16U2`). Disconnect peripherals on `D0`/`D1` while uploading sketches over USB.
`D2` & `D3` Hardware External Interrupts (`INT0`, `INT1`) Reserve for rotary encoders, hall-effect RPM sensors, radio PPM/PWM receivers, and emergency stop buttons.
`D3, D5, D6, D9, D10, D11` Hardware `PWM` (`~`) Note that `D5` and `D6` share Timer0 with `delay()` and `millis()`, running at `980 Hz` instead of `490 Hz`.
`D10 (SS), D11 (MOSI), D12 (MISO), D13 (SCK)` Hardware `SPI` Bus `D13` is also tied to the onboard `LED_BUILTIN`. Keep `D10` configured as `OUTPUT` whenever acting as SPI Master.
`A4 (SDA)` & `A5 (SCL)` Hardware `I2C` Bus Internal `10 kΩ` pull-ups are enabled automatically by the `Wire.h` library (`5.0 V` on Uno/Nano).

5. Firmware Architecture & Non-Blocking Code Standards

Avoid writing blocking delays in embedded control firmware—using `delay(1000)` freezes the processor for an entire second, causing missed button presses, dropped serial packets, and unresponsive safety stops:

6. Arduino Bench Bring-Up & Troubleshooting Checklist

  1. [ ] Verify Board & Port Selection: Confirm the exact Board, Processor bootloader (`ATmega328P` vs. `ATmega328P (Old Bootloader)` on Nano clones), and COM/tty port in the Arduino IDE / PlatformIO before uploading.
  2. [ ] Check `5.0 V` vs. `3.3 V` Logic Compatibility: Confirm no `5.0 V` sensor or `HC-SR04` echo pin is wired directly into a `3.3 V` (`ESP32` / `RP2040` / `STM32`) GPIO pin without a voltage divider or logic level shifter.
  3. [ ] Verify Common Ground (`GND`): Ensure external servo/motor battery packs share a direct ground connection with the Arduino `GND` pin (erratic servo twitching is almost always caused by a missing common ground).
  4. [ ] Isolate High-Current Noise: Add a `470 µF – 1000 µF` electrolytic capacitor across servo/motor power rails and a `0.1 µF` ceramic capacitor across the Arduino's `5V` and `GND` pins to prevent brownout resets when motors start up.
  5. [ ] Serial Monitor Baud Rate Match: Confirm `Serial.begin(115200);` in `setup()` matches the baud rate selected in the Serial Monitor (garbled `⸮⸮⸮` characters indicate a baud rate mismatch).

Electronics Reference: 1. Diodes & Transistors | 2. Integrated Circuits (ICs) | 3. Communication Buses (UART, SPI & I2C) | 4. Voltage Regulators & Power Supply Design | 5. Operational Amplifiers (Op-Amps) | 6. Sensors & Breakout Modules | 7. PCB Design & Soldering Standards | 8. Arduino & Embedded Prototyping