Data Logger shield

Adafruit Ethernet, Motor, Proto, Wave, Datalogger, GPS Shields - etc!

Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.
Locked
User avatar
tgangi
 
Posts: 21
Joined: Fri Feb 12, 2016 9:11 pm

Data Logger shield

Post by tgangi »

I am having trouble writing my data to the SD card. When I run the datalogging example it writes to it fine, but when I put it into my code all that prints to the Serial window is "Raw Sens$�VIn����� DcData stored to EEPROM.
Cu$� �$����!�&ߏJ�u�Raw Se ��VVIn%�@ߏ ca"
. My code runs fine when the SD stuff isn't in it but once it is it doesn't work. I'm having trouble figuring out what I did wrong.
Here's the code I'm running. I'm using an Uno with the BNO055 and the the Data Logger Shield.

Code: Select all

#include <Wire.h>
#include <Adafruit_Sensor.h>
#include <Adafruit_BNO055.h>
#include <utility/imumaths.h>
#include <EEPROM.h>
#include <SPI.h>
#include <SD.h>

#define SAMPLE_RATE_DELAY_MS (1000)   // how often data is collected

Adafruit_BNO055 bno = Adafruit_BNO055(55);

/*******************************************************/
const int chipSelect = 4;
File dataFile;
/******************************************************/

void displayCalStatus(void)
{
  uint8_t system, gyro, accel, mag;
  system = gyro = accel = mag = 0;
  bno.getCalibration(&system, &gyro, &accel, &mag);

  Serial.print("\t");
  if (!system)
  {
    Serial.print("! ");
  }

  Serial.print("Sys:");
  Serial.print(system, DEC);
  Serial.print(" G:");
  Serial.print(gyro, DEC);
  Serial.print(" A:");
  Serial.print(accel, DEC);
  Serial.print(" M:");
  Serial.print(mag, DEC);
}

void displaySensorOffsets(const adafruit_bno055_offsets_t &calibData)
{
    Serial.print("Accelerometer: ");
    Serial.print(calibData.accel_offset_x); Serial.print(" ");
    Serial.print(calibData.accel_offset_y); Serial.print(" ");
    Serial.print(calibData.accel_offset_z); Serial.print(" ");

    Serial.print("\nGyro: ");
    Serial.print(calibData.gyro_offset_x); Serial.print(" ");
    Serial.print(calibData.gyro_offset_y); Serial.print(" ");
    Serial.print(calibData.gyro_offset_z); Serial.print(" ");

    Serial.print("\nMag: ");
    Serial.print(calibData.mag_offset_x); Serial.print(" ");
    Serial.print(calibData.mag_offset_y); Serial.print(" ");
    Serial.print(calibData.mag_offset_z); Serial.print(" ");

    Serial.print("\nAccel Radius: ");
    Serial.print(calibData.accel_radius);

    Serial.print("\nMag Radius: ");
    Serial.print(calibData.mag_radius);
}
  
