Skip to content
Greg edited this page Oct 24, 2018 · 12 revisions

This code is a simple Arduino-based data logger. The Arduino (UNO for instance) should be connected to:

  • A real time clock DS3231 (RTC) module (I2C interface).
  • A SD card reader (with SPI interface).
  • an SSD1306 OLED display (I2C interface)

The systems monitors any change of state of a digital pin (here #2) of the Arduino, and writes the time and date of each change to the SD card (file "data.txt"). As a bonus, the temperature (from the internal RTC temperature sensor) is also written to the file. When booting, if the file "data.txt" does not exist, it is created. Otherwise the data are appended to it.

It is also possible to set the time and date of the RTC using a special file on the SD card ("setdate.txt" - see the code for the format). Finally, at each change of the input pin, the time is printed on the OLED display.

Libraries

The code is based on the following libraries

  • SdFat

  • Wire.h : Library for I2C bus communication (with the RTC module)

  • DS3231.h : Real-time clock (RTC) RTC module library

  • SPI : Library for SPI bus communication (with the SD card reader)

  • SSD1306Ascii.h and SSD1306AsciiWire.h: ASCII-only (uses less memory than graphical versions) OLED display library

Clone this wiki locally