0

Edit: We're so close! Update at bottom! I'm not sure if this is the right place to ask, but since you helped my so much in the past, I thought it's worth a try.

So as I stated in my last question, I'm using my Arduino Leonardo to simulate a GPS Receiver.

The Arduino is now connected to a Velodyne VLP-16 LiDAR

Here's what the Lidar needs: Requirements of the LiDAR

I wired it like this: Schematic

And wrote the following code:

#include <SoftwareSerial.h>
SoftwareSerial mySerial(7, 6); //232_TX,232_

int triggerFreq = 1;
unsigned long timestamp;
unsigned long triggerStartTime;
const unsigned long dt = 1000000/triggerFreq; //micros


unsigned long i;

float gprmc = 181721.000;

void setup() {
  pinMode(11, OUTPUT); // PPS
  pinMode(12, OUTPUT); // Indicator of msg_sent
  Serial.begin(9600);
  mySerial.begin(9600);
  triggerStartTime = micros();
}

void loop() {
  timestamp = micros()-triggerStartTime;
  if (timestamp>= dt*i+200000)
  {
    digitalWrite(12,HIGH);

    i +=1;
    gprmc += 1;
    mySerial.print("$GPRMC,");
    if (gprmc < 100000) mySerial.print(F("0"));
    mySerial.print(gprmc,3);
    mySerial.println(F(",A,4042.695,N,07400.796,W,,,080120,000.0,W*63"));
    Serial.print("$GPRMC,");
    if (gprmc < 100000) Serial.print(F("0"));
    Serial.print(gprmc,3);
    Serial.println(F(",A,4042.695,N,07400.796,W,,,080120,000.0,W*63"));
    digitalWrite(12,LOW);
  }
  else if (timestamp>=dt*i+100000)
  {
    digitalWrite(11,LOW);
  }
  else if (timestamp>=dt*i)
  {
    digitalWrite(11,HIGH);

  }

}

Here's the situation now:

  • I'm seeing on the board that the messages are being sent (TX LED flashing)
  • I'm also seeing that the pulse is sent correctly (flashing LED)
  • I don't measure any voltage on the TX output pin (RS232 pin3) (I'm just using my multimeter, but normally it reacts to such short voltage pulses by blinking an LED)
  • I do measure such a pulse on RS232 pin4
  • The LiDAR doesn't react to my sent messages

Now my question: Do you see an error in my implementation? Is the message sent correctly?

Thank you sooo much for your help! I'm really appreciating it!

Edit: The LiDAR manual says:

The supported NMEA sentence and syntax are exactly the same as on the wired (serial) GPS interface. Supported sentence delimiter sequences include (HEX 0D0A, the standard), by itself, and by itself.

To be honest I'm not very familiar with these kind of problems so I'm not sure if these delimiters are already being sent?

Edit Nr2: Ok the following situation:

  • I'm actually not sure what changed. The code is still the same as above
  • The LiDAR now recognizes SOME of the messages (I can only see the position, so I edited the code to change the position a bit every second, and the Lidar updates its position irregularly but approx. all 10 seconds)
  • If anyone knows an explanation, I would be very happy to know. Otherwise, I just keep on trying an will keep you updated!

So the following code partially works. That means: the LiDAR recognizes certain messages... it seems like those are always the same messages (i incremented the position every second, these are the positions):

  • 3015.2746
  • 3015.2766
  • 3015.2971
  • 3015.3107
  • 3015.3117

I displayed all the times when something was sent, and i could not find any differences between the messages that worked and those that didn't work.

One more followup: If I try to increment pos+=0.0001, it does not work... it seems like i can only change up to 3 decimals. I don't understand why, since the float uses 4 bytes, so this should be no problem to store?! helpppp

Ok so here is the code for now:

#include <SoftwareSerial.h>
SoftwareSerial mySerial(7, 6); //232_TX,232_

int triggerFreq = 1;
unsigned long timestamp;
unsigned long triggerStartTime;
const unsigned long dt = 1000000/triggerFreq; //micros
unsigned long ts_pps_high;
unsigned long ts_pps_low;
unsigned long ts_msg_high;
unsigned long ts_msg_low;


unsigned long i;

int hh = 04;
int mm = 51;
int ss = 00;
float pos = 3015.2307;
bool msg;


