Datalogger 7 – Final Report

TOC:

  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

Contest Entry Form

This is what I submitted for the entry form of the contest, followed by a more detailed writeup examining my objectives.

Project Description

I built an embedded temperature datalogger to keep track of the temperature in my garden cold frames this winter, to determine how effective they are from shielding the plants I’m wintering over from the elements.  I used a TC74 temperature sensor, 24AA1025 1024kbit EEPROM, and a DS3231M+ real-time clock to record the time and temperature hourly onto the EEPROM, and implemented a serial interface for reading the data at the end of the sampling period.  I used an Arduino-compatible Boarduino for the microcontroller.  Every hour, the device takes a sample, and then goes to an extended sleep state, to be awoken an hour later by the interrupt from the RTC.  While active, the device consumes around 8mA, while sleeping, about 180uA, so powered by 2AA batteries, it should last well beyond a single growing season, though I’ll probably want to get the data at the end of each season.  See the write-up at https://schazamp.wordpress.com/category/make-it-last/ for details of the design and power analysis.  [edit: I added a mention of the Boarduino, since forgot to put that in my entry.  I hope it doesn’t disqualify me…]

URL for Project Photos and Schematics

For Photos, see the gallery: Chapter 5 – Gallery (https://schazamp.wordpress.com/2010/11/10/make-it-last-5-gallery/)
For the Schematic, see:  https://schazamp.files.wordpress.com/2010/11/schematic.jpg

 

Bill of Materials

Item Quantity Purchase Notes
DC Boarduino 1 Adafruit Pretty much any Arduino-compatible device would work, if you use this one, however, you’ll also need an FTDI cable.  Of course, if you’re using one of these, you probably know that already.
TC74A3-5.0VAT temperature sensor 1 Mouser Digikey Pretty much any TC74 would work.
24AA1025 I2C EEPROM 1 Mouser Digikey You could use smaller ones in the same family, but you’d have to modify the EEPROM library software.
DS3231M+ RTC 1 Digikey The DS3232 looks like it supports the same interface, so it might be a drop-in replacement.
SOIC-16W Breakout for DS3231M+ 1 something like: Sparkfun or Digikey (not too sure about that one) I made my own in the spirit of the Chronodot, but without the backup battery.
>= 4-pin header 2 Sparkfun Male, 0.1″, breakaway headers are something it’s good to have around.
10K resistor 3 Sparkfun ebay You should have these lying around, otherwise, buy a lot on ebay.
0.1uF capacitor 1 Sparkfun ebay You should have these lying around, otherwise, buy a lot on ebay.
hookup wire Sparkfun: black red yellow gray It’s nice to have different colors…
AA 2-battery holder 1 Digikey Sparkfun It’s probably possible to scrounge from other project, like I did.
AA batteries 2 Seriously, who doesn’t have these lying around?
solderless breadboard 1 Sparkfun Digikey Skip this if you want to just build it on the perfboard, but they sure are nice to have before you commit a project to hardware.
24×30 perfboard 1 Something like this thing on ebay, could be cut up For final assembly.
40-pin female headers 2x Sparkfun Breakway, 0.1 inch. This is optional, you could just solder the chips directly to the perfboard.

Biggest Challenge

The biggest challenge I encountered was the difficulty I had in programming the microcontrollers I was trying to use.  I was trying to follow some home-brew PIC programmer instructions (a la http://www.circuit-projects.com/microcontroller/pic-and-eeprom-programmer.html) with no luck, and later, even when I had eliminated the PIC from my plan (due to time constraints), I failed to program the stand-alone ATmega328P (following these instructions: http://arduino.cc/en/Tutorial/ArduinoToBreadboard) in time to include it in the final build.

I expended a considerable amount of time trying to get these working, especially the latter, and had a few scares, thinking I’d hosed my Boarduino.  This is definitely the area where my lack of experience caused me difficulty.  If I hadn’t spent so much time on this, I would probably have had time to debug the assembled perf-board version.

Improvements

In the future, I hope to have better success with the standalone Arduino using the internal oscillator.  That will save me from committing my Boarduino to the project all winter, and enable me to build more than one device.

I also hope to spend some time debugging my assembled perf-board version, as there is still some problem preventing the microcontroller from reading the clock.

Thirdly, it would be really nice to add a battery backup to the DS3231M+, so that I don’t have to set the time using the serial interface after each time I reconnect power from the system.

If I build more than one, it would be nice to have a DIP switch or some other hardware mechanism for distinguishing between different devices, so I don’t get the data mixed up.  Until I do that, I can just stick a note in the enclosure.

Finally, there is some room for improvement in the serial interface, especially about setting the time and the alarm.

I will add an addendum to this series if I get any of these things fixed.

How did you hear about the contest?

I heard about this contest through the Make blog.

Final Report

Objectives

The device appears to work, and I think I will really appreciate having the time recorded with each sample, especially if I build additional devices or use them for multiple seasons.  It will also be helpful in determining the (in)validity of the sample data, if there are any bugs in the code, which would be harder to establish if all that is recorded is a sequence of samples.

I ran out of time well before I was able to try on any platforms other than the Arduino before the contest was over.  This is disappointing, but maybe I’ll have better luck if I spend some more time on it.  Learning a new microcontroller platform is not something that can be successfully rushed.

I met my secondary objective of relying on components I already had.  I don’t think I had to buy anything for this project, though I might have had better luck with the PICs  and the standalone ATmega328P if I had purchased some kind of programmer instead of trying to roll my own.  The battery holder hack was particularly hacksome.  If I make any more devices, I will probably have to actually buy battery holders.

Reflections on Design

It was very convenient having all the peripheral devices on the I2C bus, especially while trying to solder that perfboard.

As I mentioned above, I regret not having a battery backup on the DS3231M+, to maintain the time while messing about with different power supply options (FTDI cable, batteries, etc.).

Source Code

[Edit: I have added the source to google code’s subversion repository, so you can browse it directly. The versions referenced here may be out of date.]

I used 3rd party Arduino libraries for the Sleep functionality and the replacement I2C driver.  I modified the latter, adding convenience versions of the start() and restart() functions, so I will release those here:

I bundled the EEPROM code into a library of sorts, though it doesn’t follow the Arduino library convention.  Maybe I’ll clean that up later.  It should be more or less portable to other platforms, provided you replace the I2C subsystem with the platform-specific equivalent:

Finally, here’s the source of the program itself, in all its glory:

Next Steps

See the improvements section above.  I still hope to implement an equivalent project on the PIC and Launchpad platforms, after I get the standalone ATmega328P running.

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

8 Responses to Datalogger 7 – Final Report

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

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

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

  4. Pingback: Make It Last 3 – Status Update and Sleep Design | Schazamp's Blog

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

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

  7. Pingback: Make It Last 0 – Introduction | 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:

WordPress.com Logo

You are commenting using your WordPress.com 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 )

Google+ photo

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

Connecting to %s