Introduction: 3D Printed Arduino Based Analog Digital Clock
This is a Digital Clock design that was built from 24 custom 3D printed analog clocks. It shows the digital time. Between time displays, it shows moving artwork.
It is composed of 3D printed parts, 25 Arduino nanos and 48 stepper motors. Each clock face uses a custom Eagle designed PCB which can be ordered easily. The total price I paid to build this was about $500.
The clock can be adjusted to store different time zone offsets which are saved in the master Arduino EEPROM memory.
The Clock is inspired by a clock that I saw in a Boston store a few years ago by Humans Since 82. They have a similar (and better quality) clock for sale called the ClockClock24. It costs around $6000 and is beautiful. I highly recommend that you buy one if this is in your budget.
I would say that this is a moderately difficult build but would be a very rewarding high school or college student project especially if you have multiple 3D printers.
If you do this project, you will learn 3D printing, Arduino coding, schematic/PCB design and mechanical skills. There is a lot to go wrong when you are making 24 of something so... you will learn some debugging skills too.
Wire cutters and crimper
Cyanoacrylate Krazy Glue
Step 1: More Detailed Video
This video has some more details about the operation of the clock.
Step 2: Parts List and Cost
This is the link to the google sheet for the Parts list.
The cost was around $500. You may be able to cut the cost by sourcing less expensive parts. For example, the screws I bought were $41. You can find the Arduinos for $2.70 each if you are willing to solder on the header pins.
The description in the spreadsheet is a clickable link. It may or not be good over time. You can also search google for the words in the link.
Step 3: 3D Printing
This whole project was printed on a $215 Creality Ender 3 Pro with PLA. It was sliced with the free version of Cura.
It took a long time for me to do all of this printing on one printer. I would say it was around a month or 30 days of printing. Each clock module base plate takes about 9 hours to print. If you print 2 a day, that's 12 days right there. If you have access to a second 3D printer, you could go faster.
All of the parts were printed at standard temperatures with 20% infill except for the 2 gear tubes which were printed with 100% infill and supports. The supports on the gear tubes needed to be clipped off.
I learned a lot about 3D printing on this project. Some tips:
- The bed needs to be leveled every few days. If you dont, the parts will start lifting up from the bed or getting corrupted.
- The nozzle needs to be cleaned every so often. If you dont, the prints will become very thin.
- The PLA spools need to be kept tight so the filament doesn't get bound up and snap while printing.
This is a spreadsheet with details on the 3D printed parts:
Step 4: Schematics
The schematics were captured in Eagle which is owned by Autodesk.
One note is that I initially used an opto module rather than a magnetic detector module so that's why you will see opto on the schematic and the board.
Each magnetic Hall effect sensor board is connected to a 5V, Gnd and analog pin (O_0 or O_1) on the PCB. More info on this will be provided in the assembly details.
Step 5: PCB Gerber Files
You need 25 PCB boards for this project. I uploaded the Gerber files which are attached here so you can have the boards made at any PCB fab. To open the files which are compressed into a .gz file you need to use an "unzip" program. I recommend "7Zip"
You can use any PCB manufacturer you want. I used a PCB company in China called allpcb.com I received the boards in 1 week for $32.
You can tell them you want to order this board which is a link to the exact PCB I made:
register with a new account and order.
If there are issues, email: email@example.com and tell them you want to order PCB H2W-312555.
Step 6: Arduino Code
There are two Arduino files that are used for this project: The master and the slave.
The master code is used once and controls all the slaves. The slave code is used 24 times.
To open the files which are compressed into a .gz file you need to use an "unzip" program. I recommend "7Zip"
The RTC (real time clock) library .zip file is also included here. The .zip file can be added to the Arduino IDE by doing this:
sketch -> include library -> add .zip library.
To program the Arduinos, select:
tools -> Boards: Arduino Nano
tools -> Processor Atmega328 (old bootloader)
tools -> port (select your port)
Step 7: Arduino SW Description
The Master Arduino sends I2C serial commands to the 24 slave Arduinos which are located behind each clock face. The slave Arduinos decode the I2C commands into clock movements.
Possible Arduino I2C commands from Master to Slave:
0= IDLE, 1= Calibrate, 2= Arm_go_clockwise, 3= Arm_go_counter_clockwise
The clock has 8 possible positions it can be in as shown in the picture.
After reset, the master will send a calibrate command to each Arduino to get it to go to the home position which corresponds to clock position "8". There are homing magnets in the gears behind each clock and there is a Hall effect sensor that detects when the magnet is at home.
Step 8: PCB Assembly
Watch the video for the assembly of the PCB. There are 24 of these PCBs that need to be assembled so grab a beer and listen to some music or get some friends to help you.
Gather the parts shown in the pictures.
Remember to pull out the ULN2003 driver ICs from their sockets on the little driver boards that came with the motors.
Insert each part into the board and bend a few of the pins slightly so they wont fall out. Solder each component pin onto the board.
Note that there are 6 jumper wires soldered onto each board.
Note that the green 4 pin terminal blocks shown in these pictures are not used. I just soldered the inter board connections because they had a lower voltage drop and were more reliable.
Step 9: Dip Switch Details
Each PCB has a dip switch on it. The dip switch for each clock must be set to the values shown in the picture so the Master can individually address each slave clock module:
Step 10: PCB Master Board Assembly
The Master Arduino board contains the Real Time Clock(RTC) board and an Arduino nano. The RTC is programed with the current computer time everytime the master Arduino is programmed through its USB. It will hold this time with the RTC battery.
This RTC board can be hot glued or attached with double side tape to the master PCB. The soldered connections will make it secure.
The Master board will be secured to the clock with a 3D printed bracket later.
Connect the RTC Vcc to a +5 hole on the board.
Connect the RTC Gnd, SCL and SDA to the corresponding names on the PCB.
Solder on 1 I2C 1.3k (or close value) pullup resistor between the RTC board Vcc and SDA.
Solder on 1 I2C 1.3k (or close value) pullup resistor between the RTC board Vcc and SCL.
Solder on 4 twisted wires that are about 6" long to the +6V, Gnd SDA and SCL for future connection to the other boards.
Solder on a pair of 10" long wires from the D2 pin and ground. This will go to the pushbutton to increment time.
Solder on a pair of 10" long wires from the D3 pin and ground. This will go to the pushbutton to decrement time.
note: The choice of D2 and D3 works because this is the master PCB and NOT the slave PCB. On the slave PCB, D2 and D3 are used for the dip switch and the motor driver. Make sure you dont install the dip switch and motor drivers on the master PCB.
Note: The USB cable should be unplugged from the master arduino nano before turning off the power supply. There is a sneak current path and the tiny 7805 5volt regulator on the master may burn out if all the other arduinos try to power from the USB voltage when the power supply is off. If this happens, get a new larger 7805 regulator and solder it to the master board. I had to do this unfortunately in this build.
Step 11: Clock Module Assembly
Watch this clock module assembly video to build up a single clock.
Determine which side up the magnets will go by testing them with a hall effect sensor module that is wired to a5V supply or a small battery pack. I used a 4.5V battery pack for this. The light should turn green when the direction is correct.
Glue in the magnet with the Cyanoacrylate krazy glue.
Assemble the clock as shown in the video.
Cut 4 pieces of hook wire to about 6" in length. Strip both ends of the wire back about 1/4" and twist them together. Solder them to one side of the PCB at the +6V, Gnd, SDA, SCL points. They will be used to solder to adjacent clocks when you build up the digits.
Note: The magnets are glued into each of the 2 gears. One magnet for each gear. These gears are loosely connected to the hands.
The sensors are at fixed positions on the 3D printed base. When the calibrate operation happens, The motors will stop when the magnets get to the sensors. You have a few seconds to physically use your hand to move the arms to the home or "12 o'clock" position.
Step 12: Single Clock Slave Test Arduino Code
I recommend that you test each clock module after you build it. To do this, make sure the clock module is fully assembled and (TEMPORARILY) Set the dip switch at a value greater than 23. This will force the Arduino slave code to run calibration after powerup.
FYI, It wont look like the movement in the video but will check that your movements are good and the magnets are in the right places. The USB cable will be able to power both motors for this test so you dont need a power supply connection.
Plug in the USB cable and load the slave Arduino code. You should see it run the calibration on each arm. Move the arms to the top "8 O'Clock" position after each arm calibrates. Hit the reset button on the Arduino nano to do it a few times to be sure it's working.
Don't forget to set the dip switch to the correct value (0 to 23) for it's position in the large clock when you are done. Write the number of the clock in sharpie on the back of the clock for easier assembly..
Step 13: Power Supply Connections
The power supply needs to have the connectors crimped on and attached to power and supply cables per this picture. I used extension cord pieces for this. Adjust the voltage to 7.5 volts and put electrical tape around the adjustment knob so it wont accidently be turned.
The DC voltage cables will be wired through a switch to the master board.
Note that each 28BYJ48 stepper motor is being driven by 7.5Volts. The windings are each 70 Ohms.
So the current through each winding is 7.5V / 70 Ohms = 107mA
There are 2 winding actively driven by the slave stepper per step. So, 2 * 107mA = 214mA per motor
If all 48 motors are moving, it is 48 * 214mA = 10.2Amps.
That's a decent amount of current and the 10Amp power supply shown here can supply that.
FYI, when the motors are not actively driving, the Arduino code shuts off the windings so no current is sued for the motors when it's not moving.
FYI, the Arduino nanos and Hall effect sensors use an insignificant amount of current.
Step 14: Single Digit Master Test Arduino Code
This step allows you to build up some confidence by testing one full 6 clock digit.
Assemble 6 clocks into one digit by using the 2 side connector pieces at each junction and putting a screw through them. Solder on the wires to create the digit.
The Arduino code here called debug_master_counter.ino is loaded into the master PCB. All the slave clock modules should have the analog_clock_slave.ino loaded by now.
The dip switches should be set to be either: (0 to 5) or (6 to 11) or (12 to 17) or (18 to 23)
This allows you to build up one digit at a time, test it and connect it by soldering the 6 clocks together.
Temporarily solder the 4 master module wires into this clock at an empty +6v, gnd, sda, SCL point for testing.
Make sure the master module has the power supply connected to it (temporarily without the switch) and set for 7.5 volts. Since there is no connector, you will have to temporarily solder it on for this test.
The master module powers up and initialize all 6 clocks. You need to move the arms to the top (8'Oclock positions) if they're not already there. It will then send the instructions to show an incrementing count pattern from 0 to 9 as shown in the photos.
Load the master PCB arduino with the correct master_clock_slave.ino when you are done with testing all the digits.
Step 15: Full Clock Assembly
After you have all the modules assembled, you can start to use the connector links to assemble the full clock. Each connection requires 2 connector links and then a screw drops into each side of the link to secure the pieces together. Follow the pictures for this.
After the clock is together, you can solder the wires between each module. I initially had green screw terminal connectors on each board but switched to just soldering the connections. The screw terminal connectors were introducing resistance at each screw resulting in a voltage drop on the 6V line and ground.
Note that the full 3x8 clock will be floppy and unstable without the frame connected. I suggest adding the frame as soon as you can for stability. If you lift the large clock without the frame, try lifting carefully with two hands from the TOP of the clock and be very gentle.
Step 16: Frame Assembly
Once the frame is added, the large clock will become much more stable. The frame pieces add support.
There are 4 types of frame pieces. 2 Types of corner pieces and 2 types of edge pieces. You will see how they fit when you try them.
Drill out a few of the long frame pieces. When the frame is assembled later, mount those 3 switches in the holes you drilled for the switches. Place those frame pieces towards the center of the bottom of the clock..
Assemble the frame pieces as shown in the pictures.
Step 17: Attach Master Arduino PCB
Glue on the master_support bracket that will hold the master Arduino PCB as shown in this picture. Just find a place in the center that will fit for this. Put in 2 screws to hold it.
Step 18: Master Code Clock Inversion Option
The Arduino master code has the ability to invert the clock direction polarity.
Some of the 28BYJ-48 Stepper Motors seem to run backwards. This isn't a problem and we can control it in the code. An example of this is shown in the pictures here. Set the appropriate bits = 1 in the Arduino master code to invert the clock arm that is spinning the wrong way.
Step 19: Mount to Wall
I drilled a small hole in the wall and mounted a right angle bracket to the wall to hold up the clock. There may be better mounting solutions but this was simple and worked for me.
I bought this bracket at my local Ace Hardware store for $16:
Boltmaster 2-1/4 in. W x 36 in. L Steel Slotted Angle
Item no. 5080460
Step 20: Debugging and Repair
This project is best completed by:
1) building up and testing each of the 24 clocks.
2) Building a digit with 6 clocks and testing that with the special tester master code.
3) Building the whole clock and testing that with the real master code.
If you have problems, with the main clock, check your wiring and make sure your solder connections between clock modules are correct. Make sure the wires snake through the whole clock from clk0 to clk23.
If you are having communications problems, make sure the master has the I2C pullup resistors on it. You can use an oscilloscope to check the I2C signals look clean.
You can use the CA "Q-Bond" powder sold on Amazon to fix any broken 3D printed parts.
Step 21: FAQ (questions and Answers)
Some common answers to questions from the comments:
1) Why not have one microcontroller and use a mux to switch between each clock?
There are always engineering decisions to make when you build something like this. You could use a single micro-controller with muxes but you would only be able to move one clock at a time. There is actually an instructable like this where he uses servos and moves one analog clock face at a time. You could also use an FPGA (Field Programmable Gate Array) with many IOs to do this instead of having many slave uControllers but that would be much more expensive and involve skills that most people on Instructables dont have. It's actually what I do for work.
2) Instead of having one Arduino Nano at each of the 24 slaves, why not put some kind of stepper chip there?
The Arduino nano costs between $2-$3 each. As a slave, each one does the stepping control for 2 motors AND it reads the hall effect analog signals for each motor gear for the calibration function. It would be difficult to find a less expensive chip to do both of these functions.
3) Instead of using the $1.50 hall effect sensor module, why not just use individual hall effect sensors?
You are right that individual hall effect sensor chips are cheaper. They do require a resistor to be added so that would have to go on the PCB for each hall effect sensor. They would need another 3D printed mounting part and to have 3 wires soldered onto each of the pins of the small device. I decided to just use the small hall effect module PCBs which are mounted with 1 screw to make assembly and construction easier.
4) Why have so many Arduinos? Why not have one chip?
You would need an Arduino (or FPGA) with
48 motors * 4 stepper signals.
48 motors * 2 magnet pickups for calibration
= 288 pins total. I dont know of any Arduinos that can do that. An FPGA can.
5) Why has a 3-terminal regulator been added to the main master Arduino, what is the purpose?
The 3 terminal regulator was a 7805 +5V regulator I added to the master controller because I burnt out the one on the Arduino Nano board. The problem occured when I turned off the power supply with the master nano connected to the other boards. The USB should be unplugged from the master before turning off the power supply.
6) How do you adjust the minutes if the RTC drifts off of accurate time?
You can adjust the hours for DST or time zone with the pushbutton switches. To change the clock time on the RTC chip, you need to reprogram the master Arduino.
The code could be modified to have another set of switches for minute adjustment or even better, allow wireless access to the master and RTC adjustment through bluetooth.
Step 22: Final Thoughts
Good luck with this project. Take your time. It took me 3 years of experimentation to build this.
Please post pictures if you make one!
Step 23: Temporary Fusion360 File Experiment
Judges Prize in the