I'm trying to set up a system using an that delivers a specific number of digital pulses to a device using one of the digital pins. The number of pulses delivered is specified over a the Mega's USB serial connection using a Python script (or terminal for debugging).

When I close the serial connection to the Arduino, I get a short "blip" that looks like a digital high (see image below). This happens when I disconnect in PySerial using Serial.close() or when I simply close my Arduino IDE terminal window.

It does not occur when I press the reset button on the board

Any ideas on how to get rid of this? Thanks!

blip on disconnect

  • 1
    You could try adding a pull-down resistor to the pin, and see if the problem persists. Does the Arduino reset itself, when you disconnect the serial connection? – Gerben Jun 1 '17 at 15:54
  • 1
    Maybe it's a wiring thing. Try posting a schematic of your setup. Perhaps we need to see the circuitry inside the "device" you've connected the Mega to. – Gabriel Staples Aug 5 '17 at 14:36
  • Its definitely a wiring thing; you may have shorted something or missed shorting all grounds in case you have more than one; – techniche Sep 16 '17 at 18:21
  • What digital pin? What is your code? – Nick Gammon Nov 16 '17 at 6:17

When you connect and disconnect from the Arduino, the usb host chip resets the entire device. If you do not want this you can cut the RESET trace on the board. enter image description here

some boards have a jumper here instead that can be removed.

more info here


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.