0

arduino 101 with gps logger shield
Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.

arduino 101 with gps logger shield

by daijia on Tue Apr 26, 2016 11:41 pm

Can I use Adafruit GPS logger shield with Arduino 10. If.not, what are some.changes.that I need to made?

daijia
 
Posts: 1
Joined: Tue Apr 26, 2016 11:40 pm

Re: arduino 101 with gps logger shield

by adafruit_support_mike on Wed Apr 27, 2016 12:25 am

We haven't tried it, but the GPS module uses a standard Serial interface and the SD card uses SPI.

The 101 only exposes its hardware SPI pins on the ICSP header, so you'll need to add a 2x3 header for that connection and wire the pins to the appropriate signals.

adafruit_support_mike
 
Posts: 42178
Joined: Thu Feb 11, 2010 2:51 pm

Re: arduino 101 with gps logger shield

by a_kress on Wed Apr 27, 2016 12:44 am

I'm wanting to do the exact same thing!

I've the gps shield and the 101. The SD card works like a champ. GPS just isn't playing nice.

Are there any links of how to test with the iscp headers?

a_kress
 
Posts: 5
Joined: Wed Apr 27, 2016 12:37 am

Re: arduino 101 with gps logger shield

by adafruit_support_mike on Fri Apr 29, 2016 8:18 pm

What pins are you using for the Serial connection?

adafruit_support_mike
 
Posts: 42178
Joined: Thu Feb 11, 2010 2:51 pm

Re: arduino 101 with gps logger shield

by a_kress on Sat Apr 30, 2016 12:09 pm

