Input logger with rtc and pc interface

Hi

I would like to build a portable device that I can carry around which will contain a few buttons and a couple of potentiometers.
Whenever a button is pressed, it should log the event along with the pot positions and current timestamp to some sort of mass storage (SD card, USB flash drive). In other words, I need input pin states and the timestamp to be stored.
When I get to my computer I want to transfer the input events and their timestamps to it.
My PC - based code would then translate the raw button presses / knob positions into useful information based on the context.

This is my criteria, and below that are possible approaches that I have thought about:

  • An external clock with a dedicated battery would be needed, as the time should be kept even if the Arduino itself loses power.
  • I'm not sure about battery life, or if a standard 9V battery / clip would be enough. I want the device to always be ready to accept and save input, but I'm not sure if it's feasible to keep polling in a loop the whole day long, as it will obviously drain the battery. One solution is to have a power switch, or does the Arduino support interrupts?
  • As small as possible for mounting in a portable box.

I've considered these approaches. I'm not sure if there are easier ways:

  1. Get an RTC shield, as well as an SD card shield. The problem is, can I use two shields at once?
  2. Get a schematic or design it myself, and solder all the individual components together using just the AtMega itself separate from the Arduino.

Any thoughts would be appreciated.
Thanks!

flippie:

  • An external clock with a dedicated battery would be needed, as the time should be kept even if the Arduino itself loses power.
  • I'm not sure about battery life, or if a standard 9V battery / clip would be enough. I want the device to always be ready to accept and save input, but I'm not sure if it's feasible to keep polling in a loop the whole day long, as it will obviously drain the battery. One solution is to have a power switch, or does the Arduino support interrupts?

The 9v batteries for smoke alarms, don't last too long on Arduinos. You may want to investigate using 3 or more AA batteries.

flippie:
I've considered these approaches. I'm not sure if there are easier ways:

  1. Get an RTC shield, as well as an SD card shield. The problem is, can I use two shields at once?
  2. Get a schematic or design it myself, and solder all the individual components together using just the AtMega itself separate from the Arduino.

Any thoughts would be appreciated.
Thanks!

Adafruit makes a shield that combines both RTC and SD into one shield that runs on UNOs (it doesn't seem to work on a Mega without some work). Unfortunately, they are out of stock at the moment Adafruit Data logging shield for Arduino [v1.0] : ID 243 : $24.80 : Adafruit Industries, Unique & fun DIY electronics and kits.

In terms of using multiple shields, it depends on each of the two shields. If they use the same pins (except for i2c/spi serial traffic), then you can't use them together. Likewise if they don't have extenders, so you can plug a second shield into it, they can't be stacked (video shields typically don't allow another shield to be mounted on top, since the presumption is you are going to use the display).

I think many of the RTC chips use i2c. I2c and spi are serial buses that allow multiple devices to be connected (each device has an address, and will only look for commands directed to that address). I'm not familar with SD shields and whether they use i2c or not, but if they do, you should be able to attach the RTC to the i2c bus.

If you don't mind turning on arduino every time you will likely push buttons, adding a power switch will save your battery. I have two rechargeable 9V batteries (very weak batteries, don't buy them!). If I keep one project on battery, it runs out in less than two days. For the same project I have with a power switch, I occasionally turn it on and it still works after about 2 years.

The clock on the shield MichaelMeissner mentioned has a backup battery. That battery will last years.

There are integrated (SD card logger + RTC + ATmega328) solutions already out there:
http://wyolum.com/shop/20-i2gps.html
http://www.seeedstudio.com/depot/sdlogger-open-hardware-data-logger-p-723.html?cPath=132_136
etc.