Introduction: Turn Your Real Time Clock Module Into a Mini-shield. Eliminate Annoying Wires.
One thing I hate while prototyping is all those wires everywhere!
Well, I looked at my I2C Tiny RTC module, and thought...
"If I line up the SCL with A5 (which is where it connects for my library) and SDA with A4...it puts the VCC into A3, and GND into A2..."
and I though - if you can power an LED off these, then powering an RTC module should be a snap!
Now on my module, this leaves the DS pin hanging over the connector's edge - which is perfect as it isn't used.
We just need to turn A3 and A2 into a power supply rather than floating inputs!
So, inside your SETUP section of code, The first lines we add before anything else (so that the clock is powered before anything tries to read it) are simple these:
pinMode (A3, OUTPUT); // I want to simply plug the clock board into pins A2 through A5
digitalWrite (A3, HIGH); // I am using this line as a supply voltage to the clock board
pinMode (A2, OUTPUT); // This pin can't be left floating if we are going to use it as ground for the RTC
digitalWrite (A2, LOW); // Set this pin low so that it acts as Ground for the clock
That's it. Now your clock is powered assuming the pins are in the same order as the module I have, which is:
GND, VCC, SDA, SCL, DS (with DS not being necessary)
Now of course this all assumes your code already is able to read your clock, and you just want to get rid of the wires.
If you want to learn how to use a clock module, there are plenty of tutorials on that.
If you're new to my instructables and are wondering about that penny on my Arduino, check it out at
https://www.instructables.com/contest/fixit2013/
under the heading "Beef up your Arduino power".
UPDATE:
I have decided that I want to use the temperature sensor in my clock project, so I flipped over the pin header on the I2C RTC module, This means changing my clock code to read from A3 and A4, and change my Power to pin A2 and ground to pin A1.
It does give it more of a mini-shield look though. I had to insulate the circuit though as it hangs right over the ICSP (ISP) header.
See last photo.
ADDENDUM: I have found out that the I2C communications cannot be changed from pins A4 and A5, so no software changes were made. The only difference now is that the I2C RTC sits over the Arduino, rather than hanging over the edge.
Well, I looked at my I2C Tiny RTC module, and thought...
"If I line up the SCL with A5 (which is where it connects for my library) and SDA with A4...it puts the VCC into A3, and GND into A2..."
and I though - if you can power an LED off these, then powering an RTC module should be a snap!
Now on my module, this leaves the DS pin hanging over the connector's edge - which is perfect as it isn't used.
We just need to turn A3 and A2 into a power supply rather than floating inputs!
So, inside your SETUP section of code, The first lines we add before anything else (so that the clock is powered before anything tries to read it) are simple these:
pinMode (A3, OUTPUT); // I want to simply plug the clock board into pins A2 through A5
digitalWrite (A3, HIGH); // I am using this line as a supply voltage to the clock board
pinMode (A2, OUTPUT); // This pin can't be left floating if we are going to use it as ground for the RTC
digitalWrite (A2, LOW); // Set this pin low so that it acts as Ground for the clock
That's it. Now your clock is powered assuming the pins are in the same order as the module I have, which is:
GND, VCC, SDA, SCL, DS (with DS not being necessary)
Now of course this all assumes your code already is able to read your clock, and you just want to get rid of the wires.
If you want to learn how to use a clock module, there are plenty of tutorials on that.
If you're new to my instructables and are wondering about that penny on my Arduino, check it out at
https://www.instructables.com/contest/fixit2013/
under the heading "Beef up your Arduino power".
UPDATE:
I have decided that I want to use the temperature sensor in my clock project, so I flipped over the pin header on the I2C RTC module, This means changing my clock code to read from A3 and A4, and change my Power to pin A2 and ground to pin A1.
It does give it more of a mini-shield look though. I had to insulate the circuit though as it hangs right over the ICSP (ISP) header.
See last photo.
ADDENDUM: I have found out that the I2C communications cannot be changed from pins A4 and A5, so no software changes were made. The only difference now is that the I2C RTC sits over the Arduino, rather than hanging over the edge.