Sketch not saving on Arduino Uno R3

I'm building an automatic plant watering system.

The problem I'm encountering involves powering the Arduino without it being connected to the computer. The sketch runs smoothly when the USB is plugged into the computer, but once I disconnect the USB and power the Arduino with an AC adapter, it doesn't seem to execute the sketch. The AC adapter provides power, as indicated by the ON LED being lit. (The adapter has an output of 9 volts and 700mA)

I've attempted a blink test, and it also encounters the same issue. It seems like the code isn't saving on the Arduino. Any solutions?

I'd be very surprised if that were the case.

When you've loaded the blink sketch, and it works with USB power, and then doesn't work when supplied with external power, what happens if you disconnect external power and plug the USB back in? Does the LED start blinking again?

It almost certainly is executing, but will stop here, if you have code similar to that shown below (a very common mistake for disconnected systems):

   Serial.begin(Baudrate);
   while (!Serial); //wait for connection

If i disconnect the external power and plug the USB back in the sketch works as intended.

This is the code for the blink test, is the code the issue?

int ledPin = 13;

void setup() {
  pinMode(ledPin, OUTPUT);
}

void loop() {
    digitalWrite(ledPin, HIGH);
    delay(1000);
    digitalWrite(ledPin, LOW);
    delay(1000);
}

No problem with that code. If the code successfully uploads, then it is stored in the Arduino.

Some other problem is preventing it from running on external power. Please post a close up, focused photo of your setup, showing how external power is connected.

Then whew, the sketch is being saved. There just seems to be something preventing it from running from external power. Which, if the power LED is on... is still very odd.

The AC adapter is connected from the wall to the Arduino. The attached images provide close-ups of the connections; I don't know if they are relevant.


What are those other things connected to the Arduino?

Remove them and test the blink sketch again.

Yeah sorry I was just lazy and didn't take the wires out for the picture, the wires are for the main project. The blink sketch still doesn't work without the wires in.

It looks like that adapter outputs 9VAC (judging from the ~ after the 9).

If so, the Arduino will not work with it. You need a DC adapter, with correct barrel jack +/- connections. 7 to 9V is advised.

Alternatively, use a 5VDC regulated adapter, and power the Arduino through the 5V and GND pins.

2 Likes

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.