Intro: LED - Mega Clock
Step 1: Bill of Material (All You Will Need)
For the Housing
- Three 300x300mm x 3mm thickness Acrylic glass (black)
- One 300x300mm x 3mm thickness Acrylic glass (trasparent)
- Acrylic glass adhesive and polish
- Twenty 15mm spacers M3 thread
- Twenty M3 screws + washers
- One 300x300 picture frame
For the Electronic
- 480 3mm LEDs (color of your choice)
- Sixty 120 Ω resistors
- One 4-Digit 7-Segment Display common anode
- Eight 74HC595 Shift Registers
- Eight BD139 NPN Transistors
- One Arduino ATMEGA 2560 Board
- One TLC5940
- 1m RGB-LED-Strip
- One LM317 voltage regulator
- One 0.1μF capacitor
- One 1μF capacitor
- One 1 kΩ resistor
- One 330 Ω resistor
- One 2.5 mm DC Jack
- Ribbon Cable
- Header Strips
- One I2C RTC DS1307 AT24C32 Real Time Clock Module For Arduino Mega2560
- Lot of Copper Wire and tin solder
- Eight 750 Ohm Resistors
- Four circuit strip boards
- One 12V 1A Powersupply or one 11,1 1000-2000mAh Lipo rechargeable battery
Step 2: Building the Housing (Part1)
- Cut and drill the 3mm acrylic plates as shown in the sketch
- Glue front housing plate (black plate), bonding part (transparent plate) and LEDs slice plate (black plate) together
Step 3: Building the Housing (Part2)
- Glue one 300x300mm 3mm thickness acrylic plate to the back paperboard of the picture frame for more stability, if the picture frame has a glass you can take it out, we dont need it
- Screew four 15mm spacers to the acrylic plate like shown in the pictures
- Now you can glue the four spacers from one side of the picture frame to the front plate (tip scratch the plate first before gluing the spacers, they will fix better)
- Unscrew the glued four spacers for the next step
Step 4: Inserting LEDs to the Front Plate
- First insert the 3mm LEDs in the first row of the drilled plate (first 60 LEDs)
- Bend the anodes to the side and solder the cathodes arround the plate together with 0.8mm copper wire
- Repeat this for the other 7 rows
- Now solder anodes of the same column together
- You should have a matrix of 8 rows (cathodes) and 60 columns (anodes)
Step 5: Soldering the Matrix Together
- Solder one 8-pol cable connector to the 8 rows (cathodes) of the matrix
- Solder eight 8-pol cable connectors to the 60 columns (anodes) of the matrix. I have used 8-pol connectors now I have 64 cables available but we only need 60, on the left four I put rubber tape. You can also do best and use seven 8-pol connectors an one 4-pol connector so you have exact 60 connections
Step 6: Inserting the 4-Digit 7-Segment Display
- Cut the LEDs Slice plate at the center and glue the 4-Digit 7-Segment display (tip solder wires to the display before glueing the display)
- I had to scratch the back side of the plate and glued the spacers again, because it was not realy fixed like I mentioned before
Step 7: Building the Electronic
- Cut the circuit stripboards so the fit inside the picture frame
- You will need some connectors you can built your owns like I made
Step 8: Building the Electronic and Code Explanation
Here is the complete circuit and the code
I put also a 11,1V 1000mAh Lipo rechargeable battery so I can power the clock without external DC cable.
After connecting all the electronic downloading the zip 3 zip-Files one is the code an the others are the libraries.
First you have to put both libraries folders for TLCs and RTC-Module into your arduino library folder otherwise you will get error when opening the code, or you can also download the libraries from the arduino site.
The code include 3 folders:
The SetTime Folder with SetTime.ino: use this file to set the time manually for your RTC-Module for the first time, for this you have to change the byte variables in the setDateTime() function with your local Time, then load this code to your arduino and the RTC-Module will store your local Time, you only have to do this the first time to set the time or if you change the battery of your RTC-Module. The TestTimeFolder with
TestTime.ino: use this only to check if the RTC-Module stored the correct time, load this code and open the serial monitor to check it.
The LED_Mega_Clock Folder: with 6 files, all this 6 files have to be in the same Folder, open only LED_Mega_Clock.ino and you'll get all 6 files in different Taps.
- "LED_Mega_Clock Tap": here is the setup for the pins and definition of global variables and arrays for the registers and the loop() function. I have made 3 functions in the "programs Tab" with 3 different animations choose one of them and put it into the loop function.
- "RTC Tab": here is the setup of the RTC you don't really need to edit this tab but for more information visit arduino site. Here I made the function checkTime() to begin transition between RTC-Module and arduino. I use this before each animation and also don't forget to read the time before the animation and convert this binary coded data to normal decimal with the byte bcdToDec() function I made. For example: int second = bcdToDec(Wire.read()); "RGB_LED_Strip Tap": here I made 2 functions one that change the whole color-spectrum from red to magenta very 20 min and one that change each color every second use PWM outputs of your arduino to do this. you can make your own functions.
- "blue_LEDs Tap": here I made 3 functions using multiplexing one to set the blue LED-Matrix with second, minute, and hour indicator the other do the same but with a swinging point from right to left as second indicator. and the shift() function to shift data. You can make your own animations.
How to shift data: http://arduino.cc/en/tutorial/ShiftOut
- digit_display Tap: here are 3 functions one to set the the digits (anodes or arduino pins defined in the CA [ ] array in the "LED_Mega_Clock Tap") one to set the segments (cathodes or TLC pins to sink the current to GND ) and one to reset the TLC That means you have 4 digits that you set high or low with your arduino pins and 7 segments in each digit that you set high or low with the TLC using Multiplexing. How to use the TLC library: http://arduino.cc/en/tutorial/ShiftOut
You can optimise the clock for example by connecting a Foto-Resistor in the circuit to automatically controll the lightness of the clock depending on the ambient light of your room, or you can use a 10k Potentiometer to control the brightness manually.
You can also insert a button to switch betteew different programs or put another LED Strip inside the clock to illuminate the transparent Plastic Part in the front panel.