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

Hi,

I hope someone can help me understand what is going on here...

I just returned from the ship where I was measuring fuel consumption and for which I built a datalogger with 4 inputs. On the bench the logger works fine with a signal generator. The calculations are good, fairly constant and everybody is happy. But when I attached the 4 flow meters, the numbers that were logged were fluctuating wildly, even though I could read the output on the handheld display to be very stabil at 1060 L/h for the supply line and 900~500 L/h on the return line. The handheld display is fed data via RS485, so the frequency output is a separate output for use with some external data logging hard-/software.
I have attached a .csv file where you can see the logged values.

I have also attached a diagram of how I connected the the wiring insode the datalogger box and a diagram of how the system connects together.

The code I used is also attached. There is a very strange issue with it, as in line 89 in the setup function, the serial printing of the headers: When I change the header text, the SD card doesn't work. If I remove text or add text, the SD stops working! This makes absolutely no sense to me, as changing the header text should have no effect on the SD card part of the setup function?!?!?

Is there a rational explanation for this or is it something in the Serial.print function that is not right?

DATALOG_4GB.CSV (1.44 MB)

Data logger fuelflow setup.pdf (16.1 KB)

Fuel_Flow_Logging_to_SD_Card_4_channels_UNO_WORKING.ino (8.85 KB)