void setup(void)
{
  Serial.begin(9600);
  Serial.println("Raw Sensor Data");
  Serial.print("");
  bno.begin();  //start sensor

/**************************************************************/
  Serial.print("Initializing SD card...");
  pinMode(SS, OUTPUT);
  
  if (!SD.begin(chipSelect)) {
    Serial.println("Card failed, or not present");
    // don't do anything more:
    while (1) ;
  }
  Serial.println("card initialized.");
  
  dataFile = SD.open("datafile.txt", FILE_WRITE);
  if (! dataFile) {
    Serial.println("error opening datafile.txt");
    // Wait forever since we cant write data
    while (1) ;
  }
/***************************************************************/ 

  int eeAddress = 0;
  long bnoID;
  bool foundCalib = false;

  EEPROM.get(eeAddress, bnoID);

  adafruit_bno055_offsets_t calibrationData;
  sensor_t sensor;

  bno.getSensor(&sensor);
  if (bnoID != sensor.sensor_id)
   {
      Serial.println("\nNo Calibration Data for this sensor exists in EEPROM");
      delay(500);
   }
  else
   {
      Serial.println("\nFound Calibration for this sensor in EEPROM.");
      eeAddress += sizeof(long);
      EEPROM.get(eeAddress, calibrationData);

      displaySensorOffsets(calibrationData);

      Serial.println("\n\nRestoring Calibration data to the BNO055...");
      bno.setSensorOffsets(calibrationData);
      
      Serial.println("\n\nCalibration data loaded into BNO055");
      foundCalib = true;
   }

  sensors_event_t event;
  bno.getEvent(&event);
  if (foundCalib){
        Serial.println("Move sensor slightly to calibrate magnetometers");
        while (!bno.isFullyCalibrated())
        {
            bno.getEvent(&event);
            delay(SAMPLE_RATE_DELAY_MS);
        }
    }
    else
    {
  Serial.println("Please Calibrate Sensor: ");
  while (!bno.isFullyCalibrated())
  {
    bno.getEvent(&event);

    Serial.print("X: ");
    Serial.print(event.orientation.x, 4);
    Serial.print("\tY: ");
    Serial.print(event.orientation.y, 4);
    Serial.print("\tZ: ");
    Serial.print(event.orientation.z, 4);

    /* Optional: Display calibration status */
    displayCalStatus();

    /* New line for the next sample */
    Serial.println("");
   }
    }

  Serial.println("\nFully Calibrated");
    Serial.println("Calibration Results: ");
    adafruit_bno055_offsets_t newCalib;
    bno.getSensorOffsets(newCalib);
    displaySensorOffsets(newCalib);

    Serial.println("\n\nStoring calibration data to EEPROM...");

    eeAddress = 0;
    bno.getSensor(&sensor);
    bnoID = sensor.sensor_id;

    EEPROM.put(eeAddress, bnoID);

    eeAddress += sizeof(long);
    EEPROM.put(eeAddress, newCalib);
    Serial.println("Data stored to EEPROM.");

  delay(500);
        
  int8_t temp=bno.getTemp();  //get current temp
  Serial.print("Current Temperature: ");
  Serial.print(temp);
  Serial.println(" C");
  Serial.println("");
        
  bno.setExtCrystalUse(true);
        
  Serial.println("Calibration Status Values: 0 = uncalibrated, 3 = fully calibrated");

  Serial.println("Accel X \t Accel Y \t Accel Z \t Vel X   \t Vel   Y \t Vel Z   \t Gyro X \t Gyro Y \t Gyro Z \t Time");    
  
 }

float velx_i = 0;  //initial velocity values
float vely_i = 0;
float velz_i = 0;


float Time=0;

void loop()
{
  
    while ((Time <= 30.0))    // run code for 30 seconds
  {
   
    imu::Vector<3> acceleration = bno.getVector(Adafruit_BNO055::VECTOR_ACCELEROMETER);

    Serial.println("");  //print accelerometer data to serial (m/s^2)
    Serial.print(acceleration.x(), DEC);
    Serial.print("\t");
    Serial.print(acceleration.y(), DEC);
    Serial.print("\t");
    Serial.print(acceleration.z(), DEC);

    /************************************************************/
    dataFile.println("");
    dataFile.print(acceleration.x(), DEC);
    dataFile.print("\t");
    dataFile.print(acceleration.y(),DEC);
    dataFile.print("\t");
    dataFile.print(acceleration.z(), DEC);
    /**********************************************************/
  
    velx_i = acceleration.x()*Time;  //get velocity from acceleration (m/s^2)*s
    vely_i = acceleration.y()*Time;
    velz_i = acceleration.z()*Time;
        
    Serial.print("\t");  // print velocity data to serial
    Serial.print(velx_i, DEC);
    Serial.print("\t");
    Serial.print(vely_i, DEC);
    Serial.print("\t");
    Serial.print(velz_i, DEC);

    /******************************************************/
    dataFile.print("\t");
    dataFile.print(velx_i, DEC);
    dataFile.print("\t");
    dataFile.print(vely_i, DEC);
    dataFile.print("\t");
    dataFile.print(velz_i, DEC);
    /****************************************************/
        
    imu::Vector<3> gyroscope = bno.getVector(Adafruit_BNO055::VECTOR_GYROSCOPE);
    Serial.print("\t");  // print gyro data to serial (rad/s)
    Serial.print(gyroscope.x(), DEC);
    Serial.print("\t");
    Serial.print(gyroscope.y(), DEC);
    Serial.print("\t");
    Serial.print(gyroscope.z(), DEC); 
    Serial.print("\t");
    Serial.print(Time);
    Serial.print("\t");

    /*************************************************************/
    dataFile.print("\t");
    dataFile.print(gyroscope.x(), DEC);
    dataFile.print("\t");
    dataFile.print(gyroscope.y(), DEC);
    dataFile.print("\t");
    dataFile.print(gyroscope.z(), DEC);
    dataFile.print("\t");
    dataFile.print(Time);
    dataFile.print("\t");
    /************************************************************/

        
    /* Display calibration status for each sensor. */
    uint8_t system, gyro, accel, mag = 0;
    bno.getCalibration(&system, &gyro, &accel, &mag);
    Serial.print("CALIBRATION: Sys=");
    Serial.print(system, DEC);
    Serial.print(" Gyro=");
    Serial.print(gyro, DEC);
    Serial.print(" Accel=");
    Serial.print(accel, DEC);
    Serial.print(" Mag=");
    Serial.println(mag, DEC);

    /******************************************************/
    dataFile.print("CALIBRATION: Sys=");
    dataFile.print(system, DEC);
    dataFile.print(" Gyro=");
    dataFile.print(gyro, DEC);
    dataFile.print(" Accel=");
    dataFile.print(accel, DEC);
    dataFile.print(" Mag=");
    dataFile.print(mag, DEC);

    dataFile.flush();

   
/***********************************************/    
    delay(SAMPLE_RATE_DELAY_MS);

    Time = Time + 1;  // add 1 second to time
  }
}

