Malawi Production Quality
 All Files Functions Variables Macros Pages

This project measures time between pulses generated from a photo sensor. The time between each rising and falling edge is measured as well as the time between the falling and rising edge. The time measured in both cases is stored on an SD Card.

The given estimations of the HIGH time vs LOW time is 150 milli Seconds (variation = 120-170) and 30 milli seconds (variation = 10-50).

Important information
SD cards are sold in different qualities. The most important is the so called latency time This can influence the delay on the write operation.
An interrupt service routine (ISR) is called every time the edge changes. The difference between the time now and the time before is the time between edges.
These values are stored in an array. Each array can contain a maximum of BUFFER_ENTRIES (=max 100) bytes.
The program has 2 buffers once a buffer is full, the buffer pointer is switched to the other allowing the ISR to keep storing data.
Meanwhile the filled buffer is written to the SD card as a 2 column CSV format with a Long and short pulse time.
Usage instructions
a) Make sure a standard FAT32 formatted SD card is inserted in the card Holder
b) Switch the Arduino on
c) The LED should light constant
d) recording will start as soon as pulses arrive from the Opto
LED flashes
a) 2 seconds on / 2 seconds off : There is no SD card inserted or card not usable
b) 1 seconds on / 2 seconds off : The card already contains 99 MALAWIxx files. Either clean up the card or use another
c) 250 milliseconds on / 250 milliseconds off : a buffer overrun has happened.
In all cases above recording has terminated or not even started

If a very short flash happens once every 3-4 seconds the data is being recorded on the card and the system is operating perfectly.
Version Control
2013-12-31 14:55:38 +0100 (di, 31 dec 2013)
License info

Malawi_001 measuring time between pulses

Copyright (C) 2013 Nico Verduin

This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program. If not, see

Program : Malawi_001 Copyright (C) 2013 Nico Verduin This is free software, and you are welcome to redistribute it.