Skip to content

Final Project

HIMA

presentation slide

My latest project is a clock. The idea is that when the minute hand reaches full rotation, the Armenian anthem begins to play.

I was very interested in creating a gear system using the capabilities of our laboratory. Essentially, this project is a gearbox. A gearbox is a mechanism that allows for the adjustment of torque and power from the motor as needed. It is used in various machines and devices to transmit rotational force to the working mechanisms. Although the use of such a system as a gearbox requires the use of harder materials.

The gear system used in my project reduces the number of rotations of the final axis by 43,200 times, which converts the motion of a gear that completes one full rotation in one second to an axis that completes one full rotation in 12 hours.

What does it do

The clock consists of a system of gears driven by a stepper motor. The control board is programmed in such a way that the stepper motor makes one complete revolution in 1 second. The transfer of rotation is decreasing, which allows you to create hour, minute and two second hands on different axes. The watch has 4 dials: one for the hour hand, one for the minute hand, and two for the second hand. To correctly display the time, since the second hand rotates in the opposite direction compared to the hour hand, an additional gear was used to change the direction of rotation. As a result, two axes are used.

A magnet is installed on the minute hand, and a Hall sensor is located on the watch case, which allows you to fix the moment when the minute hand reaches a full turn. The case also has a DFPlayer Mini, to which a speaker is connected, to play music when the minute hand reaches a full turn.

Also, on the front of the watch case, there are places for installing sensors, which will allow you to put the watch in a vertical position. This will also enable automatic music playback every 12 hours.

Interesting work done by others

  • There is a very interesting project of creating clocks using gears made with a laser cutter. It can be found on YouTube on the GORDEEN channel.

  • An original project of creating clocks has been accomplished by a student of Fab Academy in 2019, Viraj Gandhi.

  • An incredible work of creating clocks has been accomplished by Anooj Jacob, a student of Fab Academy in 2020. The clocks are interactive and can be adjusted to different time zones if desired.

  • An extremely interesting mechanical model of the solar system with the Sun, Earth, and Moon has been created using a gear system by Megumi Iwata, a student of Fab Academy in 2018.

Materials and accessories used

Qty Description Price Link Origin
0.15 sq m Plywood 18 mm thick 2.60 $ - our lab
3 sq m Plywood 10 mm thick 27.50 $ - our lab
0.46 sq m Plywood 3 mm thick 1.61 $ - our lab
1 DRV8825 stepper motor driver 20.77 $ aliexpress.ru our lab
1 DRV8825 stepper motor driver 3.40 $ list.am our lab
1 DFPlayer Mini 2.60 $ list.am our lab
1 ATSAMD11D14A-SSUT 1.80 $ digikey.com our lab
1 Copper Clad Laminate PCB 7x10cm 0.90 $ aliexpress.ru our lab
18 Flange Ball Bearings - 8x22x7mm 7.29 $ aliexpress.ru our lab
1000 mm Stainless Steel Rod - 8 mm 28.91 $ aliexpress.ru our lab
0.36 sq m steel sheet 2mm 6.70 $ - Ashot’s factory
- other materials ~ 10.00 $ - our lab
Total ~ 115.00 $

Gear system and clock case

As part of the final project, I used the work done during the week Computer controlled machining.

This week I made a clock design with a gear system in Fusion360:

Electro side details 3

I then generated the G-code with VCarve Pro and then cut it with ShopbotPRSalpha:

Profile

Then I processed the parts, placed the gears on a metal axis:

Handmade

Then I assembled the watch but did not put the upper part of the case on and the system began to rotate:

But when the watch was closed with the upper part of the case, the system began to rotate poorly, revolutions began to be skipped, since the gears rotated the axles through the force of friction, which gradually began to lose its strength.

In order to avoid failures in the rotation system, I decided that it would be better to fix the gears on metal axles through screws.

Fastening gears to metal axles

“To fix the gears on the metal axles, it is necessary to cut out intermediate plywood circles that will connect the two gears and be fixed on the metal axle through one hole.

