SlideShare ist ein Scribd-Unternehmen logo
1 von 41
Datalogging on an Arduino

DESERT CODE CAMP 2013.1
               Presented by Don Doerres
               Embedded Pro Guy
               don@azlaborlaw.com
TODAY’S TAKEAWAYS

 The Arduino is a good starting point for a
  data logger, a device used to obtain and
  store data over a long period of time
 The Arduino with a few add-ins is capable of
     Storing data with time tags
     Displaying data in real time

     Doing these tasks without tying up a bigger
      computer
IDEA WAS TO LOG WEATHER

 I started with a barometer (BMP085) and a
  humidity sensor (DHT11)
 Both of these also provide temperature
  information
 Power came from a desktop computer
  through USB cable to Arduino, Arduino to
  breadboard
FIRST BREADBOARD
SERIOUS WEATHER…
WEATHER WATCHING…

 Observing an approaching dust storm, I
  realized that I didn’t want to leave the
  computer or sensors outside
 Barometric pressure turned out to be
  adequate for storm tracking
 Indoors, humidity did not change much

 So, I decided to record barometric pressure
  and temperature
ORIGINALLY USED PC

 Used Tera Term (Terminal Emulator) to log
  data
 Tera Term added time stamp from PC clock

 Once prototype was working, wanted to
  move time keeping function and data logging
  to Arduino and not tie up PC
ARDUINO TIMING SIX MINUTES,
WRITING TO SERIAL PORT
        Tera Term Screen




          Tera Term Log File—Adds Time Stamp
ORIGINAL PLAN: CHRONODOT & SD BREAKOUT

 Chronodot is a highly accurate clock with
  battery backup
 SD Breakout allows simple connection to SD
  card
 However, the combination would simply not
  fit on an Arduino breakout shield, let alone
  any sensors
DOT AND SD ON ARDUINO BREADBOARD

Dot




 SD
 breakout




         This picture shows the Dot and the SD card breakout
         This works as a breadboard, but is too big for a
          shield
ADAFRUIT INTRODUCED A DATA LOGGER SHIELD

 About the time I realized that my logger
  would not fit on a prototype shield, Adafruit
  introduced their new logger shield
 This had a slightly lower accuracy clock than
  the Dot, but it had everything else in surface
  mount parts
 All I had to do was add the pressure sensor
  and a connection to a 16X2 LCD display
ADAFRUIT LOGGER SHIELD
                     Battery Holder
                                         SD Holder
 DS1307 RTC




     Adafruit logger shield
     Surface mount parts left prototype area quite large
      enough for sensors
     Add an I2C 16X2 LCD display
SENSOR SELECTION

 This is the BMP085 pressure sensor
 This is a sensitive barometer/altimeter and
  temperature sensor
 It runs on 5V

 It has an I2C interface
I2C BUS

 This is a very simple serial Inter-Integrated
  Circuit connection bus, hence I2C
 The interface consists of Clock, Data, and
  ground
 Multiple devices can be hooked to the same
  bus as long as they have different addresses
 The devices I used, pressure sensor
  (address 0x77) and display (address 0), do
  have different addresses
BMP085 CONNECTION TO ARDUINO
16X2 LCD DISPLAY WITH I2C BACKPACK

   This is a back view showing the four wire
    connections—same connections as BMP085




                                          GND To GND
                  DAT to A4
                              CLK to A5
                                          5V To 5V
OTHER CONNECTIONS

 The SD breakout and the Clock are already
  wired up on the shield
 The pressure sensor I soldered to the I2C
  connection pads on the shield
 The LCD display I simply plugged in to the
  shield
 The BMP and the LCD display have different
  I2C addresses, so there is no conflict
TYPICAL DISPLAY

 Date (Year not shown), local time
 Temperature in F, Pressure in mmHG

 Display updates every 5 seconds

 Data is stored to SD card every 6 minutes
WHAT GOES ON THE SD CARD

 The log is Comma Separated Values (CSV)
  of Time, Temperature, Pressure
 Time is stored as a ‘C’ time stamp (more
  about this in two slides)
 Temperature is degrees F

 Pressure is in millimeters of Mercury (mmHg)
SAMPLE OF LOG FILE
 1363516494,79.0,691.0
 1363516868,79.0,691.0
 1363517243,79.0,691.0
 1363517617,79.1,691.1
 1363517991,79.1,691.1
 1363518365,79.1,691.1
 1363518740,79.1,691.1
 1363519114,79.2,691.2
 1363519488,79.2,691.2
 1363519862,79.2,691.2
 1363520237,79.2,691.2
 1363520611,79.1,691.1
 1363520985,79.2,691.2
 1363521359,79.1,691.1
 1363521734,79.1,691.1
 1363522108,79.2,691.2
 1363522482,79.2,691.2
 1363522857,79.2,691.2
 1363523231,79.2,691.2
 1363523605,79.2,691.2
 1363523979,79.2,691.2
 1363524354,79.2,691.2
 1363524728,79.1,691.1
 1363525102,79.1,691.1
 1363525476,79.1,691.1
THE CTIME STAMP

 The C language uses as a time stamp the
  number of seconds since January 1, 1970
 A 32 bit signed integer allows counting
  seconds until January 19, 2038 at 03:14:07
  GMT
 …by then, we will likely switch to 64 bit
  integers
 And, yes, the value is a signed integer so
  that comparisons can be readily made
DISPLAYING IN EXCEL OR OTHER SPREADSHEET

 It is simple to convert ctime to Excel time
 The macro is, using ‘A2’ as a sample cell:
                =DATE(1970,1,1)+(A2)/86400


   Display format is controlled with Excel
    formatting
              CTIME    Increase Delta    Day      Date         Time Deg F     mmHg
            1363504243         0     0   Sun   Mar 17, 2013   07:10:43 74.2    691.2
            1363506389      2146 2146    Sun   Mar 17, 2013   07:46:29 75.4    691.4
            1363506764      2521  375    Sun   Mar 17, 2013   07:52:44 76.7    691.7
            1363507138      2895  374    Sun   Mar 17, 2013   07:58:58 77.5    691.5
            1363507512      3269  374    Sun   Mar 17, 2013   08:05:12 77.4    691.4
            1363507886      3643  374    Sun   Mar 17, 2013   08:11:26 77.3    691.3
            1363508261      4018  375    Sun   Mar 17, 2013   08:17:41 77.3    691.3
LIBRARIES
UNITS

 The units of the BMP085 pressure sensor
  are Degrees C and pressure in Pascals
 Conversions are in order


        tempy = bmp.readTemperature();
        tempy = (tempy * 9.0 / 5.0) + 32.0;

        press = bmp.readPressure();
        fpress = (float)press* 0.007500616827042;
TIMESET.INO, 1 OF 2
// timeSet.ino

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

LiquidCrystal lcd(0);
RTC_DS1307 RTC;
DateTime now;

