Develop Arduino projects avoiding common wiring, power, and code pitfalls.
OpenClaw skills run inside an OpenClaw container. EasyClawd deploys and manages yours โ no server setup needed.
Initial release
---
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 glitches
## Wiring 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 on
## Pin 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 buttons
## Timing 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 immediately
## Memory 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 stability
## Serial 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 code
## Upload 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 ISP
## Sensor 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