Set RTC 3231 manually on this sketch? trouble with Python/Pserial

I’m having an awful time trying to set time on my 3231 RTC. I downloaded the Python program but when I try to install Pserial, it finds Python version 2.7 so I click 'next'. Says it's ready to install so I click 'next'. I get an error that says 'could not create key'. I click OK. Another error that says 'could not set key value’. I click OK, then another 'could not set key value’. I click OK then it says it loads. But I can't get it to set the time on this sketch.

The code is on the first post on this old thread. Links for Python are on post 39. Improved Arduino LED lighting code | Page 3 | The Planted Tank Forum

Is it possible to set the time manually on this sketch?

I've spent hours trying to get this Pserial to work-IDK if it's an issue with my computer or what. I have Windows 7, if that makes a difference. I am using Arduino 1.6.7. I have an Arduino UNO.

The libraries are loaded and it compiles, the RTC is killing me. Any help would be much appreciated.

Just load the example sketch that comes with the DS3231 library. It's easy to set the time, and you will probably only do it once. You definitely don't need Python anything for this.

Thank you aarg. It seems odd, but the DS3231RTC-master I added to the library does not show up in Examples from custom libraries. There is sodaq_DS32331. Could that example work even though the DS3231-master library is used in this sketch?

It seems odd, but the DS3231RTC-master I added to the library does not show up in Examples from custom libraries.

Then you have loaded the library incorrectly.

I would recommend Jack Christensen's library for the Ds3232/3231.

cattledog:
I would recommend Jack Christensen's library for the Ds3232/3231.

+1

And you have to remove the '-master' from the end of the library name.

mixographer:
And you have to remove the ‘-master’ from the end of the library name.

Not just that library, but many. I think it’s an artifact of github.

'DS3231RTC-master' shows up in my list of contributed libraries, that must be why it does not show up in examples from custom libraries.

Is there a way to delete the DS3231RTC-master library? I can't seem to highlight it and a right click puts it in the sketch the same as a left click.

Or do I need to delete the Arduino 1.6.7 program, get a fresh copy and start over?

Thanks guys.

Is there a way to delete the DS3231RTC-master library? I can’t seem to highlight it and a right click puts it in the sketch the same as a left click.

You need to delete the library from the file location where it resides. You do not do it from within the ide. There should be a library folder in a folder with all your sketches. Delete it from inside that library folder.

Thanks cattledog, I went there and deleted DS3231RC-master so I could try again. Here are the instructions from github;

•Go to GitHub - JChristensen/DS3232RTC: Arduino Library for Maxim Integrated DS3232 and DS3231 Real-Time Clocks, click the Download ZIP button and save the ZIP file to a convenient location on your PC.
•Uncompress the downloaded file. This will result in a folder containing all the files for the library, that has a name that includes the branch name, usually DS3232RTC-master.
•Rename the folder to just DS3232RTC.
•Copy the renamed folder to the Arduino sketchbook\libraries folder

I can only change the name of the file that got downloaded, DS3232RTC-master.zip, and if I change it to DS3232RTC, it won’t open so I changed it to DS3232RTC.zip.

When I open DS3232RTC.zip, there is a file named DS3232RTC-master. I can’t rename this file. When I open DS3232RTC-master, there are seven files.

When I try to add the zip file, the Arduino program won’t let me. Any chance you guys can help me sort this out?

You download the zip file. Click open and then extract all. The extract destination should be the user libraries folder. Remove the word "master"(rename the file) from the end of the file name "DS3232RTC-master" in the libraries folder. Restart the ide and you should be good to go.

Thanks cattledog, still having trouble but I feel like I'm getting there because now I can find those libraries under examples.

Here's what I did at the ds3231-master.zip that I downloaded.

Extract all, browse, libraries, documents, my documents, arduino, libraries, OK, extract, rename, removing '-master' from file name.

When I tried to compile, I got this error.

C:\Users\Valued Customer\Documents\Arduino\Libraries\DS3231RTC.cpp:22:22: fatal error: Wprogram.h. No such file on directory

Here’s what I did at the ds3231-master.zip that I downloaded.

The Christensen library should be called DS3232 and the #include <DS3232RTC.h>

What files are within the folder named DS3232.

Is the other library removed? Can you see/run the examples in the library? TimeRTC and SetSerial?

I was trying to get the Rodan 3231RTC library to work just because that’s what the sketch called for, now I’m trying to get the Christensen 3232RTC to work. It is named 3232RTC in the Arduino library.

HA!!! It compiled! Your prompt to change the <#include 3231RTC.h> to <#3232RTC.h> did the trick!

IDK why the 3231 library was so balky but thanks for all your help cattledog. I was stuck and you freed me up, it’s very much appreciated.

OK, I downloaded both the example from the 3232 library and the tank control sketch onto my UNO with the 3231 hooked up.

This is a comment from the example;

Set the date and time by entering the following on the Arduino *

  • serial monitor: *
  • year,month,day,hour,minute,second,

So I opened up the serial monitor and put 16,2,5,19,23,30, in the bar at the top and clicked send. A row of odd looking characters and letters and numbers move across the serial monitor. Meanwhile, a red light is flashing on the UNO that seems to be in sync with the row of movement across the serial monitor.

Make sure that the baud rate is set the same in sketch and on the serial monitor. The number used in Serial.begin(xxxxxx) should match the rate selected at the bottom right corner of the serial monitor.

Wow, you're good!

Glad you got it going.

My DS3231RTC came with a CR2032 battery.

Any idea how long the battery will hold up?

Is it OK to change battery with the system powered up to avoid losing the time setting? I ask because I don't have a laptop and was planning on installing the UNO in a semi permanent way.

saltyjoe:
My DS3231RTC came with a CR2032 battery.

Any idea how long the battery will hold up?

Is it OK to change battery with the system powered up to avoid losing the time setting? I ask because I don't have a laptop and was planning on installing the UNO in a semi permanent way.

About 8 to 10 years, or the shelf life of the battery, whichever is less. Yes, you can change the battery with the system VCC powering it, and the time will not be lost. With that type of battery, I recommend disabling the charging circuit, which is designed for a different battery, the LIR2032.