Garmin GPS18x LVC with Arduino UNO

Hi,

I connected Garmin GPS18x LVC (https://static.garmincdn.com/pumac/GPS_18x_Tech_Specs.pdf) yellow line, Measurement Pulse Output, directly to digital pin 2 on Arduino UNO as interrupt and then count the interrupt. I’m expecting for a pulse interrupt from Garmin GPS every 1 second.

I got very confused measurement,

const byte ledPin = 13;
const byte interruptPin = 2;
volatile byte state = LOW;

void setup() {
   Serial.begin(115200);
  Serial.println("Initializing...");
  pinMode(ledPin, OUTPUT);
  pinMode(interruptPin, INPUT_PULLUP);
  attachInterrupt(digitalPinToInterrupt(interruptPin), blink, CHANGE);
}

void loop() {
  digitalWrite(ledPin, state);
}

int cnt = 0;

void blink() {

  state = !state;
  if(cnt %1000 == 0) {
  unsigned long cur_time = micros();
  unsigned long cur_ms = millis();
  Serial.print(cur_time);
  Serial.print(',');
  Serial.print(cur_ms);
  Serial.print("ms,");
  Serial.println(cnt);
  }
  cnt++;
}

From console output, I got cnt value of 1000 in 3015ms, about 3.015ms * 2 = 6.03ms per interrupt. According to the GARMIN document, Measurement Pulse Output shall be updated every second.

I used a scope to check pin 2 signal, it’s 0~5.5V and interval is 16.8ms…

I’m completely lost here. Would anyone help?

thanks,

Steve

For informed help, please read and follow the directions in the "How to use this forum" post.

@jremington I quickly went through "How to use this forum" post but I am not sure what you mean. Shall I post this one somewhere else?

thanks,

Steve

You have not described the purpose of your program adequately, nor have you clearly described what went wrong.

You forgot to post a link to the product page or data sheet of the device in question, and forgot to post a wiring diagram. Were the grounds connected?

You also failed to post the code properly, using code tags.

Does that help you understand the material in the "How to use this forum" post?

Hint: most people would not use "interrupt on change" to count pulses.

Hi @jremington, thanks for the clarification. I updated my post accordingly.

Steve

The grounds are not connected.

Do you mean common ground between GPS group pin and Arduino ground pin? I tried it as well and it didn't help,

thanks,

Steve

Try it again. No circuit will work without a common ground.

If it still doesn't work, there are other circuit errors, in addition to the obvious programming error(s).