void setup() {
  // put your setup code here, to run once:
  pinMode(11, OUTPUT); // PPS
  pinMode(12, OUTPUT); // Indicator of msg_sent
  Serial.begin(9600);
  mySerial.begin(9600);
  triggerStartTime = micros();
}

void loop() {
  timestamp = micros()-triggerStartTime;
  if (timestamp>= dt*i+350000)
  {
    pos +=0.001;
    digitalWrite(12,HIGH);
    i +=1;
    if (ss == 59)
    {
      ss=0;
      if (mm==59)
      {
        mm=0;
        hh+=1;
      }
      else mm+=1;
    }
    else ss+=1;

    ts_msg_high = micros();
    mySerial.print("$GPRMC,");
    if (hh<10) mySerial.print(F("0"));
    mySerial.print(hh);
    if (mm<10) mySerial.print(F("0"));
    mySerial.print(mm);
    if (ss<10) mySerial.print(F("0"));
    mySerial.print(ss);
    mySerial.print(".000,A,");
    mySerial.print(pos,4);
    mySerial.println(",N,09749.2872,W,0.67,161.46,030913,,,A*7C");

    // Print Debug Messages
    digitalWrite(12,LOW);
    ts_msg_low=micros();
    Serial.print("PPS at: ");
    Serial.print(ts_pps_high);
    Serial.print("\t PPS low after: ");
    Serial.print(ts_pps_low-ts_pps_high);
    Serial.print("\t MSG high after: ");
    Serial.print(ts_msg_high-ts_pps_high);
    Serial.print("\t MSG low after: ");
    Serial.print(ts_msg_low-ts_pps_high);
    Serial.print("$GPRMC,");
    if (hh<10) Serial.print(F("0"));
    Serial.print(hh);
    if (mm<10) Serial.print(F("0"));
    Serial.print(mm);
    if (ss<10) Serial.print(F("0"));
    Serial.print(ss);
    Serial.print(".000,A,");
    Serial.print(pos,4);
    Serial.println(",N,09749.2872,W,0.67,161.46,030913,,,A*7C");
  }
  else if (timestamp>=dt*i+100000)
  {
    digitalWrite(11,LOW);
    if (msg==true)
    {
      msg = false; 
      ts_pps_low = micros();
    }

  }
  else if (timestamp>=dt*i)
  {
    digitalWrite(11,HIGH);  
    if (msg==false)
    {
      msg = true;
      ts_pps_high = micros();
    }
  }

}

You can see my output as well:

