Tread Clock

by kikoASN in Circuits > Arduino

364 Views, 1 Favorites, 0 Comments

Tread Clock

Screenshot 2023-07-21 170931.png
Screenshot 2023-07-21 170943.png
Screenshot 2023-07-21 170952.png
Screenshot 2023-07-21 171011.png
Screenshot 2023-07-21 171023.png
Screenshot 2023-07-21 171039.png
Screenshot 2023-07-21 171047.png
Screenshot 2023-07-21 171109.png
tread clock
building a clock that's a cube that shows time byoving 2 perpendicular treads

hello my name is Ahmed Saied Nawar I am a 11 grade student at SAIS dubai in the UAE the insperation for this project was the Devon Tread watch I wanted to make one for my self but the small motors I ordered didnt work so insted I made this cube with 2 28byj-48 stepper motors I had laying around I hope you enjoy building it. (also i didnt add any numbers to it but you can add them depending on what you want).

Supplies

so for this project the supplies are:

  • 1- arduino uno r3
  • 2- 28byj-48 stepper motors
  • 1- long timing belts cut them to length
  • 8- timing belt gears (should come with the timing belt)
  • 1- mini breadboard
  • 14- jumper cables 12 female to male 2 male to male
  • 6- small magnets (optional)
  • 3d printer

thats it its a fairly easy and cheap project

Printing the Parts

Screenshot 2023-07-21 170943.png
Screenshot 2023-07-21 170952.png
Screenshot 2023-07-21 171039.png

ok so first we need to print the parts

we will need:

6 pices of (bearing to timing belt connector.stl)

12 pieces of (connector.stl)

and 1 piece of everything else

Assembly

Okay, so after you print the parts, get the bearings and put them in each hole on each of the 3D-printed pieces so that the top of the bearing is at the exact point of the top of the hole. Then attach the bearing to the timing belt conector and attach them to the timing belt gear using the screw on the gears as shown in the picture. then attach the bearing to the timing belt gear connector as shown in the photo. then attach the remaining 2 gears to the stepper motor, as seen in the picture, and glue the motor to the stepper motor raiser, depending on how high the piece is, so that the gear is sticking out mostly but not fully. Then get the connectors you printed and glue them to the 4 pieces so that there is enough space between them so that the treads can go through. If you want, attach magnets to the connectors for the top right piece so you can fix any issues or show its insides easily. Then get the tread and glue it to itself and test it on the gear to see if it's too tight. Break the glue off of it and glue it again till you get the perfect fit. Then cut the excess and do the same thing with the horizontal, and that's it. You're done with assembly.

Cercuit Diagram

Stepper Motor 1:

  • IN1: Connect to Arduino pin 2
  • IN2: Connect to Arduino pin 3
  • IN3: Connect to Arduino pin 4
  • IN4: Connect to Arduino pin 5
  • positive to positive arduino using breadboard to connect bothe stepper motor positives to arduino
  • negative to negative arduino using breadboard to connect bothe stepper motor negatives to arduino

Stepper Motor 2:

  • IN1: Connect to Arduino pin 6
  • IN2: Connect to Arduino pin 7
  • IN3: Connect to Arduino pin 8
  • IN4: Connect to Arduino pin 9
  • positive to positive arduino using breadboard to connect bothe stepper motor negatives to arduino
  • negative to negative arduino using breadboard to connect bothe stepper motor neagitives to arduino


Final Step: Code

here is code to make the vertical move every minut 1 rotation and the horizontal moves every hour 1 rotation

#include <AccelStepper.h>


// Define the number of steps per revolution for the stepper motors

const int stepsPerRevolution = 2048;


// Configure the pins for the first motor

const int motor1In1Pin = 2;

const int motor1In2Pin = 3;

const int motor1In3Pin = 4;

const int motor1In4Pin = 5;


// Configure the pins for the second motor

const int motor2In1Pin = 6;

const int motor2In2Pin = 7;

const int motor2In3Pin = 8;

const int motor2In4Pin = 9;


// Initialize the AccelStepper objects

AccelStepper motor1(AccelStepper::FULL4WIRE, motor1In1Pin, motor1In3Pin, motor1In2Pin, motor1In4Pin);

AccelStepper motor2(AccelStepper::FULL4WIRE, motor2In1Pin, motor2In3Pin, motor2In2Pin, motor2In4Pin);


void setup() {

  // Set up the motor control pins as OUTPUT

  pinMode(motor1In1Pin, OUTPUT);

  pinMode(motor1In2Pin, OUTPUT);

  pinMode(motor1In3Pin, OUTPUT);

  pinMode(motor1In4Pin, OUTPUT);


  pinMode(motor2In1Pin, OUTPUT);

  pinMode(motor2In2Pin, OUTPUT);

  pinMode(motor2In3Pin, OUTPUT);

  pinMode(motor2In4Pin, OUTPUT);


  // Set the maximum speed and acceleration for the motors

  motor1.setMaxSpeed(2000); // Adjust the speed for motor1

  motor1.setAcceleration(9.8); // Adjust the acceleration for motor1


  motor2.setMaxSpeed(1000); // Adjust the speed for motor2

  motor2.setAcceleration(590); // Adjust the acceleration for motor2


  // Set the initial speeds for the motors

  motor1.setSpeed(9.8); // Adjust the initial speed for motor1

  motor2.setSpeed(590); // Adjust the initial speed for motor2

}


void loop() {

  // Keep both motors moving continuously

  motor1.runSpeed();

  motor2.runSpeed();

}


here is code to make the vertical move every hour 1 rotation and the horizontal moves every 12 hour 1 rotation

#include <AccelStepper.h>


// Define the number of steps per revolution for the stepper motors

const int stepsPerRevolution = 2048;


// Configure the pins for the first motor

const int motor1In1Pin = 2;

const int motor1In2Pin = 3;

const int motor1In3Pin = 4;

const int motor1In4Pin = 5;


// Configure the pins for the second motor

const int motor2In1Pin = 6;

const int motor2In2Pin = 7;

const int motor2In3Pin = 8;

const int motor2In4Pin = 9;


// Initialize the AccelStepper objects

AccelStepper motor1(AccelStepper::FULL4WIRE, motor1In1Pin, motor1In3Pin, motor1In2Pin, motor1In4Pin);

AccelStepper motor2(AccelStepper::FULL4WIRE, motor2In1Pin, motor2In3Pin, motor2In2Pin, motor2In4Pin);


void setup() {

  // Set up the motor control pins as OUTPUT

  pinMode(motor1In1Pin, OUTPUT);

  pinMode(motor1In2Pin, OUTPUT);

  pinMode(motor1In3Pin, OUTPUT);

  pinMode(motor1In4Pin, OUTPUT);


  pinMode(motor2In1Pin, OUTPUT);

  pinMode(motor2In2Pin, OUTPUT);

  pinMode(motor2In3Pin, OUTPUT);

  pinMode(motor2In4Pin, OUTPUT);


  // Set the maximum speed and acceleration for the motors

  motor1.setMaxSpeed(2000); // Adjust the speed for motor1

  motor1.setAcceleration(0.81); // Adjust the acceleration for motor1


  motor2.setMaxSpeed(1000); // Adjust the speed for motor2

  motor2.setAcceleration(9.8); // Adjust the acceleration for motor2


  // Set the initial speeds for the motors

  motor1.setSpeed(0.81); // Adjust the initial speed for motor1

  motor2.setSpeed(9.8); // Adjust the initial speed for motor2

}


void loop() {

  // Keep both motors moving continuously

  motor1.runSpeed();

  motor2.runSpeed();

}