Home
JAQForum Ver 24.01
Log In or Join  
Active Topics
Local Time 07:31 24 Nov 2024 Privacy Policy
Jump to

Notice. New forum software under development. It's going to miss a few functions and look a bit ugly for a while, but I'm working on it full time now as the old forum was too unstable. Couple days, all good. If you notice any issues, please contact me.

Forum Index : Microcontroller and PC projects : Stepper Motor

     Page 1 of 3    
Author Message
heppy36

Regular Member

Joined: 29/07/2011
Location: Australia
Posts: 54
Posted: 08:19pm 04 Oct 2011
Copy link to clipboard 
Print this post

Hi ,I just bought one of these
http://cgi.ebay.com.au/ws/eBayISAPI.dll?ViewItem&item=280706 173833#ht_4905wt_1163
and have tried to make it do things,I thought by turning on IN1 then OFF then IN2 On then Off then IN3 and 4 it would rotate?I managed to get it to turn by have IN1 and IN3 joined and IN2 and IN4 and my maximite send and on and off to theses and it rotates real slow.
I am not sure I am understanding it correctly?
any help you be great,I am just tring to get my head around stepper motors
Thanks Heaps Martin
Heppy
 
Talbit
Senior Member

Joined: 07/06/2011
Location: Australia
Posts: 210
Posted: 08:31pm 04 Oct 2011
Copy link to clipboard 
Print this post

Have a look at Silicon Chip August 2011, Circuit Notebook, page 57. A Maximite is used to run a stepper motor. It might help you.
Regards
Talbit
Talbit
 
Talbit
Senior Member

Joined: 07/06/2011
Location: Australia
Posts: 210
Posted: 08:56pm 04 Oct 2011
Copy link to clipboard 
Print this post

Whoops! Looks like it's for the Picaxe. Can you get it to work on the Maximite?
The listing is at Silicon Chip downloads - maximite stepper motor.bas
TalbitEdited by Talbit 2011-10-06
Talbit
 
heppy36

Regular Member

Joined: 29/07/2011
Location: Australia
Posts: 54
Posted: 05:56am 05 Oct 2011
Copy link to clipboard 
Print this post

Hi I thought that too,I have written a little program which turns on a pin the off then goes to the next one and so on,but motor just vibrates?
Thanks
Heppy
 
BobDevries

Senior Member

Joined: 08/06/2011
Location: Australia
Posts: 266
Posted: 07:03am 05 Oct 2011
Copy link to clipboard 
Print this post

Heppy,

as far as I remember, the stepper motor winding pulses must overlap.

Think of it as one pin connecting to one end of a winding, and the other pin to the other end, and there's usually two windings.

Suggest you check out other source code, to see what happens.

Regards,
Bob Devries
Dalby, QLD, Australia
 
BobDevries

Senior Member

Joined: 08/06/2011
Location: Australia
Posts: 266
Posted: 07:36am 05 Oct 2011
Copy link to clipboard 
Print this post

The August, 2011 issue of Silicon Chip was mentioned earlier. In that article, the outputs are used as follows:


pin8 pin12 pin16 pin20
STEP 1 0 1 1 0
STEP 2 0 1 0 1
STEP 3 1 0 0 1
STEP 4 1 0 1 0


The rate at which the steps are done, determines the speed of rotation.

maximite_stepper_motor.bas is available from the Silicon Chip website

Regards,
Bob Devries
Dalby, QLD, Australia
 
Talbit
Senior Member

Joined: 07/06/2011
Location: Australia
Posts: 210
Posted: 08:15am 05 Oct 2011
Copy link to clipboard 
Print this post

Forgive the ingorance but how do you translate the Picaxe code (maximite_stepper_motor.bas)in Silicon Chip to run on the Maximite?
Talbit
Talbit
 
heppy36

Regular Member

Joined: 29/07/2011
Location: Australia
Posts: 54
Posted: 08:51am 05 Oct 2011
Copy link to clipboard 
Print this post

Thanks Bob ,I used 15,16,17,18 on the maximite,turn 2 pins on then pause 5,the turn off then the next as per your diagram and it rotates!!
seems to stop after one rotation and need a little push to get it going again
Thanks Martin
Heppy
 
BobDevries

Senior Member

Joined: 08/06/2011
Location: Australia
Posts: 266
Posted: 09:04am 05 Oct 2011
Copy link to clipboard 
Print this post

Heppy,

try something like this:


10 DIM A$(3)
20 SETPIN 1,8:SETPIN 2,8:SETPIN 3,8:SETPIN 4,8
30 DATA "0110","0101","1001","1010"
40 FOR X=0 TO 3:READ A$(x):NEXT X
50 DO
60 FOR STP=0 TO 3
70 FOR Y=0 TO 3
80 PIN(Y+1)=VAL(MID$(A$(STP),Y+1,1))
90 NEXT Y
100 NEXT STP
110 LOOP


I didn't put any delays in there, and to reverse, you need to reverse the FOR/NEXT loop in line 60 to FOR STP=3 TO 0 STEP -1

Let me know if it works, I'm doing this blind; no hardware to test it on.

Regards,
Bob Devries
Dalby, QLD, Australia
 
heppy36

Regular Member

Joined: 29/07/2011
Location: Australia
Posts: 54
Posted: 09:04am 05 Oct 2011
Copy link to clipboard 
Print this post

Thanks Bob ,I used 15,16,17,18 on the maximite,turn 2 pins on then pause 5,the turn off then the next as per your diagram and it rotates!!
seems to stop after one rotation and need a little push to get it going again
Thanks Martin
Heppy
 
heppy36

Regular Member

