The Start

Hi, What and Why

Plug it in

Rule number 1

Water Sensor

Sound Sensor


Tri Colour LED

RTC (Real Time Clock) DS1302

RTC (Real Time Clock) DS3231

Matrix LED step 1


Stepper Motor

LCD revisited with PCF8574T

Humidity Sensor

Shift Register

RFID tags (RC-522)

7 Segment display

Ultrasonic distance sensor

5V regulator

analogRead and analogWrite

Wiring an Array of Switches

The next step

Other things I have bought

Infra red and Processing

Programming a separate arduino chip

Creating your own PCB

L293D for a DC motor

4 digit 7 segment display

Starting with motors

RF433 Wireless Comms

Sort a character array

More stuff

I2C devices (SDA,SCL)

I2C scanner

SPI devices (MOSI,MISO)

HMC5883L Compass

MMA7361 Accelerometer

Added projects

Message Display System

4WD robot car
4WD robot car II

4WD robot car COMPLETE

MP3 Player

RTC (Real Time Clock)

Model : DS1302

The RTC that was included with my kit. Apart from the 5V and GND, there are 3 cables to connect to arduino pins 7, 6 and 5 (when using the msparks DS1302 library) RTC module

Reputedly, this is a low quality RTC that is not reliable. However, I never had reason to test this ...
When you switch it on for the first time, set it manually (hardcoded; see the code below) to the current date and time; then, to ensure you don't reset it to that hardcoded time repeatedly, modify the sketch and remove the lines from the 'setup' function and upload the sketch again. In theory, the RTC will then keep track of time using the on-board battery while the RTC is unplugged from the arduino.

Later the same day, I plugged it in again and was receiving unreliable garbage from it. Maybe the battery was getting flat, I didn't bother testing it. I simply accepted the recommendations and bought a better one, the DS3231.

Wired up.
The sketch (included as an example with this library) uses pins 5, 6 and 7.
tri colour led

This is the code that is included with the library as an example.

// Example sketch for interfacing with the DS1302 timekeeping chip.
// Copyright (c) 2009, Matt Sparks
// All rights reserved.
#include <stdio.h>
#include <DS1302.h>

namespace {

// Set the appropriate digital I/O pin connections. These are the pin
// assignments for the Arduino as well for as the DS1302 chip. See the DS1302
// datasheet:
const int kCePin   = 5;  // Chip Enable
const int kIoPin   = 6;  // Input/Output
const int kSclkPin = 7;  // Serial Clock

// Create a DS1302 object.
DS1302 rtc(kCePin, kIoPin, kSclkPin);

String dayAsString(const Time::Day day) {
  switch (day) {
    case Time::kSunday: return "Sunday";
    case Time::kMonday: return "Monday";
    case Time::kTuesday: return "Tuesday";
    case Time::kWednesday: return "Wednesday";
    case Time::kThursday: return "Thursday";
    case Time::kFriday: return "Friday";
    case Time::kSaturday: return "Saturday";
  return "(unknown day)";

void printTime() {
  // Get the current time and date from the chip.
  Time t = rtc.time();

  // Name the day of the week.
  const String day = dayAsString(;

  // Format the time and date and insert into the temporary buffer.
  char buf[50];
  snprintf(buf, sizeof(buf), "%s %04d-%02d-%02d %02d:%02d:%02d",
           t.yr, t.mon,,
 , t.min, t.sec);

  // Print the formatted string to serial so we can see the time.

}  // namespace

void setup() {

  // Initialize a new chip by turning off write protection and clearing the
  // clock halt flag. These methods needn't always be called. See the DS1302
  // datasheet for details.

  // Make a new time object to set the date and time.
  // Sunday, September 22, 2013 at 01:38:50.
   Time t(2014, 10, 6, 12, 57, 50, Time::kMonday);

  // Set the time and date on the chip.

// Loop and print the time every second.
void loop() {