void setup()
{
Serial.begin(57600);
Wire.begin();
RTC.begin();
RTC.adjust(DateTime(__DATE__, __TIME__));
lcd.begin(16, 2);
lcd.setBacklight(HIGH); //HIGH is ON, LOW is OFF
}
TIMESET.INO, 2 OF 2
void loop()
{
   now = RTC.now();
   lcd.setCursor(0, 0);
   lcd.print(now.year(), DEC);
   lcd.print('/');
    if(now.month() < 10) lcd.print("0");
    lcd.print(now.month(), DEC);
    lcd.print('/');
    if(now.day() < 10) lcd.print("0");
    lcd.print(now.day(), DEC);
    lcd.setCursor(0, 1);
    if(now.hour() < 10) lcd.print("0");
    lcd.print(now.hour(), DEC);
    lcd.print(':');
    if(now.minute() < 10) lcd.print("0");
    lcd.print(now.minute(), DEC);
    lcd.print(':');
    if(now.second() < 10) lcd.print("0");
    lcd.print(now.second(), DEC);
   delay(2000);
}
AUGUST 11, 2012 STORM IN PHOENIX

   About 10 hours of plot


                                BMP_mmHg
             719.60

             719.40

             719.20

             719.00

             718.80

             718.60

             718.40

             718.20
                      0   100   200   300   400   500   600
39 HOTEL FLOORS AT
LAS VEGAS FOUR SEASONS
 Stepped up the logging rate to once per
  second
 Three round trips
                         706

                         704

                         702

                         700

                         698

                         696
                         694

                         692
                  -500         0   500   1000   1500   2000
FUTURE WORK

 Add time setting over serial while running
 Seems to be a small temperature rise of
  about 2 degrees F with the display running
 Add fancier display, perhaps a 1 hour plot of
  data on a dot matrix display
DCC_DATALOGGER_3.INO 1 OF 9
// DCC_DataLogger.ino
#include <Wire.h>
#include <RTClib.h>
#include <Adafruit_BMP085.h>
#include <LiquidCrystal.h>
#include <SD.h>

// On display, connect via i2c, default address #0 (A0-A2 not jumpered)
LiquidCrystal lcd(0);

RTC_DS1307 RTC;
Adafruit_BMP085 bmp;
const int chipSelect = 10;

File dataFile;

unsigned long int press; // press is a long
float tempy; // temperature is a float
float fpress;
int loopSec = 0;
int loopMin = 0;
int num;
// make a string for assembling the data to log:
String dataString = "";

DateTime now;
DCC_DATALOGGER_3.INO 2 OF 9
void setup()
{
Serial.begin(57600);
Wire.begin();
RTC.begin();
bmp.begin();

// set up the LCD's number of rows and columns:
lcd.begin(16, 2);
lcd.setBacklight(HIGH); //HIGH is ON, LOW is OFF

if (! RTC.isrunning())
    {
    Serial.println("RTC is NOT running!");
    // following line sets the RTC to the date & time this sketch was compiled
    RTC.adjust(DateTime(__DATE__, __TIME__));
    }
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);
DCC_DATALOGGER_3.INO 3 OF 9
// 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!
  // This is an APPEND open
dataFile = SD.open("datalog.txt", FILE_WRITE);
if (! dataFile)
    {
    Serial.println("error opening datalog.txt");
    // Wait forever since we can't write data
    while (1) ;
    }
}
DCC_DATALOGGER_3.INO 4 OF 9
void loop()
{
static int i;

if ( (loopSec % 5) == 0)
    {
    //Serial.println(__DATE__, __TIME__);
    tempy = bmp.readTemperature();
    tempy = (tempy * 9.0 / 5.0) + 32.0;
    press = bmp.readPressure();
    fpress = (float)press* 0.007500616827042;

   now = RTC.now();

   Serial.print(now.year(), DEC);
   Serial.print('/');
   if(now.month() < 10) Serial.print("0");
   Serial.print(now.month(), DEC);
   Serial.print('/');
   if(now.day() < 10) Serial.print("0");
   Serial.print(now.day(), DEC);
   Serial.print(' ');
DCC_DATALOGGER_3.INO 5 OF 9
if(now.hour() < 10) Serial.print("0");
    Serial.print(now.hour(), DEC);
    Serial.print(':');
    if(now.minute() < 10) Serial.print("0");
    Serial.print(now.minute(), DEC);
    Serial.print(':');
    if(now.second() < 10) Serial.print("0");
    Serial.print(now.second(), DEC);
    Serial.println();

   Serial.print("C time is = ");
   Serial.println(now.unixtime());

   lcd.setCursor(0, 0);
   // lcd.print(now.year(), DEC);
   // lcd.print('/');
   if(now.month() < 10) lcd.print("0");
   lcd.print(now.month(), DEC);
   lcd.print('/');
   if(now.day() < 10) lcd.print("0");
   lcd.print(now.day(), DEC);
   lcd.print("   ");
DCC_DATALOGGER_3.INO 6 OF 9
if(now.hour() < 10) lcd.print("0");
   lcd.print(now.hour(), DEC);
   lcd.print(':');
   if(now.minute() < 10) lcd.print("0");
   lcd.print(now.minute(), DEC);
   lcd.print(':');
   if(now.second() < 10) lcd.print("0");
   lcd.print(now.second(), DEC);

   lcd.setCursor(0, 1);
   lcd.print(tempy,1);
   lcd.print("F");

   lcd.print(" ");
   lcd.print(fpress,1);
   lcd.print("mmHg");

   Serial.print(tempy,1);
   Serial.print(" Deg F, ");
   Serial.print(fpress,1);
   Serial.println(" mmHgn");
   }
DCC_DATALOGGER_3.INO 7 OF 9
delay(1000);
loopSec+=1;

if(loopSec == 360) // 6 minutes
    {
    static bool lcdStatus = true; // LCD light on or off
    loopSec = 0;

    lcd.clear();
    lcd.setCursor(0, 0);
    lcd.print("Writing SD...");

    dataString = String(now.unixtime());
    dataString += ",";
    num = tempy;
    dataString += String(num);
    dataString += ".";
    tempy-=num;
    tempy+=0.05;
    tempy*=10.0;
    num=tempy;
    dataString+=String(num);
    dataString += ",";
    num = fpress;
    dataString += String(num);
DCC_DATALOGGER_3.INO 8 OF 9
dataString += ".";
    fpress-=num;
    fpress+=0.05;
    fpress*=10.0;
    num = tempy;
    dataString +=String(num);

    dataFile.println(dataString);


    // The following line will 'save' the file to the SD card after every
    // line of data - this will use more power and slow down how much data
    // you can read but it's safer!
    // If you want to speed up the system, remove the call to flush() and it
    // will save the file only every 512 bytes - every time a sector on the
    // SD card is filled with data.
    dataFile.flush();
    delay(1000);
    lcd.clear();

    // To check out if display LED was causing warming,
    // cycle it off/on every six minutes
    // #define LEDONOFF
    #ifdef LEDONOFF
    lcdStatus = !lcdStatus;
DCC_DATALOGGER_3.INO 9 OF 9
if(lcdStatus)
         {
       lcd.setBacklight(HIGH); //HIGH is ON, LOW is OFF
         }
    else
         {
         lcd.setBacklight(LOW); //HIGH is ON, LOW is OFF
         }
    #endif
    }
}
DOWNLOADS 1

 Grateful to Lady Ada!!!!
 Adafruit SD library:

https://github.com/adafruit/SD
 Adafruit RTC library:

https://github.com/adafruit/RTClib
 Adafruit logging shield tutorial:

