I have an Arduino sending serial data to the computer. I'm able to view the data using a Serial console. But, I want to be able to log it with time stamp.

I want a ready made script or program that logs serial data with time-stamp automatically without me having to change much or mess with code.


You can use the ts program from moreutils to add a timestamp to each line.

{ echo foo; sleep 1; echo bar; } | ts
Dec 13 01:07:23 foo
Dec 13 01:07:24 bar

To read from the serial port and output to a file:

ts </dev/ttyS0 >arduino.log

(Replace /dev/ttyS0 by the right path for the serial port device, .)

  • Thanks! Grabserial offers a lot more customization, including the ability to show offests and differences with different base times, restarting the logging based on patterns in the output, modifying serial line settings, etc. – nealmcb Oct 15 at 0:29

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.