Arduino

Arduino DS1307 Real Time Clock Shield

DS1307 Axonometric2I  have been interested for a while in the Arduino, an open source development platform based on the AVR series of microprocessors.  In case you have not heard of the Arduino before, there are many variants but all share the same footprint and are extendable using stacking circuit boards named “shields”.

I eventually wish to develop my own volume control setup for an amplifier, but in the meanwhile I have to learn how to code.  To that end I needed some hardware to attach to my Arduino (well Seeeduino to be more correct) and cut my teeth on.

So I have built my first shield, an I2C clock using the Maxim DS1307 RTC (Real Time Clock).

schematicThe Maxim DS1307 RTC IC (Integrated Circuit) is a fairly accurate clock that can keep time when not powered if you add a 3V battery.  Address and data are transferred serially through an I²C, bidirectional bus which is attached to the Arduino via pins 4 and 5.

It is perfectly simple to breadboard a circuit with the DS1307 IC but I was looking to make something more permanent as I was confident that I will be playing with the clock quite a bit.  You can see the schematic for the circuit I use though not included was the 0.22uf capacitor I added to the power line last minute.  The clock seemed to function well enough without but I felt it was a reasonable precaution to add it to enhance stability.

DS1307 Top1In my circuit I used 4.7K pull-up resistors on the SCL SDA and SQW/OUT lines of the Maxim DS1307 clock. These are not strictly required to use the IC with an Arduino as the AVR processor has internal pull-up resistors.    However if several I2C devices are used on the same bus it is recommended to use them.  The pull-up on the the SQW/OUT line is only required if you wish to read the square wave it produces.

The Arduino development platform has an array of input/outputs that your shields can plug into, but because of a slightly irregular layout standard stripboard doesn’t quite fit the connections.  Therefore to get a neat looking result there are plenty of prototyping shields available for purchase.  This time I purchased a Haceduino Proto Shield as the base for my clock shield.

DS1307 BottomThe choice to use the Haceduino was partly an economic one as they can be purchased at sensible prices on E-bay, but I also thought the layout looked practical.  As it turns out this turned out to be an inspired choice, I would heartily recommend the Haceduino Proto Shield.  Its double sided strip layout and flexible power routing made it easy to produce an ultra neat end result.

This is a fairly simple circuit and it was easy to make all the connections on the underside of the board.  I even had space to add a header for the SQW/OUT of the DS1307.  This can be programmed to output a square wave, so my clock can also double up as a source for adjusting oscilloscope probes! Bonus!!

DS1307 Axonometric1Asides from using some test code to check the clock functions (thanks to John Boxall), I have yet to write any software for the Maxim DS1307 RTC shield.  I look forward to playing with it though.

DS1307 Top2The DS1307 clock/calendar can provide seconds, minutes, hours, day, date, month, and year information via the I2C bus. Capable of running from 5V or the backup battery, the DS1307  automatically adjusts for months with fewer than 31 days and also compensates for leap years.  It is sufficiently well featured to add sophisticated timekeeping features to microprocessor based projects.

Expect to see a DS1307 in a future project… Of course I have a lot to learn before that happens, wish me luck!