Stalker - startup

Hi,

I am just starthing to get to grips with my Stalker - not getting any joy yet & wondering if a little help might be in order?

So this is what I have done:

Downloaded the sample code and opened in Arduino.
Downloaded the DS1307.H library (not in location indicated by demo code - got it from Seeeduino DS1307 page)
Downloded the FileLogger.H library (not in location indicated by demo code - got it from Seeeduino SD Card Shield page)
Formated the mSD card on a Canon camera and inserted.
Created an empty data.log file on the card.
Compiled the code onto the stalker via Arduino 0017/ATmega 168 - all transferred fine.
Waited several minutes and checked data.log for content.

The only error I got was when adding the FileLogger.H library: you may need to use Tools -> Fix Encoding & Reload to update
the sketch to use UTF-8 encoding. If not, you may need to delete the bad characters to get rid of this warning.
I ran the Fix Encoding & Reload tool and as far as I can tell that fixed the problem.

It all looks like it should be working but no data is getting recorded.

Any help would be appreciated.

[code]
/*===========================================================

Seeeduino Stalker Demo code – www.seeedstudio.com
Copyright © 2009-2010 Seeedstudio
This is a demo code for Seeeduino Stalker. It record the sensor
data into SD Card every 5 seccond .
In this demo code , it include two library : FileLogger and DS1307.
You can download these two library here:
http://www.seeedstudio.com/depot/images/produce/FileLogger.rar
http://www.seeedstudio.com/depot/images/produce/DS1307.rar
Remenber to add a data.log file in your SD Card first.

12.22.2009 FreeZinG
===========================================================*/

#include “FileLogger.h”
#include “DS1307.h”
#include <WProgram.h>
#include <Wire.h>

#define Timing 0
#define Accept 1
#define Record 2

byte start[7]= { ‘B’,‘e’,‘g’,‘i’,‘n’,0x0D,0x0A};
byte buffer[20];
int temp;
byte ASCII[10]={‘0’,‘1’,‘2’,‘3’,‘4’,‘5’,‘6’,‘7’,‘8’,‘9’};
unsigned char result;
unsigned char state;
int time=0;
int oldtime=0;

void setup(void)
{
result = FileLogger::append(“data.log”, start, 7);//Initial the SD Card
while(result) result = FileLogger::append(“data.log”, start, 7);
RTC.stop();
RTC.set(DS1307_MIN,30); //set the minutes
RTC.set(DS1307_HR,10); //set the hours
RTC.set(DS1307_DATE,22); //set the date
RTC.set(DS1307_MTH,12); //set the month
RTC.set(DS1307_YR,9); //set the year
RTC.start();
}

void loop(void)
{
switch(state)
{
case Timing:

    time=RTC.get(DS1307_SEC,true);
    delay(200); 
    if(time!=oldtime)
    { 
      oldtime=time;    
      temp=RTC.get(DS1307_MTH,false);
      buffer[0]=ASCII[(temp/10)];
      buffer[1]=ASCII[(temp%10)];
      buffer[2]='-';
      temp=RTC.get(DS1307_DATE,false);
      buffer[3]=ASCII[(temp/10)];
      buffer[4]=ASCII[(temp%10)];
      buffer[5]='-';
      temp=RTC.get(DS1307_HR,false);
      buffer[6]=ASCII[(temp/10)];
      buffer[7]=ASCII[(temp%10)];
      buffer[8]='-';
      temp=RTC.get(DS1307_MIN,false);
      buffer[9]=ASCII[(temp/10)];
      buffer[10]=ASCII[(temp%10)];
      buffer[11]='-';
      //temp=RTC.get(DS1307_SEC,false);
      buffer[12]=ASCII[(time/10)];
      buffer[13]=ASCII[(time%10)];
      buffer[14]=':';
      state=Accept;
    }
break;

case Accept:
temp=analogRead(0);
buffer[15]=ASCII[(temp/100)];
buffer[16]=ASCII[((temp%100)/10)];
buffer[17]=ASCII[(temp%10)];
buffer[18]=0x0D;
buffer[19]=0x0A;
state=Record;
break;

case Record:
result = FileLogger::append(“data.log”, buffer, 20);
if (result==0)
{
state=Timing;
}
break;

default:
state=Timing;
break;

}

}[/code]

  1. try to created an data.log file on the card wiht one byte data like a character ‘B’ .
  2. use a PC to format the SD card and into FAT16 .

Hi FreeZing,

I have formatted the card on Windows Vista - FAT(default) allocation=32
I have made the data.log file a non zero byte file by adding ‘B’

Unfortunately nothing - The script uploads fine, dioides D1 & D5 come on ‘solid’.
I have tested the clock via serial - all fine.
I have tested the sensor TMP36 connected via analog0 - again this works fine (one question - runnig the same sketch on a Duemilanove and Stalker gives a different output voltage from the TMP36?)

Any more tips? Thanks.

OK - some success :slight_smile:

I was using a 2Gb mSD card (not SDHC) - by following exactly the same procedure as before on a 128Mb card I was able to get a result.

What is the max capacity of card supported?

Thanks.

