Show Posts
Pages: 1 2 [3] 4
31  Using Arduino / Project Guidance / Re: Excel sheet With arduino UNO on: January 17, 2013, 12:42:14 am
I highy doubt you'l be able to keep an .xls file open in SRAM to play with them so as said before stick to csv.

For deleting data in a particular cell with csv that breaks csv each cell needs to contain something for everything to lineup.

My philosophy is never delete saved data. Its super cool that I even have it logging incorrect data
32  Using Arduino / Project Guidance / Re: GPS shield connected to Arduino UNO on: January 15, 2013, 11:19:56 pm
I dont recognise your gps library nmea.h. the way you are referencing it is strange too.

Try the TinyGPS library(google it)

It has a sample sketch and examples.
33  Using Arduino / Project Guidance / Re: Excel sheet With arduino UNO on: January 14, 2013, 07:00:37 pm
These:
https://www.sparkfun.com/products/8745

will probably be what you need to use the board you have.

You seriously are better off using https://www.sparkfun.com/products/9802 though.

I use it extensively to log to a multiple csv files.
34  Using Arduino / Project Guidance / Re: Kalman Filter and GPS D: on: January 14, 2013, 03:45:12 pm
In a larger sketch im using the similar pstring block to print to a file

Which is not HardwareSerial related. I think that was the original reason smiley-sad

EDIT: I'm a retard i switched to doubles for the gps coords. Should be fine i'll let you know smiley


RAWWRR, still using floats for altitude course and speed D:

So i had multiple mistakes in my above sketch. Namely I used wrong variable types everywhere(Go look at my useage of "c").

Also its a lot easier to hardcode the seconds_since_last_timestamp in
Code:
update_velocity2d(double lat, double lon, double seconds_since_last_timestep)
to the module update rate. In my case 0.1.

I've now got sample output to Serial and i've abolished my use of PString. I'll rewrite my file usage to use the File class and It should all be fixed float-wise. Once it works ill update the repo i made with an example sketch.

I've yet to see if there's actually any benefit of using this filter smiley.
35  Using Arduino / Project Guidance / Re: Uno --> GPS Shield --> WAV Shield on: January 14, 2013, 07:10:44 am
A stand alone unit would be advisable.

Check:
https://www.sparkfun.com/pages/GPS_Guide

For a module with a reasonably fast Time till first fix. You'll probably only require 1hz logging and the accuracy shouldn't need to be that high provided you use a reasonable range from the saved points.

Take a look at: https://en.wikipedia.org/wiki/Haversine_formula just incase this hasn't been thrown at you before

36  Using Arduino / Project Guidance / Re: Kalman Filter and GPS D: on: January 14, 2013, 07:05:39 am
The only reason I had PString was its nice ability to print floats out of the box. Ideally getting sprintf to accept floats would be awesome but I'm aware this is complex. How much program memory overhead does this cause?

Alternatively  I've found
Code:
static void print_float(float val, float invalid, int len, int prec)
{
  char sz[32];
  if (val == invalid)
  {
    strcpy(sz, "*******");
    sz[len] = 0;
        if (len > 0)
          sz[len-1] = ' ';
    for (int i=7; i<len; ++i)
        sz[i] = ' ';
    Serial.print(sz);
  }
  else
  {
    Serial.print(val, prec);
    int vi = abs((int)val);
    int flen = prec + (val < 0.0 ? 2 : 1);
    flen += vi >= 1000 ? 4 : vi >= 100 ? 3 : vi >= 10 ? 2 : 1;
    for (int i=flen; i<len; ++i)
      Serial.print(" ");
  }
  feedgps();
}
From the TinyGPS examples which will suffice With some tweaking. Unless there is a better way you know of.

I'll report back with new memory figures if required smiley

Thanks for confirming I'm not insane.
37  Using Arduino / Project Guidance / Re: Uno --> GPS Shield --> WAV Shield on: January 14, 2013, 12:41:53 am
First of all learn the component parts of this project.

  • Button presses leading to an action
  • Playing a sound
  • Logging position

http://arduiniana.org/libraries/tinygps/ plus https://www.sparkfun.com/products/10709 For GPS

Button pushes can probably be covered by an analog read from the examples

