Data logging diesel engine sensors, sample rate

Hello,

For my project i am using 5 sensors,
3 analog sensor, pressure, knock and rpm sensor
2 digital sensors, inlet temperature and outlet temperature

With what i currently have i am able to send and store the values of the sensors only one time per second. For storing the values i use an SD card.

I have been reading a lot of forums and it seems that i have to use a buffer or a string to increase the sample rate. The engine turns at 600 rpm (give or take). So every second the engine runs it does 10 turns so i need at least a hundred samples every second to get a good idea of the values.

Especially the three analog sensors have to be able to send 100 values per second.

Could somebody help me out?

DATA_logging_af.ino (3.27 KB)

the fora ?

What is that ?

.

This better?

Thanks for the helpful comment

Philip329: This better?

Thanks for the helpful comment

much better [sarcasm ]

Forget the storing of sample data, for right now. Have you been able to obtain the 100 samples per second? Blink a LED, or something every time you get 100 samples. How often does the LED blink?

Paul

Your current sampling rate is limited by this:

  delay(750);

To do better, you need to get rid of all delays in your code. The DS18B20 can run asynchronously so you can set it to that mode and read the analog sensors repeatedly while you wait for it to be ready.

Edit: Actually, the async mode applies in the library - I'm not sure if it matters for you - it's likely enough to use millis() to ensure that 750ms have elapsed before trying to get the temp after you asked the device to get the temperature.