Joined: 29/07/2011
Location: Australia
Posts: 54
Posted: 09:12am 05 Oct 2011
Copy link to clipboard 
Print this post

Bob your code rocks,it flys a round ,very smooth
Is that running full speed as I cant see how you did it
Thanks Heaps
Heppy
 
BobDevries

Senior Member

Joined: 08/06/2011
Location: Australia
Posts: 266
Posted: 09:15am 05 Oct 2011
Copy link to clipboard 
Print this post

Martin,
the delay (PAUSE) should go at line 95 between the two NEXT lines.
You can implement the reversal with a test for forward or reverse, (variable, keyswitch, whatever) then use an IF statement to select line 60 as it is, or reversed as I explained above.


55 IF CW=0 THEN 60 ELSE 65:REM CW = 0 for clockwise, non-zero for CCW rotation
60 FOR STP=0 TO 3
61 GOTO 70
65 FOR STP=3 TO 0 STEP -1
70 .......


Hope that helps
Regards,
Bob Devries
Dalby, QLD, Australia
 
BobDevries

Senior Member

Joined: 08/06/2011
Location: Australia
Posts: 266
Posted: 09:25am 05 Oct 2011
Copy link to clipboard 
Print this post

Martin,

here's the whole programme again:


10 DIM A$(3)
15 CW=0:REM CW=1 for CCW rotation
20 SETPIN 15,8:SETPIN 16,8:SETPIN 17,8:SETPIN 18,8
30 DATA "0110","0101","1001","1010"
40 FOR X=0 TO 3:READ A$(X):NEXT X
50 DO
55 IF CW=0 THEN 60 ELSE 65:REM CW=0 for clockwise, non-zero for CCW rotation
60 FOR STP=0 TO 3
61 GOTO 70
65 FOR STP=3 TO 0 STEP -1
70 FOR Y=0 TO 3
80 PIN(Y+1)=VAL(MID$(A$(STP),Y+1,1))
90 NEXT Y
95 PAUSE 5: REM increase PAUSE value to SLOW rotation.
100 NEXT STP
110 LOOP


Hope it works for you!

Regards,
Bob Devries
Dalby, QLD, Australia
 
heppy36

Regular Member

Joined: 29/07/2011
Location: Australia
Posts: 54
Posted: 09:40am 05 Oct 2011
Copy link to clipboard 
Print this post

Yes it works Great!!,I will add later if R is pushed cw=1 and if F is pushed cw=0 on startup,would to great to choose direction on start
Realy Thanks Heaps,I have learn't alot
Martin

Heppy
 
Talbit
Senior Member

Joined: 07/06/2011
Location: Australia
Posts: 210
Posted: 09:46am 05 Oct 2011
Copy link to clipboard 
Print this post

Gents, I've been following this. What about the Silicon Chip code? Have you adapted that or is it all new code? How can you use the SC code.
Talbit
Talbit
 
BobDevries

Senior Member

Joined: 08/06/2011
Location: Australia
Posts: 266
Posted: 09:55am 05 Oct 2011
Copy link to clipboard 
Print this post

Martin,

you could also check for a key at line 95... if R is pressed, set CW to 1 or if CW is already 1, set it to 0. Similarly, check for key S for SLOW, and F for fast, and adjust the PAUSE to suit.


96 I$=INKEY$:IF I$<>"" THEN 100
97 IF I$="R" OR I$="r" THEN CW=NOT(CW)
98 IF I$="F" OR I$="f" THEN DLY=DLY - 1: IF DLY<0 THEN DLY=0
99 IF I$="S" OR I$="s" THEN DLY=DLY+1: IF DLY>MAX THEN DLY=MAX


You'll need to define MAX somewhere, and play with its value to see what's a reasonable slow speed. The higher MAX is the slower the rotation at its slowest speed.
Also, Set DLY to 0 at the start of your programme.

11 DLY=0

and make line 95:

95 PAUSE DLY

Regards,
Bob Devries
Dalby, QLD, Australia
 
BobDevries

Senior Member

Joined: 08/06/2011
Location: Australia
Posts: 266
Posted: 09:58am 05 Oct 2011
Copy link to clipboard 
Print this post

Talbit,

I did look at the SC code, but decided it was easier to roll my own.

The commands of the PIC and BASIC STAMP code allow you to output to a number of pins with one command, which we can't (yet) do.

Regards,
Bob Devries
Dalby, QLD, Australia
 
BobDevries

Senior Member

Joined: 08/06/2011
Location: Australia
Posts: 266
Posted: 10:05am 05 Oct 2011
Copy link to clipboard 
Print this post

Talbit,

I'm actually wondering if the code available from SC was put there by mistake, and that the author (Mr L. Kerr from Ashby, NSW) did actually write MMBasic code for that project.

Regards,

Bob Devries
Dalby, QLD, Australia
 
Talbit
Senior Member

Joined: 07/06/2011
Location: Australia
Posts: 210
Posted: 10:21am 05 Oct 2011
Copy link to clipboard 
Print this post

Thanks Bob,
I wrote to Leo Simpson about this and I know he'll follow it through. My guess is that L. Kerr posted the wrong version. It will be interesting to see how it pans out.
Talbit.
Talbit
 
elproducts

Senior Member

Joined: 19/06/2011
Location: United States
Posts: 282
Posted: 11:03am 05 Oct 2011
Copy link to clipboard 
Print this post

The original link to the Stepper on Ebay isn't showing the product.
Says the listing has been removed.
I'd like to see the hardware used.
Can you post a new link if it's still available somewhere?
www.elproducts.com
 
     Page 1 of 3    
Print this page
© JAQ Software 2024