UNO reset itself every 30 seconds

While I am learning by following the toneMelody example, I found that the program repeat itself every 30 seconds after playing the 8 tones. I then loaded the BareMinimum example and found that the "L" LED on the board blinks every 30 seconds. Looks like the UNO reset itself every 30 seconds. Is it normal or is it my UNO's problem?

No, that is not normal.

This is the Tone Melody example : https://www.arduino.cc/en/Tutorial/toneMelody
It plays the melody just once, and that's all.

Perhaps one of these:

  • Maybe you have a cheap clone with bad quality capacitors and bad crystal and bad soldering.
  • Maybe your usb voltage is too low, or the usb cable doesn't make good contact.
  • Maybe the usb enters an energy saving mode.
  • Maybe you try to power it with a 9V battery.

Try with a different USB cable on a different computer. If possible try it with a desktop computer, not a laptop computer.
Or use a power supply (for example wall wart) of 7.5V to 12V to the DC power jack.

senderj:
I then loaded the BareMinimum example and found that the "L" LED on the board blinks every 30 seconds. Looks like the UNO reset itself every 30 seconds. Is it normal or is it my UNO's problem?

Maybe it is normal if you board is of "R3" design, like "UNO R3" board.

With R3 design boards, the L-LED at pin-13 is controlled by an OpAmp circuit and if you leave pin-13 in "floating" state, it is not defined whether the LED is ON or OFF at any time.

If you want pin-13 (L LED) in a defined state with R3 design Arduino boards, you better set the pin either to OUTPUT/LOW (LED will be OFF) or OUTPUT/HIGH or INPUT/HIGH (with internal pull-up resistor enabled) to have the LED either set to off or on instead of "floating".

Try:

void setup() {
  pinMode(13,INPUT_PULLUP); // set L LED with R3 boards ON
}

or

void setup() {
  pinMode(13,OUTPUT); // set L LED with R3 boards OFF
}

Can you observe any L LED flashing then at some time?

senderj:
Looks like the UNO reset itself every 30 seconds. Is it normal or is it my UNO's problem?

If you suspect that it is easy to confirm it by adding Serial.println("I am starting"); in setup(). If it restarts you will see that printed again and again.

...R

Thank you for all the replies. I tried it on another USB port at the back of my PC and the problem disappeared. Looks like the ports at the front panel has bad connection. Those at the back are on the mobo so it is more reliable.

senderj:
Thank you for all the replies. I tried it on another USB port at the back of my PC and the problem disappeared. Looks like the ports at the front panel has bad connection. Those at the back are on the mobo so it is more reliable.

If the USB jack is twisted a little bit because of incautious handling, you can use a pair of pliers and carefully squeeze the usb connector a little bit for firm seating of the USB cable.

senderj:
Thank you for all the replies. I tried it on another USB port at the back of my PC and the problem disappeared. Looks like the ports at the front panel has bad connection. Those at the back are on the mobo so it is more reliable.

Also be aware that the front USB connectors can not always deliver the required current. My (older generation) Dell machine at work as well as a retired PC at home have that problem. Connect an external USB HD to the front and it does not work, connect it to the back and it works.