Saturday, September 23, 2017

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;
p.Open();
p.Write(args[0]);
p.Close();

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

Read 4855 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.

Welcome!

Here I publish articles related to my areas of interest, my brief notes that may save some time to others, as well as some of my works.

This site is a work in progress. I will add more sections in the future, such as

  • More photos to photogallery
  • More Joomla!-related articles
  • ...

 

themeforest

New Posts

Using dynamic GeoIP module with nginx (CentOS)

nginx introduced dynamic module support in v. 1.9.11. This brief article provides step-by-step procedure...

13-04-2016 in Linux, BSD, Unix

READ MORE

Visual difference between pseudo and true random data

This is is "random" image generated using PHP rand() function: And this is an image...

20-11-2015 in Blog

READ MORE

Best EEPROM practices

(this article is a work in progress). My own advice will be added later...   Having...

12-10-2015 in Arduino

READ MORE
Scroll to top

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