Prevent reset when re-plugging USB power while still using external power source

Hi there,

I have an Arduino Duemilanove setup that usually runs on external power (fed directly through the Vin pin by an external stabilized 12V / 5V DC-DC buck regulator) but has to get hooked to an USB port from time to time (in order to check some of the variables currently in its memory).
Unfortunately, simply connecting the USB cable (without starting any software on the PC) always triggers a hardware reset (bootloading), naturally erasing all current variables from the memory...

Is there any way to prevent this hard reset when plugging in an USB cable while maintaining external power ? Interestingly, such a reset never occurs when I unplug the board, so its probably just a "software" problem (I am running Windows 7 which naturally always detects the board as soon as it gets connected).

Thanks for any hint / help in advance !

FNW

Yes there is.You must disable the auto-reset.This can be done connecting a resistor 120 ohms from the VCC to the reset Pin.
You could also remove the bootloader from the micro if you want, but then you need to have an external programmer to upload the program.About the power when you plug the USB cable and still powering the board from an external source, there is a MOSFET that deals with that, switching from one to another, so you can have both at the same time.I believe the board will not suffer a power loose when you remove the USB cable since the FET will switch to the external source very fast.
For more info about the auto-reset read this article:
http://playground.arduino.cc/Main/DisablingAutoResetOnSerialConnection

Hi HugoPT,

thanks for your input and sorry for my belated reply.
I already read several threads concerning "software reset" after connecting USB and how to prevent this (but I would go for the 10µF capacitor method e.g. described here
c - Arduino resetting while reconnecting the serial terminal - Electrical Engineering Stack Exchange, instead as it is easier and less 'lossy' because no current is drawn during normal operation). Some people write that this sort of reset would only occur on Mac OS X and Linux machines while Windows would not trigger a soft-reset during a simple USB handshake (= just plugging the cable) but only when trying to actually access the serial port (e.g. via HyperTerminal). Hence, I thought there might be another hardware-related problem which triggers a reset when connecting my Duemilanove board to the PC via USB...

Nevertheless, after finally finishing my project, yesterday, I now found out that there is yet again a problem while unplugging the USB cable: The LEDs on the Arduino go off for about half a second (despite my 'stabilization' of the 5V line with a 1000µF capacitor) before the external (permanent) power source kicks in... Hence, even if I would be able to prevent the soft-reset during establishment of a PC connection, unplugging the USB cable would definitely cause a hard-reset because of power loss for a certain time.
As I never need to power the board via USB, I now thought of using a little 'trick' to prevent any interference with my external power source: Would it be okay to simply cut the two power lines of the USB cable (VCC / GND) and only leave the data lines (D- / D+) intact ? If I can still transfer data with only those two data lines connected, I guess this would solve the unplugging issue (if it is not ground-related).

Maybe there is somebody out there who already did this and can share his / her experience, so I know if this makes sense or if there is a better way to go.

Thanks for any feedback !

FNW