login

Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.

Messages - el_godo

Pages: [1]
1
Exhibition / Data logger for, well, ... logging data
« on: June 01, 2015, 04:56:04 AM »
Hello all,
I am a scientist and started building my own instruments a couple of years ago. For reasons of availability I went for the Arduino back then, and realizing that 32 kB of program memory is not enough, I cloned a Sanguino: http://forum.arduino.cc/index.php?topic=68925.msg606313#msg606313.
Since then I went through a couple of adaptations (most of them necessary due to the fact that the 644 chip is poorly supprted in Arduino IDE > 0), but finally I dropped the 644 chip, trimmed the design to the core requirements and built an instrument based on the 32U4 and a MAX14502 for data transfer. This means the memory is scrammed (to 97%) and a lot of nice ideas cannot be followed any more. This is why I went back to the 644 and found wiring again.
Luckily, I found already this: http://forum.wiring.co/index.php/topic,571.0.html. Thanks very much! It works probably with the DS3231 RTC as well, but I will have to check. I also tried to tweak the TinyGPS++ library for the Arduino, and it works after eliminating the flash-brackets and using "Serial1" instead of the SoftwareSerial solution.
Code: [Select]
#include <TinyGPS++.h>
/*
   This sample code demonstrates just about every built-in operation of TinyGPS++ (TinyGPSPlus).
   It requires the use of SoftwareSerial, and assumes that you have a
   4800-baud serial GPS device hooked up on pins 4(rx) and 3(tx).
*/

// The TinyGPS++ object
TinyGPSPlus gps;

// For stats that happen every 5 seconds
unsigned long last = 0UL;

void setup()
{
  Serial.begin(115200);
  Serial1.begin(9600);

  Serial.println("KitchenSink.ino");
  Serial.println("Demonstrating nearly every feature of TinyGPS++");
  Serial.print("Testing TinyGPS++ library v. "); Serial.println(TinyGPSPlus::libraryVersion());
  Serial.println("by Mikal Hart");
  Serial.println();
}

