Stuck on a bug? Here’s a field-tested checklist to go from “why won’t it boot” to “it works!”—fast.
Get a debugging toolkit
In-stock Arduino boards
Tips for Debugging Microcontroller Projects Like a Pro
When a project won’t boot, sensors read NaN, or motors stutter, don’t panic. Follow a repeatable debug flow and you’ll find the root cause fast.
1) Start with power
- Measure 5 V/3.3 V rails with a multimeter under load. Brownouts cause random resets and bad data.
- Common ground: MCU, sensors, drivers, and power supplies must share GND.
- Right PSU: Servos and motors need their own supply, ground-tied to logic.
Tools:
Test & Measurement ·
Multimeters ·
5 V Power Supplies ·
Buck Converters
2) Flash a minimal sketch
Remove variables. Load a tiny program that just blinks an LED or prints a heartbeat. If this fails, the issue isn’t your big code—it’s power, boot, cable, or USB driver.
// Arduino heartbeat (every 1s)
void setup(){ Serial.begin(115200); pinMode(LED_BUILTIN, OUTPUT); }
void loop(){ digitalWrite(LED_BUILTIN, !digitalRead(LED_BUILTIN)); Serial.println("OK"); delay(1000); }
Boards to try:
In-stock Arduino ·
Uno R4 Minima ·
Uno R3 ·
ESP32/ESP8266
3) Add structured serial logs
Use consistent tags and timestamps. Don’t spam Serial inside ISRs or tight loops.
#define LOG(tag, msg) do{ Serial.print("["); Serial.print(tag); Serial.print("] "); Serial.println(msg); }while(0)
void setup(){ Serial.begin(115200); LOG("BOOT","Begin"); }
Handy:
USB-to-TTL adapters for secondary UARTs & boards without native USB.
4) Verify pins & wiring
- Pin conflicts: Check if SPI/I²C/UART overlap with shield pins.
- I²C pull-ups: Add 4.7–10 kΩ if the bus floats; scan addresses to confirm.
- Level shifting: 5 V boards into 3.3 V sensors need a logic-level converter.
- Cables: Some USB cables are charge-only—swap first.
Quick adds:
Level shifters ·
Jumper wires ·
Breadboards ·
Resistor kits (pull-ups)
5) Timing, debouncing, and state
- Debounce buttons (software or RC). No debounce = phantom presses.
- Avoid long delays: Prefer non-blocking
millis()patterns or a tiny state machine. - Interrupts: Keep ISRs short; set a flag and handle work in
loop().
6) Tools that save hours
- Multimeter for power integrity & continuity.
- USB logic analyzer to see I²C/SPI/UART frames and verify timing.
- Serial-to-USB adapter for extra UART logs or boot messages.
- Known-good modules to swap and isolate failing parts quickly.
Shop now:
Test & Measurement ·
Logic analyzers ·
Multimeters ·
document.querySelectorAll(‘#debug-like-a-pro pre’).forEach(pre=>{const btn=document.createElement(‘button’);btn.className=‘copy-btn’btn.type=‘button’btn.textContent=‘Copy’btn.addEventListener(‘click’,async()=>{try{await navigator.clipboard.writeText(pre.innerText.trim());const old=btn.textContent;btn.textContent=‘Copied!’setTimeout(()=>btn.textContent=old,1200)}catch(e){btn.textContent=‘Failed’}});pre.appendChild(btn)})
