Pages: 1 ... 5 6 [7] 8 9 10   Go Down
Author Topic: 28BYJ-48 5-Volt Stepper  (Read 81872 times)
0 Members and 2 Guests are viewing this topic.
Offline Offline
Edison Member
*
Karma: 8
Posts: 1341
If you're not living on the Edge, you're taking up too much space!
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Nice simple code!  I have also included 4 non-blocking functions.
Logged

If you fall... I'll be there for you!
-Floor

Skype Brighteyes3333
(262) 696-9619

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

Off the top of my head while traveling I don't recognize ramp().
36000 is 360 degrees in my function call.
1200 is 12 RPM.


Ahh, reverse of what I thought - cheers, i'll keep playing!
Logged

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

2 Stepper motors with drive 28BYJ-48 (Chinese) + lib accellstepper

Hello everyone, I need help. I am wanting to use the lib that accellstepper

control over a stepper motor at the same time, but I can not for the code

using 2 motors running in opposite directions simutaneamente, triggered by buttons

for clockwise and counterclockwise. For lib "Stepper.h" and 2 engines already

get (below).

I thank anyone who can help.






Code:

#include <Stepper.h>


//
//
// 2 Motor de passo 5v + 2 botoes
//
//
#include <Stepper.h>  //Biblioteca já disponível na IDE do Arduino



 #define STEPS 150  // max 100
 
const int steps=100;  //Número de passos para o motor
 int buttonState1=0;
 int buttonState2=0;
 Stepper stepper1(STEPS, 0, 2, 1, 3); // Motor 1
 Stepper stepper2(STEPS, 5, 7, 4, 6); // Motor 2

void setup()
 {
 stepper1.setSpeed(200);    //Velocidade da rotação do motor (RPM)
 stepper2.setSpeed(200);    //Velocidade da rotação do motor (RPM)
 pinMode(8,INPUT);   //Botão 1
 pinMode(9,INPUT);   //Botão 2
 pinMode(12,OUTPUT);   //LED

 }

void loop()
 {
 buttonState1=digitalRead(8);
 buttonState2=digitalRead(9);
 if(buttonState1==LOW)   //Gira para um lado
 {
    digitalWrite(12,HIGH);
    stepper1.step(steps);
    stepper2.step(steps);
 }
 else if(buttonState2==LOW)  //Gira para o outro lado
 {
    digitalWrite(12,HIGH);
    stepper1.step(-steps);
    stepper2.step(-steps);
 }
 else   //Fica parado
 {
    digitalWrite(12,LOW);
    stepper1.step(0);
    stepper2.step(0);

 }
 }


« Last Edit: June 28, 2013, 07:38:00 am by fcaldeira » Logged

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

Hi guys!

First of all thanks for the useful things in this thread.
The arduino is really new for me, so sorry about my noob questions.
I'd like to create a motorized camera slider, first only with one 28BYJ-48.
I found Sbright33's great library(https://gist.github.com/sbright33/4178431).
But I'm so confused about the wiring. Do I simply connect the 28BYJ-48 motor to the arduino board. In this case how can I get 12V? Eg from the arduino board's Vin pin?
Or do I need to use the ULN2003 board (Connect the 28BYJ-48 motor to the ULN2003 and the ULN2003 to the arduino board)?


Thanks for your answer.

Regards,
Peter
Logged

Offline Offline
Edison Member
*
Karma: 8
Posts: 1341
If you're not living on the Edge, you're taking up too much space!
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Here's a good picture for you:
http://www.geeetech.com/wiki/index.php/Stepper_Motor_5V_4-Phase_5-Wire_%26_ULN2003_Driver_Board_for_Arduino
or
https://www.google.com/search?q=uln2003+wiring&tbm=isch
or
https://www.google.com/search?q=uln2003+wiring

I made a camera slider too!  Thanks for the Compliments...
Logged

If you fall... I'll be there for you!
-Floor

Skype Brighteyes3333
(262) 696-9619

Offline Offline
Edison Member
*
Karma: 8
Posts: 1341
If you're not living on the Edge, you're taking up too much space!
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

You can use 5V or 12V.  Some of my functions are designed for a 12V supply and 5V motor.
Logged

If you fall... I'll be there for you!
-Floor

Skype Brighteyes3333
(262) 696-9619

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

hey guy this working perfectly thanks a lot
can you make a knob version
(if you dont understant war the knob is):
control thr direction of the stepper thith a pontetiometer
Logged

Offline Offline
Edison Member
*
Karma: 8
Posts: 1341
If you're not living on the Edge, you're taking up too much space!
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I would consider it.  What do you mean exactly?

