Carloop GPS - Never get a fix

I’ve slightly modified the GPS example and installed it on a Carloop with an Electron using the 12pin extenders. I brought the device outside with direct access to the sky on a clear day. I waited for more than an hour and never got a GPS fix?

Here’s the code:
// Run our code even when out of range of Wi-Fi / cellular.
SYSTEM_THREAD(ENABLED);

#include <carloop.h>
#include “CANProtocolBase.h”
#include “CANProtocol_OBD.h”

// Forward declerations
void printGPSInfo(TinyGPSPlus &gps);
void printCANInfo();
void printAccelerometerInfo();
String formatFloat(float val, bool valid, int len, int prec);
String formatDateTime(TinyGPSDate &d, TinyGPSTime &t);

// Blue LED
int _led1 = D7;
// Timestamp for debug messages
unsigned long _lastDebugMsg = millis();

// Threshold to trigger a publish
// 9000 is VERY sensitive, 12000 will still detect small bumps
int _accelThreshold = 40000;

// Our Carloop object
Carloop carloop;

// Our protocol object
CANProtocolBase* canProtocol = new CANProtocol_OBD();

// for publishing values
String buf;

// A FuelGauge for checking on the battery state
FuelGauge fuel;

void setup() {

// Fire up serial for debug output
Serial.begin();

// We're going to use the LED attached to D7 to indicate if we're in Simulation mode or not.  It will be on
// when we are in simulation mode, off otherwise.
pinMode(_led1, OUTPUT);

/*
// Toggle the led
for(int i=0; i++ ; i<10) {
digitalWrite(_led1, HIGH);
delay(500);
digitalWrite(_led1, LOW);
delay(500);
}
*/
Serial.println(“Proxi-Carloop-GPS Evaluation”);

// Start up the Carloop using the default configuration.
//carloop.begin();

}

void loop() {
unsigned long now;
now = millis();
carloop.update();
//canProtocol->loop();

if (millis() - _lastDebugMsg > 1000) {
  Serial.println("====Debug info====");
  printGPSInfo(carloop.gps());
  /*
  printCANInfo();
  printAccelerometerInfo();
  */
  _lastDebugMsg = millis();
}

}

void printGPSInfo(TinyGPSPlus &gps) {

Serial.printf(“GPS %6d chars: \n”, gps.charsProcessed()); //
Serial.printf(“Lat: %s\n”, formatFloat(gps.location.lat(), gps.location.isValid(), 11, 6).c_str());
Serial.printf(“Lon: %s\n”, formatFloat(gps.location.lng(), gps.location.isValid(), 11, 6).c_str());
Serial.printf(“Date/Time: %s”, formatDateTime(gps.date, gps.time).c_str());

/*
String s;
s += String::format("GPS %6d chars: ", gps.charsProcessed());
s += formatFloat(gps.location.lat(), gps.location.isValid(), 11, 6);
s += formatFloat(gps.location.lng(), gps.location.isValid(), 12, 6);
s += formatDateTime(gps.date, gps.time);
Serial.println(s.c_str());
*/
}

void printCANInfo() {

}

void printAccelerometerInfo() {

}

String formatFloat(float val, bool valid, int len, int prec) {
String s;
if (!valid) {
while(len-- > 1) {
s += '';
}
s += ’ ';
}
else {
char format[10];
snprintf(format, sizeof(format), “%%%d.%df”, len, prec);
s += String::format(format, val);
/
code */
}

return s;
}

String formatDateTime(TinyGPSDate &d, TinyGPSTime &t) {
String s;

// Date portion
if (!d.isValid()) {
s += “********** “;
}
else {
s += String::format(”%02d/%02d/%02d”, d.month(), d.day(), d.year());
}

// Time portion
if (!t.isValid()) {
s += "******** “;
}
else {
s += String::format(”%02d:%02d:%02d ", t.hour(), t.minute(), t.second());
}

return s;
}

I noticed that I had commented out the Carloop.begin() I corrected that and then I eventually saw valid GPS data through the serial port debug messages. However, I never saw the GPS Fix light enabled. Are we suppose to manage that through our code?

@nlwelch,

Just to confirm, are you receiving the full set of data over serial, or are you receiving only partial data? If you are getting partial data and the rest of the fields are filled with zeros, then maybe you do not actually have a GPS fix.

If you do not have a GPS fix, then the most likely thing to look into is whether or not you are supplying adequate power. Insufficient power might result in not being able to get a fix.

If you are getting a full data set and you actually have a fix, then try the sample code with no changes and see if you get the same behaviour. I am not able to say exactly what the behaviour should be; my order got lost and I am waiting for a replacement GPS to be shipped to me. When I get my GPS, then I will be able to help in better detail.

In my case I’m receiving valid GPS data, bit the fix LED on the Carloop GPS adapter is never lit.

Have you gotten any data on your power quality yet? You want to have sufficient voltage with very low ripple, plus enough amps to supply the peak current loads, not just the average load.

I’ve reviewed the Carloop code and I don’t see where the LED ever get’s initialized or used.

I just looked at the schematics and see that the LED is not set by the code so it’s a GPS issue of some sort.

Not to beat on a dead horse, BUT…

No GPS will acquire a lock if it does not have sufficient power to run the antenna.
GPS antennae are normally active antennae and consume power.

I just received my Carloop GPS board. Can someone point me to an example particle electron app that actually works with the Carloop GPS board. I’ve tried the carloop_minimal example app and I get battery voltage, but I don’t get GPS information.

@ruhandsomeiii,

Are you saying that you get no information at all, or the information is all zeros?
The code shown above should work fine.

If you are getting just zeros, then make sure you have a clear view of the sky, give it a couple of minutes, and absolutely make sure your power supply provides enough volts, amps and that the power quality is clean.

You need to do

digitalWrite(D4, HIGH);

I’m not quite sure about the D4 pin. You have to see the code. There is a npn transistor that blinks a led when get a fix, but you need to send to HIGH that pin. By default the led doesnt blink.

Thanks, I’ll see about this as well.

Thank for you suggestions. I took your advice from a previous post and flashed particle firmware version 0.8.0-rc.9 with the corresponding Carloop-Minimal code. After waiting for about 5 to 10 minutes, I started receiving GPS information. Particle firmware version 0.7.0 is a no-go. I did try firmware version 0.6.4, but either I didn’t wait long enough to get a fix or it just didn’t work for me. In either case, thanks for the help. Using version 0.8.0-rc, the battery, and the latest Carloop library seems to work well. Again, Thanks for the help.