User avatar
adafruit_support_mike
 
Posts: 67446
Joined: Thu Feb 11, 2010 2:51 pm

Re: Data Logger shield

Post by adafruit_support_mike »

That looks like a baudrate mismatch.

Your setup() function calls Serial.begin(9600). Is your Serial Monitor also set to 9600 baud?

User avatar
tgangi
 
Posts: 21
Joined: Fri Feb 12, 2016 9:11 pm

Re: Data Logger shield

Post by tgangi »

yeah it's set to 9600

User avatar
tgangi
 
Posts: 21
Joined: Fri Feb 12, 2016 9:11 pm

Re: Data Logger shield

Post by tgangi »

if I comment out this part of the code

Code: Select all

if (!SD.begin(chipSelect)) {
    Serial.println("Card failed, or not present");
    // don't do anything more:
    while (1) ;
  }
  Serial.println("card initialized.");
and just do SD.open(chipSelect) it prints "error opening sensordata.txt" I'm still doing this to open the file but obviously something is going wrong:

Code: Select all

sensorData = SD.open("sensordata.txt", FILE_WRITE);
  if (! sensorData) {
    Serial.println("error opening sensordata.txt");
    // Wait forever since we cant write data
    while (1) ;
  }

User avatar
adafruit_support_mike
 
Posts: 67446
Joined: Thu Feb 11, 2010 2:51 pm

Re: Data Logger shield

Post by adafruit_support_mike »

Hrm.. there may be some noise in the signal lines.

Post a photo showing your hardware and connections and we'll take a look. 800x600 images usually work best.

User avatar
tgangi
 
Posts: 21
Joined: Fri Feb 12, 2016 9:11 pm

Re: Data Logger shield

Post by tgangi »

Here's my setup
IMG_5981.jpg
IMG_5981.jpg (953.01 KiB) Viewed 561 times

User avatar
adafruit_support_mike
 
Posts: 67446
Joined: Thu Feb 11, 2010 2:51 pm

Re: Data Logger shield

Post by adafruit_support_mike »

Nothing out of the ordinary there, and the soldering on your BNO055 breakout looks excellent.

Try kicking the Serial baudrate up to about 38400. It's possible that communication with the SD card is messing with the Serial Port's interrupt rate.

User avatar
tgangi
 
Posts: 21
Joined: Fri Feb 12, 2016 9:11 pm

Re: Data Logger shield

Post by tgangi »

Thanks! That helped with the symbols. It still is having trouble initializing the SD card and I'm wondering if I'm trying to make it do 2 things at once with initializing the SD card and the sensor calibration. Any suggestions on what to try to fix this?

User avatar
adafruit_support_mike
 
Posts: 67446
Joined: Thu Feb 11, 2010 2:51 pm

Re: Data Logger shield

Post by adafruit_support_mike »

Can you get the SD code to work on its own, without the BNO055 code? There may be some trouble with the SD card.

User avatar
tgangi
 
Posts: 21
Joined: Fri Feb 12, 2016 9:11 pm

Re: Data Logger shield

Post by tgangi »

Yeah when I run the Datalogger example it creates the file and writes to it fine but when I try it with my code and all it prints is "Base�+" This is my most recent code. I'm using tabs to make it a little easier to read

Code: Select all