http://learn.adafruit.com/adafruit-data-logger-
  shield
DOWNLOADS 2

 LCD i2c backpack tutorial
 http://learn.adafruit.com/i2c-spi-lcd-backpack

 Liquid Crystal control library

 https://github.com/adafruit/LiquidCrystal
QUESTIONS?

   Find more slides from Don at
    www.slideshare.net/dondoerres

Weitere ähnliche Inhalte

Was ist angesagt?

Datasheet Fluke Data Acquisition System. Hubungi PT. Siwali Swantika 021-4585...
Datasheet Fluke Data Acquisition System. Hubungi PT. Siwali Swantika 021-4585...Datasheet Fluke Data Acquisition System. Hubungi PT. Siwali Swantika 021-4585...
Datasheet Fluke Data Acquisition System. Hubungi PT. Siwali Swantika 021-4585...PT. Siwali Swantika
 
The SRC Platinum - A Vacuum Steam Outdoor Reset Control
The SRC Platinum - A Vacuum Steam Outdoor Reset ControlThe SRC Platinum - A Vacuum Steam Outdoor Reset Control
The SRC Platinum - A Vacuum Steam Outdoor Reset ControlHeat-Timer Corporation
 
Tps3305 33
Tps3305 33Tps3305 33
Tps3305 33____
 
110 MSPS/140 MSPS Analog Interface
110 MSPS/140 MSPS Analog Interface110 MSPS/140 MSPS Analog Interface
110 MSPS/140 MSPS Analog InterfaceHua Duy Tien
 
Precision Temperature Scanner - the 1586A Super DAQ by Fluke Calibration
Precision Temperature Scanner - the 1586A Super DAQ by Fluke CalibrationPrecision Temperature Scanner - the 1586A Super DAQ by Fluke Calibration
Precision Temperature Scanner - the 1586A Super DAQ by Fluke CalibrationFluke Calibration
 
Brosur Fluke Bench Multimeter. Hubungi PT. Siwali Swantika 021-45850618
Brosur Fluke Bench Multimeter. Hubungi PT. Siwali Swantika 021-45850618Brosur Fluke Bench Multimeter. Hubungi PT. Siwali Swantika 021-45850618
Brosur Fluke Bench Multimeter. Hubungi PT. Siwali Swantika 021-45850618PT. Siwali Swantika
 
Datasheet Fluke Hydra Series III. Hubungi PT. Siwali Swantika 021-45850618
Datasheet Fluke Hydra Series III. Hubungi PT. Siwali Swantika 021-45850618Datasheet Fluke Hydra Series III. Hubungi PT. Siwali Swantika 021-45850618
Datasheet Fluke Hydra Series III. Hubungi PT. Siwali Swantika 021-45850618PT. Siwali Swantika
 
Fluke Data Acquisition System Selection Guide. Hubungi PT. Siwali Swantika 02...
Fluke Data Acquisition System Selection Guide. Hubungi PT. Siwali Swantika 02...Fluke Data Acquisition System Selection Guide. Hubungi PT. Siwali Swantika 02...
Fluke Data Acquisition System Selection Guide. Hubungi PT. Siwali Swantika 02...PT. Siwali Swantika
 
Datasheet Fluke 9190A. Hubungi PT. Siwali Swantika 021-45850618
Datasheet Fluke 9190A. Hubungi PT. Siwali Swantika 021-45850618Datasheet Fluke 9190A. Hubungi PT. Siwali Swantika 021-45850618
Datasheet Fluke 9190A. Hubungi PT. Siwali Swantika 021-45850618PT. Siwali Swantika
 
Android Things in action
Android Things in actionAndroid Things in action
Android Things in actionStefano Sanna
 
HX Controlador temperatura Hanyoung NUX (www.nammisa.com)
HX Controlador temperatura Hanyoung NUX (www.nammisa.com)HX Controlador temperatura Hanyoung NUX (www.nammisa.com)
HX Controlador temperatura Hanyoung NUX (www.nammisa.com)Hanyoung NUX
 

Was ist angesagt? (15)

Datasheet Fluke Data Acquisition System. Hubungi PT. Siwali Swantika 021-4585...
Datasheet Fluke Data Acquisition System. Hubungi PT. Siwali Swantika 021-4585...Datasheet Fluke Data Acquisition System. Hubungi PT. Siwali Swantika 021-4585...
Datasheet Fluke Data Acquisition System. Hubungi PT. Siwali Swantika 021-4585...
 
The SRC Platinum - A Vacuum Steam Outdoor Reset Control
The SRC Platinum - A Vacuum Steam Outdoor Reset ControlThe SRC Platinum - A Vacuum Steam Outdoor Reset Control
The SRC Platinum - A Vacuum Steam Outdoor Reset Control
 
Tps3305 33
Tps3305 33Tps3305 33
Tps3305 33
 
110 MSPS/140 MSPS Analog Interface
110 MSPS/140 MSPS Analog Interface110 MSPS/140 MSPS Analog Interface
110 MSPS/140 MSPS Analog Interface
 
Precision Temperature Scanner - the 1586A Super DAQ by Fluke Calibration
Precision Temperature Scanner - the 1586A Super DAQ by Fluke CalibrationPrecision Temperature Scanner - the 1586A Super DAQ by Fluke Calibration
Precision Temperature Scanner - the 1586A Super DAQ by Fluke Calibration
 
Brosur Fluke Bench Multimeter. Hubungi PT. Siwali Swantika 021-45850618
Brosur Fluke Bench Multimeter. Hubungi PT. Siwali Swantika 021-45850618Brosur Fluke Bench Multimeter. Hubungi PT. Siwali Swantika 021-45850618
Brosur Fluke Bench Multimeter. Hubungi PT. Siwali Swantika 021-45850618
 
Datasheet Fluke Hydra Series III. Hubungi PT. Siwali Swantika 021-45850618
Datasheet Fluke Hydra Series III. Hubungi PT. Siwali Swantika 021-45850618Datasheet Fluke Hydra Series III. Hubungi PT. Siwali Swantika 021-45850618
Datasheet Fluke Hydra Series III. Hubungi PT. Siwali Swantika 021-45850618
 
Fluke Data Acquisition System Selection Guide. Hubungi PT. Siwali Swantika 02...
Fluke Data Acquisition System Selection Guide. Hubungi PT. Siwali Swantika 02...Fluke Data Acquisition System Selection Guide. Hubungi PT. Siwali Swantika 02...
Fluke Data Acquisition System Selection Guide. Hubungi PT. Siwali Swantika 02...
 
Datasheet Fluke 9190A. Hubungi PT. Siwali Swantika 021-45850618
Datasheet Fluke 9190A. Hubungi PT. Siwali Swantika 021-45850618Datasheet Fluke 9190A. Hubungi PT. Siwali Swantika 021-45850618
Datasheet Fluke 9190A. Hubungi PT. Siwali Swantika 021-45850618
 
4511
45114511
4511
 
Android Things in action
Android Things in actionAndroid Things in action
Android Things in action
 
Nlc co y-na60_02
Nlc co y-na60_02Nlc co y-na60_02
Nlc co y-na60_02
 
