MAKER: ihart / Translation: Fun EndlessThis project is a true “mechanical clock” made from 3D printed parts, 25 Arduino Nano, and 48 stepper motors.Each clock face is designed using Eagle’s PCB.The inspiration for the clock came from a clock I saw a few years ago in a store in Boston called ClockClock 24, which cost about $6000 and was very beautiful.
By completing this project, you will learn skills in 3D printing, Arduino programming, schematics and PCB design, mechanical skills, and some debugging techniques.
Materials and Costs
A complete materials list file (ClockPartsList.xlsx) can be downloaded from the project file repository at the end of this document.
Tools List
3D Printer
Soldering Iron
Screwdriver
Wire Cutters and Crimping Pliers
Glue
The cost is about $500. Costs can also be reduced by sourcing cheaper parts. The descriptions in the spreadsheet are clickable links. If the links are broken, you can search for the words in the link on Google.
3D Printing
The entire project was printed using PLA material, and the 3D printer used was the Creality Ender 3 Pro. Slicing was done using the free version of Cura.It took about 1 month to print. Each clock module base took about 9 hours to print. If you print 2 a day, it will take 12 days; using two 3D printers will speed up the process.All parts were printed at a standard temperature with a 20% fill rate.This project has a lot of knowledge about 3D printing: the machine needs to be leveled every few days. Otherwise, parts will lift off the machine or get damaged. The nozzle needs to be cleaned periodically. Otherwise, the printed parts will become very thin. The PLA filament needs to be kept taut to prevent tangling and jamming during printing.The list of 3D printed parts (Clock 3D Printed Parts List.xlsx) and the STL files needed for printing (stls.zip) can be downloaded from the project file repository at the end of this document.
Schematic and PCB Files
The schematic is drawn using Autodesk’s Eagle.It should be noted that initially, a photoelectric module was used instead of a magnetic detector module, which is why the photoelectric module can be seen on both the schematic and the circuit board.Each magnetic Hall effect sensor is connected to the 5V, Gnd, and analog pins (O_0 or O_1) on the PCB.For more information, see the assembly details.The schematic file (analog_clock_rev2.sch) can be downloaded from the project file repository at the end of this document.This project requires 25 PCBs. The Gerber files attached here can be used to manufacture the circuit boards at any PCB factory. To open files compressed into .gz, the recommended decompressor is 7Zip.
The schematic file (H2W-312555_Analog_clock_Rev2.zip.gz) can be downloaded from the project file repository at the end of this document.
Arduino Programming
The Arduino files for the project consist of two: the master control file and the slave device file.The master control code is used only once to control all slave devices. The slave device code is used 24 times.
The RTC (Real Time Clock) library .zip file is also included in the .gz file. You can add the .zip file to the Arduino IDE by executing:sketch -> include library -> add .zip library.To program the Arduino, select:tools -> Boards: Arduino Nano tools -> Processor Atmega328 (old bootloader) tools -> port (select port)The code file (HartClock_Arduino_Code.zip.gz) can be downloaded from the project file repository at the end of this document.
Introduction to Arduino SW
The master Arduino sends I2C serial commands to the 24 slave Arduinos 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 (0 = idle, 1 = calibrate, 2 = rotate clockwise, 3 = rotate counterclockwise)As shown in the figure, the clock has 8 possible positions.After reset, the master will send a calibration command to each Arduino to return to the original position corresponding to clock position 8. Each gear behind the clock has a return magnet, and there is a Hall effect sensor to detect whether the magnet is in place.
PCB Soldering
There are 24 PCBs that need to be soldered, and you can ask friends for help if necessary 🙂Remember to unplug the ULN2003 driver IC from the socket that comes with the motor.Insert each component into the circuit board and bend the pins slightly to prevent them from falling out, then solder the component leads to the board.
Note: Each board has 6 jumpers soldered. The green 4-pin terminal shown in the image was not used here; the inter-board wiring was soldered directly, resulting in lower voltage drop and greater reliability.
Setting the DIP Switch
Each PCB has a DIP switch. Set the DIP switch for each clock as shown in the picture so that the master controller can address each slave clock module separately.
Assembling the PCB Mainboard
The Arduino mainboard includes the Real Time Clock (RTC) board and Arduino Nano. Whenever the main Arduino is programmed via USB, the RTC is programmed with the current computer time and saves the time data via the RTC battery. The RTC board can be hot glued or taped to the main PCB. Soldered connections make it secure.Use a 3D printed bracket to secure the mainboard to the clock.Connect the RTC Vcc to the +5 pin on the board.Connect the RTC Gnd, SCL, and SDA to the respective names on the PCB.Solder a 1.3k (or close value) pull-up resistor on the I2C between RTC board Vcc and SDA.Solder a 1.3k (or close value) pull-up resistor on the I2C between RTC board Vcc and SCL.Solder 4 wires for +6V, Gnd, SDA, and SCL, leaving a length of about 6 inches for future connection to other circuit boards.Solder a 10-inch long wire to the D2 pin and ground to increase the time via a button.Solder a 10-inch long wire to the D3 pin and ground to decrease the time via a button.Note: Before turning off the power, unplug the USB cable from the main Arduino Nano. This is a potential current path, and when the power is off, other Arduinos may try to power themselves with the USB power, which could burn out the mini 7805 voltage regulator on the master. If this happens, purchase a higher wattage 7805 voltage regulator and solder it to the mainboard. This needs to be done here.
Clock Module Assembly
Test using the Hall effect sensor module (connected to a 5V power supply or small battery pack) to determine if the magnet is facing up. A 4.5V battery pack is used here for power. When the direction is correct, the indicator light should turn green.Use Cyanoacrylate Krazy glue to attach the magnets.As shown, assemble the clock.
Cut 4 hook-shaped wires to about 6 inches long. Strip about 1/4 inch from each end and twist them together. Solder them to the +6V, Gnd, SDA, SCL points on the PCB. When the digits are installed, they will be used to solder to the adjacent clock.
Single Clock Arduino Code Testing
It is recommended to test each clock module after assembly. To do this, make sure the clock module is fully assembled and (temporarily) set the DIP switch to a value greater than 23. This will force the Arduino to run calibration from the code upon power-up. The video is for reference, allowing you to check if the clock movement is good and if the magnets are correctly positioned. The USB power can power both motors for this test, so no power connection is needed.Insert the USB cable and load the Arduino code. You should see it calibrate on each arm. After each arm is calibrated, move the arm to the top 8 o’clock position. Press the Reset button on the Arduino Nano a few times to ensure it works properly.Once done, don’t forget to set the DIP switch to the correct value (0 to 23). Write down the clock number on the sandpaper at the back of the clock for easy assembly.
Power Connection
As shown, the power device needs to be crimped with connectors and connected to the power and power lines, using an extension cord for this purpose. Set the voltage to 7.5V and wrap tape around the adjustment knob to prevent it from being accidentally turned.The DC voltage line will connect to the mainboard through a switch.Each 28BYJ48 stepper motor is powered by 7.5V. The winding is 70 ohms each.Thus, the current through each winding is 7.5V/70 ohms = 107mAEach stepper motor actively drives 2 windings. Therefore, each motor requires 2 * 107mA = 214mAIf all 48 motors are in motion, it would be 48 * 214mA = 10.2Amps.That’s quite a lot of current, and the 10Amp power supply shown here can provide that current.For reference, when the motors are not actively driven, the Arduino code will turn off the windings, so no current is applied to the motors when they are not moving. The current used by the Arduino Nano and the Hall effect sensors is very small.
Single Clock Digital Arduino Master Code Testing
Testing the digital made up of 6 clock modules.Using 2 side connectors at each node and tightening with screws, assemble the 6 clock modules into a number.The Arduino code called debug_master_counter.ino has been loaded into the main PCB. By now, all slave clock modules should have loaded Analog_clock_slave.ino.The DIP switch should be set to: (0 to 5) or (6 to 11) or (12 to 17) or (18 to 23)You can build one number at a time, test it, and connect the 6 clocks together by soldering.Temporarily solder these 4 master module wires to the +6V, Gnd, SDA, SCL empty points of this clock for testing.Ensure the master module is powered (temporarily without a switch) and set to 7.5V. Since there are no connectors, temporarily solder it for this test.The master module powers up and initializes all 6 clocks. If the arms have not been moved to the top (8 o’clock position), they need to be moved to the top. It will then send instructions to display an incrementing count from 0 to 9, as shown.
After testing all numbers, use the correct master_clock_slave.ino to load the main PCB Arduino.The testing code file (debug_master_counter.ino) can be downloaded from the project file repository at the end of this document.
Installing All Clock Digits
After assembling all modules, you can start using connectors to link the complete clock. Each connection requires 2 connector links, then insert screws on each side of the links to secure the parts together, as shown.
Once the clocks are together, solder the wires between each module. Initially, there were green screw terminals on each board, but they were later switched to soldered connections, as screw terminals introduce resistance at each screw, causing voltage drop on the 6V line and ground.Note that without connecting the frame, the complete 3×8 large clock is unstable.
Installing the Frame
Add the frame, which increases support and stabilizes the overall clock.There are 4 types of frames. 2 corner pieces and 2 edge pieces. When trying them, observe how well they fit.Drill holes in the long frame. While assembling the frame, install the 3 switches in the drilled holes. Place the clock in the center of the bottom frame.As shown, assemble the frame.
Fix the Arduino PCB mainboard at the bottom.
Secure (glue) the main Arduino PCB to the master_support bracket, then find a suitable position in the center as shown. Screw in 2 screws to secure it.
Master Control Reverse Option
The Arduino master code has the capability to reverse the clock direction. Some 28BYJ-48 stepper motors run in reverse. This can be controlled in the code. As shown, set appropriate bits = 1 in the Arduino master code.
Debugging and Maintenance
Recommended steps: 1) Assemble and test 24 clock modules (one by one). 2) Build a number with 6 clock modules and test it using special test master control code. 3) Assemble the entire clock and test it with the correct master control code.If there are issues with the master clock, check the wiring and ensure the soldering between clock modules is correct. Ensure that the wires run from clk0 to clk23 throughout the clock.If you encounter communication issues, ensure there are pull-up resistors on the I2C on the master. You can use an oscilloscope to check if the I2C signals are normal.
Frequently Asked Questions
1) Why not use a single microcontroller and switch between each clock using a multiplexer? When building this thing, there is always a trade-off in engineering complexity. A single microcontroller can be used with a multiplexer, but only one clock can be moved at a time. There is actually an idea like this, using servos to move one analog clock face at a time. An FPGA (Field Programmable Gate Array) with many IOs can also replace many slave controllers, but it would be much more expensive and require additional skills.2) Why not use some stepper chip instead of 24 Arduino Nanos for the slaves? The price of an Arduino Nano is $2. As slaves, each one performs step control for 2 motors and reads the Hall effect analog signal from each motor gear for calibration. It is difficult to find a cheap chip to do both functions.3) Why use a $1.50 Hall effect sensor module instead of a single Hall effect sensor chip? A single Hall effect sensor chip is cheaper, but it requires adding a resistor, so each Hall effect sensor must be placed on the PCB. This requires additional 3D printed parts and soldering 3 wires to each pin of the small device. The Hall effect module PCB that installs with only 1 screw makes assembly much easier.4) Why use so many Arduinos instead of one chip? An Arduino (or FPGA) chip with the following functions would be needed:48 motors 4 step signals + 48 motors 2 for calibration Hall effect sensors = 288 pins. Arduino cannot do this; FPGA can.5) What is the purpose of adding a 3-terminal voltage regulator on the master Arduino? The 3-terminal voltage regulator is added to the main controller, the 7805 regulator, which burns when the master Arduino connects to other circuit boards and the power is turned off. Before turning off the power, the USB should be unplugged from the master.6) If the RTC module’s time is off, how can it be adjusted? The hour of the timezone can be adjusted using a push button switch. To change the clock time on the RTC chip, the Arduino master program needs to be reprogrammed. The code can be modified to allow wireless access to the master via Bluetooth and adjust the RTC.This project took three years, and now you can enjoy the results.The code used in the project can be downloaded from the project file repository: https://make.quwj.com/project/367Recommended Reading: (Clicking the title will redirect)Disassembling the 1968 US Military Computer, really suspecting it is “time travel”!PhD student DIY super microscope, directly seeing atoms!Using 10 transparent screens to create a high-tech OLED displayLikes and views are the greatest support