- Chapter 0 – Introduction
- Chapter 1 – Arduino I2C
- Chapter 2 – Continuous EEPROM Addressing (digression)
- Chapter 3 – Update and Sleep Design
- Chapter 4 – Clock Design and Sleep Investigation
- Chapter 5 – Gallery
- Chapter 6 – Results
- Chapter 7 – Final Report
- Chapter 8 – Followup 1
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.
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: https://code.google.com/p/arms22/downloads/detail?name=Sleep003.zip, 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:
- Initialize interfaces, read sample number from EEPROM
- Wait for 10 seconds for serial input. If serial input found, enter interactive mode (see below).
- If 10 seconds elapse with no serial input, enter embedded mode.
- Get the time from the DS3231M and the temperature from the TC74
- Record the time and sample on the 24AA1025 EEPROM
- Go to sleep
- 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.