Problem: Arduino won’t run with USB disconnected

I’ve seen a few people mention problems with getting their Arduino board to execute code when running stand-alone disconnected from USB, and it’s a problem that had me scratching my head when I first came across it too. The symptom is that you’ve written some code, uploaded it to the Arduino, tested it, and everything seems to work fine – until you disconnect the USB and try to run the Arduino off a battery, and it just won’t go. Plug it back in to USB and everything is fine. Grrrrr!

The basic problem is the Arduino seeing a floating input to the RX line on the serial port. While booting up the Arduino bootloader searches for an update from a host computer, and if it finds one it loads it up and runs it. But with the RX line floating it sees garbage data and sits there indefinitely waiting for an update that will never come.

The solution is easy when you know how. Just stick a 10k resistor across the RX and TX connections (ie: digital pins 0 and 1) or from RX to GND when you’re not using the USB connection and the Arduino will boot cleanly and execute your code as expected.

Leave a Reply