Hardware -- Storage

A project log for Heartbeat Logger

A portable device that logs a snippet of your heart at the push of a button.

Ole Andreas UtstumoOle Andreas Utstumo 02/15/2016 at 22:160 Comments

Sampling 12 bit values at a rate of 512Hz will after 24 hours generate

data = 2byte/sample 512samples/s 60s/m 60m/h 24h = 88.473Mb

A SD card has large capacity and is both cheap and easy to read. For this project a micro SD card was chosen as data storage. The SD card is intended to interface with the microcontroller in SPI mode, using one of the onboard USART SPI modules of the SAMD20. This didn’t work in the prototype, so I emulated SPI communication with bit banging.

Pinout for the micro SD card in SPI mode. Source:

The SD card is powered by a voltage of 3.3V, and must be interfaced at the same voltage level. A level converter can be used to make it compatible with i.e 5V systems, but with a standard 3.7V li-ion battery it makes sense to run the entire system on regulated 3.3V. The SD card consumes 4mA in idle mode and 7mA in active mode. The static current drain was not taken into account in the prototype, and single-handedly drained the battery in a week. This was fixed in the revision by adding a N channel MOSFET between the card and GND.

For the software, FatFS will be employed.