Can anyone think of any improvements to my code?  It's been awhile since I asked or made any changes.
Logged

If you fall... I'll be there for you!
-Floor

Skype Brighteyes3333
(262) 696-9619

Offline Offline
Edison Member
*
Karma: 8
Posts: 1341
If you're not living on the Edge, you're taking up too much space!
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

What's a knob version?
Logged

If you fall... I'll be there for you!
-Floor

Skype Brighteyes3333
(262) 696-9619

Offline Offline
Jr. Member
**
Karma: 0
Posts: 62
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I am trying to use the original code on the first page of this post. I have this same stepper, and I only need to rotate it once, 360 degrees. Nothing continuous, and not very often. When I use the CustomStepper library, it works very well. But when I try to use the code from the original post here, the motor is very slow, and that is when I have the speed dialed all the way up to "5". Plus if I feel the motor, it feels very stuttery, not smooth at all like when I use the CustomStepper library. I looked at that library, and it seems to do the same thing (uses digitalWrites to the pins, and in the same sequence). So what is the difference? What am I missing? And how can I optimize the original code to make it work the same way? I want to take that code, and then use shift registers to send the various HIGH/LOW commands to several stepper motors at once. Thanks!
Logged

Offline Offline
Jr. Member
**
Karma: 0
Posts: 62
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Update. I just tried using a delay of "1", and that works very smoothly. Is there a way to use anything lower? Say "0.5"?
Logged

Offline Offline
Full Member
***
Karma: 2
Posts: 213
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Update. I just tried using a delay of "1", and that works very smoothly. Is there a way to use anything lower? Say "0.5"?

I'm also new to this and just started to explore the different Demos. With the sketch from posting #1 it wont be possible to go faster than delay(1). But if you like, you can rewrite the sketch and use delayMicrosecond and recalculate the whole potmeter-reading.

BTW: I have a newer Version of the ULN2003 board. It is made in SMD fashion and features pins in1-7 and A-F.
This pcb must be powered in a different way, where GND and VCC are placed on a separate Header instead of using In5 for VCC.
Logged

It's not my fault when my Posts are full of Errors. This stupid autocorrection from my browser is set up for german grammar.

Offline Offline
Full Member
***
Karma: 2
Posts: 213
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

...Can anyone think of any improvements to my code?  It's been awhile since I asked or made any changes.


I tried to understand what your code is doing. It seems, there are different voids to do the same Thing. " st07" is doing the 8-step thingy in an improved way, but there are also two others. Why?

There is a void "move" , which seems to be the simplest way to move the stepper.
It would help me a lot, if you could write a simple example program to demonstrate how to do microstepping or fast running.
Would you consider to split the sketch in a standard-(5v) and overclocked (12V)Version?

THX alot
Olaf
Logged

It's not my fault when my Posts are full of Errors. This stupid autocorrection from my browser is set up for german grammar.

Offline Offline
Edison Member
*
Karma: 8
Posts: 1341
If you're not living on the Edge, you're taking up too much space!
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Yes there are a few ways to step with st07.  Full steps and half steps.  4 or 8 of them.  Look for differences in the code.  You should not call these directly, as they are used by my functions.

move() is the easiest way to move one step.  The other functions use degrees and RPM as parameters.  Maybe you could help me by writing some demo code.  Just try one function call at a time in loop() or setup().  My Demo is only one short line of code.  They are commented out.  When you execute it you will see what it does.  Let me know if you have any questions about any of the function parameters.  I have written them up somewhere on github.  I can also translate what the function name means if you'd like.  The easiest way to learn is to try! 

Generally the "Cool" functions are designed for 12v.  There is no need to cool with 5v, as it will not be excessively hot to begin with.
Logged

If you fall... I'll be there for you!
-Floor

Skype Brighteyes3333
(262) 696-9619

Metro Atlanta
Offline Offline
Newbie
*
Karma: 0
Posts: 1
nearly complete noob
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hey all, I just fell off the turnip truck and i just got one of these motors with the driver board.
don't have a clue how to wire it to my arduino. smiley-confuse
Could one of you point me in the right direction while everyone else laughs and snickers?
thanks,
Tone



Never mind i found it
http://www.4tronix.co.uk/arduino/Stepper-Motors.php

i will have lots of other, hopefully better wuestions soon.
thanks

T
« Last Edit: September 14, 2013, 12:31:27 pm by tone57 » Logged

Pages: 1 ... 5 6 [7] 8 9 10   Go Up
Jump to: