Hi! My name is Simon Tushev.
I do web design and development.

Preventing Arduino from auto-reset when COM port opens\closes

by / Wednesday, 08 December 2010 / Published in Arduino

As you may have noticed, each time you open or close COM port, your Arduino board resets. This may be good for development, but when you put something into production or just create an application that keeps the port open only while transmitting data, it's very disturbing.

There are two ways to prevent this from happening.

anti reset capacitor


The first, physical way, requires installing a small (10 uF) capacitor between reset and ground pin. It will "eat" the reset pulse, so your board will not reboot.

However, this works only after your board was started successfully. If you connect the capacitor before you plug Arduino to USB, it will not start. As well, you will not be able to upload any sketch without removing the capacitor. So, this is not the best way and should be used only when your program on a computer cannot be modified.

The second, software way, works much better. You should set Data Terminal Ready (DTR) parameter for port to false\disabled. Without that signal, Arduino will not reset each time the port is opened or closed.

An example in C# how to do this:

SerialPort p = new SerialPort(args[1], 9600);
p.DtrEnable = false;

With the second way, you'll still be able to upload any sketch - if necessary.

Read 7907 times Last modified on Thursday, 02 April 2015 10:23

Do you like this? Please share!

Simon Tushev

Simon is IT professional with interests in web design, electronics, photography and astronomy. He writes about PHP, Yii, Joomla!, Arduino and several other topics.

We use cookies, just to track visits to our website, we store no personal details Privacy policy