Go Down

Topic: RTC, logging shield (Read 294 times) previous topic - next topic


Good Morning, evening, what ever :-)

Refering to this (nice and easy one):

I did post the following question:
Nice and easy project, thank you.
What I like to do, but do not have the knowledge to do, is to stack another shield,
"XD-204 Data Logger Shield | RTC | Data Logger for Arduino UNO" from ebay.
I did try to write my code myself, but ........
Anyone outthere can help out with that, will be most appreciated :-)
end qouting

The instructables is quite old, so I did not get any answer, I am sure this is an easy one
for most of you out there, so I hope some kind soule can help me out :-)

Thank You.


Here is a sketch I have so far, an Arduino UNO, RTC logging shield and a key pad LCD shield stacked.
And a BMP180 sensor.
This one works, but suggestions to add logging to this.
I did try meny things but non of them works, so a clue how to do it would be nice.

Thank You.


#include <SFE_BMP180.h>
#include <Wire.h>
#include "RTClib.h"
#include <LiquidCrystal.h>

LiquidCrystal lcd(8, 9, 4, 5, 6, 7); // Keypad Shield
SFE_BMP180 pressure;
#define BMP (0x77));
#define DS3231_I2C_ADDRESS 0x68
// Altitude of home.
#define ALTITUDE 60.0
char daysOfTheWeek[7][12] = {"Sun","Mon", "Tue", "Wed", "Thu", "Fri", "Sat"};
void setup()
 lcd.begin(16, 2);

 lcd.setCursor(15, 1);
 lcd.setCursor(7, 1);
   // sets time and date data to DS3231
   Wire.write(0); // set next input to start at the seconds register


 Serial.println(); // New line
 Serial.print("Provided Altitude:\n");
 Serial.print(ALTITUDE, 0);
 Serial.print(" meters, ");
 Serial.print(ALTITUDE * 3.28084, 0);
 Serial.println(" feet\n");
 Serial.print("Read BMP180 Pressure Sensor:\n");

 if (pressure.begin())
   Serial.println("BMP180 init success");
   Serial.println("BMP180 init fail\n\n");
   while (1); // Pause forever.

void loop()

 char status;
 double T, P, p0, a;
 Serial.println(); // New line

 status = pressure.startTemperature();
 if (status != 0)

   DateTime now = RTC.now();
   char dateBuffer[12];

   sprintf(dateBuffer, "%02u-%02u-%04u ", now.day(), now.month(), now.year());

   lcd.setCursor(0, 0);
   sprintf(dateBuffer, "%02u-%02u ", now.day(), now.month());

   sprintf(dateBuffer, "%02u:%02u:%02u ", now.hour(), now.minute(), now.second());

   lcd.setCursor(6, 0);
   sprintf(dateBuffer, "%02u:%02u ", now.hour(), now.minute());

   lcd.setCursor(12, 0);
   // lcd.print(now.dayOfTheWeek());
   //  Serial.println();

   // Wait for the measurement to complete:

   //  Serial.print("Read BMP180 Temperature Sensor:\n");
   status = pressure.getTemperature(T);
   if (status != 0)
     Serial.print(" ");
     Serial.print(T, 2);

     lcd.setCursor(10, 1);
     lcd.print(T, 2);

     Serial.print(" deg C, ");
     Serial.print((9.0 / 5.0)*T + 32.0, 2);
     Serial.print(" deg F  ");

     status = pressure.startPressure(3);
     if (status != 0)
       // Wait for the measurement to complete:

       status = pressure.getPressure(P, T);
       if (status != 0)
         // Print out the measurement:
         // Serial.print("Absolute Pressure: ");
         Serial.print(P, 2);
         lcd.setCursor(0, 1);
         lcd.print(P, 2);
         Serial.print(" mb, ");
         Serial.print(P * 0.0295333727, 2);
         Serial.print(" inHg");
       else Serial.println("error retrieving pressure measurement\n");
     else Serial.println("error starting pressure measurement\n");
   else Serial.println("error retrieving temperature measurement\n");
 else Serial.println("error starting temperature measurement\n");

 delay(5000);  // Pause for 5 seconds.


|| | ||| | || | ||  ~Woodstock

Please do not PM with technical questions or comments.  Keep Arduino stuff out on the boards where it belongs.

Go Up