PS - any thoughts on the sensor output difference? (see previous post)

Hi FreeZinG,

I’m making some progress here but could I ask for your help on the code below? I want to save the year in the date and have modified the code to suite but the output is not right (see below) - what have I done wrong?

Also, the code header says the data is saved every 5 seconds but actually it is every second - how would I change this to 5 seconds… or more?

Thanks for your help.

01/03//0,17:05:19,014
01/03//0,17:05:20,015
01/03//0,17:05:21,017
01/03//0,17:05:22,015
01/03//0,17:05:23,015
01/03//0,17:05:24,016
01/03//0,17:05:25,015
01/03//0,17:05:26,016
01/03/30,17:05:27,015
01/03/30,17:05:28,015
01/03/30,17:05:29,015
01/03/30,17:05:30,016
01/03/30,17:05:31,015

[code]/*===========================================================

Seeeduino Stalker Demo code – www.seeedstudio.com
Copyright © 2009-2010 Seeedstudio
This is a demo code for Seeeduino Stalker. It record the sensor
data into SD Card every 5 seccond .
In this demo code , it include two library : FileLogger and DS1307.
You can download these two library here:
http://www.seeedstudio.com/depot/images/produce/FileLogger.rar
http://www.seeedstudio.com/depot/images/produce/DS1307.rar
Remenber to add a data.log file in your SD Card first.

12.22.2009 FreeZinG
===========================================================*/

#include “FileLogger.h”
#include “DS1307.h”
#include <WProgram.h>
#include <Wire.h>

#define Timing 0
#define Accept 1
#define Record 2

byte start[7]= { ‘B’,‘e’,‘g’,‘i’,‘n’,0x0D,0x0A};
byte buffer[23];
int temp;
byte ASCII[10]={‘0’,‘1’,‘2’,‘3’,‘4’,‘5’,‘6’,‘7’,‘8’,‘9’};
unsigned char result;
unsigned char state;
int time=0;
int now=0;
int oldtime=0;

void setup(void)
{
result = FileLogger::append(“data.txt”, start, 7);//Initial the SD Card
while(result) result = FileLogger::append(“data.txt”, start, 7);
RTC.stop();
RTC.set(DS1307_MIN,05); //set the minutes
RTC.set(DS1307_HR,17); //set the hours
RTC.set(DS1307_DATE,01); //set the date
RTC.set(DS1307_MTH,03); //set the month
RTC.set(DS1307_YR,10); //set the year
RTC.start();
}

void loop(void)
{

switch(state)
{
case Timing:

    time=RTC.get(DS1307_SEC,true);
    delay(200); 
    if(time!=oldtime)
    { 
      oldtime=time;    
      temp=RTC.get(DS1307_DATE,false);
      buffer[0]=ASCII[(temp/10)];
      buffer[1]=ASCII[(temp%10)];
      buffer[2]='/';
      temp=RTC.get(DS1307_MTH,false);
      buffer[3]=ASCII[(temp/10)];
      buffer[4]=ASCII[(temp%10)];
      buffer[5]='/';
      temp=RTC.get(DS1307_YR,false);
      buffer[6]=ASCII[(temp/10)];
      buffer[7]=ASCII[(temp%10)];
      buffer[8]=',';
      temp=RTC.get(DS1307_HR,false);
      buffer[9]=ASCII[(temp/10)];
      buffer[10]=ASCII[(temp%10)];
      buffer[11]=':';
      temp=RTC.get(DS1307_MIN,false);
      buffer[12]=ASCII[(temp/10)];
      buffer[13]=ASCII[(temp%10)];
      buffer[14]=':';
      //temp=RTC.get(DS1307_SEC,false);
      buffer[15]=ASCII[(time/10)];
      buffer[16]=ASCII[(time%10)];
      buffer[17]=',';
      state=Accept;
    }
break;

case Accept:
temp=analogRead(0);
buffer[18]=ASCII[(temp/100)];
buffer[19]=ASCII[((temp%100)/10)];
buffer[20]=ASCII[(temp%10)];
buffer[21]=0x0D;
buffer[22]=0x0A;
state=Record;
break;

case Record:
result = FileLogger::append(“data.txt”, buffer, 23);
if (result==0)
{
state=Timing;
}
break;

default:
state=Timing;
break;

}

}

[/code]

I am sorry for the late reply, we are busy on our new project.

you can change the (time!=oldtime+5)to change to 5 seconds .

I just received a new Stalker and tried the demo code. Using the (time!=oldtime+5) the Stalker would stop logging data after the time reached one minute. I used:

if(time%5==0 && time!=oldtime) it would then record data every five seconds.

Hi just got going with my Stalker so this is all interesting stuff
one question … do we know what sd cards work with the Stalker
i.e. max memory size … SD card types that work.
see the question was asked before but cant see an answer.

Cheers
Jack

@JocTheCroc

The Stalker use the SPI interface to control the SD card , so your card need to support SPI mode . max memory size depend on the code or library you use … now the library we use in demo just can support FAT16 , but you can find some other library that can support FAT32.

We suggest you use the 1G card and FAT16 formated .