Wednesday, 13 April 2011

Set the time on your DS1307 with the Arduino

After getting my DS1307 RTC working I thought it would be easier to set the time using an app (can I call it that?) on the PC that uses the PC time.

The code base that I used/modified to read and write to my DS1307 was from here, this uses a UNIX time code to set the time.

The app should be used in conjunction with this Sketch, or derivative that uses the same method to set the time.  You can also see any serial data sent back from the Arduino in the 'data received' window.

Now I'm not an expert in VB programming but I like the occasional challenge so here it is, please use it and modify it as you like, I got most of the instructions using Google anyway.
The idea is that the computer time is split out into the separate boxes, not necessary but clearer for me to programme.

The 'T' box continually updates to create the UNIX time code and is sent to the Arduino/RTC when the 'Send' button is clicked.

To install the App: -
  1. Get it from my dropbox public folder here.
  2. Extract to a folder on your PC.
  3. Run the setup to install.
  4. Run the programme.
  5. Select the comm port (plug in Arduino first).
  6. Select the baud rate to match the Arduino.
  7. Click Connect.
  8. Click Disconnect before exiting the app.
Any problems or suggestions please use the comments.
23/4/11 - Post updated - Link to Arduino sketch corrected.


Ken Boak said...


You have done a lot in 10 days considering you only discovered Arduino on April 4th!

Combined with the wireless capability of JeeNodes, it opens the possibility of extending control and monitoring networks all around the house and even into the garden.

I've been developing a device called Nanode - which is similar to Arduino but with built in ethernet controller.

This allows remote monitoring and control via the web - using services such as Pachube.

Nanode is featured here:


Gadjet said...

Thanks for commenting, the first, apart from a bit of spam.

Although I made the post on the 4th I bought the Uno on the 23rd of March, it just took a few days to get familiar with the Arduino.
I'll definitely have a look at your project, I've bought the Ethernet shield but been a bit dissapointed with what I could do with it without resorting to PHP scripts on a server but it's early days yet.
I'm ordering a couple of the Jeelabs because of the ability to do remote monitoring and control.


Jason said...

Great work with the app. I also found the it strange that no one else had come up with a solution for syncing the time from the computer. I ended up using a python script, but your app looks like a very nice clean solution (for windoze users). You should definitely add a link to your page from the time section of the arduino wiki page.

Gadjet said...

Thanks for the feedback.
I'd not thought about putting it on the Wiki, good idea, just done it.

Cheers said...

Program is cool, just ran into some issues with it. my PC clock is not 24 hours so the time is showing
"4:08:46 PM" In your Program. So its not allowing me to set the time properly to the ds1307.


Kirk W said...

Set my clock to 24 Hours, and format From US to UK Time. this works now :)

Gadjet said...

Kirk W,
Thanks for the feedback, I've not done a lot with the programme for a while but I'll take a look at the clock issues, I never thought about the 12/24 hr issue. Glad you got it to work though.

bogent said...

I have tried to download but I could not connect with the dropbox.

Gadjet said...

Sorry, try again.
For some reason the file name extension had changed to rar, I have changed it back to zip so now it should download OK.
Please let me know if it doesn't work.


Three button WiFi Remote

Using the power control circuit from the Wirelesse door/Window sensor I have designed a simple 3 button WiFi remote with the intention of co...

Popular Posts