Log FuelFlow -Reading 4 frequency inputs (digital on/off) and logging to SD card

Hi,

Information to anyone wanting to use this sketch:

The attached sketch logs fuel flow from 4 flow meters by a digital 5V impulse, measures the timeperiod and calculates the frequency and flowrate based on the set pulseconstant for the meter. It saves the flow data to an Adafruit data logger SD card shield with RTC timestamp. If serial monitor is active, the result is displayed there as well. The sketch is built for monitoring flow and burnrate on 2 engines simultaneously, using 4 flow meters. 2 for each engine (supply and return). SD card data is stored in a .CSV file and is easily imported into excel and flow data is displayed under the relevant heading.
Each time the sketch is restared, a new heading is written to distingish tests form each other. Data logging only takes place is an input is sensed, meaning that if there are no impulses on the inputs(flowflow), it stops logging.

The logged values for each set of flow meters, 10 values total:

New log started!
Date : Time
Supply(instantaneous) -- TotalSupply -- Return(instantaneous) -- TotalReturn -- Burnrate (supply - return) x 2
0.000000 0.000 0.000000 0.0000 0.000000

To set the flowrates to match your meters: Set the pulse constant (K-factor) to what is specific for your meters.

For some reason, the pulse generator is not working.

Fuel_Flow_Logging_to_SD_Card_4_channels.ino (8.26 KB)