Hello, I'm a total noob at this (programming and stepper motor stuff). So I've been trying get a 28BYJ-48 to complete one turn in 24 hours, but the best I can do, is to make it turn at 1 revolution per hour (by luck). The original code allowed me to get a 1 rpm
This is the code I am using, I found it somewhere in the internet, and I'm just changing de steps per revolutin setting and the setSpeed. The original code allowed me to get a 1 rpm, so the StepsPerRevolution line was in 2038 and the SetSpeed was in 60.
#include <Stepper.h>
const int stepsPerRevolution = 32; // 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);
void setup() {
// set the speed:
myStepper.setSpeed(1);
// initialize the serial port:
Serial.begin(9600);
}
void loop() {
// step one revolution in one direction:
Serial.println("clockwise");
myStepper.step(stepsPerRevolution);
delay(500);
}
2700 seconds is quite a long time, if you want really smooth motion you might be better off running the motor a bit faster then using some gearing to reduce the rotation rate of whatever it is that you are turning. Perhaps a system of gears or worm gear giving a 100:1 reduction ratio, so you can have the motor move a little bit every 27 seconds.
The 28BYJ-48 has a 64:1 gear ratio so one revolution of the output shaft takes 2048 steps, for 1 rev per day it would take:
86400 seconds / 2048 steps = 42.1875 seconds per step. (42188 millis or 42187500 micros).