As for playing a sound https://www.sparkfun.com/products/11029 might be useful. Although you may want more control just search sound at sparkfun and read the examples
38  Using Arduino / Project Guidance / Re: HOW TO CONSTRUCT ARDUINO BOARD on: January 14, 2013, 12:15:07 am
http://arduino.cc/en/Main/ArduinoBoardSerialSingleSided3

Could you please look around for stuff before posting in all caps?
39  Using Arduino / Project Guidance / Re: Sensors Workig, what next on: January 13, 2013, 10:44:03 pm
Fritzing would be a good start at least for one test board. Once you get used to the PCB process look for a local manufacturer and roll your own files.
40  Using Arduino / Project Guidance / Re: GPS shield connected to Arduino UNO on: January 13, 2013, 10:09:37 pm
The documentation that comes with the shield on the useful links section of the product page should be your first target.

This GPS module appears to use SiRF although it support NMEA which is supported by TinyGPS. You may have to enable that if SiRF is the default.

There's an example sketch on the tiny gps website at: http://arduiniana.org/libraries/tinygps/

Could you also keep your discussion down to 1 thread you have multiple.
41  Using Arduino / Project Guidance / Kalman Filter and GPS D: on: January 13, 2013, 09:59:34 pm
Hello smiley,

I've got a 10hz GPS module successfully logging out data to a file on a microsd and I would love to get some smoothing going. I'm having difficulty finding some kalman filter stuff for GPS within arduino specifically. I'm happy for you to correct me here and post a load of them smiley-razz.

Anyway, i discovered this yesterday https://github.com/lacker/ikalman and after making a few changes to my preference such as wrapping the actual logic into an object and fixing up the for loops to work in or out of C99 mode (i forget which way round that is smiley-razz) i've got it successfully compiling onto an Uno. My changes can be found here: https://github.com/rfox90/ikalman its highly likely i may of made a silly mistake there I'm not exactly proficient at C++ and especially not code I don't understand due to the maths behind it.

The problem appears to be that I run out of RAM on the Arduino as its restarting. This occurs the moment i call an update to the filter.

Am I heading in the right direction or just condemning myself to run out of RAM?
Code:
#include <SoftwareSerial.h>
#include <TinyGPS.h>
#include <GPSFilter.h>

#include <PString.h>
#define RXPIN 2
#define TXPIN 3

//Defined in the specs for the module i am using
#define GPSBAUD 38400

#define error(s) sd.errorHalt_P(PSTR(s))
TinyGPS gps;


SoftwareSerial uart_gps(RXPIN, TXPIN);

GPSFilter f(2.5);

int freeRam();

char buff[50];
char pbuff[100];
PString line(pbuff,sizeof pbuff);

unsigned long lastUpdate;
unsigned long lastSentence;
float c;



void setup()
{
  Serial.begin(115200);
  Serial.println(F("...waiting for lock..."));
  uart_gps.begin(GPSBAUD);
  uart_gps.write("$PMTK314,0,1,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0*28\r\n");
  uart_gps.write("$PMTK220,100*2F\r\n");
  lastSentence = millis();
  lastUpdate = millis();
}


