Stalker v2.1 + GPS Bee, GPSlogger.

Hi everybody!

I’m trying to make GPS logger and using for that Stalker v2.1 + GPS Bee, to save log files in microSD.
Everything works fine, I did check GPS Bee on u-center and Stalker works fine too. Sketch loads good.
In Serial Monitor shows:
“GPSlogger
writing to GPSLOG09.TXT
ready!
$PSRF100,01,4800,08,01,000E
$PSRF105,01
3E
$PSRF103,00,00,00,0124
$PSRF103,01,00,00,01
27
$PSRF103,02,00,00,0126
$PSRF103,03,00,00,01
27
$PSRF103,04,00,01,0121
$PSRF103,05,00,00,01
21
$PSRF151,00*3E”
How I undertand that mean device works properly. When I check my microSD card there was files named GPSLOG00, GPSLOG01, GPSLOG02… etc, but those files are 0 kB. I’m opening file and nothing in it.
It happens even when I use separate from computer, with battery on outside the same files without data.

Please help, what can be reason of my situation?

Your SDcard must be FAT16 or FAT32.
What code do you use in stalker?
Please tell us more detail.

Yes, I tried Fat16 and Fat32 too.

Last time I used this sketch that I put below, but I used other sketch too, all time same no data in file.

// Ladyada’s logger modified by Bill Greiman to use the Fat16 library

// this is a generic logger that does checksum testing so the data written should be always good
// Assumes a sirf III chipset logger attached to pin 0 and 1

#include “Fat16.h”
#include “Fat16util.h”
#include <avr/sleep.h>

// macros to use PSTR
#define putstring(str) SerialPrint_P(PSTR(str))
#define putstring_nl(str) SerialPrintln_P(PSTR(str))

// power saving modes
#define SLEEPDELAY 0
#define TURNOFFGPS 0
#define LOG_RMC_FIXONLY 1

SdCard card;
Fat16 f;

#define led1Pin 4
#define led2Pin 3
#define powerPin 2

#define BUFFSIZE 75
char buffer[BUFFSIZE];
uint8_t bufferidx = 0;
uint8_t fix = 0; // current fix data
uint8_t i;

/* EXAMPLE

$PSRF103,,,,*CKSUM

00=GGA,01=GLL,02=GSA,03=GSV,04=RMC,05=VTG
00=SetRate,01=Query
Output every seconds, off=00,max=255
00=disable Checksum,01=Enable checksum for specified message
Note: checksum is required

Example 1: Query the GGA message with checksum enabled
$PSRF103,00,01,00,01*25

Example 2: Enable VTG message for a 1Hz constant output with checksum enabled
$PSRF103,05,00,01,01*20

Example 3: Disable VTG message
$PSRF103,05,00,00,01*21

*/

#define SERIAL_SET “$PSRF100,01,4800,08,01,00*0E\r\n”

// GGA-Global Positioning System Fixed Data, message 103,00
#define LOG_GGA 0
#define GGA_ON “$PSRF103,00,00,01,0125\r\n"
#define GGA_OFF "$PSRF103,00,00,00,01
24\r\n”

// GLL-Geographic Position-Latitude/Longitude, message 103,01
#define LOG_GLL 0
#define GLL_ON “$PSRF103,01,00,01,0126\r\n"
#define GLL_OFF "$PSRF103,01,00,00,01
27\r\n”

// GSA-GNSS DOP and Active Satellites, message 103,02
#define LOG_GSA 0
#define GSA_ON “$PSRF103,02,00,01,0127\r\n"
#define GSA_OFF "$PSRF103,02,00,00,01
26\r\n”

// GSV-GNSS Satellites in View, message 103,03
#define LOG_GSV 0
#define GSV_ON “$PSRF103,03,00,01,0126\r\n"
#define GSV_OFF "$PSRF103,03,00,00,01
27\r\n”

// RMC-Recommended Minimum Specific GNSS Data, message 103,04
#define LOG_RMC 1
#define RMC_ON “$PSRF103,04,00,01,0121\r\n"
#define RMC_OFF "$PSRF103,04,00,00,01
20\r\n”

// VTG-Course Over Ground and Ground Speed, message 103,05
#define LOG_VTG 0
#define VTG_ON “$PSRF103,05,00,01,0120\r\n"
#define VTG_OFF "$PSRF103,05,00,00,01
21\r\n”

// Switch Development Data Messages On/Off, message 105
#define LOG_DDM 1
#define DDM_ON “$PSRF105,013E\r\n"
#define DDM_OFF "$PSRF105,00
3F\r\n”

