If I upload any sketch that sends serial data, I immediately see the TX/RX LEDs flash once the sketch is uploaded. If I then start the serial monitor, the sketch appears to restart.

A bare minimum sketch that shows this behaviour:

void setup()

void loop()

Tested with several boards and Mac and Windows versions of the IDE.

Example output - it goes back to "Setup" when I open the serial monitor:


Why is this?


The Arduino uses the RTS (Request To Send) (and I think DTR (Data Terminal Ready)) signals to auto-reset. If you get a serial terminal that allows you to change the flow control settings you can change this functionality.

The Arduino terminal doesn't give you a lot of options and that's the default. Others will allow you to configure a lot more. Setting the flow control to none will allow you to connect/disconnect from the serial without resetting your board. it's quite useful for debugging when you want to be able to just plug in the connector and see the output without having to start the sketch over.

Another way to disable the auto reset is to put a pull up resistor on the reset pin.

Disabling Auto Reset On Serial Connection

| improve this answer | |
  • 2
    Arduino Unos can be fixed with a 10 µF capacitor across RESET and GND. It works for the one installation I've used it for, so far … – scruss Oct 19 '14 at 15:44
  • 1
    I tried using PuTTY, connecting to the COM port the Arduino appears at (COM16 in my case). It is still resetting the Arduino if "Flow control" in Connection/Serial is set to "None" (the other options are "XON/XOFF", "RTS/CTS", and "DSR/DTR"). I used version 0.60 of PuTTY. – Peter Mortensen Aug 9 '15 at 11:13
  • -cont: It was tried on an Arduino Uno R3. – Peter Mortensen Aug 9 '15 at 11:21
  • The Duemilanove and Uno have a trace labeled "EN RESET" which controls this behavior. Scratch off that trace to disable auto-reset. Solder a wire across the pads to re-enable it. – mhopeng May 14 '16 at 4:13

The truth is always in the datasheets, the schematics and the code:

The Arduino UNO actually uses the /DTR line to trigger a reset, as you can see on the following datasheet:

reset schematic

| improve this answer | |
  • The link to your schematic image is broken. – linhartr22 Aug 11 '16 at 22:47
  • 1
    Thank you, I fixed it! I actually thought that SO was caching images, but looks like it's not, so I'll make sure to keep it always on. – zmo Aug 14 '16 at 10:06
  • 1
    Yes, but what actually happens? Is it due to the way the ATmega16U2 is programmed (asserting PD7 low when a COM port is opened by a program?)? Or following some standard for DTR?). And what is the implication of C5? - will it reset the main processor for both transitions (low to high & high to low)? What is the approximate pulse width (in microseconds) on the reset pin of the main processor and what does it look like? – Peter Mortensen Mar 20 '18 at 8:53
  • 1
    How is this an answer? What we suppose to do with this information???? – GeneCode Dec 23 '18 at 7:51
  • 1
    It actually does nothing, as you can see from the schematics. The reason it's there is that you can cut the DTR line between the RESET-EN legs to disable automatic reset, and if you want to reenable it, then you can solder together the two RESET-EN pads. – zmo Feb 19 at 13:21

This fixes the problem

import os
import sys
import termios
import fcntl

        self.fd = sys.stdin.fileno()

        # Stop resetting the arduino on serial connect

        self.newattr = termios.tcgetattr(self.fd)
        self.newattr[2] = self.newattr[2] & ~termios.HUPCL
        termios.tcsetattr(self.fd, termios.TCSANOW, self.newattr)
| improve this answer | |

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.