HX Controlador temperatura Hanyoung NUX (www.nammisa.com)
HX Controlador temperatura Hanyoung NUX (www.nammisa.com)HX Controlador temperatura Hanyoung NUX (www.nammisa.com)
HX Controlador temperatura Hanyoung NUX (www.nammisa.com)
 
Hakko 936 schematic
Hakko 936 schematicHakko 936 schematic
Hakko 936 schematic
 
Gnu linux on arm for $50 - $100
Gnu linux on arm for $50 - $100Gnu linux on arm for $50 - $100
Gnu linux on arm for $50 - $100
 

Ähnlich wie 2013 1 arduino_datalogger

Design of Temperature Data Logger Using Thermocouple
Design of Temperature Data Logger Using ThermocoupleDesign of Temperature Data Logger Using Thermocouple
Design of Temperature Data Logger Using ThermocoupleIRJET Journal
 
Using Ready-for-PIC and SDR Libraries
Using Ready-for-PIC and SDR LibrariesUsing Ready-for-PIC and SDR Libraries
Using Ready-for-PIC and SDR LibrariesCorrado Santoro
 
Digital Alarm Clock 446 project report
Digital Alarm Clock 446 project reportDigital Alarm Clock 446 project report
Digital Alarm Clock 446 project reportAkash Mhankale
 
Intel galileo gen 2
Intel galileo gen 2Intel galileo gen 2
Intel galileo gen 2srknec
 
Interfacing Of PIC 18F252 Microcontroller with Real Time Clock via I2C Protocol
Interfacing Of PIC 18F252 Microcontroller with Real Time Clock via I2C ProtocolInterfacing Of PIC 18F252 Microcontroller with Real Time Clock via I2C Protocol
Interfacing Of PIC 18F252 Microcontroller with Real Time Clock via I2C ProtocolIJERA Editor
 
ARDUINO BASED TIME AND TEMPERATURE DISPLAY
ARDUINO BASED TIME AND TEMPERATURE DISPLAY ARDUINO BASED TIME AND TEMPERATURE DISPLAY
ARDUINO BASED TIME AND TEMPERATURE DISPLAY ajit kumar singh
 
Udayan_219209024_DA1001_FTP.pptx
Udayan_219209024_DA1001_FTP.pptxUdayan_219209024_DA1001_FTP.pptx
Udayan_219209024_DA1001_FTP.pptxSyncrotrone
 
Gas leakage detection system
Gas leakage detection systemGas leakage detection system
Gas leakage detection systemAashiq Ahamed N
 
Chp7 pic 16 f84 interfacing - copy
Chp7 pic 16 f84 interfacing - copyChp7 pic 16 f84 interfacing - copy
Chp7 pic 16 f84 interfacing - copymkazree
 

Ähnlich wie 2013 1 arduino_datalogger (20)

Anup2
Anup2Anup2
Anup2
 
Design of Temperature Data Logger Using Thermocouple
Design of Temperature Data Logger Using ThermocoupleDesign of Temperature Data Logger Using Thermocouple
Design of Temperature Data Logger Using Thermocouple
 
Bidirect visitor counter
Bidirect visitor counterBidirect visitor counter
Bidirect visitor counter
 
Lcd12 a64
Lcd12 a64Lcd12 a64
Lcd12 a64
 
Using Ready-for-PIC and SDR Libraries
Using Ready-for-PIC and SDR LibrariesUsing Ready-for-PIC and SDR Libraries
Using Ready-for-PIC and SDR Libraries
 
Digital Alarm Clock 446 project report
Digital Alarm Clock 446 project reportDigital Alarm Clock 446 project report
Digital Alarm Clock 446 project report
 
a simple bcd counter project
a simple bcd counter projecta simple bcd counter project
a simple bcd counter project
 
Real Time Embedded System
Real Time Embedded SystemReal Time Embedded System
Real Time Embedded System
 
Server/Client Remote platform logger.
Server/Client Remote platform logger.Server/Client Remote platform logger.
Server/Client Remote platform logger.
 
Intel galileo gen 2
Intel galileo gen 2Intel galileo gen 2
Intel galileo gen 2
 
Ds1307 datasheet
Ds1307 datasheetDs1307 datasheet
Ds1307 datasheet
 
Em s7 plc
Em s7 plcEm s7 plc
Em s7 plc
 
FINISHED_CODE
FINISHED_CODEFINISHED_CODE
FINISHED_CODE
 
Interfacing Of PIC 18F252 Microcontroller with Real Time Clock via I2C Protocol
Interfacing Of PIC 18F252 Microcontroller with Real Time Clock via I2C ProtocolInterfacing Of PIC 18F252 Microcontroller with Real Time Clock via I2C Protocol
Interfacing Of PIC 18F252 Microcontroller with Real Time Clock via I2C Protocol
 
chapter 4
chapter 4chapter 4
chapter 4
 
ARDUINO BASED TIME AND TEMPERATURE DISPLAY
ARDUINO BASED TIME AND TEMPERATURE DISPLAY ARDUINO BASED TIME AND TEMPERATURE DISPLAY
ARDUINO BASED TIME AND TEMPERATURE DISPLAY
 
Udayan_219209024_DA1001_FTP.pptx
Udayan_219209024_DA1001_FTP.pptxUdayan_219209024_DA1001_FTP.pptx
Udayan_219209024_DA1001_FTP.pptx
 
Presentation1 (1)
Presentation1 (1)Presentation1 (1)
Presentation1 (1)
 
Gas leakage detection system
Gas leakage detection systemGas leakage detection system
Gas leakage detection system
 
Chp7 pic 16 f84 interfacing - copy
Chp7 pic 16 f84 interfacing - copyChp7 pic 16 f84 interfacing - copy
Chp7 pic 16 f84 interfacing - copy
 

Mehr von Don Doerres

2018 03 28_near_scifi
2018 03 28_near_scifi2018 03 28_near_scifi
2018 03 28_near_scifiDon Doerres
 
2018LifeOnOtherWorldsl
2018LifeOnOtherWorldsl2018LifeOnOtherWorldsl
2018LifeOnOtherWorldslDon Doerres
 
2018_03_15_life_on_otherworlds
2018_03_15_life_on_otherworlds2018_03_15_life_on_otherworlds
2018_03_15_life_on_otherworldsDon Doerres
 
2017 aacr youth day
2017 aacr youth day2017 aacr youth day
2017 aacr youth dayDon Doerres
 
Presentation desert codecamp_2017_1_sonichandkerchief
Presentation desert codecamp_2017_1_sonichandkerchiefPresentation desert codecamp_2017_1_sonichandkerchief
Presentation desert codecamp_2017_1_sonichandkerchiefDon Doerres
 
Rasberry pi class
Rasberry pi classRasberry pi class
Rasberry pi classDon Doerres
 
2012 1 arduino_rs232
2012 1 arduino_rs2322012 1 arduino_rs232
2012 1 arduino_rs232Don Doerres
 
Raspberry pi lnl
Raspberry pi lnlRaspberry pi lnl
Raspberry pi lnlDon Doerres
 
Single Boards Overview
Single Boards OverviewSingle Boards Overview
Single Boards OverviewDon Doerres
 

Mehr von Don Doerres (10)

2018 03 28_near_scifi
2018 03 28_near_scifi2018 03 28_near_scifi
2018 03 28_near_scifi
 
