Project showcase
Arduino nano stepper motor clock

Arduino nano stepper motor clock © LGPL

A very simple clock made with 2 Arduino nanos and two stepper motors.

  • 250 views
  • 0 comments
  • 2 respects

Components and supplies

About this project

From my previous projects you can tell I am about clocks. I wanted to make a clock using a stepper motor controlled by Arduino nano to indicate the hour and another nano and stepper motor to indicate the minute. The stepper motors are from ROHS and are 28BYJ-48 5VDC available from Banggood or Wish for about $3 each. They come with control board and jumper wires ready to hook up. The hook up is really simple just follow directions in the stepper motor example (the stepper motor control example is available from get-hub or usually downloads with Arduino programming.)

The only changes necessary in the stepper motor control files is to change the delay time in the loop function. For the minute motor start with a delay of about 1800 and for the hour motor use a delay of about 21600. To adjust the timekeeping you might have to tweak the delay time a little according to the motor variability.

The dials I prepared (printed from internet) are mounted on CD's and the stepper motors are hot glued to the back of the CD's

Since the hookup is described in the stepper motor control example and all it amounts to is plug and play no schematic is included.

Hands shown are cut from thin plastic and painted black.

Code

Code for the Minute controlArduino
/* 
 Stepper Motor Control - one step at a time
 
 This program drives a unipolar or bipolar stepper motor. 
 The motor is attached to digital pins 8 - 11 of the Arduino.
 
 The motor will step one step at a time, very slowly.  You can use this to
 test that you've got the four wires of your stepper wired to the correct
 pins. If wired correctly, all steps should be in the same direction.
 
 Use this also to count the number of steps per revolution of your motor,
 if you don't know it.  Then plug that number into the oneRevolution
 example to see if you got it right.
 
 Created 30 Nov. 2009
 by Tom Igoe
 
 */

#include <Stepper.h>

const int stepsPerRevolution = 200;  // change this to fit the number of steps per revolution
                                     // for your motor

// initialize the stepper library on pins 8 through 11:
Stepper myStepper(stepsPerRevolution, 8,9,10,11);            

int stepCount = 0;         // number of steps the motor has taken

void setup() {
  // initialize the serial port:
  Serial.begin(9600);
}

void loop() {
  // step one step:
  myStepper.step(1);
  Serial.print("steps:" );
  Serial.println(stepCount);
  stepCount++;
  delay(1800);
}
Code for the Hour controlArduino
/* 
 Stepper Motor Control - one step at a time
 
 This program drives a unipolar or bipolar stepper motor. 
 The motor is attached to digital pins 8 - 11 of the Arduino.
 
 The motor will step one step at a time, very slowly.  You can use this to
 test that you've got the four wires of your stepper wired to the correct
 pins. If wired correctly, all steps should be in the same direction.
 
 Use this also to count the number of steps per revolution of your motor,
 if you don't know it.  Then plug that number into the oneRevolution
 example to see if you got it right.
 
 Created 30 Nov. 2009
 by Tom Igoe
 
 */

#include <Stepper.h>

const int stepsPerRevolution = 200;  // change this to fit the number of steps per revolution
                                     // for your motor

// initialize the stepper library on pins 8 through 11:
Stepper myStepper(stepsPerRevolution, 8,9,10,11);            

int stepCount = 0;         // number of steps the motor has taken

void setup() {
  // initialize the serial port:
  Serial.begin(9600);
}

void loop() {
  // step one step:
  myStepper.step(1);
  Serial.print("steps:" );
  Serial.println(stepCount);
  stepCount++;
  delay(21600);
}

Comments

Author

Default
garysat
  • 5 projects
  • 17 followers

Additional contributors

  • Stepper motor control - one step at a time by Tom Igoe

Members who respect this project

TheblaineDefault
See similar projects
you might like

Similar projects you might like

7-Segment Clock with Arduino Nano + DS3231 + LDR

Project tutorial by Ingo Lohs

  • 6,678 views
  • 19 comments
  • 30 respects

The ONE TUBE™ Easiest Arduino Nano Nixie Clock Project Ever

Project tutorial by WannaDuino

  • 2,621 views
  • 7 comments
  • 10 respects

Clock Arduino Nano NeoPixel Ring Alarm/Timer Function

Project in progress by WannaDuino

  • 11,688 views
  • 21 comments
  • 45 respects

Stepper Motor Control with STSPIN820 Evaluation Board

Project showcase by microst

  • 2,840 views
  • 1 comment
  • 7 respects

Arduino Nano "One Digit" Big LED Clock

Video tutorial by Mirko Pavleski

  • 1,090 views
  • 0 comments
  • 6 respects

TB6600 Stepper Motor driver Tester

Project in progress by ashleyblack

  • 14,650 views
  • 13 comments
  • 23 respects
Add projectSign up / Login