Go Down

Topic: How to sync PC time/date with serial monitor? (Read 107 times) previous topic - next topic

Suaad



Can I sync PC time and date with the analog readings and dispaly it in serial monitor without extra hardware?

I google this and I find some suggestions to use time library but i don't know how to
merge it with my code

other suggestion was to use gobetwino but doesn't work!!
may it not compatible with windows 8




Nick_Pyner

Use a proper terminal programme like RealTerm, which is free. This will enable you to record your data along with timestamp from the PC clock.

No extra hardware
No extra software
No gobetweeno either

Robin2

Can I sync PC time and date with the analog readings and dispaly it in serial monitor without extra hardware?
How often are the readings taken?
I ask because the date does not seem relevant for data that lives briefly in the Arduino Serial monitor and then is lost forever.

...R

jurs

Can I sync PC time and date with the analog readings and dispaly it in serial monitor without extra hardware?
You can create a "serial command handling" for your Arduino sketch to enter a time manually using the serial monitor. Such like (example for German date/time format) a command like this:
Code: [Select]

set 23.02.2015 18:23:30

Then the Arduino sketch could read and evaluate that command, provide and update the date/time using the millis() function each second.

The disadvantage would be: After each reset like power-on or closing/opening the serial monitor you would first have to enter date/time command before you have it ready in your sketch. And the accuracy is as good or bad as the 16 MHz crystal or resonator on your Arduino, typically <50 ppm with a 16 MHz crystal oscillator and <5000 ppm with a 16 MHz ceramic resonator.

Suaad

Quote
Use a proper terminal programme like RealTerm
is it easy to use and connect with arduino for begginers?
i made quick search.. if you can provide me a link that explain it simply i'll be so thankful :)

Suaad

Quote
How often are the readings taken?
I ask because the date does not seem relevant for data that lives briefly in the Arduino Serial monitor and then is lost forever.

...R
I need to take readings every five minutes for six consecutive hours (maximum)

Suaad

Quote
You can create a "serial command handling" for your Arduino sketch to enter a time manually using the serial monitor. Such like (example for German date/time format) a command like this:
i am afraid that i can't understand what you mean by serial command  hanling!
did you mean that i have to enter it in serial monitor? or in sketch?

Is this code

Quote
set 23.02.2015 18:23:30
all I need to enter?

jurs

i am afraid that i can't understand what you mean by serial command  hanling!
did you mean that i have to enter it in serial monitor? or in sketch?
You would have to enter the command in the serial monitor, then press [ENTER] or [RETURN] on the PC keyboard or click the "Send" button. But it will only work if you have a sketch which can handle that as serial input.

Is this code

all I need to enter?
At first you will need a sketch for serial command and time handling that
- reads the command from the serial monitor
- split an convert the numbers to year, month, date, hour, minute, second
- and must provide a processing logic using the millis() function to regularly update the time
No extra hardware required, but you'd have to enter the time manually after each reset of the controller.

Another possibility would exist with compiling and uploading a sketch. When compiling, you could create a "time stamp of compile date/time" in your sketch. Each time the sketch starts, it then could read that time stamp from the hex file uploadet to the Arduino. So if you do this:
- compile and upload the sketch
- immediately start the serial monitor
You could have the current date and time in your sketch without manually entering ist. Just 5 seconds late or so from your PC clock, which would be the estimated time for compiling, uploading and starting the serial monitor. Unfortunately: After each reset of the controller, the time will alwas start at the date/time when the sketch was compiled.

So you can decide what you would like to have, then I can create one example sketch for you. Two possibilities:

1. Create a clock that starts with zero or any given starting date/time. You then can "set" the date and time via the serial monitor to any date/time you want.

2. Create a clock that always starts at the date/time when the sketch was compiled and uploaded to the Arduino. But each reset of the controller resets date/time. So to have a current time you would always need to upload a new sketch.

If you select one of the possibilities, I can program an example program for you. Just let me know what you want and also tell me about your preferred date formatting, whether it is "dd.mm.yyyy hh:mm:ss" like in Germany or any other date/time formatting you would like to have.

Nick_Pyner

#8
Feb 24, 2015, 01:27 am Last Edit: Feb 25, 2015, 05:09 am by Nick_Pyner
is it easy to use and connect with arduino for begginers?
i made quick search.. if you can provide me a link that explain it simply i'll be so thankful :)
Yes it is

realterm.sourceforge.net/

Setting it up is quite intuitive. Note its baud rate is 57600 by default, not 9600. The COM port is the same as the serial monitor. Timestamping is in the capture section.

As I said, no extra programming, you simply serial.print the result just like ( I assume ) you do now. The rest is done for you by RealTerm.

Be aware that, while you originally asked about using the serial monitor, you don't use that for this purpose, you use a terminal. The serial monitor is not a terminal, even though it often looks like one and can sometimes serve the same purpose - but not this time. 

I'm not surprised you can't understand what is meant by "serial command handling", I don't either, and neither of us need to. It is utterly irrelevant rubbish. You don't need to "create a clock" or split any numbers, or manually enter any times. It's all misleading nonsense, and just a silly attempt at re-inventing the wheel.

Go Up
 


Please enter a valid email to subscribe

Confirm your email address

We need to confirm your email address.
To complete the subscription, please click the link in the email we just sent you.

Thank you for subscribing!

Arduino
via Egeo 16
Torino, 10131
Italy