#define USE_WAAS 0 // useful in US, but slower fix
#define WAAS_ON “$PSRF151,013F\r\n" // the command for turning on WAAS
#define WAAS_OFF "$PSRF151,00
3E\r\n” // the command for turning off WAAS

// 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 setup()
{
WDTCSR |= (1 << WDCE) | (1 << WDE);
WDTCSR = 0;
Serial.begin(4800);
putstring_nl("\r\nGPSlogger");
pinMode(led1Pin, OUTPUT);
pinMode(led2Pin, OUTPUT);
pinMode(powerPin, OUTPUT);
digitalWrite(powerPin, LOW);

if (!card.init()) {
putstring_nl(“Card init. failed!”);
error(1);
}
if (!Fat16::init(&card)) {
putstring_nl(“No partition!”);
error(2);
}
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 (f.open(buffer, O_CREAT | O_EXCL | O_WRITE | O_SYNC)) break;
}

if(!f.isOpen()) {
putstring("couldnt create "); Serial.println(buffer);
error(3);
}
putstring("writing to "); Serial.println(buffer);
putstring_nl(“ready!”);

putstring(SERIAL_SET);
delay(250);

if (LOG_DDM)
putstring(DDM_ON);
else
putstring(DDM_OFF);
delay(250);

if (LOG_GGA)
putstring(GGA_ON);
else
putstring(GGA_OFF);
delay(250);

if (LOG_GLL)
putstring(GLL_ON);
else
putstring(GLL_OFF);
delay(250);

if (LOG_GSA)
putstring(GSA_ON);
else
putstring(GSA_OFF);
delay(250);

if (LOG_GSV)
putstring(GSV_ON);
else
putstring(GSV_OFF);
delay(250);

if (LOG_RMC)
putstring(RMC_ON);
else
putstring(RMC_OFF);
delay(250);

if (LOG_VTG)
putstring(VTG_ON);
else
putstring(VTG_OFF);
delay(250);

if (USE_WAAS)
putstring(WAAS_ON);
else
putstring(WAAS_OFF);
}

void loop()
{
//Serial.println(Serial.available(), DEC);
char c;
uint8_t sum;

// read one ‘line’
if (Serial.available()) {
c = Serial.read();
//Serial.print(c, BYTE);
if (bufferidx == 0) {
while (c != ‘$’)
c = Serial.read(); // wait till we get a $
}
buffer[bufferidx] = c;

//Serial.print(c, BYTE);
if (c == '\n') {
  //putstring_nl("EOL");
  //Serial.print(buffer);
  buffer[bufferidx+1] = 0; // terminate it

  if (buffer[bufferidx-4] != '*') {
    // no checksum?
    Serial.print('*', BYTE);
    bufferidx = 0;
    return;
  }
  // get checksum
  sum = parseHex(buffer[bufferidx-3]) * 16;
  sum += parseHex(buffer[bufferidx-2]);

  // check checksum
  for (i=1; i < (bufferidx-4); i++) {
    sum ^= buffer[i];
  }
  if (sum != 0) {
    //putstring_nl("Cxsum mismatch");
    Serial.print('~', BYTE);
    bufferidx = 0;
    return;
  }
  // got good data!

  if (strstr(buffer, "GPRMC")) {
    // find out if we got a fix
    char* p = buffer;
    p = strchr(p, ',')+1;
    p = strchr(p, ',')+1;       // skip to 3rd item

    if (p[0] == 'V') {
      digitalWrite(led1Pin, LOW);
      fix = 0;
    } else {
      digitalWrite(led1Pin, HIGH);
      fix = 1;
    }
  }
  if (LOG_RMC_FIXONLY) {
    if (!fix) {
      Serial.print('_', BYTE);
      bufferidx = 0;
      return;
    }
  }
  // rad. lets log it!
  Serial.print(buffer);
  Serial.print('#', BYTE);
  digitalWrite(led2Pin, HIGH);      // sets the digital pin as output
  
  // Bill Greiman - need to write bufferidx + 1 bytes to getCR/LF
  bufferidx++;
  
  if(f.write((uint8_t*) buffer, bufferidx) != bufferidx) {
     putstring_nl("can't write!");
     return;
  }

  digitalWrite(led2Pin, LOW);

  bufferidx = 0;

  // turn off GPS module?
  if (TURNOFFGPS) {
    digitalWrite(powerPin, HIGH);
  }

  sleep_sec(SLEEPDELAY);
  digitalWrite(powerPin, LOW);
  return;
}
bufferidx++;
if (bufferidx == BUFFSIZE-1) {
   Serial.print('!', BYTE);
   bufferidx = 0;
}

} else {

}

}

