Tiny RTC DS1307 + 24C32 Real Time Clock Module (HCMODU0011)

Real Time Clock modules for microcontrollers
the_fellowship
Posts: 2
Joined: Thu Dec 25, 2014 6:14 pm

Re: Tiny RTC DS1307 + 24C32 Real Time Clock Module (HCMODU00

Post by the_fellowship » Mon Mar 16, 2015 6:01 pm

Hi,

I've just ordered and am now waiting for this RTC to arrive :-)

I'm very new to this so apologies if this is a silly question, but what is the difference between the P1 and P2 sets of pins?
If you only want to use the RTC features, which set of pins would you need to connect?
e.g. If I want to connect to Arduino UNO R3, is the following correct:

RTC P2 <---> Arduino UNO
GND <----> GND
VCC <----> +5V
SCL <----> A5
SDA <---> A4

Thanks in advance for any info/help with these questions :-)

andrew
Site Admin
Posts: 1374
Joined: Sun Aug 05, 2012 4:15 pm

Re: Tiny RTC DS1307 + 24C32 Real Time Clock Module (HCMODU00

Post by andrew » Tue Mar 17, 2015 10:00 am

what is the difference between the P1 and P2 sets of pins?
Nothing, they are electrically connected together. The additional header is probably just there to make it convenient to daisy-chain other I2C devices on the same bus. The significant different is that one header has the addition of the SQ ant BAT pins.
If I want to connect to Arduino UNO R3, is the following correct:
Yeah that looks fine to me.
Comments made by this poster do not necessarily reflect the views of Hobby Components Ltd.

the_fellowship
Posts: 2
Joined: Thu Dec 25, 2014 6:14 pm

Re: Tiny RTC DS1307 + 24C32 Real Time Clock Module (HCMODU00

Post by the_fellowship » Tue Mar 17, 2015 10:45 am

Thanks for the confirmation :-)

barewires
Posts: 49
Joined: Wed Aug 21, 2013 7:38 am

Re: Tiny RTC DS1307 + 24C32 Real Time Clock Module (HCMODU00

Post by barewires » Fri Jul 24, 2015 2:04 pm

Hi,

I just opened up my HC RTC from May 2014, and had it working in minutes with a Micromite MkII with I2C.
The MMBasic is smart and knows the type of RTC connected, avoiding all of the frustrating (=Arduino headers, libraries, compiler) :cry: I2C setup.

The Micromite MkII is a home programmed (OS firmware, one-time-only using a PICkit3 or 3clone), open source, Microchip PIC32MX170 MIPS 32-bit CPU, 48 MHz, and 10uF MLCC Vcap, that is powered by a UART dongle at 3.3v maximum (use a 5v USB to 3.3 regulator if needed) and uses a console terminal at 38400 baud for self-generated editing, debugging and load/save to PC
See http://geoffg.net/micromite.html for details

I would recommend a Hobbycomponents Model HCMODU0051 Silicon Labs CP2102 3.3V USB to UART serial interface module adaptor to power and communicate. An extension USB cable may be required or HC dupont jumpers.

or

Model HCCABL0015 - USB to RS232 TTL Serial Interface Cable - but requires a 5v to 3.3v LDO regulator (I use MPC1700-330) and two filter capacitors to safely power the Micromite and peripherals, the cable however is a bonus.

This is all the code needed to set, read the DS1307 RTC and syncs the Micromite MkII to real-time every 12 hours.
The internal MMII Basic clock can drift +- 3 seconds per hour.

Code: Select all

'this will set the RTC to 2015 July 24 14:01:02 PM and can be done from the command line prompt.
RTC SETTIME 15, 7, 24, 14, 01, 02
This will sync the internal pseudo RTC to the real RTC.

Code: Select all

RTC GETTIME ' get and set the internal time at startup

SETTICK 12*3600*1000, SetTime, 4   ' interrupts set to 12 hours * 3600 seconds per hour * 1000 ticks per second

Do 
	'< normal user program goes here>
	PAUSE 1000
	Print Date$, Time$  'to console UART Dongle to Teraterm or Putty
Loop

SetTime: ' interrupt called every 12 hours
RTC GETTIME ' reset the internal MM Basic time to RTC
IRETURN

harpop
Posts: 3
Joined: Wed Feb 25, 2015 10:23 am

Re: Tiny RTC DS1307 + 24C32 Real Time Clock Module (HCMODU00

Post by harpop » Wed Jul 29, 2015 7:01 pm

Hello,
I just ordered 3 pieces of this module.
I read that to read/write the time or to read/write to the eeprom I just need to connect the module to the I2C pins of the Arduino but I am wondering what the "DS" and "SQ" pins are used for. Can someone shed some light on this !
Thanks.

andrew
Site Admin
Posts: 1374
Joined: Sun Aug 05, 2012 4:15 pm

Re: Tiny RTC DS1307 + 24C32 Real Time Clock Module (HCMODU00

Post by andrew » Thu Jul 30, 2015 7:50 am

The DS1307 has a feature where you can output a square wave to a pin. Without referencing the datasheet I think this can at fixed frequencies of 1Hz, 4KHz, 8KHz, and 32KHz. You have to configure an internal register to do this but when configured correctly the square wave will appear on the SQ pin.

If you take a look at the pictures in the first post you'll notice there a 3 pads in the top left corner. These allow you to solder an optional DS1820 temperature sensor. If you do this the DS pin connects to its data out pin.

If you are only interested in the RTC and EEPROM features then the only pins you need to connect to your Arduino are as follows:

RTC.......Arduino(UNO)
GND.....GND
VCC......5V
SDA......A4
SCL.......A5


I'll update the first post to add these answers.
Comments made by this poster do not necessarily reflect the views of Hobby Components Ltd.

harpop
Posts: 3
Joined: Wed Feb 25, 2015 10:23 am

Re: Tiny RTC DS1307 + 24C32 Real Time Clock Module (HCMODU00

Post by harpop » Thu Jul 30, 2015 9:36 am

Thank you for your reply.

arduinocoder
Posts: 2
Joined: Mon Jun 13, 2016 11:11 am

Re: Tiny RTC DS1307 + 24C32 Real Time Clock Module (HCMODU00

Post by arduinocoder » Thu Jun 16, 2016 10:41 am

Hi,

I need to change the analog pin on the arduino since I already have my lcd screen connected on A4 and A5.

How can i do that?

Thanks

andrew
Site Admin
Posts: 1374
Joined: Sun Aug 05, 2012 4:15 pm

Re: Tiny RTC DS1307 + 24C32 Real Time Clock Module (HCMODU00

Post by andrew » Thu Jun 16, 2016 12:14 pm

The analogue pins A4 and A5 also double up as a hardware serial I2C interface which the RTC module and the library make use of. This hardware interface is fixed to these pins and so as a result you can't move it to a different set of pins. However, depending on your LCD, it is probably also using these pins as an I2C interface. As the I2C interface can support multiple salve devices being connected to it at the same time, if your LCD does have an I2C interface and doesn't use the same slave addresses as this module you should be able to connect them both to these pins.

Just check first to see if your LCD is an I2C slave device.
Comments made by this poster do not necessarily reflect the views of Hobby Components Ltd.

arduinocoder
Posts: 2
Joined: Mon Jun 13, 2016 11:11 am

Re: Tiny RTC DS1307 + 24C32 Real Time Clock Module (HCMODU00

Post by arduinocoder » Thu Jun 16, 2016 1:14 pm

Hi Andrew,

Wouaah you're right!!! it just works!!!!
Connected my Serial I2C LCD 1602 Module (HCARDU0023) (0x27) and my Real Time Clock module HCMODU0011 DS1307 on pin A4 and A5 together works like a charm !!!!

Many thanks!

Post Reply

Return to “RTC”