2018LifeOnOtherWorldsl
2018LifeOnOtherWorldsl2018LifeOnOtherWorldsl
2018LifeOnOtherWorldsl
 
2018 tamid sshw
2018 tamid sshw2018 tamid sshw
2018 tamid sshw
 
2018_03_15_life_on_otherworlds
2018_03_15_life_on_otherworlds2018_03_15_life_on_otherworlds
2018_03_15_life_on_otherworlds
 
2017 aacr youth day
2017 aacr youth day2017 aacr youth day
2017 aacr youth day
 
Presentation desert codecamp_2017_1_sonichandkerchief
Presentation desert codecamp_2017_1_sonichandkerchiefPresentation desert codecamp_2017_1_sonichandkerchief
Presentation desert codecamp_2017_1_sonichandkerchief
 
Rasberry pi class
Rasberry pi classRasberry pi class
Rasberry pi class
 
2012 1 arduino_rs232
2012 1 arduino_rs2322012 1 arduino_rs232
2012 1 arduino_rs232
 
Raspberry pi lnl
Raspberry pi lnlRaspberry pi lnl
Raspberry pi lnl
 
Single Boards Overview
Single Boards OverviewSingle Boards Overview
Single Boards Overview
 

Kürzlich hochgeladen

Lilac Illustrated Social Psychology Presentation.pptx
Lilac Illustrated Social Psychology Presentation.pptxLilac Illustrated Social Psychology Presentation.pptx
Lilac Illustrated Social Psychology Presentation.pptxABMWeaklings
 
Top Rated Pune Call Girls Tingre Nagar ⟟ 6297143586 ⟟ Call Me For Genuine Se...
Top Rated  Pune Call Girls Tingre Nagar ⟟ 6297143586 ⟟ Call Me For Genuine Se...Top Rated  Pune Call Girls Tingre Nagar ⟟ 6297143586 ⟟ Call Me For Genuine Se...
Top Rated Pune Call Girls Tingre Nagar ⟟ 6297143586 ⟟ Call Me For Genuine Se...Call Girls in Nagpur High Profile
 
CALL ON ➥8923113531 🔝Call Girls Adil Nagar Lucknow best Female service
CALL ON ➥8923113531 🔝Call Girls Adil Nagar Lucknow best Female serviceCALL ON ➥8923113531 🔝Call Girls Adil Nagar Lucknow best Female service
CALL ON ➥8923113531 🔝Call Girls Adil Nagar Lucknow best Female serviceanilsa9823
 
Breath, Brain & Beyond_A Holistic Approach to Peak Performance.pdf
Breath, Brain & Beyond_A Holistic Approach to Peak Performance.pdfBreath, Brain & Beyond_A Holistic Approach to Peak Performance.pdf
Breath, Brain & Beyond_A Holistic Approach to Peak Performance.pdfJess Walker
 
Call Girls Anjuna beach Mariott Resort ₰8588052666
Call Girls Anjuna beach Mariott Resort ₰8588052666Call Girls Anjuna beach Mariott Resort ₰8588052666
Call Girls Anjuna beach Mariott Resort ₰8588052666nishakur201
 
8377087607 Full Enjoy @24/7-CLEAN-Call Girls In Chhatarpur,
8377087607 Full Enjoy @24/7-CLEAN-Call Girls In Chhatarpur,8377087607 Full Enjoy @24/7-CLEAN-Call Girls In Chhatarpur,
8377087607 Full Enjoy @24/7-CLEAN-Call Girls In Chhatarpur,dollysharma2066
 
Lucknow 💋 High Class Call Girls Lucknow 10k @ I'm VIP Independent Escorts Gir...
Lucknow 💋 High Class Call Girls Lucknow 10k @ I'm VIP Independent Escorts Gir...Lucknow 💋 High Class Call Girls Lucknow 10k @ I'm VIP Independent Escorts Gir...
Lucknow 💋 High Class Call Girls Lucknow 10k @ I'm VIP Independent Escorts Gir...anilsa9823
 
Call Girls In Andheri East Call US Pooja📞 9892124323 Book Hot And
Call Girls In Andheri East Call US Pooja📞 9892124323 Book Hot AndCall Girls In Andheri East Call US Pooja📞 9892124323 Book Hot And
Call Girls In Andheri East Call US Pooja📞 9892124323 Book Hot AndPooja Nehwal
 
Understanding Relationship Anarchy: A Guide to Liberating Love | CIO Women Ma...
Understanding Relationship Anarchy: A Guide to Liberating Love | CIO Women Ma...Understanding Relationship Anarchy: A Guide to Liberating Love | CIO Women Ma...
Understanding Relationship Anarchy: A Guide to Liberating Love | CIO Women Ma...CIOWomenMagazine
 
The Selfspace Journal Preview by Mindbrush
The Selfspace Journal Preview by MindbrushThe Selfspace Journal Preview by Mindbrush
The Selfspace Journal Preview by MindbrushShivain97
 
Pokemon Go... Unraveling the Conspiracy Theory
Pokemon Go... Unraveling the Conspiracy TheoryPokemon Go... Unraveling the Conspiracy Theory
Pokemon Go... Unraveling the Conspiracy Theorydrae5
 
Introducing to billionaire brain wave.pdf
Introducing to billionaire brain wave.pdfIntroducing to billionaire brain wave.pdf
Introducing to billionaire brain wave.pdfnoumannajam04
 
CALL ON ➥8923113531 🔝Call Girls Mahanagar Lucknow best sexual service
CALL ON ➥8923113531 🔝Call Girls Mahanagar Lucknow best sexual serviceCALL ON ➥8923113531 🔝Call Girls Mahanagar Lucknow best sexual service
CALL ON ➥8923113531 🔝Call Girls Mahanagar Lucknow best sexual serviceanilsa9823
 
办理国外毕业证学位证《原版美国montana文凭》蒙大拿州立大学毕业证制作成绩单修改
办理国外毕业证学位证《原版美国montana文凭》蒙大拿州立大学毕业证制作成绩单修改办理国外毕业证学位证《原版美国montana文凭》蒙大拿州立大学毕业证制作成绩单修改
办理国外毕业证学位证《原版美国montana文凭》蒙大拿州立大学毕业证制作成绩单修改atducpo
 
(KAVYA) Call Girls Humayun Nagar ✔️Just Call 7001035870✔️ HI-Fi Hyderabad Esc...
(KAVYA) Call Girls Humayun Nagar ✔️Just Call 7001035870✔️ HI-Fi Hyderabad Esc...(KAVYA) Call Girls Humayun Nagar ✔️Just Call 7001035870✔️ HI-Fi Hyderabad Esc...
(KAVYA) Call Girls Humayun Nagar ✔️Just Call 7001035870✔️ HI-Fi Hyderabad Esc...Sanjna Singh
 
call girls in candolim beach 9870370636] NORTH GOA ..
call girls in candolim beach 9870370636] NORTH GOA ..call girls in candolim beach 9870370636] NORTH GOA ..
call girls in candolim beach 9870370636] NORTH GOA ..nishakur201
 
