28BYJ-48 Stepper Motor and L293D driver

I need some help with driving my Stepper motor 15 degrees every hour.

I found this forum Rotating 28BYJ-48 Stepper Motor below 1 RPM

In this forum it says:

//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

From this info I'm assuming I will need to use this below info to build my program.
//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 = 32 * 63.68395 = 2037.8864 in 4 step control signal sequence

If I want to have the stepper motor run for 12 hrs. of the day estimating from 9am-9pm
the time it would take is 60sec x 60min x 12hrs = 43,200 seconds in a 12 hour period. Believe the Arduino has a delay of 1000 to equal 1s. So every hour would have a 60x60x1 = 320 seconds x 1000 - 360,000ms. Still confused how to program the motor to rotate 15deg every 360000ms

Any help would be greatly appreciated. I'm trying to build a portable solar tracking charger for camping. Only issue I'm running into is the code for the Arduino Uno R3

the L293 is for a DC motor. a uln2003 board can be used to drive with of the stepper coils

the general answer is how often to step the motor, msec/step

28BYJ48 Stepper Motor says 5.625°/64 steps or 0.0879°/step.

figure out what the delay needs to be between steps and after how many steps a extra step is needed or needs to be skipped

I agree, forget the L293 and just use the ULN2003 driver that comes with some of those motors. You can buy them on eBay.

If you assume 4076 steps per revolution,

  • the number of steps to cover 15 degrees is (15/360)*4076 = 170 (rounded)

  • to move 15 degrees in one hour, the time per step is 3600000/170 = 21176 ms

I'll check out the uln2003 board, but for now, Is the L293 not usable for this application? I'm not using a driver board. Its the IC chip L293 on the bottom picture.

so if its 5.625 deg/64 step:
(5.625/64)=(15/x)
960=5.625x
steps would be 170.6666repeated
so my code would be 170.666 steps every 360,000ms. Not sure how to put this in code form as I've never used the stepper before. Would it be something like this:

#include <Stepper.h>

int ip1 = 8;
int ip2 = 9;
int ip3 = 10;
int ip4 = 11;

void setup()
{
//outputs Arduino UNO R3 pin outputs into stepper motor inputs
pinMode(Ip1, OUTPUT);
pinMode(Ip2, OUTPUT);
pinMode(Ip3, OUTPUT);
pinMode(Ip4, OUTPUT);

Stepper stepper(Ip1, Ip2, Ip3, Ip4);

void loop()
{
//number of steps motor takes and time delay between next step.
stepper.step(170.66);
delay(360000);
}

Not easily. There are countless tutorials on the web for using the 28BJY-48 stepper with the ULN2003. You do not need any libraries.

@jremington
for the second bullet does 21176ms have the stepper continuously moving?
Code for it:

stepper.step(1);
delay(21176);

or can I tell the stepper to perform 170 steps every 360,000ms?
Code for it:

stepper.step(170);
delay(360000);

I replied to gcjr for a work in progress code if you can critique it.

stepper.step(1);
delay(21176);

This will work with a unipolar stepper driver in half step mode, or with a bipolar stepper driver in half step mode and a modified 28BYJ-48 (converted to bipolar operation).

But why make things difficult for yourself, when it will work out of the box with the ULN2003?

I've already ordered a ULN2003. I just already have a couple IC L293 on hand and just wanted to see if it could be done without spending more money. It'll be a few days before the ULN arrives. So I'm still going to tinker around with the IC L293

The L293 can drive four DC motors in one direction, or one four coil unipolar stepper. This shows one possible wiring scheme, in about the middle of the page.

Here is a more informative schematic of a better approach than the above (either L298 or L293 will work with the 28BYJ-48):

Thanks for the references, The Arduino and IC circuit mention in the link is how I got my circuit currently just using different pins. So if there is 48 steps in revolution then 360deg/48steps = 7.5 deg/steps. Then 2 steps would get 15 degrees. then the code would be. using this seems to be more accurate for my application then having to to round 170.666666

// Include the Arduino Stepper Library
#include <Stepper.h>

// Number of steps per output rotation
const int stepsPerRevolution = 48;

// Create Instance of Stepper library
Stepper myStepper(stepsPerRevolution, 10, 9, 8, 7);


void setup()
{
	// set the speed at 20 rpm:
	myStepper.setSpeed(20);
	// initialize the serial port:
	Serial.begin(9600);
}

void loop() 
{
	// step one revolution in one direction:
	Serial.println("clockwise");
	myStepper.step(2);
	delay(360000);
}

Revolution of what? Most of the 28BYJ-48 motors have gearbox outputs. The basic unipolar motor inside this very carefully and completely analyzed example has 64 or 32 steps/revolution (half or full step), which is then further geared down.

hard to see how. the 28BYJ has 4 coils that need to be driven. see BYJ48 Stepper Motor

Not so hard. See the schematic in post #9. The four coils can be independently driven with one L293 or L298, for example with the center taps both connected to the motor power supply positive (or ground, if you prefer).

That is basically what the ULN2003 does, with the center taps all connected to motor power positive.

ok, thanks.
it's a quad driver, you use only 4 of the 8 transistors

Exactly. Using all four drivers this way basically recreates the ULN2003:
Capture

I was going based off the link you mentioned Control Unipolar & Bipolar Steppers with L293D Motor Driver IC & Arduino

But that makes sense it wouldn't be 48 if the output shaft isn't centered. Due to be at the corner there needs to be a gear reduction ration. Then yea I'd have to use the 170 and add a counter so for every fifth step use a step of 171.

When I set const int stepsPerRevolution = 4096 the output shaft doesn't move. When its at 48 or 64 it does. Anything over 140 and it stops moving form me testing it. But you hear the gears going inside the motor. Does this mean it uses the center gear for the number of steps per revolution?

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.