void loop()
{
  while(uart_gps.available()) {     // While there is data on RX
    char c = uart_gps.read();
    if(c == '$'){
    //  Serial.println();
    }
   // Serial.print(c);
    if(gps.encode(c)) {
      int year;
      byte month, day, hour, minute, second, hundredths;
      unsigned long age;
      gps.crack_datetime(&year,&month,&day,&hour,&minute,&second,&hundredths,&age); //Get the date from the GPS
      unsigned long date;
      gps.get_datetime(&date,0,0);
      if(date == TinyGPS::GPS_INVALID_DATE){
         Serial.println(F("Invalid Age"));
          //continue;
      }
      if(age == TinyGPS::GPS_INVALID_AGE) {
          Serial.println(F("Waiting for more valid data"));
          continue;
      }
      float latitude, longitude;
      double dlat,dlong;
      gps.f_get_position(&latitude, &longitude);

      double ulat,ulong;
      ulat = (double)latitude;
      ulong = (double)longitude;
      c = (millis() - lastSentence)/1000;
      //seconds since last update
      f.update_velocity2d(ulat,ulong,c);
      lastSentence = millis();
      Serial.println(F("Does not get here");
      if((millis() - lastUpdate) >= 500 || lastUpdate == NULL){
      f.get_lat_long(&dlat,&dlong);

      line.begin();
      line.print("201,");
      line.print(dlat,8);
      line.print(",");
      line.print(dlong,8);
      line.print(",");
      line.print(year);
      line.print("-");
      line.print(month);
      line.print("-");
      line.print(day);
      line.print(" ");
      line.print(hour);
      line.print(":");
      line.print(minute);
      line.print(":");
      //Serial.println(second);
      line.print(second);
      line.print(".");
      line.print(hundredths);
      line.print(",");
      line.print(gps.f_altitude(),2);
      line.print(",");
      line.print(gps.f_course(),2);
      line.print(",");
      line.print(gps.f_speed_kmph(),2);
      Serial.println(line);
      lastUpdate = millis();
      }
    }
  }
}
int freeRam () {
  extern int __heap_start, *__brkval;
  int v;
  return (int) &v - (__brkval == 0 ? (int) &__heap_start : (int) __brkval);
}

42  Using Arduino / Storage / Re: How many bytes can name a file using SD.open? on: November 09, 2012, 09:22:21 am
Code:
if(!sd.exists(string)){
   sd.mkdir(string);
}
Feel free to make multiple levels of folders at once:
sd.mkdir("2012/11/09/");

works smiley
43  Using Arduino / Storage / Re: How many bytes can name a file using SD.open? on: November 08, 2012, 06:51:46 pm
Correct, you can only use 8 characters(8 Bytes) and a 3 character extension.

Code:
eg. textfile.txt
     (8).(3)
I used folders to sort out the problem your describing:
Code:
2012/11/08/<ID>.txt


44  Using Arduino / Storage / Re: Random Error Codes on: November 08, 2012, 06:48:41 pm
The SparkFun microSD shields uses pin 8 for SD chip select.  Sometimes it will almost work with the wrong chip select pin.  This happens if pin 8 floats low.

Try changing this line
Code:
const uint8_t chipSelect = SS;
to this
Code:
const uint8_t chipSelect = 8;
Many thanks, This worked perfectly. I went back re-read the product description and associated files and yes it does quite clearly state that pin 8 must be used.

THANKS smiley-grin
45  Using Arduino / Storage / Re: Random Error Codes on: November 01, 2012, 03:56:24 pm
im using the ofstream class as it seemed the easiest i also like being able to  do stdout << "stuff". I don't think using ofstream would cause the issue however ill switch to one that uses SDFile and see if im getting the same issue.

So I switched to a SDFile setup and the same thing occured again im hitting reset when this fails:
Code:
...waiting for lock...
581
error: Cannot Open File
SD errorCode: 0X6
...waiting for lock...
Can't access SD card. Do not reformat.
SD errorCode: 0X2
...waiting for lock...
Can't access SD card. Do not reformat.
SD errorCode: 0X4
...waiting for lock...
581
error: Cannot Open File
SD errorCode: 0X4
...waiting for lock...
Invalid Age
581
error: Cannot Open File
SD errorCode: 0X4
...waiting for lock...
581
error: Cannot Open File
SD errorCode: 0X4
...waiting for lock...
Invalid Age
581
error: Cannot Open File
SD errorCode: 0X4
...waiting for lock...
581
error: Cannot Open File
SD errorCode: 0X6
...waiting for lock...
581
error: Cannot Open File
SD errorCode: 0X4
...waiting for lock...
581
error: Cannot Open File
...waiting for lock...
581
error: Cannot Open File
...waiting for lock...
581
error: Cannot Open File
SD errorCode: 0X4
...waiting for lock...
Invalid Age
...waiting for lock...
581
error: Cannot Open File
SD errorCode: 0XF
...waiting for lock...
Invalid Age
581
error: Cannot Open File
...waiting for lock...
581
error: Cannot Open File
...waiting for lock...
Invalid Age
581
error: Cannot Open File
...waiting for lock...
Can't access SD card. Do not reformat.
SD errorCode: 0X4
...waiting for lock...

Ill run one of the SDFat exmaples through continually for awhile see if they work or not.

It ran quite well but after awhile stopped, inserting the sdcard into the computer and then reformatting has caused it to work again but im still getting intermitent 13s and 8s.

Could bad pins cause this. My soldering isnt bad but isn't great smiley?
Pages: 1 2 [3] 4