Arduino and DS1307 programming question

I didn't realize I was... Not sure what to look at. I went back to look at the final code. Very possible I'm not seeing something!...This code is what I'm using to move ahead with an irrigation project of sorts:
....
Probably just a misunderstanding as I was not looking or thinking about it as carefully as I could have.

I was referring specifically to these lines in your setup:
Code:
  pinMode(A3, OUTPUT);
  pinMode(A2, OUTPUT);
  digitalWrite(A3, HIGH);
  digitalWrite(A2, LOW);
and somehow relating that to your mention of an earlier attempt at using an LED other than the one on the board (and without a resistor which is not good).

Yes, I took a look at that (DS3231) awhile back. Doesn't it use a super cap instead of the coin cell like I'm using? Definitely worth checking out when I need more precision. The 1307 came with a kit I bought when I decided to jump in and learn Arduino.
The DS3231 is an advancement over the 1307 in my opinion. It can use a coin cell battery. It also has the capability to set alarms which will change the output of a pin (see here if you are interested).
 

Thread Starter

TrmickCO

Joined Oct 9, 2016
72
Probably just a misunderstanding as I was not looking or thinking about it as carefully as I could have.

I was referring specifically to these lines in your setup:
Code:
  pinMode(A3, OUTPUT);
  pinMode(A2, OUTPUT);
  digitalWrite(A3, HIGH);
  digitalWrite(A2, LOW);
and somehow relating that to your mention of an earlier attempt at using an LED other than the one on the board (and without a resistor which is not good).



The DS3231 is an advancement over the 1307 in my opinion. It can use a coin cell battery. It also has the capability to set alarms which will change the output of a pin (see here if you are interested).
Probably just a misunderstanding as I was not looking or thinking about it as carefully as I could have.

I was referring specifically to these lines in your setup:
Code:
  pinMode(A3, OUTPUT);
  pinMode(A2, OUTPUT);
  digitalWrite(A3, HIGH);
  digitalWrite(A2, LOW);
and somehow relating that to your mention of an earlier attempt at using an LED other than the one on the board (and without a resistor which is not good).



The DS3231 is an advancement over the 1307 in my opinion. It can use a coin cell battery. It also has the capability to set alarms which will change the output of a pin (see here if you are interested).
Ok, I see. Those outputs (A2, A3) I'm using for the clock. The DS3231 looks pretty promising, I mentioned the super cap after I stumbled on a Jameco page. Peaked my interest:
https://www.jameco.com/z/277258-VP-DS3231-RTC-Real-Time-Clock-Module-Super-Capacitor_2217625.html
I shop at sparkfun every now and again as well(supporting a local business), they have some interesting options. Of course It's always more expensive than eBay, Amazon, Banggood etc..
Just for the record, I agree using an LED without a resistor is not a great idea. Sometimes I'll do a quick test without a resistor, but the final circuit will always include one.
Also, just wanted to point out again, removing any nearby noise/interference from the DS1307 does in fact help with it's accuracy(as the datasheet points out) and I'm now running a tight time.
 

Thread Starter

TrmickCO

Joined Oct 9, 2016
72
Yeah, it's just how it worked out. Keep in mind this is only a piece of the whole project. There are several other elements including a relay, mosfet, and a pump(solenoid) that are also involved. So, this is how everything pieced together in the end I suppose. It was loosely based on a project in a book. I pretty much took my own path with it though.
Running great btw. (Small irrigation system on timer for plants.)...Just need to build an enclosure etc.
 

Phil-S

Joined Dec 4, 2015
238
Yes, I took a look at that (DS3231) awhile back. Doesn't it use a super cap instead of the coin cell like I'm using? Definitely worth checking out when I need more precision. The 1307 came with a kit I bought when I decided to jump in and learn Arduino.
Maxim (Dallas Semiconductors) produce a wide range of RTC devices. The DS1307 is popular as it is cheap and comes in a DIP8 package. Others like the DS3231 come in slightly tricky SOIC16 so you need a breakout board or a ready made one from Adafruit etc. The gain in accuracy is reflected in the much higher price. You can run (when not connected to USB) etc. on a coin cell just like the DS1307. Some variants, I believe, have a facility for a rechargeable backup power supply like a Lipo - if you were careful with the charging current, you could use a super cap instead. The backup current is very low <10uA) so a CR2032 would keep things going for a very long time. The beauty of the DS3231 and 1307 is that apart from some obscure registers, you can use the same libraries interchangeably. Some of the DS3231 llibraries give you access to chip temperature as well as being able to fine trim the accuracy using the aging registers
 
Top