PPS at: 2001060  PPS low after: 100000   MSG high after: 350016  MSG low after: 427132$GPRMC,045103.000,A,3015.2336,N,09749.2872,W,0.67,161.46,030913,,,A*7C
PPS at: 3001060  PPS low after: 100004   MSG high after: 350004  MSG low after: 427112$GPRMC,045104.000,A,3015.2346,N,09749.2872,W,0.67,161.46,030913,,,A*7C
PPS at: 4001056  PPS low after: 100000   MSG high after: 350004  MSG low after: 427116$GPRMC,045105.000,A,3015.2355,N,09749.2872,W,0.67,161.46,030913,,,A*7C
PPS at: 5001060  PPS low after: 100004   MSG high after: 350004  MSG low after: 427112$GPRMC,045106.000,A,3015.2365,N,09749.2872,W,0.67,161.46,030913,,,A*7C
PPS at: 6001056  PPS low after: 100004   MSG high after: 350004  MSG low after: 427116$GPRMC,045107.000,A,3015.2375,N,09749.2872,W,0.67,161.46,030913,,,A*7C
PPS at: 7001060  PPS low after: 100004   MSG high after: 350004  MSG low after: 427120$GPRMC,045108.000,A,3015.2385,N,09749.2872,W,0.67,161.46,030913,,,A*7C
PPS at: 8001056  PPS low after: 100004   MSG high after: 350020  MSG low after: 427132$GPRMC,045109.000,A,3015.2395,N,09749.2872,W,0.67,161.46,030913,,,A*7C
PPS at: 9001060  PPS low after: 100000   MSG high after: 350016  MSG low after: 427160$GPRMC,045110.000,A,3015.2404,N,09749.2872,W,0.67,161.46,030913,,,A*7C
PPS at: 10001052     PPS low after: 100008   MSG high after: 350020  MSG low after: 427164$GPRMC,045111.000,A,3015.2414,N,09749.2872,W,0.67,161.46,030913,,,A*7C
PPS at: 11001064     PPS low after: 100000   MSG high after: 350020  MSG low after: 427164$GPRMC,045112.000,A,3015.2424,N,09749.2872,W,0.67,161.46,030913,,,A*7C
PPS at: 12001056     PPS low after: 100008   MSG high after: 350004  MSG low after: 427152$GPRMC,045113.000,A,3015.2434,N,09749.2872,W,0.67,161.46,030913,,,A*7C
PPS at: 13001056     PPS low after: 99996    MSG high after: 350020  MSG low after: 427164$GPRMC,045114.000,A,3015.2443,N,09749.2872,W,0.67,161.46,030913,,,A*7C
PPS at: 14001056     PPS low after: 100008   MSG high after: 350008  MSG low after: 427156$GPRMC,045115.000,A,3015.2453,N,09749.2872,W,0.67,161.46,030913,,,A*7C
PPS at: 15001052     PPS low after: 100004   MSG high after: 350020  MSG low after: 427164$GPRMC,045116.000,A,3015.2463,N,09749.2872,W,0.67,161.46,030913,,,A*7C
PPS at: 16001052     PPS low after: 100000   MSG high after: 350016  MSG low after: 427164$GPRMC,045117.000,A,3015.2473,N,09749.2872,W,0.67,161.46,030913,,,A*7C
PPS at: 17001056     PPS low after: 100004   MSG high after: 350020  MSG low after: 427164$GPRMC,045118.000,A,3015.2482,N,09749.2872,W,0.67,161.46,030913,,,A*7C
PPS at: 18001052     PPS low after: 100000   MSG high after: 350016  MSG low after: 427164$GPRMC,045119.000,A,3015.2492,N,09749.2872,W,0.67,161.46,030913,,,A*7C
PPS at: 19001056     PPS low after: 100004   MSG high after: 350020  MSG low after: 427160$GPRMC,045120.000,A,3015.2502,N,09749.2872,W,0.67,161.46,030913,,,A*7C
PPS at: 20001060     PPS low after: 100000   MSG high after: 350004  MSG low after: 427148$GPRMC,045121.000,A,3015.2512,N,09749.2872,W,0.67,161.46,030913,,,A*7C
PPS at: 21001052     PPS low after: 100004   MSG high after: 350020  MSG low after: 427168$GPRMC,045122.000,A,3015.2521,N,09749.2872,W,0.67,161.46,030913,,,A*7C
PPS at: 22001064     PPS low after: 100004   MSG high after: 350004  MSG low after: 427148$GPRMC,045123.000,A,3015.2531,N,09749.2872,W,0.67,161.46,030913,,,A*7C
PPS at: 23001052     PPS low after: 100008   MSG high after: 350020  MSG low after: 427172$GPRMC,045124.000,A,3015.2541,N,09749.2872,W,0.67,161.46,030913,,,A*7C
PPS at: 24001052     PPS low after: 100008   MSG high after: 350024  MSG low after: 427168$GPRMC,045125.000,A,3015.2551,N,09749.2872,W,0.67,161.46,030913,,,A*7C
PPS at: 25001056     PPS low after: 100000   MSG high after: 350016  MSG low after: 427168$GPRMC,045126.000,A,3015.2561,N,09749.2872,W,0.67,161.46,030913,,,A*7C
PPS at: 26001052     PPS low after: 100008   MSG high after: 350024  MSG low after: 427160$GPRMC,045127.000,A,3015.2570,N,09749.2872,W,0.67,161.46,030913,,,A*7C
PPS at: 27001056     PPS low after: 100000   MSG high after: 350020  MSG low after: 427156$GPRMC,045128.000,A,3015.2580,N,09749.2872,W,0.67,161.46,030913,,,A*7C
PPS at: 28001060     PPS low after: 100008   MSG high after: 350004  MSG low after: 427144$GPRMC,045129.000,A,3015.2590,N,09749.2872,W,0.67,161.46,030913,,,A*7C
PPS at: 29001056     PPS low after: 100000   MSG high after: 350020  MSG low after: 427156$GPRMC,045130.000,A,3015.2600,N,09749.2872,W,0.67,161.46,030913,,,A*7C
PPS at: 30001056     PPS low after: 100004   MSG high after: 350020  MSG low after: 427164$GPRMC,045131.000,A,3015.2609,N,09749.2872,W,0.67,161.46,030913,,,A*7C
PPS at: 31001056     PPS low after: 100008   MSG high after: 350004  MSG low after: 427148$GPRMC,045132.000,A,3015.2619,N,09749.2872,W,0.67,161.46,030913,,,A*7C
PPS at: 32001056     PPS low after: 99996    MSG high after: 350012  MSG low after: 427164$GPRMC,045133.000,A,3015.2629,N,09749.2872,W,0.67,161.46,030913,,,A*7C
PPS at: 33001056     PPS low after: 100008   MSG high after: 350020  MSG low after: 427164$GPRMC,045134.000,A,3015.2639,N,09749.2872,W,0.67,161.46,030913,,,A*7C
PPS at: 34001056     PPS low after: 100000   MSG high after: 350016  MSG low after: 427164$GPRMC,045135.000,A,3015.2648,N,09749.2872,W,0.67,161.46,030913,,,A*7C
PPS at: 35001060     PPS low after: 100004   MSG high after: 350000  MSG low after: 427144$GPRMC,045136.000,A,3015.2658,N,09749.2872,W,0.67,161.46,030913,,,A*7C
PPS at: 36001060     PPS low after: 100000   MSG high after: 350004  MSG low after: 427148$GPRMC,045137.000,A,3015.2668,N,09749.2872,W,0.67,161.46,030913,,,A*7C
PPS at: 37001060     PPS low after: 100004   MSG high after: 350004  MSG low after: 427144$GPRMC,045138.000,A,3015.2678,N,09749.2872,W,0.67,161.46,030913,,,A*7C
PPS at: 38001064     PPS low after: 100004   MSG high after: 350004  MSG low after: 427144$GPRMC,045139.000,A,3015.2687,N,09749.2872,W,0.67,161.46,030913,,,A*7C
PPS at: 39001060     PPS low after: 100008   MSG high after: 350004  MSG low after: 427152$GPRMC,045140.000,A,3015.2697,N,09749.2872,W,0.67,161.46,030913,,,A*7C
PPS at: 40001052     PPS low after: 100008   MSG high after: 350024  MSG low after: 427160$GPRMC,045141.000,A,3015.2707,N,09749.2872,W,0.67,161.46,030913,,,A*7C
PPS at: 41001052     PPS low after: 100000   MSG high after: 350016  MSG low after: 427168$GPRMC,045142.000,A,3015.2717,N,09749.2872,W,0.67,161.46,030913,,,A*7C
PPS at: 42001060     PPS low after: 100004   MSG high after: 350004  MSG low after: 427148$GPRMC,045143.000,A,3015.2727,N,09749.2872,W,0.67,161.46,030913,,,A*7C
PPS at: 43001056     PPS low after: 100000   MSG high after: 350020  MSG low after: 427164$GPRMC,045144.000,A,3015.2736,N,09749.2872,W,0.67,161.46,030913,,,A*7C
PPS at: 44001052     PPS low after: 100004   MSG high after: 350020  MSG low after: 427164$GPRMC,045145.000,A,3015.2746,N,09749.2872,W,0.67,161.46,030913,,,A*7C
PPS at: 45001064     PPS low after: 100004   MSG high after: 350004  MSG low after: 427144$GPRMC,045146.000,A,3015.2756,N,09749.2872,W,0.67,161.46,030913,,,A*7C
PPS at: 46001052     PPS low after: 100004   MSG high after: 350020  MSG low after: 427172$GPRMC,045147.000,A,3015.2766,N,09749.2872,W,0.67,161.46,030913,,,A*7C
PPS at: 47001056     PPS low after: 100004   MSG high after: 350020  MSG low after: 427164$GPRMC,045148.000,A,3015.2775,N,09749.2872,W,0.67,161.46,030913,,,A*7C
PPS at: 48001056     PPS low after: 100000   MSG high after: 350016  MSG low after: 427164$GPRMC,045149.000,A,3015.2785,N,09749.2872,W,0.67,161.46,030913,,,A*7C
PPS at: 49001060     PPS low after: 100004   MSG high after: 350004  MSG low after: 427144$GPRMC,045150.000,A,3015.2795,N,09749.2872,W,0.67,161.46,030913,,,A*7C
PPS at: 50001052     PPS low after: 100000   MSG high after: 350016  MSG low after: 427160$GPRMC,045151.000,A,3015.2805,N,09749.2872,W,0.67,161.46,030913,,,A*7C
PPS at: 51001060     PPS low after: 100004   MSG high after: 350004  MSG low after: 427148$GPRMC,045152.000,A,3015.2814,N,09749.2872,W,0.67,161.46,030913,,,A*7C
PPS at: 52001056     PPS low after: 100000   MSG high after: 350020  MSG low after: 427164$GPRMC,045153.000,A,3015.2824,N,09749.2872,W,0.67,161.46,030913,,,A*7C
PPS at: 53001064     PPS low after: 100004   MSG high after: 350000  MSG low after: 427144$GPRMC,045154.000,A,3015.2834,N,09749.2872,W,0.67,161.46,030913,,,A*7C
PPS at: 54001056     PPS low after: 100004   MSG high after: 350020  MSG low after: 427164$GPRMC,045155.000,A,3015.2844,N,09749.2872,W,0.67,161.46,030913,,,A*7C
PPS at: 55001060     PPS low after: 100004   MSG high after: 350020  MSG low after: 427172$GPRMC,045156.000,A,3015.2854,N,09749.2872,W,0.67,161.46,030913,,,A*7C
PPS at: 56001068     PPS low after: 100004   MSG high after: 350000  MSG low after: 427144$GPRMC,045157.000,A,3015.2863,N,09749.2872,W,0.67,161.46,030913,,,A*7C
PPS at: 57001060     PPS low after: 99996    MSG high after: 350012  MSG low after: 427160$GPRMC,045158.000,A,3015.2873,N,09749.2872,W,0.67,161.46,030913,,,A*7C
PPS at: 58001064     PPS low after: 100004   MSG high after: 350004  MSG low after: 427148$GPRMC,045159.000,A,3015.2883,N,09749.2872,W,0.67,161.46,030913,,,A*7C
PPS at: 59001056     PPS low after: 100000   MSG high after: 350024  MSG low after: 427132$GPRMC,045200.000,A,3015.2893,N,09749.2872,W,0.67,161.46,030913,,,A*7C
PPS at: 60001060     PPS low after: 100004   MSG high after: 350020  MSG low after: 427124$GPRMC,045201.000,A,3015.2902,N,09749.2872,W,0.67,161.46,030913,,,A*7C
PPS at: 61001064     PPS low after: 100008   MSG high after: 350004  MSG low after: 427116$GPRMC,045202.000,A,3015.2912,N,09749.2872,W,0.67,161.46,030913,,,A*7C
PPS at: 62001060     PPS low after: 100008   MSG high after: 350008  MSG low after: 427124$GPRMC,045203.000,A,3015.2922,N,09749.2872,W,0.67,161.46,030913,,,A*7C
PPS at: 63001060     PPS low after: 100012   MSG high after: 350008  MSG low after: 427120$GPRMC,045204.000,A,3015.2932,N,09749.2872,W,0.67,161.46,030913,,,A*7C
PPS at: 64001052     PPS low after: 100000   MSG high after: 350020  MSG low after: 427136$GPRMC,045205.000,A,3015.2941,N,09749.2872,W,0.67,161.46,030913,,,A*7C
PPS at: 65001060     PPS low after: 100008   MSG high after: 350004  MSG low after: 427120$GPRMC,045206.000,A,3015.2951,N,09749.2872,W,0.67,161.46,030913,,,A*7C
PPS at: 66001064     PPS low after: 100000   MSG high after: 349996  MSG low after: 427116$GPRMC,045207.000,A,3015.2961,N,09749.2872,W,0.67,161.46,030913,,,A*7C
PPS at: 67001060     PPS low after: 100004   MSG high after: 350004  MSG low after: 427120$GPRMC,045208.000,A,3015.2971,N,09749.2872,W,0.67,161.46,030913,,,A*7C
PPS at: 68001060     PPS low after: 100000   MSG high after: 350004  MSG low after: 427112$GPRMC,045209.000,A,3015.2980,N,09749.2872,W,0.67,161.46,030913,,,A*7C
PPS at: 69001052     PPS low after: 100004   MSG high after: 350020  MSG low after: 427164$GPRMC,045210.000,A,3015.2990,N,09749.2872,W,0.67,161.46,030913,,,A*7C
PPS at: 70001064     PPS low after: 100004   MSG high after: 350004  MSG low after: 427136$GPRMC,045211.000,A,3015.3000,N,09749.2872,W,0.67,161.46,030913,,,A*7C
PPS at: 71001060     PPS low after: 100004   MSG high after: 350004  MSG low after: 427148$GPRMC,045212.000,A,3015.3010,N,09749.2872,W,0.67,161.46,030913,,,A*7C
PPS at: 72001064     PPS low after: 100004   MSG high after: 350004  MSG low after: 427144$GPRMC,045213.000,A,3015.3020,N,09749.2872,W,0.67,161.46,030913,,,A*7C
PPS at: 73001056     PPS low after: 100000   MSG high after: 350016  MSG low after: 427164$GPRMC,045214.000,A,3015.3029,N,09749.2872,W,0.67,161.46,030913,,,A*7C
PPS at: 74001064     PPS low after: 99988    MSG high after: 350004  MSG low after: 427148$GPRMC,045215.000,A,3015.3039,N,09749.2872,W,0.67,161.46,030913,,,A*7C
PPS at: 75001052     PPS low after: 100000   MSG high after: 350020  MSG low after: 427164$GPRMC,045216.000,A,3015.3049,N,09749.2872,W,0.67,161.46,030913,,,A*7C
PPS at: 76001060     PPS low after: 100004   MSG high after: 350000  MSG low after: 427144$GPRMC,045217.000,A,3015.3059,N,09749.2872,W,0.67,161.46,030913,,,A*7C
PPS at: 77001056     PPS low after: 100008   MSG high after: 350004  MSG low after: 427148$GPRMC,045218.000,A,3015.3068,N,09749.2872,W,0.67,161.46,030913,,,A*7C
PPS at: 78001060     PPS low after: 100008   MSG high after: 350004  MSG low after: 427152$GPRMC,045219.000,A,3015.3078,N,09749.2872,W,0.67,161.46,030913,,,A*7C
PPS at: 79001052     PPS low after: 100008   MSG high after: 350020  MSG low after: 427164$GPRMC,045220.000,A,3015.3088,N,09749.2872,W,0.67,161.46,030913,,,A*7C
PPS at: 80001052     PPS low after: 100000   MSG high after: 350016  MSG low after: 427164$GPRMC,045221.000,A,3015.3098,N,09749.2872,W,0.67,161.46,030913,,,A*7C
PPS at: 81001056     PPS low after: 100008   MSG high after: 350020  MSG low after: 427164$GPRMC,045222.000,A,3015.3107,N,09749.2872,W,0.67,161.46,030913,,,A*7C
PPS at: 82001060     PPS low after: 100000   MSG high after: 350016  MSG low after: 427172$GPRMC,045223.000,A,3015.3117,N,09749.2872,W,0.67,161.46,030913,,,A*7C
1

