The First Clock of February

imageS.n

By the end of the week it will be February and we’ll be on to our February theme, MakerBar, it’s about time. The members are talking about clock and calendar projects and there are two clock classes in the works Raspberry Python – Talking Clock Feb 9th and ChipKIT for Organic Lifeforms: Clock Edition¬†Feb 23th.

This then is the first clock of February, a ChipKIT Uno32 with a ChipKIT Basic I/O Shield attached. As befits a beginning this is a very simple project.

Step 1 Solder in RTC Crystal (based on instructions here)
image

Step 2 Attached Basic I/O Shield (got this for contest here)
image

Step 3 Program (combined OLED example here with RTC example here)


#include <IOShieldOled.h>
#include <RTCC.h>

void setup(){
IOShieldOled.begin();
Serial.begin(9600);

// Initialize the RTCC module
RTCC.begin();

// Set the time to something sensible
RTCC.hours(11);
RTCC.minutes(45);
RTCC.seconds(0);
RTCC.year(13);
RTCC.month(01);
RTCC.day(29);
}

void loop(){
char date[9];
char time[9];

// Format the time and print it.
sprintf(date,”%02d/%02d/%02d”, RTCC.day(), RTCC.month(), RTCC.year());
sprintf(time,”%02d:%02d:%02d”, RTCC.hours(), RTCC.minutes(), RTCC.seconds());

//Clear the virtual buffer
IOShieldOled.clearBuffer();

//Chosing Fill pattern 0
IOShieldOled.setFillPattern(IOShieldOled.getStdPattern(0));
//Turn automatic updating off
IOShieldOled.setCharUpdate(0);
IOShieldOled.clearBuffer();
IOShieldOled.setCursor(0, 0);
IOShieldOled.putString(date);
IOShieldOled.setCursor(0, 1);
IOShieldOled.putString(time);
IOShieldOled.setCursor(0, 2);
IOShieldOled.putString(“MakerBar”);
IOShieldOled.putString(“ChipKit Clock”);
IOShieldOled.updateDisplay();
}

This clock will become the basis of the class project for the February 23th class,  ChipKIT for Organic Lifeforms: Clock Edition. The clock in that class will not rely on this shield and will have functionality this clock does not, like setting the time, and time permitting an alarm.

Full, latest code available here.