3D Printed Arduino Based Analog Digital Clock

18,859

247

81

Introduction: 3D Printed Arduino Based Analog Digital Clock

About: I'm an Electrical Engineer with "engineer disease." I need to always be making, fixing or learning about something.

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.

Supplies

3D Printer

Soldering Iron

Screw Drivers

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.

Parts List Link

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:

3D Part Quantities Spreadsheet

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:

https://allpcb.com/Product/PcbDetail?OrderNO=H2W-3...

register with a new account and order.

If there are issues, email: service@allpcb.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

Microcontroller Contest

Judges Prize in the
Microcontroller Contest

Be the First to Share

    Recommendations

    • Make It Modular: Student Design Challenge

      Make It Modular: Student Design Challenge
    • Science Fair Challenge

      Science Fair Challenge
    • Origami Speed Challenge

      Origami Speed Challenge

    81 Comments

    0
    337048234
    337048234

    19 days ago on Step 12

    Why doesn't mine work who can help me see what's wrong

    9930e79a58d3e8f6fe406352b926c07.jpgbd126ed0c814a384efa406fbd02992a.jpg134bf824d7bbe043c6331dff130f473.jpg
    0
    ihart
    ihart

    Reply 19 days ago

    Looks good! Can you describe what happens?
    The best thing to do would be to shoot a video and upload it to YouTube. Share the YouTube link here.
    Move the camera around so we can see the motors moving, the hall effect sensors turning on/off etc.

    0
    MikeA90
    MikeA90

    Question 5 weeks ago on Introduction

    Hi, fantastic project. I have ordered up enough components to build 6 clocks to see how it goes. As you mention it’s possible that 10 amps will be drawn from the power supply if all the motors are active. From reading your description power to each clock is daisy chained from the master. What size cable to you use? Mike

    0
    ihart
    ihart

    Answer 5 weeks ago

    Hi Mike,
    I used what I had at hand which was 24Awg (gauge) telephone or Cat5 wire.
    It seems to work and can handle the stepper motor inrush current. The code ends up not actually starting the motors simultaneously so they are sequenced in time and don't actually startup at the same moment. That said, you would be better off using heavier gauge wire if you have it. Good luck with your build! Let us know how it goes.

    0
    Kevr102
    Kevr102

    4 months ago

    Hi,
    Love the clock and great Instructable, I would like to have a go at building one with 360 degree BK30 Stepper motors, I noticed in your code that you don't have the pin outs for the stepper motors, I'm not fully conversant with Arduino codes but stepper motor codes usually have pin outs? I may be missing something.
    Many Thanks

    0
    Kevr102
    Kevr102

    Reply 4 months ago

    Hi forget my last message, I’ve had a further look through the Instructable and it makes sense now, I didn’t read it thoroughly, the master with rtc, no dip switch or stepper driver and 24 slave clocks. Cool, many thanks

    0
    Kevr102
    Kevr102

    Reply 2 months ago

    Hi Ira,
    I still haven't got round to starting the my project clock with the different stepper motors I want to use, how are you controlling the steps per minute of the stepper motors within the code as I think mine will be different.
    Many Thanks

    0
    ihart
    ihart

    Reply 2 months ago

    Hi Kevr102, You're stalling and delaying. ;-) I know how it goes. It took me a few years of experimenting to get this project complete.

    The motor speed is controlled in the analog_clock_slave.ino file. It is 3mS per step. You can modify this part of the code to change it:

    //////////////////////////////////////////////
    void loop() //Main loop
    //////////////////////////////////////////////
    {
    currentMicros = micros();
    if (currentMicros - last_time >= 3000) { //do stepper if 3 millisecond has elapsed
    0
    Kevr102
    Kevr102

    Reply 2 months ago

    Many thanks Ira, it’s a great project, I was supposed to start it over Christmas but it never happened, another thing I want to ask was do the magnets and sensors have to be in the 12 o clock position for both hands?
    Thanks once again

    0
    ihart
    ihart

    Reply 2 months ago

    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. Does that make sense?

    If you decide to build this project, buy enough stuff for one clock and 3D print one square clock with 2 motors. Start with that. You could either order just a few PCBs or hand wire a few Arduinos onto a perf board. You'll see everything working. After that, you can go into "production" mode to make the other 23 clocks.

    0
    ihart
    ihart

    Reply 4 months ago

    Hi Kevr102,
    That's great that you are planning to build the clock. I'm not familiar with the BK30 stepper but all steppers are 360degs continuous rotation.
    You can see the pinouts from the Arduino to the stepper driver chips at "Step 4" which is the schematic. In the Arduino code, you'll see those pins 3,4,5,6 and 8,9,10,11 being assigned to stepper motor outputs.

    0
    Kevr102
    Kevr102

    Reply 4 months ago

    Hi, Many thanks for the information, I must have missed that.
    Many thanks, I will let you know how I get on but it may be a while.

    0
    Kevr102
    Kevr102

    Reply 4 months ago

    Hi Something else I don’t quite understand, the master code doesn’t have any pin outs and how is this used within the clock, I know there is 1 master and 23 slaves, the slaves working with the dip switches all driven from the master, I will get my head found it at some point, thanks

    0
    ihart
    ihart

    Reply 4 months ago

    Fair question. The Master keeps track of the time, the "art" and some of the control push button switches. It knows what all the 24 slave clock positions should be at any point in time. It does have some pinouts such as the switches. These are described in step 10. I agree that I should have made a separate schematic for the master board.

    0
    Kevr102
    Kevr102

    Reply 4 months ago

    No, the Instructable is fine, I just never read it properly, thanks for the reply

    0
    alaskansnowboarder
    alaskansnowboarder

    8 months ago on Step 23

    nice job, would it not be possible to use an Arduino mega, and then 30 or so 74HC595 shift registers?

    0
    ihart
    ihart

    Reply 7 months ago

    Hi, I love the tradeoff thoughts like this in engineering designs.
    I think it would be possible to drive the steppers this way although, you still need the uln2003 motor driver chips near each stepper motor.

    One reason I don't think this will work in this design is for the hall effect magnet sensors that are used in this design with a magnet embedded in the gear to pick up the home position for the clock arm. There are 48 of these home position sensors. I guess, they could also be shifted back to the Mega somehow through shift registers with MANY long wires but in the end, I don't think you will buy anything but, maybe.

    The 24 arduino nano chips cost ~$3 each. They connect with a $3 master Arduino nano that talks to the 24 "slaves" through 2wire I2C. It's pretty simple this way and the wiring is relatively short and easy.

    0
    DirkSchlecht
    DirkSchlecht

    1 year ago

    Hi ihart. This clock and your work are fantastic. I guess I will build it and I have a lot of questions :-). Would it be possible to build a bigger one of this basis? Maybe 10 x 5 clocks? Is this a big change in the arduino code?

    0
    ihart
    ihart

    Reply 1 year ago

    Hi Dirk,
    Thanks. Glad to help with questions here. Other users may answer as well.
    You could build it bigger but there would be a number of problems to overcome: Arduino code changes, power supply issues and 3D printed material structural support.