#include <Wire.h>
#include <Adafruit_Sensor.h>
#include <Adafruit_BNO055.h>
#include <utility/imumaths.h>
#include <EEPROM.h>
#include <SPI.h>
#include <SD.h>
#include "sensor_data.h"
#include "display_CalStatus.h"
#include "display_SensorOffsets.h"
#include "SD_setup.h"
#include "SD_print.h"

#define SAMPLE_RATE_DELAY_MS (1000)  // how often data is collected

void setup(void)
{
  Serial.begin(57600);  // set serial baud
  Serial.print("Baseball Sensor Data");
  Serial.print("\n");

  SDsetup();  // initializes SD card, opens file

  bno.begin();  // start sensor

  // calibrate sensor or restore previous calibration
  int eeAddress = 0;
  long bnoID;
  bool foundCalib = false;

  EEPROM.get(eeAddress, bnoID);

  adafruit_bno055_offsets_t calibrationData;
  sensor_t sensor;

  bno.getSensor(&sensor);
  if (bnoID != sensor.sensor_id)
  {
    Serial.println("\nNo Calibration Data for this sensor exists in EEPROM");
    delay(500);
  }
  else
  {
    Serial.println("\nFound Calibration for this sensor in EEPROM.");
    eeAddress += sizeof(long);
    EEPROM.get(eeAddress, calibrationData);

    displaySensorOffsets(calibrationData);

    Serial.println("\n\nRestoring Calibration data to the BNO055...");
    bno.setSensorOffsets(calibrationData);

    Serial.println("\n\nCalibration data loaded into BNO055");
    foundCalib = true;
  }

  sensors_event_t event;
  bno.getEvent(&event);
  if (foundCalib)
  {
    Serial.println("Move sensor slightly to calibrate magnetometers");
    while (!bno.isFullyCalibrated())
    {
      bno.getEvent(&event);
      delay(SAMPLE_RATE_DELAY_MS);
    }
  }
  else
  {
    Serial.println("Please Calibrate Sensor: ");
    while (!bno.isFullyCalibrated())
    {
      bno.getEvent(&event);

      Serial.print("X: ");
      Serial.print(event.orientation.x, 4);
      Serial.print("\tY: ");
      Serial.print(event.orientation.y, 4);
      Serial.print("\tZ: ");
      Serial.print(event.orientation.z, 4);

      displayCalStatus();
      Serial.println("");
    }
  }

  Serial.println("\nFully Calibrated");
  Serial.println("Calibration Results: ");
  adafruit_bno055_offsets_t newCalib;
  bno.getSensorOffsets(newCalib);
  displaySensorOffsets(newCalib);

  Serial.println("\n\nStoring calibration data to EEPROM...");

  eeAddress = 0;
  bno.getSensor(&sensor);
  bnoID = sensor.sensor_id;

  EEPROM.put(eeAddress, bnoID);

  eeAddress += sizeof(long);
  EEPROM.put(eeAddress, newCalib);
  Serial.println("Data stored to EEPROM.");

  int8_t temp = bno.getTemp(); //get current temp
  Serial.print("Current Temperature: ");
  Serial.print(temp);
  Serial.println(" C");
  Serial.println("");

  bno.setExtCrystalUse(true);

  // creat data column lables
  Serial.print("Ax \t\t Ay \t\t Az \t\t AM \t\t LAx \t\t LAy \t\t LAz \t\t LAM \t\t Vx \t\t Vy \t\t Vz \t\t VM \t\t Gx \t\t Gy \t\t Gz \t\t GM \t\t Time");

}

void loop()
{
  if (Serial.available())
  {
    int startCode = Serial.parseInt();
    if (startCode == 1)
    {
     
      while (Time <= 30.0)  // run code for 30 seconds
      {
        accelData();
        accelSD();  // prints accel data to SD

        linaccelData();
        imu::Vector<3> linacceleration = bno.getVector(Adafruit_BNO055::VECTOR_LINEARACCEL);
        linaccelSD();

        velx = linacceleration.x() * Time; //get velocity from lin acceleration (m/s^2)*s
        vely = linacceleration.y() * Time;
        velz = linacceleration.z() * Time;

        velData();
        velSD();  // print vel data to SD

        gyroData();
        gyroSD();  //print gyro data to SD

        Serial.print(Time);
        Serial.print("\t");

        /* Display calibration status for each sensor. */
        uint8_t system, gyro, accel, mag = 0;
        bno.getCalibration(&system, &gyro, &accel, &mag);
        Serial.print("CALIBRATION: Sys=");
        Serial.print(system, DEC);
        Serial.print(" Gyro=");
        Serial.print(gyro, DEC);
        Serial.print(" Accel=");
        Serial.print(accel, DEC);
        Serial.print(" Mag=");
        Serial.println(mag, DEC);

        sensorData.close();  // close SD file

        delay(SAMPLE_RATE_DELAY_MS);

        Time = Time + 1; // add 1 second to time
      }
    }
  }
}
SD_print.h:

