Voltage Leakage on Digital Outputs

Hi all,

I'm trying to generate some TTL pulses for different events in order to sync some electrophysiological recordings to programmatic events, but I'm having an issue with generating clean square pulses from the arduino digital pins.

For instance, when a pin goes from low to high, I get a positive impulse response on my oscilliscope, with goes to 5V then quickly decays back to 0. The converse happens when going from high to low, with a -5V impulse with a decay back to 0 (see pictures below, sorry for the quality). What I really want is for the channel to stay at 1 when HIGH, then drop down to 0 when LOW.

Why is this happening? And what can I do to fix it? I've tried grounding everything, with no effect.

I've also messed with the pulse duration, but the effect is still there (50ms pulse duration):

100ms pulse duration:

Code:

const int waterOut = 2;
const int lickOut  = 3;

void setup() {
  // put your setup code here, to run once:
  pinMode(waterOut,OUTPUT);
  pinMode(lickOut,OUTPUT);
}

void loop() {
  // put your main code here, to run repeatedly:
  delay(500);
  digitalWrite(waterOut,HIGH);
  delay(100);
  digitalWrite(waterOut,LOW);
  delay(500);
  digitalWrite(lickOut,HIGH);
  delay(100);
  digitalWrite(lickOut,LOW);
}

Thanks in advance!

Sorry, those oscilloscope photos won't show up for some reason, let me know if these links work:

50ms pulse width: https://www.amazon.com/clouddrive/share/tYzeCLJjhVfOW0wH8Tc8pXw0RMwJOstKSodwK57aplg?v=grid&ref_=cd_ph_share_link_copy

100ms pulse width: https://www.amazon.com/clouddrive/share/PFlfhyJCiU0bNErWxYIKR6MTVvhYPCxujJTnR4wB9oq?v=grid&ref_=cd_ph_share_link_copy

The links never open for me.
Do you have the oscilloscope probe ground pin connected to ground on the board?

Yes I have, running the arduino ground to the oscilloscope ground seems to make no impact on the quality of the waveform, which is very puzzling to me…

edit: I managed to attach the photos below, the first is 50ms pulses, the 2nd is 100ms

Hi, I think you are seeing "Capacitive coupling only" on your oscilloscope. Check the input setting. It should be "DC" not "AC".

Let us know...

I'd second that after seeing the traces.

That did the trick on the oscilloscope, thanks!

I suppose my issue now is that my actual data acquisition system reads these TTL pulses through a parallel port, which appears to have AC coupling on its input (ie. one pulse is read as a rise then a fall, followed by another rise and fall after the pulse duration)... but this is probably an issue to work out with that system, but if anyone would like to help, the manual linked below references the parallel port that I'm trying to interface with: http://neuralynx.com/manuals/DigitalLynx10S_Manual.pdf

My current setup has the output pin running to pin 1 on the parallel port, with the arduino ground running to pin 2 (which should be connected to the ground on the parallel port).

The parallel port is just TTL according to the manual, not AC. They have 2 kinds of input boards for analog. One AC and one DC. Dwight