void sleep_sec(uint8_t x) {
while (x–) {
// set the WDT to wake us up!
WDTCSR |= (1 << WDCE) | (1 << WDE); // enable watchdog & enable changing it
WDTCSR = (1<< WDE) | (1 <<WDP2) | (1 << WDP1);
WDTCSR |= (1<< WDIE);
set_sleep_mode(SLEEP_MODE_PWR_DOWN);
sleep_enable();
sleep_mode();
sleep_disable();
}
}

SIGNAL(WDT_vect) {
WDTCSR |= (1 << WDCE) | (1 << WDE);
WDTCSR = 0;
}

/* End code */

Anybody tried Stalker v2.1 with GPS bee? Maybe someone send me demo code which works and i will try again.
I will be really appreciate, if someone helps me with my problem.

Thanks for your feedback, we have been update our WIKI at seeedstudio.com/wiki/Seeeduino_Stalker_v2.1
Try to use our demo code for sd card.

#include <SD.h>

const int chipSelect = 10;
String buffer = “”;
unsigned char ptr;
File myFile;
byte val;
void setup()
{
Serial.begin(19200);
pinMode(chipSelect,OUTPUT);
if(!SD.begin(chipSelect))
{
return;
}
File myFile = SD.open(“data.log”,FILE_WRITE);
myFile.close();
}

void loop()
{
if(Serial.available() > 0)
{
val = Serial.read();
buffer = String(val);
myFile = SD.open(“data.log”,FILE_WRITE);
myFile.print(buffer);
myFile.close();
}
}

Best regards

Yuri

I tried demo code and SD card works, so it saved with some text. But I couldn’t get data from GPS to my SD card, it’s saves file without data. :frowning:

Dear customer,

Happy New Year!(:slight_smile:)

According to your description, I think it may be you connect the wrong line.
As you know the new code for the Stalker 2.1. It will be work for GPSBee and record data in the sd card.
When you need to provide power to the Stalker 2.1, use dual-female wire to connect USB5V to VCC and GND to GND with UartSB.
We found TX RX would interfere with GPS signals. Or you can also use battery to provide power.
I hope this time can solve your problem.

I doesn’t mean that device is working properly, I have the same output in console both with GPS Bee and without.
Are used pins 2, 3, 4 really proper ones?.

It’s a pitty that there is no demo code on Wiki.

Actually our WIKI remind you to check Stalker 1.0 to view some code for demo. And TX RX would interfere with GPS signals is fact.
Anyway, SD card only use less than 2G.
So I could not understand what you mean used pins 2, 3, 4?Is there TX RX VCC?
But what in Serial Monitor shows code is find, that is GPS data.

check out my post

ive got over these problems
cheers
ken b

Dear everybody,

Here is a new code for them with FAT16 libraries.
#include <Fat16.h>
#include <Fat16util.h>
#include <MsTimer2.h>//The Time2 Interrupt Library

SdCard card;
Fat16 myFile;//Creat a Fat16 system depanding on Fat16 Library

String recvBuf;
String HeadMessage = “$GPRMC”;

unsigned char recv;
unsigned char flag;
int nameIndex = 0;
int Gpsflag;
char name[]=“datalog.txt”;

void stopGps()
{
Gpsflag = 0;
}

void setup()
{
Serial.begin(19200);
flag = 0;
card.init();
// initialize a FAT16 volume
Fat16::init(&card);
myFile.open(name, O_CREAT | O_APPEND | O_WRITE);

MsTimer2::set(450,stopGps);//Set Timer2 Interrupt every 900ms(at 8MHz)
}

void loop()
{
if(Serial.available())
{
recv = Serial.read();
if(recv == 0x0A)
{
recvBuf = “”;
}
recvBuf += recv;
nameIndex = recvBuf.indexOf(HeadMessage);
if(nameIndex != -1)//if there has HeadMessage there will not return -1,so we can know is ther a new message
{
recvBuf = “”;
flag = 1;
}
if(flag == 1)
{
Gpsflag = 1;
MsTimer2::start();
myFile.print(HeadMessage);//wo miss the headmessage up there,so we add the head message before we add the next
while(Gpsflag)//Get one Packet message during the 900ms,cause the GPS send the message every 1 second
{
while(Serial.available())
{
myFile.print((char)Serial.read());
}
}
flag = 0;//clear the flag,waiting for the next Packet
MsTimer2::stop();
myFile.close();//Close and Save
myFile.open(name,O_APPEND | O_WRITE);//allow to Write
Serial.flush();//Clrean the Serial Buff
}
}
}

And can view at seeedstudio.com/wiki/index.p … ed_Antenna.

Can it solve your problem?