Im not sure I've just got the headers soldered where they'd normally get soldered (I'm pretty new). Here's a pic of what I've got.

In the code it's using ping 7 & 8 for the soft serial pins.

Image

a_kress
 
Posts: 5
Joined: Wed Apr 27, 2016 12:37 am

Re: arduino 101 with gps logger shield

by adafruit_support_mike on Sat Apr 30, 2016 11:09 pm

The switch down at the end of the GPS shield is set for 'direct connect' on pins 0 and 1. Try flipping that to the 'software serial' side.

adafruit_support_mike
 
Posts: 42178
Joined: Thu Feb 11, 2010 2:51 pm

Re: arduino 101 with gps logger shield

by a_kress on Sun May 01, 2016 5:17 pm

adafruit_support_mike wrote:The switch down at the end of the GPS shield is set for 'direct connect' on pins 0 and 1. Try flipping that to the 'software serial' side.


I double checked the switch. It's switched up on soft serial. Same result. Nothing logged.

I pulled out an UNO and tested the shield with that and the data log sketch. The gps works just as it should. I loaded the same sketch on the 101 without modifying it and it won't compile.
Code: Select all | TOGGLE FULL SIZE
exit status 1
no matching function for call to ‘Adafruit_GPS::Adafruit_GPS(SoftwareSerial*)’

a_kress
 
Posts: 5
Joined: Wed Apr 27, 2016 12:37 am

Re: arduino 101 with gps logger shield

by franklin97355 on Sun May 01, 2016 6:39 pm

I don't thing the 101 has support for software serial.

franklin97355
 
Posts: 16314
Joined: Mon Apr 21, 2008 2:33 pm
Location: Lacomb, OR.

Re: arduino 101 with gps logger shield

by a_kress on Mon May 02, 2016 1:12 pm

So I've got this kind of working.

I had to move the switch over to hardware serial then wire the TX & RX of the gps shield to the 101's RX & TX. Then in the code it will read from the serial.read().

It's definitely not optimal yet but they're now talking. So far it's spitting out incomplete sentences. I'll have to post a picture of it later.

With the switch moved to hardware the SD card still seems to work perfectly.

a_kress
 
Posts: 5
Joined: Wed Apr 27, 2016 12:37 am

Re: arduino 101 with gps logger shield

by a_kress on Mon May 09, 2016 10:38 pm

Here is what I did:

https://learn.adafruit.com/adafruit-ult ... n-leonardo
I used these steps and loaded the leo_echo example sketch.

ImageImage
using that sketch I added some code for the logging and gyro info.

Here is my code so far:

Code: Select all | TOGGLE FULL SIZE
#include <BMI160.h>
#include <CurieIMU.h>
#include <MadgwickAHRS.h>
#include <CurieBLE.h>
#include <CurieTime.h>
#include <Adafruit_GPS.h>
#include <SD.h>
#include "defs.h"
 
#define mySerial Serial1
Adafruit_GPS GPS(&mySerial);
 
File logfile;
char filename[15];
 
BLEPeripheral blePeripheral; // create peripheral instance
BLEService ledService("FastApp-2016-04-12");
// create switch characteristic and allow remote device to read and write
BLECharCharacteristic ledCharacteristic("FastApp-2016-04-12", BLERead | BLEWrite);
// create button characteristic and allow remote device to get notifications
BLECharCharacteristic buttonCharacteristic("FastApp-2016-04-12", BLERead | BLENotify); // allows remote device to get notifications
 
 
// this keeps track of whether we're using the interrupt
// off by default!
boolean usingInterrupt = false;
void useInterrupt(boolean); // Func prototype keeps Arduino 0023 happy
 
Madgwick filter; // initialise Madgwick object
int ax, ay, az;
int gx, gy, gz;
float yaw;
float pitch;
float roll;
int factor = 800; // variable by which to divide gyroscope values, used to control sensitivity
 
int count = 0; // need a counter because we only get seconds level time from CurieTime.h
String gps="";
 
void setup() {
  CurieIMU.begin(); 
  // connect at 115200 so we can read the GPS fast enough and echo without dropping chars
  // also spit it out
  Serial.begin(115200);
  while(!Serial);
  Serial.println(VERSION);
  // set the local name peripheral advertises
  blePeripheral.setLocalName("FastApp");
  // set the UUID for the service this peripheral advertises:
  blePeripheral.setAdvertisedServiceUuid(ledService.uuid());
 
  // add service and characteristics
  blePeripheral.addAttribute(ledService);
  blePeripheral.addAttribute(ledCharacteristic);
  blePeripheral.addAttribute(buttonCharacteristic);
 
  ledCharacteristic.setValue(0);
  buttonCharacteristic.setValue(0);
  // use the code below to calibrate accel/gyro offset values
  Serial.println("Internal sensor offsets BEFORE calibration...");
  Serial.print(CurieIMU.getAccelerometerOffset(X_AXIS)); Serial.print("\t");
  Serial.print(CurieIMU.getAccelerometerOffset(Y_AXIS)); Serial.print("\t");
  Serial.print(CurieIMU.getAccelerometerOffset(Z_AXIS)); Serial.print("\t");
  Serial.print(CurieIMU.getGyroOffset(X_AXIS)); Serial.print("\t");
  Serial.print(CurieIMU.getGyroOffset(Y_AXIS)); Serial.print("\t");
  Serial.print(CurieIMU.getGyroOffset(Z_AXIS)); Serial.print("\t");
  Serial.println("");
   
  Serial.println("Starting Gyroscope calibration...");
  CurieIMU.autoCalibrateGyroOffset();
  Serial.println("Starting Acceleration calibration...");
  CurieIMU.autoCalibrateAccelerometerOffset(X_AXIS, 0);
  CurieIMU.autoCalibrateAccelerometerOffset(Y_AXIS, 0);
  CurieIMU.autoCalibrateAccelerometerOffset(Z_AXIS, 1);
   
  Serial.println("Internal sensor offsets AFTER calibration...");
  Serial.print(CurieIMU.getAccelerometerOffset(X_AXIS)); Serial.print("\t");
  Serial.print(CurieIMU.getAccelerometerOffset(Y_AXIS)); Serial.print("\t");
  Serial.print(CurieIMU.getAccelerometerOffset(Z_AXIS)); Serial.print("\t");
  Serial.print(CurieIMU.getAccelerometerOffset(X_AXIS)); Serial.print("\t");
  Serial.print(CurieIMU.getAccelerometerOffset(Y_AXIS)); Serial.print("\t");
  Serial.print(CurieIMU.getAccelerometerOffset(Z_AXIS)); Serial.print("\t");
  Serial.println("");
  // advertise the service
  blePeripheral.begin();
  // 9600 NMEA is the default baud rate for Adafruit MTK GPS's- some use 4800
  GPS.begin(9600);
  mySerial.begin(9600);
 
  GPS.sendCommand(PMTK_SET_NMEA_OUTPUT_RMCGGA);
  GPS.sendCommand(PMTK_SET_NMEA_UPDATE_5HZ);
  GPS.sendCommand(PGCMD_NOANTENNA);
  // Ask for firmware version
  mySerial.println(PMTK_Q_RELEASE);
 
  // see if the card is present and can be initialized:
  if (!SD.begin(chipSelect)) {      // if you're using an UNO, you can use this line instead
    Serial.println("Card init. failed!");
  }
   
  strcpy(filename, "GPSLOG00.TXT");
  for (uint8_t i = 0; i < 100; i++) {
    filename[6] = '0' + i/10;
    filename[7] = '0' + i%10;
    // create if does not exist, do not open existing, write, sync after write
    if (!SD.exists(filename)) {
      break;
    }
  }
  logfile = SD.open(filename, FILE_WRITE);
}
 
void loop() {
  boolean endofline=false;
  char c = GPS.read();
   
  if (GPSECHO){
    if (c) Serial.print(c);
    gps+=c;
  }
   
  if(c=='\n') endofline=true;
   
  // if a sentence is received, we can check the checksum, parse it...
  if (GPS.newNMEAreceived()) { 
    if (!GPS.parse(GPS.lastNMEA()))   // this also sets the newNMEAreceived() flag to false
      return;  // we can fail to parse a sentence in which case we should just wait for another
  }
 
  // approximately every 2 seconds or so, print out the current stats
  if (endofline) {
    CurieIMU.readMotionSensor(ax, ay, az, gx, gy, gz);
   
    // use function from MagdwickAHRS.h to return quaternions
    filter.updateIMU(gx / factor, gy / factor, gz / factor, ax, ay, az);
   
    // functions to find yaw roll and pitch from quaternions
    yaw = filter.getYaw();
    roll = filter.getRoll();
    pitch = filter.getPitch();
    String sql = "$AGYRO,";
 
    String timestamp = "20";
    timestamp += GPS.year; timestamp += "-"; timestamp += GPS.month; timestamp += "-"; timestamp += GPS.day;
    timestamp += " "; timestamp += GPS.hour; timestamp += ":"; timestamp += GPS.minute; timestamp += ":"; timestamp += GPS.seconds;
     
    sql+= timestamp; sql+=",";
    sql+= gx; sql+= ", ";
    sql+= gy; sql+= ", ";
    sql+= gz; sql+= ", ";
    sql+= ax; sql+= ", ";
    sql+= ay; sql+= ", ";
    sql+= az;
    Serial.println(sql);
     
    logfile.println(gps);
    logfile.println(sql);
    gps="";
  }
   
  logfile.flush();
}

a_kress
 
Posts: 5
Joined: Wed Apr 27, 2016 12:37 am

Re: arduino 101 with gps logger shield

by MPer on Sat Jul 29, 2017 3:48 pm

Attached is the patch for Arduino 101. Use SoftSerial.

PS:Had to append .txt as an extension as .diff was not allowed.
Attachments
Adafruit_GPS_101.diff.txt
(3.18 KiB) Downloaded 2 times

MPer
 
Posts: 4
Joined: Mon May 22, 2017 11:49 am

Please be positive and constructive with your questions and comments.