2

NOOB Question: when my Uno is connected to an external power source it will not start running the uploaded sketch. The Arduino web site says it's because the RX pin is not connected and then gets random data.

The site suggests grounding the RX pin using a resistor (granted it suggests a 10K and I used a smaller one ) or connecting it to the TX pin.

From Why doesn't my sketch start when I power up or reset the Arduino board?

Most likely because you are sending serial data to the board when it firsts turns on. During the first few seconds, the bootloader (a program pre-burned onto the chip on the board) listens for the computer to send it a new sketch to be uploaded to the board. After a few seconds without communication, the bootloader will time out and start the sketch that's already on the board. If you continue to send data to the bootloader, it will never time out and your sketch will never start. You'll either need to find a way to stop serial data from arriving for the first few seconds when the board powers (e.g. by enabling the chip that sends the data from within your setup() function) or burn your sketch onto the board with an external programmer, replacing the bootloader.

From Why doesn't my sketch start when I'm powering the board with an external power supply? (Arduino Diecimila or earlier)

Because the RX pin is unconnected, the bootloader on the board may be seeing garbage data coming in, meaning that it never times out and starts your sketch. Try tying the RX pin to ground with a 10K resistor (or connecting RX directly to the TX pin).

Both failed for me.

What should I do?

  • To upload your sketch, you have to connect your uno to your system using usb cable. After that you can use any ext. supply – Aircraft Sep 28 '15 at 12:38
  • I uploaded the sketch using the USB port connected to my computer. The sketch runs immediately after I upload it (the motor runs). Then I disconnected the USB port and connect a 9V batery to the barrel connector. The "power on light" on the UNO is on, but the sketch does not start. – Fabio Sep 28 '15 at 12:43
  • Try uploading some other sketch like blinking led connected to 13 pin then connect your uno to 9v battery and check if led is blinking or not.! – Aircraft Sep 28 '15 at 12:53
  • 3
    Motors use large amount of current. A 9v battery can't provide that much current, so the motors won't run. – Gerben Sep 28 '15 at 15:44
  • Gerben is right. The problem was the battery. Everything runs fine on a 9V power source connected to the outlet. So, my question is, what batery should I use? The projet is a small robot with 2 "yellow dc motors" – Fabio Sep 28 '15 at 21:39
3

The problem was, as Gerben said, the battery was too weak to run the engine.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.