Code: Select all

void linaccelSD()
{
  imu::Vector<3> linacceleration = bno.getVector(Adafruit_BNO055::VECTOR_LINEARACCEL);

  /************* print  lin accel data to SD file *****************/
  sensorData.print("\t");
  sensorData.print(linacceleration.x(), DEC);
  sensorData.print("\t");
  sensorData.print(linacceleration.y(), DEC);
  sensorData.print("\t");
  sensorData.print(linacceleration.z(), DEC);
  sensorData.print("\t");
}

void accelSD()
{
  imu::Vector<3> acceleration = bno.getVector(Adafruit_BNO055::VECTOR_ACCELEROMETER);

  /************* print accel data to SD file *****************/
  sensorData.print("\t");
  sensorData.print(acceleration.x(), DEC);
  sensorData.print("\t");
  sensorData.print(acceleration.y(), DEC);
  sensorData.print("\t");
  sensorData.print(acceleration.z(), DEC);
  sensorData.print("\t");
  /*******************************************************/

}

void velSD()
{

  /************ print vel data to SD file ******************/
  sensorData.print("\t");
  sensorData.print(velx, DEC);
  sensorData.print("\t");
  sensorData.print(vely, DEC);
  sensorData.print("\t");
  sensorData.print(velz, DEC);
  sensorData.print("\t");
  /********************************************************/


}

void gyroSD()
{
  imu::Vector<3> gyroscope = bno.getVector(Adafruit_BNO055::VECTOR_GYROSCOPE);

  /*************** print gyro data to SD file ***************/
  sensorData.print("\t");
  sensorData.print(gyroscope.x(), DEC);
  sensorData.print("\t");
  sensorData.print(gyroscope.y(), DEC);
  sensorData.print("\t");
  sensorData.print(gyroscope.z(), DEC);
  sensorData.print("\t");
  sensorData.print(Time);
  sensorData.print("\t");
  /*********************************************************/

}

SD_setup.h:

Code: Select all

/****** set chip select value *******/
const int chipSelect = 10;
/***********************************/
File sensorData ;
/************** Initialize SD Card **************/
void SDsetup()
{
  Serial.print("Initializing SD card...");
  // make sure that the default chip select pin is set to
  // output, even if you don't use it:
  pinMode(SS, OUTPUT);

  // see if the card is present and can be initialized:
  if (!SD.begin(chipSelect))
  {
    Serial.println("Card failed, or not present");
    // don't do anything more:
    while (1) ;
  }
  Serial.println("card initialized.");

  // Open up the file we're going to log to!
  sensorData = SD.open("data.txt", FILE_WRITE);
  if (! sensorData)
  {
    Serial.println("error opening sensordata.txt");
    // Wait forever since we cant write data
    while (1) ;
  }
}
/****************************************************/
display_CalStatus.h:

Code: Select all

void displayCalStatus(void)
{
  uint8_t system, gyro, accel, mag;
  system = gyro = accel = mag = 0;
  bno.getCalibration(&system, &gyro, &accel, &mag);

  Serial.print("\t");
  if (!system)
  {
    Serial.print("! ");
  }

  Serial.print("Sys:");
  Serial.print(system, DEC);
  Serial.print(" G:");
  Serial.print(gyro, DEC);
  Serial.print(" A:");
  Serial.print(accel, DEC);
  Serial.print(" M:");
  Serial.print(mag, DEC);
}
display_SensorOffsets.h:

Code: Select all

void displaySensorOffsets(const adafruit_bno055_offsets_t &calibData)
{
  Serial.print("Accelerometer: ");
  Serial.print(calibData.accel_offset_x); Serial.print(" ");
  Serial.print(calibData.accel_offset_y); Serial.print(" ");
  Serial.print(calibData.accel_offset_z); Serial.print(" ");

  Serial.print("\nGyro: ");
  Serial.print(calibData.gyro_offset_x); Serial.print(" ");
  Serial.print(calibData.gyro_offset_y); Serial.print(" ");
  Serial.print(calibData.gyro_offset_z); Serial.print(" ");

  Serial.print("\nMag: ");
  Serial.print(calibData.mag_offset_x); Serial.print(" ");
  Serial.print(calibData.mag_offset_y); Serial.print(" ");
  Serial.print(calibData.mag_offset_z); Serial.print(" ");

  Serial.print("\nAccel Radius: ");
  Serial.print(calibData.accel_radius);

  Serial.print("\nMag Radius: ");
  Serial.print(calibData.mag_radius);
}
sensor_data.h:

