Display the pc time server on Arduino without external hardware

I'm patching up a circuit with multiple sensors. I need the Arduino to capture the pc time when any of the sensors are being triggered/step . So the time will keep on elapsing hence i can know the timing between every each sensor. Can anyone help me with these ?

"without external hardware"

But, but ... this is just easy/peasy if you use an rtc. Ten bucks for all the hardware, and twenty lines of code.

Otherwise you can add up the millis. I hear that is within 5% of real time.

If you do not want to use RTC clock as ChrisTenone suggested, you still need at an "external" hardware - that is the usb cable between PC and Arduino.

Lisahlabey:
I'm patching up a circuit with multiple sensors. I need the Arduino to capture the pc time when any of the sensors are being triggered/step . So the time will keep on elapsing hence i can know the timing between every each sensor. Can anyone help me with these ?

You don't need to capture PC Time every time you make a reading, but only every minute or more to compare it with microseconds() to compensate for Arduino clock drift.

Very precise ms-level synchronization via serial line can be tricky, because it can have unpredicted delay into both PC process scheduler and serial port buffer. If accuracy is important, use external RTC.

Some form of connection between the PC and Arduino will be needed to permit the time value to be exchanged.

It is not clear what you mean by "no external hardware"... do you mean no electrical connection via a cable?

Give us a clue what connection options are available to you? Wifi, Ethernet, Bluetooth, serial port?

The PC will either need to provide the time at regular intervals or on request, in any case a "time server" will need to run on the PC.

There are many ways to get the time to the Arduino that does not involve a PC, for example a low cost RTC (as already sugested is the obvious cheap way) or a low cost GPS receiver for a super accurate time if it can always "view" satellites (Using the NMEA sentences and the accurate pulse per second output.)

Thanks all . i get it now :slight_smile: