Datalogger 3 – Status Update and Sleep Design


  1. Chapter 0 – Introduction
  2. Chapter 1 – Arduino I2C
  3. Chapter 2 – Continuous EEPROM Addressing (digression)
  4. Chapter 3 – Update and Sleep Design
  5. Chapter 4 – Clock Design and Sleep Investigation
  6. Chapter 5 – Gallery
  7. Chapter 6 – Results
  8. Chapter 7 – Final Report
  9. Chapter 8 – Followup 1

Status Update

So, the contest entries have to be in by Friday and, ha ha, I don’t know what I was thinking, but there’s no way I’m going to be able to replicate this experiment with the PIC or the LaunchPad.  I think the hardware design is sound, and that it would only be a matter of setting up the development environments and porting the code, however, I have not successfully programmed the LaunchPad with anything of substance, and I have not successfully programmed any of my PICs with anything at all, after some abortive attempts at a home-brew serial programmer.  Rather than letting these things get in the way of the AVR-based data logger, I’ve elected to set them aside and try and make the one I have work.  Good luck, self.

Here’s what I have done so far:

  • Interface with EEPROM device
  • Get temperature  from sensor
  • Record samples at intervals
  • Fabricate breakout for DS3231 clock
  • Implement serial interface

So here’s what I have left to do:

  • Set up DS3231 software interface
  • Set up sleep and interrupt wakeup (using DS3231’s alarms)
  • Set up stand-alone Arduino-compatible ATmega328 with internal oscillator
  • Power stand-alone system with batteries
  • Fabricate perf-board and test outside.
  • Write up interesting design considerations, update references.
  • Take some photos.
  • Submit entry.


Sleep Design

This part is, in theory, quite simple.  The DS3231M has a settable alarm that can be programmed to trip periodically.  If I tell it to go off hourly, it will drive one of its output pins low.

I found this promising Sleep library for Arduino:, which is LGPL and appears to derive from other Arduino Sleep projects I’ve seen.  It can be configured to wake up on external interrupts, so if I hook up the DS3231M alarm output to digital input 2 or 3, it ought to wake the device up every hour to do my bidding.

With that in mind, I concocted the following high-level flow of control for the device, which happens at boot up, when the reset switch has been triggered:

  1. Initialize interfaces, read sample number from EEPROM
  2. Wait for 10 seconds for serial input.  If serial input found, enter interactive mode (see below).
  3. If 10 seconds elapse with no serial input, enter embedded mode.
  4. Get the time from the DS3231M and the temperature from the TC74
  5. Record the time and sample on the 24AA1025 EEPROM
  6. Go to sleep
  7. When triggered by interrupt on pin 2, go to 4

Interactive mode allows the user to control the device by the serial interface, including:

  • Setting the date and time
  • Setting the alarm
  • Displaying the most recent sample
  • Dumping all stored samples (prints in CSV format for easy export to your favorite script or spreadsheet)
  • Erasing the EEPROM (which starts the sampling over at 0)
  • Exit interactive mode (starts embedded mode sampling sequence)

There is a jumper for selecting between external power and power from the FTDI cable.  The idea is that when the user has collected all the data she wants, she can bring the device in, switch the jumper (in case the batteries are too low), hook it up to USB, press reset, and connect with a terminal to control the state of the device.

Next up will be any interesting lessons I learn from trying to operate the DS3231M tonight when I hook it up.

This entry was posted in Datalogger, Make It Last, Projects. Bookmark the permalink.

8 Responses to Datalogger 3 – Status Update and Sleep Design

  1. Pingback: Make It Last 0 – Introduction | Schazamp's Blog

  2. Pingback: Make It Last 1 – Arduino I2C | Schazamp's Blog

  3. Pingback: Make It Last 2 – Contiguous EEPROM address space (digression) | Schazamp's Blog

  4. Pingback: Make It Last 4 – Clock Design and Sleep Investigation | Schazamp's Blog

  5. Pingback: Make It Last 5 – Gallery | Schazamp's Blog

  6. Pingback: Make It Last 6 – Results | Schazamp's Blog

  7. Pingback: Make It Last 7 – Final Report | Schazamp's Blog

  8. Pingback: Make It Last 8 – Followup 1 | Schazamp's Blog

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s