Code: Select all

Adafruit_BNO055 bno = Adafruit_BNO055(55);
float Time = 0;
float velx = 0;
float vely = 0;
float velz = 0;
float accelMag;
float linaccelMag;
float velMag;
float gyroMag;

void accelData()
{
  imu::Vector<3> acceleration = bno.getVector(Adafruit_BNO055::VECTOR_ACCELEROMETER);

  Serial.println("");  //print accelerometer data to serial (m/s^2)
  Serial.print(acceleration.x(), DEC);
  Serial.print("\t");
  Serial.print(acceleration.y(), DEC);
  Serial.print("\t");
  Serial.print(acceleration.z(), DEC);

  accelMag = sqrt((acceleration.x() * acceleration.x()) + (acceleration.y() * acceleration.y()) + (acceleration.z() * acceleration.z()));
  Serial.print("\t");
  Serial.print(accelMag, DEC);
}

void linaccelData()
{
  imu::Vector<3> linacceleration = bno.getVector(Adafruit_BNO055::VECTOR_LINEARACCEL);
  Serial.print("\t");
  Serial.print(linacceleration.x(), DEC);
  Serial.print("\t");
  Serial.print(linacceleration.y(), DEC);
  Serial.print("\t");
  Serial.print(linacceleration.z(), DEC);

  linaccelMag = sqrt((linacceleration.x() * linacceleration.x()) + (linacceleration.y() * linacceleration.y()) + (linacceleration.z() * linacceleration.z()));
  Serial.print("\t");
  Serial.print(linaccelMag, DEC);
}

void velData()
{

  Serial.print("\t");  // print velocity data to serial
  Serial.print(velx, DEC);
  Serial.print("\t");
  Serial.print(vely, DEC);
  Serial.print("\t");
  Serial.print(velz, DEC);

  velMag = sqrt((velx * velx) + (vely * vely) + (velz * velz));
  Serial.print("\t");
  Serial.print(velMag, DEC);
}

void gyroData()
{
  imu::Vector<3> gyroscope = bno.getVector(Adafruit_BNO055::VECTOR_GYROSCOPE);
  Serial.print("\t");  // print gyro data to serial (rad/s)
  Serial.print(gyroscope.x(), DEC);
  Serial.print("\t");
  Serial.print(gyroscope.y(), DEC);
  Serial.print("\t");
  Serial.print(gyroscope.z(), DEC);
  Serial.print("\t");

  gyroMag = sqrt((gyroscope.x() * gyroscope.x()) + (gyroscope.y() * gyroscope.y()) + (gyroscope.z() * gyroscope.z()));
  Serial.print(gyroMag, DEC);
  Serial.print("\t");
}

User avatar
gammaburst
 
Posts: 1015
Joined: Thu Dec 31, 2015 12:06 pm

Re: Data Logger shield

Post by gammaburst »

When I compile your code for Arduino UNO, it warns:

Sketch uses 24,548 bytes (76%) of program storage space. Maximum is 32,256 bytes. Global variables use 1,890 bytes (92%) of dynamic memory, leaving 158 bytes for local variables. Maximum is 2,048 bytes. Low memory available, stability problems may occur.

That could be your problem - big program leaves very little room for stack. Stack overflow can cause strange behavior, crashing, etc.

User avatar
tgangi
 
Posts: 21
Joined: Fri Feb 12, 2016 9:11 pm

Re: Data Logger shield

Post by tgangi »

Thank you! I was able to decrease the dynamic memory and it finally runs. Unfortunately most of the time it is still not recognizing the SD card or the card failing for some reason.

User avatar
gammaburst
 
Posts: 1015
Joined: Thu Dec 31, 2015 12:06 pm

Re: Data Logger shield

Post by gammaburst »

You may still have insufficient memory. This page talks about memory space troubleshooting, and mentions SD cards:
https://learn.adafruit.com/memories-of- ... o?view=all

Locked
Please be positive and constructive with your questions and comments.

Return to “Arduino Shields from Adafruit”