Display Date and Time on Serial Monitor without External Hardware

Dear all,

I am kinda new to Arduino.

My task is to collect timestamped sensor data using Arduino without the external hardware. I searched for answers for this problem and found the "Arduino Time library" (link: http://playground.arduino.cc/Code/time). I tried the sample code in TimeSerial.pde. However, I did not get the date and time output on the serial monitor.

Does anyone have similar problem? Any solution is highly welcomed! Thanks!

Sincerely, Michael

Doesn't that code expect an RTC connected to serial?

You can use millis() that returns an unsigned long as milliseconds since startup to keep track of Arduino time for up to 49.7-some days (over 4 billion millseconds) before rollover.

You can either find a way to enter the proper Unix Time (seconds since start of 1/1/1970) and have the Arduino store that and the millis() that was entered to make time stamps in Unix Time or you can note the startup time, log millis() and post-process your time stamps after collection if there is no easy way to tell Arduino what the Unix Time is.

Is it more trouble to write something down or to connect an RTC or to provide a way to enter the correct Unix Time or the correct Date & Time? If you get creative, you could enter data using a TV remote and IR receiver though you won't get feedback to check your entry.

Hi GoForSmoke,

Thanks for your quick reply.

There is no external hardware at all...

What I want to do is to connect Arduino to a PC via USB and get the current PC time from arduino without manually sending the date and time via the serial monitor. Do you know anyways to do this? Many thanks!

Can you write PC code? Can you get the PC to recognize the Arduino connection?