It is probably not a very good one and I would buy any other at the drop of a hat BUT for the 6 week wait cycle. So I'm stuck with it.
In my research I have read about 3 pin RTCs, 4 pin ones and 5 pin ones but never a 6 pin one (which mine is). Even the description in my item talks of "Simple 3-Wire Interface" but it has 6 pins/wires? These are - RST, I/O, SCLK, GND, VCC2 & VCC1. a few articles talk of using pins A4(SDA) & A5(SCL). None of my six pins is SCL nor SDA.
Some articles talk of SPI and I2C too. So I am totally confused. I have looked at the Rtc_Pcf8563 library and the DS1302 library. There is also talk about needing and NOT needing pull-up-down resistors
I have a further complication in that I would like to leave my 128X64 OLED display attached (for debugging and feedback) and this DOES use SCL and SDA. Can 2 different devices use SCL and SDA at the same time?
I have Uno and Mega clones but would prefer to use my Nano clone if that makes a difference.
Could some kind, brilliant person tell me how to connect MY (6 pin) RTC (and leaving my OLED connected) and write a sketch to initialize MY RTC and read it back with indication as to what is plugged in where? The OLED works PERFECTLY with the u8glib library. (or point me at such a sketch) :o
I will wrap your sketch around my u8glib example....
from what I understand of the data this is an odd mix of I2C and SPI. It has a slave select pin the CE. but it needs to be made HIGH during wright and read instead of LOW like with SPI. the dataLine, the I/O is bidirectional like with I2C but there is no ACK bits mentioned or what so ever, so that excludes the Wire.h library for I2c. SPI uses 2 uni directional datalines the MOSI and the MISO.
this is the 3-wire interface, as I have no experience with this I'd like to point you to my first google hit
Best way I found to run a DS1302 was with Henning Karlsen's library here. If yours is really a 1302, then there are no SDA/SCL lines since it's not an I2C device. 1302 datasheet
The DS1307 is simpler though because it's I2C, and just goes on the SDA/SCL bus along with other I2C devices as long as the addresses are different. I have an Adafruit AF931 and Sparkfun's DS1307 happily together on the same board sharing the SDA and SCL. See top left of attached photo. Sharing is the whole point of the I2C bus; in fact I've had that setup running with 2x I2C EEPROMs as well. All happy together....
and mine doesnt use i2c or SPI its just 3 wires to any IO you like.
and to tell you how bad it is, i found a article that says it adds or removes 2second each day!
and as i sad i got it working a week ago and it got a offset of +-2min
as i see on the images your 6pin version as VCC1 and VCC2
one should be connected to the battery and the other one to the IC and you need the one thats connected to the IC.
I downloaded and copied the library and loaded the easy example....
Modified the date and time etc. Today is a good day as the are NO worries whether it is DD/MM/YY or MM/DD/YY.... 01/01/2015. I set the time to 11:39:00 and uploaded the sketch.
Activated the serial monitor and the time never changed
Checked everything, all okay? There is NO CE so I connected pin 2 to RST! Right????
I also plugged 5V to VCC2 and left VCC1 unconnected????
Righto- I connected my 1302 to the pins as required by HK's sketch DS1302_Serial_Easy . Mine's a loose chip not on a little board, so I took Arduino 2 to 1302 5, 3 to 6 and 4 to 7. Jammed a crystal into 1302 pins 2 and 3; power and ground to 1302 pin 1 and 4. Opened sketch, changed delay to 10000 so it didn't whizz too fast for a screen shot.
Got the below output: time updating every 10 seconds.... left it until the minutes had changed too. All is good, I'm afraid.
Can you see the traces on that little PCB?- can you track them back to the chip to verify which pin on the edge is which?
Bit disheartened at the moment so I just ordered 3 DS1307s from 3 different sellers due on the 19th (ha!ha!). Hopefully one of them will worked as specified as my 1302 is a bit disappointing.
Will try spirit's suggested library in a bit. Can't understand why the battery got so hot????
Hi,
I have always used the DS1307 and no problems at all, even it left for months the time holds well as long as you fit the CR2032/1220 back up battery... I have put on my own micro PCBs for controlleres, etc.
Yes I have a couple of those modules, they have memory on them too, but never used it. The DS1307 has a small amount of memory for holding alarm values, etc. I'm sure you will be Ok with them!!
One side of the board, labeled P1, has BAT, the 4 I2C pins(?), DS and SQ. On the other side, labeled P2, has the 4 I2C pins and DS....
The setups I have seen just wire in the I2C terminals on the P2 side. Why not the DS? And if wired where does it connect to?
And what about the BAT, DS & SQ pins on P1? In fact, why P1 and P2?
With the standard i2c pins wired only will the battery trickle charge?
Questions? Questions? Questions?
I got some weird ones from China that completely refuse to cycle time unless the backup battery is installed. You can set it but the battery is needed to make it clock.
I'll have to look you up when I design and code my Mains relay to switch on TV LED strip backlight and soundbar when I press "ON" on my Sony TV remote.....
I'm converting a PICAXE BASIC program to a C++ sketch (for my brother) to kill time....
I'm converting a PICAXE BASIC program to a C++ sketch (for my brother) to kill time....
As an old Picaxer I still do that sometimes, Picaxe basic simple but confusing at times... "C" Well I'm still learning, just play with the code until it works, often a silly mistake. I have never used the DS1302 only the DS1307 which I find works fine.