Hello all,

I'm currently working with a teensy 3.2 + audio shield, and working on a simple project to record/playback audio from an SD card (I've loosely altered the example code for recording/playback: https://github.com/PaulStoffregen/Au...r/Recorder.ino).
The project is designed to record audio based on a tilt switch's orientation, and is controlled entirely with power cycles.
For instance, to record: The system powers up and reads the tilt switch in the 'record' orientation, it then records until power is removed from the system.

I found out quickly that if the recording isn't gracefully stopped then all of the data is lost (the SD card just shows a 0kB file).

My solution to this was to use a large capacitor between the power rails, and a sensing cap on an analog pin to detect when Vin is dropping voltage. It works for the most part, but I would ideally like to improve the system (size of the device is a large factor so saving any amount of space is useful).

The ideal situation i'm looking for is to remove these capacitors and having the system (semi)gracefully handle terminating the files.
Does anyone know of a way to do this (The idea that popped in my head was creating multiple short bursts of 500 ms recordings and concatenating them when playback occurs)?

Thanks!