How to Disable Serial COM Auto Reset on Arduino Uno

Posted by Max Power | Posted in Arduino | Posted on 29-11-2011-05-2008

2

Edit:  I gave up on trying to disable the auto reset through software.  The capacitor method works but is cumbersome.  The easiest solution is to use an external FTDI as I show in this post.

To test the following solutions I am using the LED example included with the Arduino software to test it. Using your computer, upload the PhysicalPixel sketch from File > Examples > Communication > PhysicalPixel to the Arduino.  After you upload the sketch, plug it into the WGT634u and lets test it out.  In this example when we send a “H” the LED on the Arduino will light and when we send a “L” the LED will go off.  However, you might notice that the LED blinks a bunch of times and does not stay light.  This is because the serial port resets.  When we are trying to communicate with it via the COM port this is annoying.  However there are ways to fix this.

Hardware Solution

Here are some hardware solutions that you might want to try: http://www.arduino.cc/playground/Main/DisablingAutoResetOnSerialConnection.  I was able to make it work by adding a 10uF capacitor between the RESET and GND.  One note though, you need to plug in the Arduino first to let it start, then you can add the capacitor.  If you have the capacitor connected before you connect the USB cable it will not work.  Here is a reference: http://tushev.org/articles/electronics/38-preventing-arduino-from-auto-reset-when-com-port-openscloses

Software Solution

The other option is to set Data Terminal Ready (DTR) to false or disabled for the port that hosts your Arduino.

Python

Here is an example of how to do this in Python.  I downloaded the pySerial package and modified it as follows:

  1. Copy the folder c:\Python27\Lib\site-packages\serial to c:\Python27\Lib\site-packages\arduino
  2. In the arduino folder, delete the file serialwin32.pyc
  3. Edit the file serialwin32.py, replace the line self._dtrState = win32.DTR_CONTROL_ENABLE to say self._dtrState = win32.DTR_CONTROL_DISABLE
  4. Save the file and use import arduino to use the modified package

Here is the code that I am using to turn on the LED on pin 13.  This uses the PhysicalPixel sketch mentioned above.

import arduino
ser=arduino.Serial('COM4',9600)
ser.write('L')

Comments posted (2)

Finaly I found thet
for python in Linux you must do like this:
ser.dsrdtr=False
ser.setDTR(level=False)

Whet will be no Reset

hello, this is an old post but google is pointing here.

I found a workaround for this problem on the web.
On the openwrt console you must type :

cat /dev/ttyACM0 &

or add it somewhere in a script at boot.

and voila, no capacitor needed !

Write a comment