I will need several plywood circles with a diameter of 50 mm with a hole with a diameter of 8.1 mm and different thicknesses (5 mm , 6.6mm, 8mm, 9.1mm and 10mm).However, for cutting, I will use 10mm plywood.To get circles of different thicknesses, I will first select the operation in the VCarve Pro program Pocket and carve with different values to get the thickness I need from 10mm plywood.”

Circles

Then I will select the Profile operation to cut out the details:

Circles

Here is the output of ShopbotPRSalpha:

Circles

After sanding, I attached the gears with circles to each other using screws:

Circles

Then I attached them with a metal one after having previously made holes:

Circles

And this is what they look like in place:

Circles

Fixing points Hall sensor

The original design of the watch did not provide for the presence of a sensor, so there was no place on the watch case for its installation. To solve this problem, I added a place for the sensor stand in the VCarve Pro program. It is worth noting that the sensor will be installed on the minute dial. However, in order to be able to later change the position of the clock from horizontal to vertical, I added additional places for the sensor stand. I also created additional places to install the sensor on the hour dial. To fix the sensor in the appropriate place, I added holes for fixing with screws. In addition, I provided a strip for laying the wire from the sensor.

Place for the sensor

Let’s fasten the upper part of the case to the table and carry out the necessary cut operations:

After the operation cut, we get:

Place for the sensor

Replacing the electronics housing

To improve the project, I decided to change the stepper motor that I used during the week Computer controlled machining to a stepper motor 23KM -J250-G1V. To accommodate the electronics housing, it is required to change the dimensions of the housing. To do this, I changed the details in the VCarve Pro program:

electro frame

And then cut out on a CNC milling machine:

electro frame

Test assembly of electronics

To test the performance of my project, I decided to first assemble the circuit on a breadboard , and then, based on the results, implement it on a PCB.

In the original version, the stepper motor worked using an Arduino UNO microcontroller and an Arduino Shield expansion board.

Electronics test 1

I would like to implement my project on my own PCB instead of using the Arduino UNO.

Based on the advice from my instructor Babken Chugaszyan, I will be using the microstepping driver DRV8825. A microstepping driver like DRV8825 provides higher resolution by incorporating intermediate steps. This is achieved by powering the coils with intermediate current levels.

Following the tutorial How to control a stepper motor with DRV8825 driver and Arduino, I have successfully assembled a functional circuit on a breadboard:

Electronics test 2

Then I added a Hall sensor and a pezobasis to this circuit so that when the motor is running, when a magnet is brought to the Hall sensor, the pezobasis turns on for a certain time and at a certain frequency:

Electronics test 3

Then I connected a 5 volt voltage regulator to the 24 volt power supply that my motor runs through:

Electronics test 4

Let’s take a look at the diagram in action:

But I was already interested in using a song or melody in mp3 format as a clock signal. We found DFPlayer Mini in our lab. After numerous trial and error, I managed to solve the problem that I set for myself, namely, the inclusion of a song when it reaches 12 hours.

The problem with the player was that it didn’t work with the microcontroller I was using on my board. Fortunately, this module can be used without a board by connecting power, speaker and buttons directly to the module. The moment of the button can also be bypassed by connecting the contact ADKEY1 to the digital pin of the microcontroller:

Electronics test 5

Let’s see how the circuit works:

I have not connected this module to the general circuit mentioned above, but the principle of separate operation makes it possible for the general circuit to work correctly.

PCBs

The schema test on the breadboard worked and proved to work, but in application in the project can not be used for further work. And now it has come, based on what is implemented in the form of PCBs, let’s create a circuit implemented on PCBs.

PCB control system

As a control PCB for my project, I used a PCB that I designed in the Electronics design week, and which I milled and soldered during the week Electronics Production.

board final

PCB for fit Hall sensor

I have already implemented the PCB for landing the Hall sensor in the week Input Devices.

The schema remains the same:

hall sensor

But due to my future location, I will slightly change the design of the board, namely PinHeaders to PinHeaders with holes to connect the contacts from the bottom of the board.