void loop()
{
  // Dispatch incoming characters
  while (Serial1.available() > 0)
    {
      gps.encode(Serial1.read());
    }
  if (gps.location.isUpdated())
  {
    Serial.print("LOCATION   Fix Age=");
    Serial.print(gps.location.age());
    Serial.print("ms Raw Lat=");
    Serial.print(gps.location.rawLat().negative ? "-" : "+");
    Serial.print(gps.location.rawLat().deg);
    Serial.print("[+");
    Serial.print(gps.location.rawLat().billionths);
    Serial.print(" billionths],  Raw Long=");
    Serial.print(gps.location.rawLng().negative ? "-" : "+");
    Serial.print(gps.location.rawLng().deg);
    Serial.print("[+");
    Serial.print(gps.location.rawLng().billionths);
    Serial.print(" billionths],  Lat=");
    Serial.print(gps.location.lat(), 6);
    Serial.print(" Long=");
    Serial.println(gps.location.lng(), 6);
  }

  else if (gps.date.isUpdated())
  {
    Serial.print("DATE       Fix Age=");
    Serial.print(gps.date.age());
    Serial.print("ms Raw=");
    Serial.print(gps.date.value());
    Serial.print(" Year=");
    Serial.print(gps.date.year());
    Serial.print(" Month=");
    Serial.print(gps.date.month());
    Serial.print(" Day=");
    Serial.println(gps.date.day());
  }

  else if (gps.time.isUpdated())
  {
    Serial.print("TIME       Fix Age=");
    Serial.print(gps.time.age());
    Serial.print("ms Raw=");
    Serial.print(gps.time.value());
    Serial.print(" Hour=");
    Serial.print(gps.time.hour());
    Serial.print(" Minute=");
    Serial.print(gps.time.minute());
    Serial.print(" Second=");
    Serial.print(gps.time.second());
    Serial.print(" Hundredths=");
    Serial.println(gps.time.centisecond());
  }

  else if (gps.speed.isUpdated())
  {
    Serial.print("SPEED      Fix Age=");
    Serial.print(gps.speed.age());
    Serial.print("ms Raw=");
    Serial.print(gps.speed.value());
    Serial.print(" Knots=");
    Serial.print(gps.speed.knots());
    Serial.print(" MPH=");
    Serial.print(gps.speed.mph());
    Serial.print(" m/s=");
    Serial.print(gps.speed.mps());
    Serial.print(" km/h=");
    Serial.println(gps.speed.kmph());
  }

  else if (gps.course.isUpdated())
  {
    Serial.print("COURSE     Fix Age=");
    Serial.print(gps.course.age());
    Serial.print("ms Raw=");
    Serial.print(gps.course.value());
    Serial.print(" Deg=");
    Serial.println(gps.course.deg());
  }

  else if (gps.altitude.isUpdated())
  {
    Serial.print("ALTITUDE   Fix Age=");
    Serial.print(gps.altitude.age());
    Serial.print("ms Raw=");
    Serial.print(gps.altitude.value());
    Serial.print(" Meters=");
    Serial.print(gps.altitude.meters());
    Serial.print(" Miles=");
    Serial.print(gps.altitude.miles());
    Serial.print(" KM=");
    Serial.print(gps.altitude.kilometers());
    Serial.print(" Feet=");
    Serial.println(gps.altitude.feet());
  }

  else if (gps.satellites.isUpdated())
  {
    Serial.print("SATELLITES Fix Age=");
    Serial.print(gps.satellites.age());
    Serial.print("ms Value=");
    Serial.println(gps.satellites.value());
  }

  else if (gps.hdop.isUpdated())
  {
    Serial.print("HDOP       Fix Age=");
    Serial.print(gps.hdop.age());
    Serial.print("ms Value=");
    Serial.println(gps.hdop.value());
  }

  else if (millis() - last > 5000)
  {
    Serial.println();
    if (gps.location.isValid())
    {
      static const double LONDON_LAT = 51.508131, LONDON_LON = -0.128002;
      double distanceToLondon =
        TinyGPSPlus::distanceBetween(
          gps.location.lat(),
          gps.location.lng(),
          LONDON_LAT,
          LONDON_LON);
      double courseToLondon =
        TinyGPSPlus::courseTo(
          gps.location.lat(),
          gps.location.lng(),
          LONDON_LAT,
          LONDON_LON);

      Serial.print("LONDON     Distance=");
      Serial.print(distanceToLondon/1000, 6);
      Serial.print(" km Course-to=");
      Serial.print(courseToLondon, 6);
      Serial.print(" degrees [");
      Serial.print(TinyGPSPlus::cardinal(courseToLondon));
      Serial.println("]");
    }

    Serial.print("DIAGS      Chars=");
    Serial.print(gps.charsProcessed());
    Serial.print(" Sentences-with-Fix=");
    Serial.print(gps.sentencesWithFix());
    Serial.print(" Failed-checksum=");
    Serial.print(gps.failedChecksum());
    Serial.print(" Passed-checksum=");
    Serial.println(gps.passedChecksum());

    if (gps.charsProcessed() < 10)
      Serial.println("WARNING: No GPS data.  Check wiring.");

    last = millis();
    Serial.println();
  }
}
Since I wished for a comfortable solution for the data transfer/charging/code updating business, but the MAX14502 being discontinued, I adapted the design of the Ardulab, employing a sixfold 1:2 analog switch (TS3A27518, function verified) and a SD-USB-bridge chip (AU6331) to emulate a SD-card-reader. A twofold switch (TS3USB30) routes the USB lines to either the bridge chip or a FT231 for connection to the 644. The unit runs on a single LiPo, charged by a MCP73831 (verified). The voltage is converted to 5V via MCP1640 (verified), 3V3 comes from an LDO device from the 5V (verified). I know, it sounds ineffective, but all other solutions also had only a conversion efficiency of around 60%, which is exactly as good as a resistor network.
I will set up a breadboard soon to verify the interactions of all components together. Past experiences showed that this is a crucial step in order to verify both hardware feasibility and software function and shall not be ommited.
I will be happy to share my progress and experiences if it is of interest.
Cheers
Sebastian
Pages: [1]