A number of hints to check, though I can only throw vague observations on the error (EDIT: some hints only make sense with an older version of the question):

  • You set the SoftwareSerial to pin 7 for RX and pin 6 for TX, but the TX LED of the board is connected to the hardware UART, which is used by Serial. So the TX LED reacts to your debug messages sent via Serial.print() to the PC. The TX and RX pins on your Arduino board are always connected to the hardware UART, which always is managed by Serial and cannot be claimed by SoftwareSerial.
  • The "SoftwareSerial TX pin" of your Arduino (note: the TX pin you set via SoftwareSerial mySerial(7, 6);) needs to be connected to RX of the GPS module. Remember: If you transmit something via the transmit line of one device, it needs to be received by the receive line of the other device (T stands for transmit, R for receive, and X for that you must cross the lines). (This hint ignores that you've got a RS232 shield, I realized that only later.)
  • The docs state that your gprmc record is accepted in either hhmmss or hhmmss.s format. Yet you send a string with three places after the dot. I'm not sure whether I misinterpret something here.
  • If you just add 1 to gprmc every second, you'll end up sending the equivalent of "18 hours, 17 minutes, 61 seconds" after 40 seconds runtime (because the format is expected to be hhmmss), which might or might not confuse the GPS chip.
  • Is 9600 baud the correct speed for the GPS receiver? Somewhere in the docs should be a hint about that (I'd expect at least 115200 on devices that are less than 20 years old...).
  • The pulse line might follow negative logic, i.e. it normally is HIGH and need to be pulled LOW for the pulse. Check the data sheet whether a LOW pulse is needed, in which case you need to swap HIGH and LOW on the pulse line.
  • What is pin 12 (msg_sent) and why do you need it? Its not mentioned in the schematics. I can only glean that it might signal your RS232 shield that the message has been sent to the RS232 shield and the RS232 UART now may empty its buffer, i.e. actually send the message over the wire to the GPS chip. If this is indeed the case, you signal the RS232 shield that the message has been sent before you actually send the message.
  • Try it without the RS232 shield? RS232 is just a specification of "serial protocol" that allows for voltage levels of up to 25V plus a few extra signal lines. By the schematic and wiring, I see that the GPS chip does not use any extra lines and expects a signal level of 5V. With SoftwareSerial, you already output "serial protocol" at 5V signal level from your GPIO pins. From afar, it looks like the RS232 shield inserts more potential points of failure into the communication. Have you got a Serial-to-USB converter to actually check the output of your RS232 shield?
  • Your delimiters are not sent. Hex 0D0A is simply CRLF, or "carriage return, line feed" or "the standard line break characters in plain text files on DOS and Windows". Which means: The last mySerial.print() would need to be changed to mySerial.println(), which is just like mySerial.print(), only that it adds a line break at the end.
  • Maybe it works if you connect the pin labeled GPS_RXD_CNT in the schematics with pin 6 of your Arduino while removing any own wiring from TX and RX of your Arduino.
  • Floats do not "store 3 decimal places after the decimal point", they store the significant binary places plus the position of the point. This means: if the number of significant places is big, you lose precision at the end. Converted to decimal, a 32-bit float only has a precision of 6-7 decimal places. A number like (decimal) 100000.01 would lose its last 1, yielding 100000.0; this also is true for 1000000.1 (=1000000.0), 10000001000.0 (=10000000000.0) and 0.000010000001 (=0.00001). So if you add 0.1 to 1234567.0, you'll end up with 1234567.0 -- or in the extreme: 1234567000000.0 + 11111.0 = 1234567000000.0. (Numbers off the top of my head, reality might introduce some rounding between decimal and binary representation, this is just to get the point across -- also, your decimal output will not show this exactly, because a binary representation only is precise for fractions of powers of two after the point).

Also, you might want to add some Serial.println() calls for each of your digitalWrite() calls, outputting something like "pin 11 (PPS) is now HIGH". Then use the Serial Monitor of Arduino IDE (don't forget to set its baud rate to 9600) to check whether the protocol looks right.

|improve this answer|||||
  • Thanks for your hints. I'm trying to answer them: – MarayJay Jan 8 at 16:06
  • - Indeed i set the softwareSerial to Pin7 & 6. This is because I have the RS-232 shield mounted on top of the Arduino, which executes the communication. It has it's own TX LED that's flasching, when data is sent via RS-232. So this should be right - Maybe my schematic was a bit confusing. i connected the Arduino Tx to the Lidar RX, so this should also work (i tested the connection). I will update my schematic. – MarayJay Jan 8 at 16:13
  • - You are right. However, in an other part of the document, the say >"The GPRMC record may be configured for HHMMSS, HHMMSS.s, HHMMSS.ss, and HHMMSS.sss formats." So this should be right as well... - Yess nice input! I changed this and will edit my question. However, it still doesnt work :S – MarayJay Jan 8 at 16:14
  • @MarayJay "may be configured for" may mean that you'll have to tell the GPS chip the exact format before using it. Also, I'm not sure whether you actually need the RS232 shield. Maybe you can just directly wire the Arduino pin 6 to the GPS board. – orithena Jan 8 at 16:32
  • 1
    thank you for all your hints and support! :O Unfortunately I ran out of time...I had to present a working system today, and had to invest my time in other things, since this is only a very small part of my project. now the deadline is over and after several night shifts, I honestly don't have the energy to persue this any further. But if I or anyone from our lab finds a way, I will let you know! :) – MarayJay Jan 10 at 17:50

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.