//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
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);
}
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.
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.
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?