CALL ON ➥8923113531 🔝Call Girls Rajajipuram Lucknow best sexual service
CALL ON ➥8923113531 🔝Call Girls Rajajipuram Lucknow best sexual serviceCALL ON ➥8923113531 🔝Call Girls Rajajipuram Lucknow best sexual service
CALL ON ➥8923113531 🔝Call Girls Rajajipuram Lucknow best sexual serviceanilsa9823
 
LC_YouSaidYes_NewBelieverBookletDone.pdf
LC_YouSaidYes_NewBelieverBookletDone.pdfLC_YouSaidYes_NewBelieverBookletDone.pdf
LC_YouSaidYes_NewBelieverBookletDone.pdfpastor83
 
文凭办理《原版美国USU学位证书》犹他州立大学毕业证制作成绩单修改
文凭办理《原版美国USU学位证书》犹他州立大学毕业证制作成绩单修改文凭办理《原版美国USU学位证书》犹他州立大学毕业证制作成绩单修改
文凭办理《原版美国USU学位证书》犹他州立大学毕业证制作成绩单修改atducpo
 

Kürzlich hochgeladen (20)

Lilac Illustrated Social Psychology Presentation.pptx
Lilac Illustrated Social Psychology Presentation.pptxLilac Illustrated Social Psychology Presentation.pptx
Lilac Illustrated Social Psychology Presentation.pptx
 
Top Rated Pune Call Girls Tingre Nagar ⟟ 6297143586 ⟟ Call Me For Genuine Se...
Top Rated  Pune Call Girls Tingre Nagar ⟟ 6297143586 ⟟ Call Me For Genuine Se...Top Rated  Pune Call Girls Tingre Nagar ⟟ 6297143586 ⟟ Call Me For Genuine Se...
Top Rated Pune Call Girls Tingre Nagar ⟟ 6297143586 ⟟ Call Me For Genuine Se...
 
CALL ON ➥8923113531 🔝Call Girls Adil Nagar Lucknow best Female service
CALL ON ➥8923113531 🔝Call Girls Adil Nagar Lucknow best Female serviceCALL ON ➥8923113531 🔝Call Girls Adil Nagar Lucknow best Female service
CALL ON ➥8923113531 🔝Call Girls Adil Nagar Lucknow best Female service
 
escort service sasti (*~Call Girls in Paschim Vihar Metro❤️9953056974
escort service  sasti (*~Call Girls in Paschim Vihar Metro❤️9953056974escort service  sasti (*~Call Girls in Paschim Vihar Metro❤️9953056974
escort service sasti (*~Call Girls in Paschim Vihar Metro❤️9953056974
 
Breath, Brain & Beyond_A Holistic Approach to Peak Performance.pdf
Breath, Brain & Beyond_A Holistic Approach to Peak Performance.pdfBreath, Brain & Beyond_A Holistic Approach to Peak Performance.pdf
Breath, Brain & Beyond_A Holistic Approach to Peak Performance.pdf
 
Call Girls Anjuna beach Mariott Resort ₰8588052666
Call Girls Anjuna beach Mariott Resort ₰8588052666Call Girls Anjuna beach Mariott Resort ₰8588052666
Call Girls Anjuna beach Mariott Resort ₰8588052666
 
8377087607 Full Enjoy @24/7-CLEAN-Call Girls In Chhatarpur,
8377087607 Full Enjoy @24/7-CLEAN-Call Girls In Chhatarpur,8377087607 Full Enjoy @24/7-CLEAN-Call Girls In Chhatarpur,
8377087607 Full Enjoy @24/7-CLEAN-Call Girls In Chhatarpur,
 
Lucknow 💋 High Class Call Girls Lucknow 10k @ I'm VIP Independent Escorts Gir...
Lucknow 💋 High Class Call Girls Lucknow 10k @ I'm VIP Independent Escorts Gir...Lucknow 💋 High Class Call Girls Lucknow 10k @ I'm VIP Independent Escorts Gir...
Lucknow 💋 High Class Call Girls Lucknow 10k @ I'm VIP Independent Escorts Gir...
 
Call Girls In Andheri East Call US Pooja📞 9892124323 Book Hot And
Call Girls In Andheri East Call US Pooja📞 9892124323 Book Hot AndCall Girls In Andheri East Call US Pooja📞 9892124323 Book Hot And
Call Girls In Andheri East Call US Pooja📞 9892124323 Book Hot And
 
Understanding Relationship Anarchy: A Guide to Liberating Love | CIO Women Ma...
Understanding Relationship Anarchy: A Guide to Liberating Love | CIO Women Ma...Understanding Relationship Anarchy: A Guide to Liberating Love | CIO Women Ma...
Understanding Relationship Anarchy: A Guide to Liberating Love | CIO Women Ma...
 
The Selfspace Journal Preview by Mindbrush
The Selfspace Journal Preview by MindbrushThe Selfspace Journal Preview by Mindbrush
The Selfspace Journal Preview by Mindbrush
 
Pokemon Go... Unraveling the Conspiracy Theory
Pokemon Go... Unraveling the Conspiracy TheoryPokemon Go... Unraveling the Conspiracy Theory
Pokemon Go... Unraveling the Conspiracy Theory
 
Introducing to billionaire brain wave.pdf
Introducing to billionaire brain wave.pdfIntroducing to billionaire brain wave.pdf
Introducing to billionaire brain wave.pdf
 
CALL ON ➥8923113531 🔝Call Girls Mahanagar Lucknow best sexual service
CALL ON ➥8923113531 🔝Call Girls Mahanagar Lucknow best sexual serviceCALL ON ➥8923113531 🔝Call Girls Mahanagar Lucknow best sexual service
CALL ON ➥8923113531 🔝Call Girls Mahanagar Lucknow best sexual service
 
办理国外毕业证学位证《原版美国montana文凭》蒙大拿州立大学毕业证制作成绩单修改
办理国外毕业证学位证《原版美国montana文凭》蒙大拿州立大学毕业证制作成绩单修改办理国外毕业证学位证《原版美国montana文凭》蒙大拿州立大学毕业证制作成绩单修改
办理国外毕业证学位证《原版美国montana文凭》蒙大拿州立大学毕业证制作成绩单修改
 
(KAVYA) Call Girls Humayun Nagar ✔️Just Call 7001035870✔️ HI-Fi Hyderabad Esc...
(KAVYA) Call Girls Humayun Nagar ✔️Just Call 7001035870✔️ HI-Fi Hyderabad Esc...(KAVYA) Call Girls Humayun Nagar ✔️Just Call 7001035870✔️ HI-Fi Hyderabad Esc...
(KAVYA) Call Girls Humayun Nagar ✔️Just Call 7001035870✔️ HI-Fi Hyderabad Esc...
 
call girls in candolim beach 9870370636] NORTH GOA ..
call girls in candolim beach 9870370636] NORTH GOA ..call girls in candolim beach 9870370636] NORTH GOA ..
call girls in candolim beach 9870370636] NORTH GOA ..
 
CALL ON ➥8923113531 🔝Call Girls Rajajipuram Lucknow best sexual service
CALL ON ➥8923113531 🔝Call Girls Rajajipuram Lucknow best sexual serviceCALL ON ➥8923113531 🔝Call Girls Rajajipuram Lucknow best sexual service
CALL ON ➥8923113531 🔝Call Girls Rajajipuram Lucknow best sexual service
 
