So I am building a TinyCircuits GPS tracker for a research project I am doing. I successfully built one GPS and the GPS txt file came out in readable ascii form, which I could then convert to an NMEA file for mapping on Google Earth. However, I ordered more parts to build more GPS's and I am getting this file (see attachment) which is not readable. I am wondering if there is a way to make this readable or if there is an error with the pieces I am using.
I am using a TinyDuino Processor, TinyShield USB and ICP adapter, MicroSD card and TinyShield GPS. I used the following Arduino code to program it:
/*
This Arduino sketch will log GPS NMEA data to a SD card every second
*/
#include <SoftwareSerial.h>
#include <SD.h>
// The Arduino pins used by the GPS module
static const int GPS_ONOFFPin = A3;
static const int GPS_SYSONPin = A2;
static const int GPS_RXPin = A1;
static const int GPS_TXPin = A0;
static const int GPSBaud = 9600;
static const int chipSelect = 10;
// The GPS connection is attached with a software serial port
SoftwareSerial Gps_serial(GPS_RXPin, GPS_TXPin);
void setup()
{
// Init the GPS Module to wake mode
pinMode(GPS_SYSONPin, INPUT);
pinMode(GPS_ONOFFPin, OUTPUT);
digitalWrite( GPS_ONOFFPin, LOW );
delay(5);
if( digitalRead( GPS_SYSONPin ) == LOW )
{
// Need to wake the module
digitalWrite( GPS_ONOFFPin, HIGH );
delay(5);
digitalWrite( GPS_ONOFFPin, LOW );
}
// Open the debug serial port at 9600
Serial.begin(9600);
// Open the GPS serial port
Gps_serial.begin(GPSBaud);
Serial.print("Initializing SD card...");
// make sure that the default chip select pin is set to
// output, even if you don't use it:
pinMode(10, OUTPUT);
// see if the card is present and can be initialized:
if (!SD.begin(chipSelect)) {
Serial.println("Card failed, or not present");
// don't do anything more:
return;
}
Serial.println("card initialized.");
}
int inByte = 0; // incoming serial byte
byte pbyGpsBuffer[100];
int byBufferIndex = 0;
void loop()
{
byte byDataByte;
if (Gps_serial.available())
{
byDataByte = Gps_serial.read();
Serial.write(byDataByte);
pbyGpsBuffer[ byBufferIndex++ ] = byDataByte;
if( byBufferIndex >= 100 )
{
byBufferIndex = 0;
File dataFile = SD.open("gps.txt", FILE_WRITE);
// if the file is available, write to it:
if (dataFile) {
dataFile.write(pbyGpsBuffer, 100);
dataFile.close();
}
// if the file isn't open, pop up an error:
else {
Serial.println("error opening gps.txt");
}
}
}
}
If anyone knows how I would go about fixing this, please let me know. Thank you!
Telit shipped some modules with a default 4800 baud messages instead of 9600- this is most likely the issue. We have an updated code example at https://codebender.cc/sketch:60928
Sorry about the wasted time though- let me know how this goes.
Thanks,
Ben
I just tried to upload that new code; but I got this error message:
Arduino: 1.6.8 (Mac OS X), Board: "Arduino Pro or Pro Mini, ATmega328 (3.3V, 8 MHz)"
/Users/kristenfalcinelli/Documents/College/Research/GPSupdate/GPSupdate.ino:20:31: fatal error: SoftwareSerial256.h: No such file or directory
#include "SoftwareSerial256.h"
^
compilation terminated.
exit status 1
Error compiling for board Arduino Pro or Pro Mini.
This report would have more information with
"Show verbose output during compilation"
option enabled in File -> Preferences.
Do you have that file in the same folder as the .ino? You can use the 'Download' link in the left panel to grab a zip of all the files.