Pages: [1]   Go Down
Author Topic: 28BYJ-48 geared stepper 64 or 32 steps.  (Read 894 times)
0 Members and 1 Guest are viewing this topic.
0
Offline Offline
Full Member
***
Karma: 0
Posts: 144
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I recently acquired a few 5v unipolar steppers - 28BYJ-48. These are advertised as 64 step with 1/64 reduction gearing. They also ship wired in the order, Blue, Pink, Yellow, Orange, Red turning in one direction only. Swapping the Pink and Yellow wires however, has the stepper rotating CW and CCW. But I am not able to solve the fact that motorsSteps must be set at 32, to drive my application as required at 1 rpm, rather than 64 steps advertised. Other than that, these little motors run almost resonance free, which is great for astrophotos.

All my other steppers run as advertised using the standard Arduino library - not sure why the 28BYJ-48 requires only half the number of steps / revolution? I suspect it's a user problem, but have no idea where to start looking.

Furthermore, should I set the stepper pins to OUTPUT, or is this the default stepper library configuration any way?
Logged

Fl
Offline Offline
Newbie
*
Karma: 0
Posts: 17
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

i have 2 of these on a camera setup and here is the code i have that runs them off of 1 joystick.

#include <Stepper.h>
 
const int stepsPerRevolution = 64; 
 
Stepper pan(stepsPerRevolution, 8,10,9,11);
Stepper tilt(stepsPerRevolution, 3,5,4,6);
 
void setup() {
 
  pan.setSpeed(300);    // pan
  tilt.setSpeed(300);   // tilt
}
 
 void loop() {
 
  int sensorReading = analogRead(A0); // pan
 
  if (sensorReading < 300) { pan.step(4); }   // pan left
  if (sensorReading > 800) { pan.step(-4); }  // pan right
 
  int sensorReading2 = analogRead(A1); // tilt
 
  if (sensorReading2 < 300) { tilt.step(4); } // motion down
  if (sensorReading2 > 800) { tilt.step(-4); } // motion up
   
   
 }

simple and easy
good luck
Logged

Pages: [1]   Go Up
Jump to: