Arduino
by @ivangdavila
Develop Arduino projects avoiding common wiring, power, and code pitfalls.
clawhub install arduino
π About This Skill
name: Arduino
description: Develop Arduino projects avoiding common wiring, power, and code pitfalls.
metadata: {"clawdbot":{"emoji":"π","os":["linux","darwin","win32"]}}
Voltage and Power Traps
3.3V vs 5V logic mixing damages boards β ESP32 is 3.3V, Uno is 5V, level shifter required
USB provides max 500mA β not enough for motors, servos, or many LEDs
Never power motors from Arduino 5V pin β use external supply with common ground
Brown-out causes random resets β looks like code bugs, actually insufficient power
Decoupling capacitors (0.1Β΅F) near sensor power pins β reduces noise-related glitchesWiring Mistakes
Floating inputs read random values β always use pullup or pulldown resistor
All components must share common ground β separate grounds = nothing works
Long wires pick up noise β keep analog sensor wires short
LEDs need current limiting resistors β direct connection burns LED and pin
Reversed polarity destroys components β double-check before powering onPin Conflicts
RX/TX pins (0, 1) conflict with Serial β avoid for GPIO when using Serial Monitor
Some pins have special functions β check board pinout for I2C, SPI, interrupt-capable pins
PWM only on pins marked with ~ β analogWrite() on wrong pin does nothing
Internal pullup available β INPUT_PULLUP eliminates external resistor for buttonsTiming Traps
delay() blocks everything β nothing else runs, no input reading, no interrupts serviced
millis() for non-blocking timing β compare against last action time
millis() overflows after ~50 days β use subtraction: millis() - lastTime >= interval
Interrupts for time-critical events β attachInterrupt() responds immediatelyMemory Constraints
Uno has only 2KB RAM β large arrays fail silently with weird behavior
F() macro keeps strings in flash β Serial.println(F("text")) saves RAM
PROGMEM for constant arrays β keeps data out of RAM
String class fragments heap β prefer char arrays for stabilitySerial Debugging
Baud rate must match β mismatch shows garbage, not an obvious error
Serial.begin() required in setup β output before this goes nowhere
Serial printing slows execution β remove or reduce for production codeUpload Problems
Wrong board selected β uploads but doesn't run correctly
Serial Monitor holds port β close before uploading
USB cable might be power-only β some cheap cables don't carry data
Bootloader corrupted β reflash using another Arduino as ISPSensor Communication
I2C devices share bus β check for address conflicts with scanner sketch
5V sensors on 3.3V boards give wrong readings or damage β check operating voltage
SPI needs separate CS per device β can't share chip select lines