Sorry. I figured it out... The battery holder I bought was wired backwards!! Ha.
Thanks for your help. Always impressed by the speed in which you respond
GPS data logger kit: Interfacing with two temp and one pressure sensor
Moderators: adafruit_support_bill, adafruit
Please be positive and constructive with your questions and comments.
-
- Posts: 40
- Joined: Sun Jan 15, 2012 12:52 pm
-
- Posts: 40
- Joined: Sun Jan 15, 2012 12:52 pm
Re: GPS data logger kit: Interfacing with two temp and one pressure sensor
Hi there,
My GPS logger was working fine up until yesterday. For some reason when I turn on my logger, rather than logging the data to one file, it logs the data to multiple files each 33KB in size. ? I don't understand why. I haven't changed my code or anything else.
I suspected perhaps there was an error with my SD card so I tried logging onto multiple SD cards and have had the same issue.
Any ideas on what may be the cause of this?
Regards,
TG
My GPS logger was working fine up until yesterday. For some reason when I turn on my logger, rather than logging the data to one file, it logs the data to multiple files each 33KB in size. ? I don't understand why. I haven't changed my code or anything else.
I suspected perhaps there was an error with my SD card so I tried logging onto multiple SD cards and have had the same issue.
Any ideas on what may be the cause of this?
Regards,
TG
- Attachments
-
- Screen shot 2012-03-14 at 5.48.56 PM.png (51.64 KiB) Viewed 1493 times
- adafruit_support_bill
- Posts: 88096
- Joined: Sat Feb 07, 2009 10:11 am
Re: GPS data logger kit: Interfacing with two temp and one pressure sensor
Hmmm. It looks like they all have the same date/time (2000-01-001 12:AM) Probably a problem in your real-time-clock. Check the battery?
-
- Posts: 40
- Joined: Sun Jan 15, 2012 12:52 pm
Re: GPS data logger kit: Interfacing with two temp and one pressure sensor
I get the same output when the power is from the USB of my computer. Puzzling no?
- adafruit_support_bill
- Posts: 88096
- Joined: Sat Feb 07, 2009 10:11 am
Re: GPS data logger kit: Interfacing with two temp and one pressure sensor
I was thinking of the RTC battery, but this is a GPS shield we are talking about. The time stamp should be coming from the GPS. What does your GPS data look like?
-
- Posts: 40
- Joined: Sun Jan 15, 2012 12:52 pm
Re: GPS data logger kit: Interfacing with two temp and one pressure sensor
The first photo is of the logged data, the second is of the serial readout.
Note: I was running it inside because its cold out. However, I was experiencing the same problem yesterday when I ran it outside.
Note: I was running it inside because its cold out. However, I was experiencing the same problem yesterday when I ran it outside.
- Attachments
-
- Screen shot 2012-03-15 at 8.23.46 AM.png (48.17 KiB) Viewed 1477 times
-
- Screen shot 2012-03-15 at 8.21.18 AM.png (35.55 KiB) Viewed 1477 times
- adafruit_support_bill
- Posts: 88096
- Joined: Sat Feb 07, 2009 10:11 am
Re: GPS data logger kit: Interfacing with two temp and one pressure sensor
Are you using the basic GPS logger sketch from the tutorial? That sketch only opens a new file in the setup function. If you are getting multiple files, then your Arduino must be resetting for some reason. One of the most common causes of this is insufficient power. In this case, it seems to be happening on a regular basis. How many hours/minutes worth of data do you get in each file?
-
- Posts: 40
- Joined: Sun Jan 15, 2012 12:52 pm
Re: GPS data logger kit: Interfacing with two temp and one pressure sensor
Each 33KB file is about 30second of recording I would say.
This is a sample of my code:
[Edit - moderator - use code button for submitting large blocks of code]
This is a sample of my code:
[Edit - moderator - use code button for submitting large blocks of code]
Code: Select all
#include <Wire.h>
#include <SD.h>
#include <BMP085.h>
#include <avr/sleep.h>
#include "GPSconfig.h"
#include <SoftwareSerial.h>
// power saving modes
#define SLEEPDELAY 0
#define TURNOFFGPS 0
#define LOG_RMC_FIXONLY 0
// Use pins 2 and 3 to talk to the GPS. 2 is the TX pin, 3 is the RX pin
SoftwareSerial gpsSerial = SoftwareSerial(2, 3);
// Baud rate of GPS unit
#define GPSRATE 4800
// Set the pins used
#define powerPin 4
#define led1Pin 5
#define led2Pin 6
#define chipSelect 10
#define BUFFSIZE 90
char buffer[BUFFSIZE];
uint8_t bufferidx = 0;
uint8_t fix = 0; // current fix data
uint8_t i,j,k;
char *parseptr;
float Temperature;
int32_t Pressure;
float lat,lon,temp;
char date[7];
char utc_time[10];
char alt[10];
File logfile;
// BMP085
BMP085 bmp;
// read a Hex value and return the decimal equivalent
uint8_t parseHex(char c) {
if (c < '0')
return 0;
if (c <= '9')
return c - '0';
if (c < 'A')
return 0;
if (c <= 'F')
return (c - 'A')+10;
}
// blink out an error code
void error(uint8_t errno) {
while(1) {
for (i=0; i<errno; i++) {
digitalWrite(led1Pin, HIGH);
digitalWrite(led2Pin, HIGH);
delay(100);
digitalWrite(led1Pin, LOW);
digitalWrite(led2Pin, LOW);
delay(100);
}
for (; i<10; i++) {
delay(200);
}
}
}
void readline(void) {
char c;
bufferidx = 0; // start at begninning
while (1) {
c=gpsSerial.read();
if (c == -1)
continue;
if (c == '\n')
continue;
if ((bufferidx == BUFFSIZE-1) || (c == '\r')) {
buffer[bufferidx] = 0;
return;
}
buffer[bufferidx++]= c;
}
}
void setup() {
WDTCSR |= (1 << WDCE) | (1 << WDE);
WDTCSR = 0;
Serial.begin(9600);
Serial.println("\r\nGPS and BMP085 logger");
pinMode(led1Pin, OUTPUT);
pinMode(led2Pin, OUTPUT);
pinMode(powerPin, OUTPUT);
digitalWrite(powerPin, LOW);
// 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 init. failed!");
error(1);
}
strcpy(buffer, "GPSLOG00.TXT");
for (i = 0; i < 100; i++) {
buffer[6] = '0' + i/10;
buffer[7] = '0' + i%10;
// create if does not exist, do not open existing, write, sync after write
if (! SD.exists(buffer)) {
break;
}
}
logfile = SD.open(buffer, FILE_WRITE);
if( ! logfile ) {
Serial.print("Couldnt create ");
Serial.println(buffer);
error(3);
}
Serial.print("Writing to ");
Serial.println(buffer);
logfile.println("# A GPS track data file");
logfile.println("# UTC time lat lon gps_alt pressure temperature");
logfile.println("# hhmmss.sss deg deg m hPa C");
logfile.println("#");
// connect to the GPS at the desired rate
gpsSerial.begin(GPSRATE);
Serial.println("Ready!");
gpsSerial.print(SERIAL_SET);
delay(250);
gpsSerial.print(GGA_ON);
delay(250);
//gpsSerial.print(GLL_OFF);
//delay(250);
//gpsSerial.print(GSA_OFF);
//delay(250);
//gpsSerial.print(GSV_OFF);
//delay(250);
gpsSerial.print(RMC_OFF);
delay(250);
//gpsSerial.print(VTG_OFF);
// gpsSerial.print(RMC_ON);
// delay(250);
gpsSerial.print(WAAS_ON);
bmp.begin();
}
void loop() {
char c;
uint8_t sum;
char *p;
// read a line of data
readline();
Serial.print("raw line: ");
Serial.println(buffer);
// get checksum
sum = parseHex(buffer[bufferidx-2]) * 16;
sum += parseHex(buffer[bufferidx-1]);
Serial.print("Checksum:");
Serial.println(sum);
// check checksum
for (i=1; i < (bufferidx-3); i++) {
sum ^= buffer[i];
}
if (sum != 0) {
//putstring_nl("Cxsum mismatch");
Serial.print('~');
bufferidx = 0;
return;
}
p = buffer;
// UTC time is item 2
p = strchr(p, ',')+1;
for (k=0;k<9;k++)
utc_time[k]=p[k];
Serial.print(" UTC time:");
Serial.println(utc_time);
// lat is item 3
p = strchr(p, ',')+1;
// get degrees and convert minutes to decimal degrees
lat = (p[0]-'0')*10.0 + (p[1]-'0') + ((p[2]-'0')*10.0 + (p[3]-'0') + (p[5]-'0')/10.0 + (p[6]-'0')/100.0 + (p[7]-'0')/1000.0 + (p[8]-'0')/10000.0)/60.0;
// N or S is item 4
p = strchr(p, ',')+1;
if (p[0]=='S')
lat *= -1.0;
Serial.print(" latitude:");
Serial.println(lat,7);
// lon is item 5
p = strchr(p, ',')+1;
// get degrees and convert minutes to decimal degrees
lon = (p[0]-'0')*100.0 + (p[1]-'0')*10.0 + (p[2]-'0') + ((p[3]-'0')*10.0 + (p[4]-'0') + (p[6]-'0')/10.0 + (p[7]-'0')/100.0 + (p[8]-'0')/1000.0 + (p[9]-'0')/10000.0)/60.0;
// E or W is item 6
p = strchr(p, ',')+1;
if (p[0]=='W')
lon *= -1.0;
Serial.print(" longitude:");
Serial.println(lon,7);
// fix indicator is item 7
p = strchr(p, ',')+1;
if (p[0]=='0') {
fix = 0;
digitalWrite(led1Pin, LOW);
}
else {
fix = 1;
digitalWrite(led1Pin, HIGH);
}
// alt is item 10
p = strchr(p, ',')+1;
p = strchr(p, ',')+1;
p = strchr(p, ',')+1;
j=0;
while (p[j] != ',') {
alt[j] = p[j];
j++;
}
Serial.print(" alt:");
Serial.println(alt);
bufferidx = 0;
// now start logging data
digitalWrite(led2Pin, HIGH); // sets the digital pin as output
// write date
logfile.print(date);
logfile.print(" ");
// write UTC time
logfile.print(utc_time);
logfile.print(" ");
// write latitude
logfile.print(lat,7);
logfile.print(" ");
// write longitude
logfile.print(lon,7);
logfile.print(" ");
// write altitude
logfile.print(alt);
logfile.print(" ");
// get data from the BMP085 and log
Temperature = bmp.readTemperature();
Serial.print("Temperature = ");
Serial.print(Temperature);
Serial.println(" C");
Pressure = bmp.readPressure();
Serial.print("Pressure = ");
Serial.print(Pressure);
Serial.println(" Pa");
// write pressure
logfile.print(" ");
logfile.print(Pressure);
logfile.print(" ");
// write temperature
logfile.println(Temperature);
logfile.flush();
digitalWrite(led2Pin, LOW);
// turn off GPS module?
if (TURNOFFGPS) {
digitalWrite(powerPin, HIGH);
}
delay(SLEEPDELAY * 1000);
digitalWrite(powerPin, LOW);
return;
}
- adafruit_support_bill
- Posts: 88096
- Joined: Sat Feb 07, 2009 10:11 am
Re: GPS data logger kit: Interfacing with two temp and one pressure sensor
Spontaneous resets are often due to fluctuations in the power supply. This is happening both with USB and battery power?
-
- Posts: 40
- Joined: Sun Jan 15, 2012 12:52 pm
Re: GPS data logger kit: Interfacing with two temp and one pressure sensor
Yes. It happens in both cases.
- adafruit_support_bill
- Posts: 88096
- Joined: Sat Feb 07, 2009 10:11 am
Re: GPS data logger kit: Interfacing with two temp and one pressure sensor
Not sure what is going on there. Has anything changed in your code, hardware or wiring since it was last working reliably? Do you have anything connnected to the reset pin? Check all your connections to make sure they are secure.
-
- Posts: 40
- Joined: Sun Jan 15, 2012 12:52 pm
Re: GPS data logger kit: Interfacing with two temp and one pressure sensor
Nothing has changed in my code. I even reinstalled my old code and still the same issue. I have triple check all my connections and they are all how they should be.
Is it possible I have a failed GPS unit?
Is it possible I have a failed GPS unit?
- adafruit_support_bill
- Posts: 88096
- Joined: Sat Feb 07, 2009 10:11 am
Re: GPS data logger kit: Interfacing with two temp and one pressure sensor
It looks like your GPS unit is reporting data. The question is: what is causing your Arduino to reset every 30 seconds or so. Typical causes of resets are:Is it possible I have a failed GPS unit?
- Unstable or weak power supply
Noise spikes or brownouts (can be caused by things like an appliance plugged into the same circuit)
Loose connection
Short circuit
-
- Posts: 40
- Joined: Sun Jan 15, 2012 12:52 pm
Re: GPS data logger kit: Interfacing with two temp and one pressure sensor
Thanks for the tips. I will try some stuff this weekend and get back to you!
Cheers!
Cheers!
-
- Posts: 40
- Joined: Sun Jan 15, 2012 12:52 pm
Re: GPS data logger kit: Interfacing with two temp and one pressure sensor
Hey there,
I rebuilt another data logger shield and loaded my original code onto a new arduino. I have the same issue. The logged files are only 33kb. I cant seem to get it to log to only one file.
The next step for me is to try a new GPS unit. Is there anything else you can think of that I could try before I try a new GPS unit?
Thanks!
I rebuilt another data logger shield and loaded my original code onto a new arduino. I have the same issue. The logged files are only 33kb. I cant seem to get it to log to only one file.
The next step for me is to try a new GPS unit. Is there anything else you can think of that I could try before I try a new GPS unit?
Thanks!
Please be positive and constructive with your questions and comments.