Program and read IBM AT real-time clock/calendar with Arduino.

Real-time clock (RTC) Module is a direct clock/calendar replacement for AT-compatible computers and other applications. It has internal lithium cell for external power failure and crystal. No external components required. The unit can be found on some motherboards or just ordered as a free sample from Texas Instruments website.

12/24 time formats with daylight saving, alarm features and 100-year calendar and programmable square output. On top of that 114 bytes of nonvolatile storage are available for general purpose.

I've built it on single plated PCB as an Adruino shield. Work with 8-bit bidirectional bus requires 11 digital pins from Arduino in this primary design. Anyway when module is set up you can put it aside (up to 10 years, internal cell will take care of internal operations and memory:) and develop serial bus interface. I hope that'll be my next project.

Time, data, registers can be read/written with simple commands through Serial port, directly from Arduino IDE serial monitor.

After upload to Arduino flash:
- send 't' to display current module time
- send 'r' to display registers
- send 'h/m/s/M/D/Y' to adjust time and date


If you are using new module first step is to run the oscillator. Instruction included in datasheet archive. Write 010x pattern to register A. writebyte(regA,0x2A) function will help to run newly shipped module at start-up.

2 Buttons on my prototype are optional.

Cheers!

Login to post a comment...

Sarge 4 weeks, 1 day ago

smoltis, thanks for this write-up. i came upon these parts (BQ3287) and wanted to put them to use. your post was the first that came up when i googled "BQ3287 arduino". the code was packed and ready to go. this is probably ancient history now but there is an error with the fritzing diagram. D12 goes to pin 17 and reset (pin 18) goes to VCC. in the diagram, it looks like they are on pin 16 and 17 respectively. i had to dig more too find out why. thanks to kerry wong's write-up, i've got it. sallright, builds character. sarge