hall sensor

Then I milled the board, soldered the components in place and this is the result:

hall sensor

PCB for landing DRV8825 driver

I will base the design of the circuit for landing the DRV8825 driver on the circuit I have assembled. This board will supply the driver with 24 volts. In order for the entire circuit to work through a single power source, it is necessary to put a voltage regulator at 5 volts. Also, this board will have additional PinHeaders that will supply current to the Hall sensor and DFPlayer Mini along with the control system coming to the board from the board.

driver board

After that, I conveniently arranged the components on the board. I also made additional holes for attaching the PCB to the watch case:

driver board

Then I milled the board, soldered the components in place. And first of all, I did a test, powered the board from a 24 Volt power source, and turned on 3 LEDs connected in series through the 5 Volt output. And here is the result:

driver board

Although the experiment was successful, but in the future, when using the board, the current regulator got very hot and in the end I had to replace the SMD current regulator with a regular one that is capable of conducting many more amperes through itself. And here is the result:

driver board

PCB for landing DFPlayer Mini

When designing the PCB for connecting the DFPlayer Mini, I took into account the required connectors. Although my project does not provide for controlling the DFPlayer Mini through the RX and TX channels, I will still add these pins to be able to connect to another microcontroller through these channels. This project requires the following outputs: +5V and GND for power supply, ADKEY1 for turning on the first track, and SPK1 and SPK2 for speaker connection.

The schema looks like this:

DFPlayer Mini

On the PCB design, I will also make places for attaching the board to the case:

DFPlayer Mini

I then milled the board, soldered the components in place and this is the result:

DFPlayer Mini

3D Print

To combine the electronics on the watch case, it would be appropriate to print them on a 3D printer.

Hall sensor stand

In order to fix the Hall sensor on the watch case, a part was developed in the FreeCad program:

Hall case

The parts are provided with holes for fixing the board and holes for fixing the part on the watch case.

Detail I printed on MakerBot Replicator 2:

And here is the result:

Hall case

Speaker stand

In order to fix the speaker on the watch case, a part was developed in the FreeCad program:

DFPlayer Mini

The speaker will be fixed to the part, and through the holes on the part it will be fixed to the watch case.

And this is how the part looks after printing on MakerBot Replicator 2:

DFPlayer Mini

Securing boards

To fix the boards in a case designed for electronics, I decided to draw a Tube figure in the FreeCad program:

DFPlayer Mini

They are designed so that the board rises slightly higher relative to the case. I printed these details different heights:

DFPlayer Mini

Placement of Electronics

Once the printed circuit boards are fabricated and their assemblies are printed, they can be attached to the watch case.

Let’s attach the Hall sensor to the stand, and then secure the assembly to the case using screws:

Placement of electronics

Now, let’s mount the board designed for the stepper driver. Then, we will connect the stepper motor mounted on the lid through the contacts on the board:

Placement of electronics

Let’s place the remaining boards and the speaker:

Placement of electronics

And this is what the speaker looks like from the outside of the electronics case:

Placement of electronics

Work on the laser cutter

For some jobs, a laser cutter may be appropriate.

Dials and hands

To create dials and hands, I used the program CorelDRAW. It is necessary to draw three types of dial and 3 types of arrows in order to be visually distinguishable. I made the arrows two levels, the first level will be fixed to the axis, and the other level will hide this axis. The place for the location of the magnet on the minute hand was also taken into account.

laser clock

Then I cut it out with a laser cutter.

I did not engrave the numbers on the dial, but only emphasized the outline with a cutting operation with light settings.

Then I glued the two arrow equations and got the following result:

laser clock

I also put the magnet minute hand in its intended place:

laser clock

Driven gear

To fix the plywood driven gear to the stepper motor gear and ensure a large contact, it is advisable to cut several gears with a thickness of 3.5mm on a laser cutter and then glue them together.

Let’s do that. First of all, I generated a new gear in Fusion 360 with a module of 0.8mm and a number of teeth of 16, this is the parameters of the gear attached to the new motor. Then I moved it to the program CorelDRAW:

laser gear

And then I cut it out on a laser cutter and got the following result:

laser gear

And then glued them together:

laser gear

And got the following result:

laser gear

Code Example

After all the necessary components are ready and assembled, it’s time to think about programming.

The first question that arose was related to the fact that I needed a stepper motor in the system that should run continuously: it should complete one revolution in one minute. There are many examples of controlling stepper motors through stepper drivers. However, when the stepper motor is running and other calculations with a certain duration are performed (especially when using the delay() function), it affects the motor’s movement and slows it down during the execution of the delay() function.

To solve this issue, I decided to use the TaskScheduler library. It allows me to create separate tasks that can run independently of each other.

Let’s take a look at my final code for controlling the system:

#include <TaskScheduler.h>
#define dirPin 2
#define stepPin 3
#define hallPin 4
#define play 16 
#define stepsPerRevolution 6400
int breakBetweenLaunches = 3000000; // 50 minutes
int hallThreshold = 400;

// Create task objects
Task task1(1000, TASK_FOREVER, [](){
  for(int i=0; i < stepsPerRevolution; i++) {
    digitalWrite(stepPin, HIGH);
    delayMicroseconds(500000/6400);
    digitalWrite(stepPin, LOW);
    delayMicroseconds(500000/6400);
  }
});

// Variables for working with a piezo emitter
bool playActive = false;
unsigned long startTime = 0;

// Create a task scheduler
Scheduler scheduler;

void setup() {
  // Initialize pins
  pinMode(stepPin, OUTPUT);
  pinMode(dirPin, OUTPUT);
  pinMode(hallPin, INPUT);
  pinMode(play, OUTPUT);
  digitalWrite(play, HIGH);

  // Add tasks to the scheduler
  scheduler.addTask(task1);

  // Run tasks
  scheduler.enableAll(); 
}

void loop() {
  // Check the condition of the Hall sensor
  int hallValue = analogRead(hallPin);
  unsigned long thisMoment = millis();
  if (hallValue < hallThreshold && thisMoment - startTime > breakBetweenLaunches) {
    if (!playActive) {
      digitalWrite(play, LOW);
      playActive = true;
      startTime = millis();
    } 
  } 

  if (thisMoment - startTime > 20000) {  
    digitalWrite(play, HIGH);
    playActive = false;
  }

  // Start the scheduler to execute tasks
  scheduler.execute();
}
This code is designed to do the following:

  1. Connects the required TaskScheduler library.

  2. Defines pins for connecting the motor, Hall sensor and DFPlayer Mini (player for playing sound files).

  3. Sets variables and constants such as steps per revolution, dead time between starts, and Hall sensor threshold.

  4. Creates a task object (task1) to rotate the motor.

  5. Initializes the pins and sets up the player.

  6. Creates a task scheduler (scheduler) and adds a task (task1) to the scheduler.

  7. Runs all tasks in the scheduler.

  8. In the main loop() loop, the following happens:

    • The value from the Hall sensor is read.

    • If the value of the Hall sensor is below the threshold value and enough time has passed since the previous start, then the player is activated to play the sound.

    • If 20 seconds have passed since the player was activated, it will be deactivated.

    • Tasks are running in the scheduler.

The general purpose of the code is to control the motor and the player based on the value from the hall sensor. When the value of the Hall sensor satisfies the condition and enough time has passed since the previous start, the player is activated to play the sound, and the motor performs the rotation task. Task Scheduler allows you to manage the sequence and timing of tasks.

Files

3D watch assembly design - Fusion360 file

2D body and gear design - DXF file

All PCBs - RAR archive

3D mounting details - RAR archive

Driven gear, Dial and hands - SVG file

Clock code - RAR archive (INO file)

License

CC BY: This license grants users the ability to distribute, remix, adapt, and create derivative works based on the material, in any medium or format, as long as proper attribution is provided to the original creator. Commercial use is permitted under this license. CC BY encompasses the following elements: BY – Credit must be given to the creator.


Last update: June 21, 2023