Go Down

Topic: Create log files at intervals (Read 135 times) previous topic - next topic


I have a couple of Arduino sensors transmitting data to a serial to USB. This is connected to a COM port in my Mac at ~1Hz. I can connect to the devices and see the data as expected using Coolterm and screen through the terminal and can log the data for a specific session using Coolterm (this requires clicking 'save to file' and manually stopping when I want).

I would like to be able to collect and log data over longer periods of time and have .txt files of the collected data automatically created and saved at specified intervals (create one file per hour).

I've scoured for ways to do this using Coolterm and Zterm and can't figure it out. Is there perhaps a way to do it using the Mac terminal and some shell scripts? Am I overlooking something basic? Thanks all.


Jul 11, 2018, 01:45 am Last Edit: Jul 11, 2018, 03:36 am by Nick_Pyner
I've scoured for ways to do this using Coolterm and Zterm and can't figure it out.
In that case, you might look at doing it on the Arduino instead - where is it easy to do with local SD card. This brings its own benefits - no need to have PC connected all the time, and you can download the files at leisure. You can use date/time as the filename and create a new file on the change of hour.


Jul 11, 2018, 02:52 am Last Edit: Jul 11, 2018, 02:53 am by jremington
An easy way to do that with Arduino alone is to use OpenLog, which is a separate module that creates/reads/writes files on a uSD card. 3.3V only, so if you use this with a 5V Arduino, be sure to put a ~4.7K resistor in series with Arduino TX->OpenLog RX.

Note that if you store the unix date/time stamp (4 bytes) in each line of your data file, there is no need to deal with multitudes of files. Check out the Arduino Time library.

Go Up