Build your own clock with the MCP79410 chip and 4 7-Segment LED modules.
Provide the information to build a working clock that gets time fromprogramming source and keeps it even when power is shut down.Displays time via four, 7-segment LED blocks, that use shiftregisters to multiply output from source to endpoint.
Soldering ability both for iron and hot air.
Arduino ISP programming knowledge.
Arduino code reading and debugging.
Lucid Tronix clock chip Tutorial.
Lucid Tronix shift register Tutorial
Skills Gained:
Required Resources :
if (thehour > 12 ) thehour -= 12;Comment this line out if you want a 24 hour clock. Next we have to separate the tens column from the ones column for both the minutes and the hours. We do this with the lines:
int minute_tens = now.minute() / 10; int minute_ones = now.minute() % 10;Here we are making use of integer division and the modulo operator . So, if now.minute() returns 57, with integer division 57 / 10 = 5 and 57 % 10 = 7 and these are the digits we will display on the seven segment LEDs. Lastly, in the video you can see the decimal point on one of the seven segment LEDs blinks every second. We do this with the following two lines of code:
if (now.second()% 2 == 0) decimal_point_mask = 0b01111111; else decimal_point_mask = 0b11111111;Depending on whether the current second is even or odd, we toggle the state of the first bit in the decimal_point_mask variable. All the rest of the bits in this variable are 1 so that when we AND it with the byte dec_digits[hour_ones] it doesn't change any of the bits controlling the segments of the seven segment LED it just turns the decimal point on or off.
shiftOut(dataPin, clockPin, MSBFIRST, dec_digits[hour_ones] & decimal_point_mask);This code uses the standard Arduino Wire library for I2C communication with the real time clock chip, as well as adafruit's fork of the RTCLib library . The wire library comes with Arduino, but you will need to download the RTClib by clicking the download as zip button on the github page, then unzip it and rename it and place it in your Arduino libraries folder.
Comments: