I wanted to make a data logger for a project with an Arduino and I also needed the real time. So I used DS3231RTC (real time clock). I wanted to synchronise this RTC with my PC. I searched for some codes to send the PC time to Arduino and I found something and I want to share it as my first instructable.
Step 1: Make Arduino Ready
First you have to upload this program to your arduino. This program just receives the time from PC with special format and write it on the RTC.
To see the current time of the RTC you need to write "B," on the serial. (without quotation mark)
For more information visit this website.
Step 2: Send the Time From PC to Arduino
To send the time from PC, You just need to run this batch file. before that right click on it and Edit it. You need to change your arduino COM port. Mine was COM3. So change the COM number in the batch file. Do not forget, your PC's serial should be free. Maybe your Serial communication of your arduino IDE is open. Please close it first and then run the batch file.
This batch file is not at all perfect. It was the second time I wrote a batch file. So sometimes you have to run it twice. If you see the above picture as a result, including the time and date with some prefixes, that means the batch file is run completely.
Step 3: Results
Now if you write "B," on the Arduino's Serial. You will see the same time as your PC.