Go Down

Topic: Rotating 28BYJ-48 Stepper Motor below 1 RPM (Read 74 times) previous topic - next topic

knightridar

Hi I am trying to rotate my stepper motor below 1 RPM.
The intent is to use it for tracking the sun for a solar cooking project I am working on.

The motor I am using is 28BYJ-48. It comes with a lot of starter Arduino kits.
It's a 5 volt stepper motor with a 1 to 64 gear ratio.

For the solar tracking I have have taken into account
24 hours of rotation of the earth in 360 degrees.
I've calculated this out to be 15 degrees/hr -->.25 degrees/min-->.004167 degrees/sec
Or .25 degrees/min/360 degrees = .000694 RPM

In my code below I've input the number of steps the motor must take to complete one revolution.
I've been able to successfully use the code with 1 RPM, but anything below that doesn't rotate.

Is there a reason why? Are steppers not good enough for this type of motion?


Thanks! Any input is appreciated.

//28BYJ-48 Stepper Motor

//Half-step mode: 8 step control signal sequence (recommended) 5.625 degrees per step / 64 steps per one revolution of the internal motor shaft
//Arduino Stepper Library runs in 4 step control signal sequence 11.25 degrees per step / 32 steps per one revolution of the internal motor shaft
//Gear reduction ratio: 1 to 63.68395
// Steps per one revolution (internal motor shaft) * Gear reduction ratio = Actual number of steps per revolution = 64 * 63.68395 = 4075.7728 in 8 step control signal sequence
// Steps per one revolution (internal motor shaft) * Gear reduction ratio = Actual number of steps per revolution = 32 * 63.68395 = 2037.8864 in 4 step control signal sequence


//stepper library
#include <Stepper.h>

//ms stands for motor steps
//#define is used to assign a name for a constant value i.e. in this case ms stands for actual number of steps per revolution
#define ms 2037.8864

//mip stands for motor input pin
//output pins 8,9,10,11 on Arduino UNO R3 attach to input pins 1,2,3,4 respectively on stepper motor driver ULN2003A
int mip1 = 8;
int mip2 = 9;
int mip3 = 10;
int mip4 = 11;

//command tells the Arduino stepper library which pins are connected to motor controller
//first parameter in parenthesis is number of actual steps that occur per revolution
Stepper stepper(ms, mip1, mip2, mip3, mip4); 

void setup()
{
 
//outputs Arduino UNO R3 pin outputs into stepper motor inputs
  pinMode(mip1, OUTPUT);
  pinMode(mip2, OUTPUT);
  pinMode(mip3, OUTPUT);
  pinMode(mip4, OUTPUT);

//stepper motor value in parenthesis is in RPM   
  stepper.setSpeed(.000694);
}

//repeats commands written below
void loop()
{
//number of steps the motor takes to complete one revolution 
stepper.step(ms);
}

jremington

Please use code tags.
stepper.setSpeed takes an integer argument.

Radicator

Hi knightridar,

you can try a library called AccelStepper, that let you control the stepper really easily.

You need only to set the pin outside the board and set only the maximum acceleration, speed and targhet position, no more informations. If you need I can give you an example of code.

Riccardo

Go Up
 


Please enter a valid email to subscribe

Confirm your email address

We need to confirm your email address.
To complete the subscription, please click the link in the email we just sent you.

Thank you for subscribing!

Arduino
via Egeo 16
Torino, 10131
Italy