LC_YouSaidYes_NewBelieverBookletDone.pdf
LC_YouSaidYes_NewBelieverBookletDone.pdfLC_YouSaidYes_NewBelieverBookletDone.pdf
LC_YouSaidYes_NewBelieverBookletDone.pdf
 
文凭办理《原版美国USU学位证书》犹他州立大学毕业证制作成绩单修改
文凭办理《原版美国USU学位证书》犹他州立大学毕业证制作成绩单修改文凭办理《原版美国USU学位证书》犹他州立大学毕业证制作成绩单修改
文凭办理《原版美国USU学位证书》犹他州立大学毕业证制作成绩单修改
 

2013 1 arduino_datalogger

  • 1. Datalogging on an Arduino DESERT CODE CAMP 2013.1 Presented by Don Doerres Embedded Pro Guy don@azlaborlaw.com
  • 2. TODAY’S TAKEAWAYS  The Arduino is a good starting point for a data logger, a device used to obtain and store data over a long period of time  The Arduino with a few add-ins is capable of  Storing data with time tags  Displaying data in real time  Doing these tasks without tying up a bigger computer
  • 3. IDEA WAS TO LOG WEATHER  I started with a barometer (BMP085) and a humidity sensor (DHT11)  Both of these also provide temperature information  Power came from a desktop computer through USB cable to Arduino, Arduino to breadboard
  • 6. WEATHER WATCHING…  Observing an approaching dust storm, I realized that I didn’t want to leave the computer or sensors outside  Barometric pressure turned out to be adequate for storm tracking  Indoors, humidity did not change much  So, I decided to record barometric pressure and temperature
  • 7. ORIGINALLY USED PC  Used Tera Term (Terminal Emulator) to log data  Tera Term added time stamp from PC clock  Once prototype was working, wanted to move time keeping function and data logging to Arduino and not tie up PC
  • 8. ARDUINO TIMING SIX MINUTES, WRITING TO SERIAL PORT Tera Term Screen Tera Term Log File—Adds Time Stamp
  • 9. ORIGINAL PLAN: CHRONODOT & SD BREAKOUT  Chronodot is a highly accurate clock with battery backup  SD Breakout allows simple connection to SD card  However, the combination would simply not fit on an Arduino breakout shield, let alone any sensors
  • 10. DOT AND SD ON ARDUINO BREADBOARD Dot SD breakout  This picture shows the Dot and the SD card breakout  This works as a breadboard, but is too big for a shield
  • 11. ADAFRUIT INTRODUCED A DATA LOGGER SHIELD  About the time I realized that my logger would not fit on a prototype shield, Adafruit introduced their new logger shield  This had a slightly lower accuracy clock than the Dot, but it had everything else in surface mount parts  All I had to do was add the pressure sensor and a connection to a 16X2 LCD display
  • 12. ADAFRUIT LOGGER SHIELD Battery Holder SD Holder DS1307 RTC  Adafruit logger shield  Surface mount parts left prototype area quite large enough for sensors  Add an I2C 16X2 LCD display
  • 13. SENSOR SELECTION  This is the BMP085 pressure sensor  This is a sensitive barometer/altimeter and temperature sensor  It runs on 5V  It has an I2C interface
  • 14. I2C BUS  This is a very simple serial Inter-Integrated Circuit connection bus, hence I2C  The interface consists of Clock, Data, and ground  Multiple devices can be hooked to the same bus as long as they have different addresses  The devices I used, pressure sensor (address 0x77) and display (address 0), do have different addresses
  • 16. 16X2 LCD DISPLAY WITH I2C BACKPACK  This is a back view showing the four wire connections—same connections as BMP085 GND To GND DAT to A4 CLK to A5 5V To 5V
  • 17. OTHER CONNECTIONS  The SD breakout and the Clock are already wired up on the shield  The pressure sensor I soldered to the I2C connection pads on the shield  The LCD display I simply plugged in to the shield  The BMP and the LCD display have different I2C addresses, so there is no conflict
  • 18. TYPICAL DISPLAY  Date (Year not shown), local time  Temperature in F, Pressure in mmHG  Display updates every 5 seconds  Data is stored to SD card every 6 minutes
  • 19. WHAT GOES ON THE SD CARD  The log is Comma Separated Values (CSV) of Time, Temperature, Pressure  Time is stored as a ‘C’ time stamp (more about this in two slides)  Temperature is degrees F  Pressure is in millimeters of Mercury (mmHg)
  • 20. SAMPLE OF LOG FILE 1363516494,79.0,691.0 1363516868,79.0,691.0 1363517243,79.0,691.0 1363517617,79.1,691.1 1363517991,79.1,691.1 1363518365,79.1,691.1 1363518740,79.1,691.1 1363519114,79.2,691.2 1363519488,79.2,691.2 1363519862,79.2,691.2 1363520237,79.2,691.2 1363520611,79.1,691.1 1363520985,79.2,691.2 1363521359,79.1,691.1 1363521734,79.1,691.1 1363522108,79.2,691.2 1363522482,79.2,691.2 1363522857,79.2,691.2 1363523231,79.2,691.2 1363523605,79.2,691.2 1363523979,79.2,691.2 1363524354,79.2,691.2 1363524728,79.1,691.1 1363525102,79.1,691.1 1363525476,79.1,691.1
  • 21. THE CTIME STAMP  The C language uses as a time stamp the number of seconds since January 1, 1970  A 32 bit signed integer allows counting seconds until January 19, 2038 at 03:14:07 GMT  …by then, we will likely switch to 64 bit integers  And, yes, the value is a signed integer so that comparisons can be readily made
  • 22. DISPLAYING IN EXCEL OR OTHER SPREADSHEET  It is simple to convert ctime to Excel time  The macro is, using ‘A2’ as a sample cell: =DATE(1970,1,1)+(A2)/86400  Display format is controlled with Excel formatting CTIME Increase Delta Day Date Time Deg F mmHg 1363504243 0 0 Sun Mar 17, 2013 07:10:43 74.2 691.2 1363506389 2146 2146 Sun Mar 17, 2013 07:46:29 75.4 691.4 1363506764 2521 375 Sun Mar 17, 2013 07:52:44 76.7 691.7 1363507138 2895 374 Sun Mar 17, 2013 07:58:58 77.5 691.5 1363507512 3269 374 Sun Mar 17, 2013 08:05:12 77.4 691.4 1363507886 3643 374 Sun Mar 17, 2013 08:11:26 77.3 691.3 1363508261 4018 375 Sun Mar 17, 2013 08:17:41 77.3 691.3
  • 24. UNITS  The units of the BMP085 pressure sensor are Degrees C and pressure in Pascals  Conversions are in order tempy = bmp.readTemperature(); tempy = (tempy * 9.0 / 5.0) + 32.0; press = bmp.readPressure(); fpress = (float)press* 0.007500616827042;
  • 25. TIMESET.INO, 1 OF 2 // timeSet.ino #include <Wire.h> #include <RTClib.h> #include <LiquidCrystal.h> LiquidCrystal lcd(0); RTC_DS1307 RTC; DateTime now; void setup() { Serial.begin(57600); Wire.begin(); RTC.begin(); RTC.adjust(DateTime(__DATE__, __TIME__)); lcd.begin(16, 2); lcd.setBacklight(HIGH); //HIGH is ON, LOW is OFF }
  • 26. TIMESET.INO, 2 OF 2 void loop() { now = RTC.now(); lcd.setCursor(0, 0); lcd.print(now.year(), DEC); lcd.print('/'); if(now.month() < 10) lcd.print("0"); lcd.print(now.month(), DEC); lcd.print('/'); if(now.day() < 10) lcd.print("0"); lcd.print(now.day(), DEC); lcd.setCursor(0, 1); if(now.hour() < 10) lcd.print("0"); lcd.print(now.hour(), DEC); lcd.print(':'); if(now.minute() < 10) lcd.print("0"); lcd.print(now.minute(), DEC); lcd.print(':'); if(now.second() < 10) lcd.print("0"); lcd.print(now.second(), DEC); delay(2000); }
  • 27. AUGUST 11, 2012 STORM IN PHOENIX  About 10 hours of plot BMP_mmHg 719.60 719.40 719.20 719.00 718.80 718.60 718.40 718.20 0 100 200 300 400 500 600
  • 28. 39 HOTEL FLOORS AT LAS VEGAS FOUR SEASONS  Stepped up the logging rate to once per second  Three round trips 706 704 702 700 698 696 694 692 -500 0 500 1000 1500 2000
  • 29. FUTURE WORK  Add time setting over serial while running  Seems to be a small temperature rise of about 2 degrees F with the display running  Add fancier display, perhaps a 1 hour plot of data on a dot matrix display
  • 30. DCC_DATALOGGER_3.INO 1 OF 9 // DCC_DataLogger.ino #include <Wire.h> #include <RTClib.h> #include <Adafruit_BMP085.h> #include <LiquidCrystal.h> #include <SD.h> // On display, connect via i2c, default address #0 (A0-A2 not jumpered) LiquidCrystal lcd(0); RTC_DS1307 RTC; Adafruit_BMP085 bmp; const int chipSelect = 10; File dataFile; unsigned long int press; // press is a long float tempy; // temperature is a float float fpress; int loopSec = 0; int loopMin = 0; int num; // make a string for assembling the data to log: String dataString = ""; DateTime now;
  • 31. DCC_DATALOGGER_3.INO 2 OF 9 void setup() { Serial.begin(57600); Wire.begin(); RTC.begin(); bmp.begin(); // set up the LCD's number of rows and columns: lcd.begin(16, 2); lcd.setBacklight(HIGH); //HIGH is ON, LOW is OFF if (! RTC.isrunning()) { Serial.println("RTC is NOT running!"); // following line sets the RTC to the date & time this sketch was compiled RTC.adjust(DateTime(__DATE__, __TIME__)); } 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);
  • 32. DCC_DATALOGGER_3.INO 3 OF 9 // 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! // This is an APPEND open dataFile = SD.open("datalog.txt", FILE_WRITE); if (! dataFile) { Serial.println("error opening datalog.txt"); // Wait forever since we can't write data while (1) ; } }
  • 33. DCC_DATALOGGER_3.INO 4 OF 9 void loop() { static int i; if ( (loopSec % 5) == 0) { //Serial.println(__DATE__, __TIME__); tempy = bmp.readTemperature(); tempy = (tempy * 9.0 / 5.0) + 32.0; press = bmp.readPressure(); fpress = (float)press* 0.007500616827042; now = RTC.now(); Serial.print(now.year(), DEC); Serial.print('/'); if(now.month() < 10) Serial.print("0"); Serial.print(now.month(), DEC); Serial.print('/'); if(now.day() < 10) Serial.print("0"); Serial.print(now.day(), DEC); Serial.print(' ');
  • 34. DCC_DATALOGGER_3.INO 5 OF 9 if(now.hour() < 10) Serial.print("0"); Serial.print(now.hour(), DEC); Serial.print(':'); if(now.minute() < 10) Serial.print("0"); Serial.print(now.minute(), DEC); Serial.print(':'); if(now.second() < 10) Serial.print("0"); Serial.print(now.second(), DEC); Serial.println(); Serial.print("C time is = "); Serial.println(now.unixtime()); lcd.setCursor(0, 0); // lcd.print(now.year(), DEC); // lcd.print('/'); if(now.month() < 10) lcd.print("0"); lcd.print(now.month(), DEC); lcd.print('/'); if(now.day() < 10) lcd.print("0"); lcd.print(now.day(), DEC); lcd.print(" ");
  • 35. DCC_DATALOGGER_3.INO 6 OF 9 if(now.hour() < 10) lcd.print("0"); lcd.print(now.hour(), DEC); lcd.print(':'); if(now.minute() < 10) lcd.print("0"); lcd.print(now.minute(), DEC); lcd.print(':'); if(now.second() < 10) lcd.print("0"); lcd.print(now.second(), DEC); lcd.setCursor(0, 1); lcd.print(tempy,1); lcd.print("F"); lcd.print(" "); lcd.print(fpress,1); lcd.print("mmHg"); Serial.print(tempy,1); Serial.print(" Deg F, "); Serial.print(fpress,1); Serial.println(" mmHgn"); }
  • 36. DCC_DATALOGGER_3.INO 7 OF 9 delay(1000); loopSec+=1; if(loopSec == 360) // 6 minutes { static bool lcdStatus = true; // LCD light on or off loopSec = 0; lcd.clear(); lcd.setCursor(0, 0); lcd.print("Writing SD..."); dataString = String(now.unixtime()); dataString += ","; num = tempy; dataString += String(num); dataString += "."; tempy-=num; tempy+=0.05; tempy*=10.0; num=tempy; dataString+=String(num); dataString += ","; num = fpress; dataString += String(num);
  • 37. DCC_DATALOGGER_3.INO 8 OF 9 dataString += "."; fpress-=num; fpress+=0.05; fpress*=10.0; num = tempy; dataString +=String(num); dataFile.println(dataString); // The following line will 'save' the file to the SD card after every // line of data - this will use more power and slow down how much data // you can read but it's safer! // If you want to speed up the system, remove the call to flush() and it // will save the file only every 512 bytes - every time a sector on the // SD card is filled with data. dataFile.flush(); delay(1000); lcd.clear(); // To check out if display LED was causing warming, // cycle it off/on every six minutes // #define LEDONOFF #ifdef LEDONOFF lcdStatus = !lcdStatus;
  • 38. DCC_DATALOGGER_3.INO 9 OF 9 if(lcdStatus) { lcd.setBacklight(HIGH); //HIGH is ON, LOW is OFF } else { lcd.setBacklight(LOW); //HIGH is ON, LOW is OFF } #endif } }
  • 39. DOWNLOADS 1  Grateful to Lady Ada!!!!  Adafruit SD library: https://github.com/adafruit/SD  Adafruit RTC library: https://github.com/adafruit/RTClib  Adafruit logging shield tutorial: http://learn.adafruit.com/adafruit-data-logger- shield
  • 40. DOWNLOADS 2  LCD i2c backpack tutorial  http://learn.adafruit.com/i2c-spi-lcd-backpack  Liquid Crystal control library  https://github.com/adafruit/LiquidCrystal
  • 41. QUESTIONS?  Find more slides from Don at www.slideshare.net/dondoerres