Very cheap stepper and driver to play with.

eclectic

Moderator
Now I can see a whole new range of PICAXE sex toy projects, or is my corrupted mind?

Only joking. Looks very attractive for making robotic objects as well as for getting one of protoypes off the ground. I followed up a link to supply Polymorph, but working out volumes of the item (pellets) to be useable is difficult to work out. Be good if the volumes were shown related to a finished cubic volume.

Thanks
250g granules is about 350ml volume

Roughly halve that for solid product

(I've just measured some. -)

No responsibility accepted for my errors.

E (and OE)

Addit
And remember, it's re-usable, as long as it's clean.
 

Goeytex

Senior Member
The stuff melts at 60 Degrees C. I suspect the stepper motor shafts might get that hot with extended use.
 

ZOR

Senior Member
Thanks all for the information, will definately get some as I can see many uses for it. I remember now seeing it many years ago on a shopping channel, and the person demonstrating it manufactured replacement knife handles, and a key that had broken in half?, made a replacement end.

Very good in respect to it be reuseable.
 

ZOR

Senior Member
Just got my part from Meccano (link given earlier)
I had to drill the hole out to 5mm to fit, but as it was brass it was easy to do.
meccano.jpg

Only cost £1.95, bit different to all the other couplers prices that I would still have had to modify to get a plate on.
 

lemaxnut

Member
Code to test same:

Code:
#Picaxe 08m2
'Stepper motor driver test
'Boris Burke May 2012

setfreq m8
dirs=%00010111
do
	b1=b1+2 max 3//3	'b1 is direction control, 2=CW 0=CCW
	for w1=1 to 2060	'seems to be about the right number of steps for 360 degrees
		b0=b0+b1-1//4	'b0 cycles from 0 to 3 for CW and from 3 to 0 for CCW
		lookup b0,(%00011,%00110,%10100,%10001),pinsC
		pause 1
	next w1
	pause 4000
loop
First of Boris, Thank you very much for posting a code us newbies can work with right away. I would need a few more lifetimes before I could write code at your level, but reading it and following what it does helps a lot.
I noticed that this code produces 1 full turn in one direction, but only half in the other ? Was there a reason in the code for this that I missed out ?
doesn't w1 dictate 1 to 2060 in both directions ? Can I also surmise that if I wanted, say only 20 degrees in both directions, then I only need to tweak w1?

Which variable would I change if I wanted a slowly increasing/ decreasing angle of rotation, say going from 5 degrees up to 20 in 4 steps ?
 

Goeytex

Senior Member
Which variable would I change if I wanted a slowly increasing/ decreasing angle of rotation, say going from 5 degrees up to 20 in 4 steps ?
The code is for a motor that has 5.625 / 64 step angle at the shaft. The step angle is fixed. ( except for microstepping or half stepping) That means that each "step" by definition will be ~ .088 degrees at the shaft. You can't just jump a stepper motor to a certain position or arbitrarily change the step angle. In order for the motor to rotate, the coils must be pulsed in sequence (usually) one step at a time.

Boris did not include much pause time between steps ( Pause 1) because the code processing time was long enough to give adequate time for the coils to build up enough current to move the rotor. Increasing the pause will slow the motor at the expense of added average current and additional heat.

The number of 2060 to make a complete revolution does not seem to match the motor spec of 5.625/64 which should take 4096 steps . It would closer match a motor with a step angle of 5.625 / 32. ( 2048 steps)
 
Last edited:

lemaxnut

Member
I noticed that this code produces 1 full turn in one direction, but only half in the other ? Was there a reason in the code for this that I missed out ?
doesn't w1 dictate 1 to 2060 in both directions ? unquote!

Boris, So sorry, had a brain fart ! Forgot to switch the jumper to output 0. Works beautifully now !
 

ZOR

Senior Member
CONNECTOR.jpg

Does anyone know the name of the manufacturer/type of the motor connector socket/header on the stepper drive board, and possibly Ebay source?

Want to make my own board using ULN2803 IC. with more outputs. Thanks
 

ZOR

Senior Member
Many thanks, however i could not find anything the same. The nearest I have got to is JST connectors on Ebay. Regards
 

Paix

Senior Member
5V Stepper Motor 28BYJ-48 With Drive Test Module Board ULN2003 5 Line 4 Phase ( 200712530295 ) I have four on order by the original slow boat.

It seems that there are several traders doing these at the moment SINEDY and ABEYERR to name but two.

http://www.ebay.com/itm/200712530295

http://www.ebay.co.uk/itm/5V-Stepper-Motor-28BYJ-48-Drive-Test-Module-Board-ULN2003-5-Line-4-Phase-/271005201851

Like Boriz I'm willing to take a chance at the price.
http://www.picaxeforum.co.uk/archive/index.php/t-22230.html

Why identify the motor and buy elsewhere. at 99p per shot take a punt and you have the device you are looking for. Remove the controller and replace it with your own if you wish.

Looks like someone has a freight container full of these to shift.
 

lemaxnut

Member
I bought 4 off SINEDY posted to Sydney for AU$11.00 and they came within 3 weeks and I have tested them all using Boriz's code and they all work perfectly, so no complaints.
 

ZOR

Senior Member
Thanks Jim, just ordered them.
I did look at them earlier but having no side view I could not see if side slots. Could have used straight 0.1 pcb headers but then no polarisation. Regards
 

tony_g

Senior Member
and mine finally turned up after a good few weeks waiting,the code from boriz works great and it seems to be a good little motor and board for the few pieces of change it cost, now to just find a small project to stick it in :confused:
 

ZOR

Senior Member
Thanks Jim, I was going to pull off two connectors from two boards, but it seemed a shame to mess up two good little pcb's

Ebay's usually excellent on delivery, don't know what we would do without them now. Who goes to the shop's anymore?, apart from the wife to drag back the food shopping. Won't let her shop online, the excercise does her good.
 

lemaxnut

Member
I tried Boriz's code and have successfully played around with different variable in line one to change the angle of rotation, but don't know enough about the subject to introduce some form of acceleration and deceleration functions. I had thought it would work like the DC motor code with the "on" time gradually increasing and the "off" time decreasing and vice versa, but when I tried to introduce extra code lines or sub-routines, the whole thing went to hell in a hand basket.
 

JimPerry

Senior Member
It's the pause between steps that changes the speed - the elcheapo ebay steppers can't go really fast but can go really slow!
Sample code for a 08m2 attached
Code:
pause 1000 
output c.0, c.1, b.3, b.5
symbol delay = 6 'Must be at least 3 or motor will not turn; probably should be at least 4 in order
b4=delay
start:
for b4 = 233 to 13 step -10		
cw:
high b.1
	'for b2 = 1 to 2	'Sets number of complete revolutions clockwise.
		for w0 = 64 to 1 step -1
			high c.0: low c.1: low b.3: high b.5
			pause delay
			'low c.0: low c.1: low b.3: low b.5 'Removing power from the motor allows cooling.
			'pause b4	
			'high c.0: 
			high c.1: 'low b.3: 
			low b.5
			pause delay
			'low c.0: low c.1: low b.3: low b.5 'Removing power from the motor allows cooling.
			'pause b4
			low c.0: 
			'high c.1: 
			high b.3:
			' low b.5
			pause delay
			'low c.0: low c.1: low b.3: low b.5 'Removing power from the motor allows cooling.
			'pause b4
			'low c.0: 
			low c.1: 
			'high b.3: 
			high b.5
			pause delay
			'low c.0: low c.1: low b.3: low b.5 'Removing power from the motor allows cooling.
			'pause b4
		next w0
	'next b2
low c.0: low c.1: low b.3: low b.5 'Removing power from the motor allows cooling.
high b.2
pause 1
	for w0 = 255 to 1	step -1
			high c.0: low c.1: low b.3: high b.5
			pause delay
			'low c.0: low c.1: low b.3: low b.5 'Removing power from the motor allows cooling.
			'pause b4	
			'high c.0: 
			high c.1: 'low b.3: 
			low b.5
			pause delay
			'low c.0: low c.1: low b.3: low b.5 'Removing power from the motor allows cooling.
			'pause b4
			low c.0: 
			'high c.1: 
			high b.3:
			' low b.5
			pause delay
			'low c.0: low c.1: low b.3: low b.5 'Removing power from the motor allows cooling.
			'pause b4
			'low c.0: 
			low c.1: 
			'high b.3: 
			high b.5
			pause delay
			'low c.0: low c.1: low b.3: low b.5 'Removing power from the motor allows cooling.
			'pause b4
		next w0
	'next b2
low c.0: low c.1: low b.3: low b.5 'Removing power from the motor allows cooling.

pause 1
low b.1
high b.2 
ccw:

'	for b2 = 1 to 2	'Sets number of complete revolutions counter-clockwise.
		for w0 = 128 to 1 step -1	'360 degrees counter-clockwise.
			low c.0: low c.1: high b.3: high b.5
			pause b4
			'low c.0: low c.1: low b.3: low b.5 'Removing power from the motor allows cooling.
			'pause b4
			'low c.0: 
			high c.1: '
			'high b.3:
			low b.5
			pause b4
			'low c.0: low c.1: low b.3: low b.5 'Removing power from the motor allows cooling.
			'pause b4
			high c.0: 
			'high c.1: 
			low b.3: 
			'low b.5
			pause b4
			'low c.0: low c.1: low b.3: low b.5 'Removing power from the motor allows cooling.
			'pause b4
			'high c.0: 
			low c.1: 
			'low b.3: 
			high b.5
			pause b4
			'low c.0: low c.1: low b.3: low b.5 'Removing power from the motor allows cooling.
			'pause b4
		next w0
'	next b2

low c.0: low c.1: low b.3: low b.5 'Removing power from the motor allows cooling.
pause 1
low b.2 
for w0 = 512 to 1 step -1	
			high c.0: low c.1: low b.3: high b.5
			pause delay
			'low c.0: low c.1: low b.3: low b.5 'Removing power from the motor allows cooling.
			'pause b4	
			'high c.0: 
			high c.1: 'low b.3: 
			low b.5
			pause delay
			'low c.0: low c.1: low b.3: low b.5 'Removing power from the motor allows cooling.
			'pause b4
			low c.0: 
			'high c.1: 
			high b.3:
			' low b.5
			pause delay
			'low c.0: low c.1: low b.3: low b.5 'Removing power from the motor allows cooling.
			'pause b4
			'low c.0: 
			low c.1: 
			'high b.3: 
			high b.5
			pause delay
			'low c.0: low c.1: low b.3: low b.5 'Removing power from the motor allows cooling.
			'pause b4
		next w0
	'next b2
low c.0: low c.1: low b.3: low b.5 'Removing power from the motor allows cooling.

pause 1
low b.1
next b4
'for b2 = 1 to 2	'Sets number of complete revolutions counter-clockwise.
		for w0 = 128 to 1 step -1	'360 degrees counter-clockwise.
			low c.0: low c.1: high b.3: high b.5
			pause b4
			'low c.0: low c.1: low b.3: low b.5 'Removing power from the motor allows cooling.
			'pause b4
			'low c.0: 
			high c.1: '
			'high b.3:
			low b.5
			pause b4
			'low c.0: low c.1: low b.3: low b.5 'Removing power from the motor allows cooling.
			'pause b4
			high c.0: 
			'high c.1: 
			low b.3: 
			'low b.5
			pause b4
			'low c.0: low c.1: low b.3: low b.5 'Removing power from the motor allows cooling.
			'pause b4
			'high c.0: 
			low c.1: 
			'low b.3: 
			high b.5
			pause b4
			'low c.0: low c.1: low b.3: low b.5 'Removing power from the motor allows cooling.
			'pause b4
		next w0
'	next b2

low c.0: low c.1: low b.3: low b.5 'Removing power from the motor allows cooling.
pause 1
goto start
 
Last edited:

boriz

Senior Member
This code has acceleration and deceleration with a fixed number of steps from start to finish. Tweak the values to suit.

Code:
#Picaxe 08m2
'Stepper motor driver test with acceleration
'Boris Burke May 2012

symbol prefinish=w0		'controls the start of deceleration
symbol finish=w1		'number of steps to the finish
symbol steps=w2			'counts the steps
symbol direction=b6		'2=CW 0=CCW
symbol phase=b7			'counts from 0 to 3 for CW and from 3 to 0 for CCW
symbol speed=W6			'changes with acceleration/deceleration (lower is faster, min 1)
symbol slow_limit=w7	'destination speed when starting and stopping (higher is slower)

setfreq m8				'double the Picaxe clock speed
pause 1000				'wait for the new clock speed to settle (1000=500mS at m8)
dirs=%00010111			'bit 3 cannot be used because I'm using an 08m2
slow_limit=32			'upper limit for slowest step speed during acceleration/deceleration
finish=4096				'number of steps to take
direction=2				'direction switch 0=CW 2=CCW

do
	direction=direction+2 max 3//3				'alternate direction, comment this line for single direction
	speed=slow_limit							'set delay
	for steps=1 to finish						'beging rotation loop
		prefinish=finish-steps+1				'set deceleration point
		if steps<slow_limit then				'if starting
			speed=speed-1 min 1					'then accelerate
		elseif prefinish<slow_limit then		'if stopping
			speed=speed+1 max slow_limit		'then decelerate
		endif									'end acceleration adjustmet to SPEED
		pause speed								'speed of rotation pause
		phase=phase+direction-1//4				'work out the next output bit pattern
		lookup phase,(%00011,%00110,%10100,%10001),pinsC	'move stepper motor
	next steps									'end of rotation loop
	pause 4000									'wait 2 seconds
loop
Note: When the steps stop coming, two of the motor coils are still energized. This is good for accurate position-and-stay effects, but if you want the motor to run cooler and to save power when there is no need for it to 'hold hard' to it's last position, set the outputs to LOW.
 

lemaxnut

Member
Thanks muchas Boriz and Jim Perry for your contributions towards my education in code writing. I will study both codes and play with the suggested variables and revert with my progress.
It might please you, and all seniors here, to know that I do pass on everything I learn from you guys to other novices, so the wheel goes around.
 

lemaxnut

Member
This code has acceleration and deceleration with a fixed number of steps from start to finish. Tweak the values to suit.

Thank you, the code works beautifully, and the acceleration and deceleration is noticeable. I will tweak it to suit.

Jim Perry's code also works, though I had to change the pin designations and make small corrections on the syntax - haven't played with it yet, only tried it.
Need to speed it up quite a bit.

But what I realize now is that I had not clearly stated what I was trying to achieve, and I have used the terms acceleration/deceleration incorrectly.

What I want to do is to operate a Carnival Swing Ride as realistically as possible. Hence, on the first swing, I want the shaft to turn 10 degrees CW and 10 CCW. Then the next swing 15 degrees, etc. increasing in 5 degree (approximate) increments.
Then when it reaches 30 degrees forward and backward, to hold this amplitude for 5 to 10 times, then reverse the process.

Now, I have achieved changing the angle of rotation at the shaft using Boriz's original code, and I know what variable controls this.
But how to I string them together ?
1) I tried making a counter change the controlling word variable but it rejected as incorrect syntax
2) I have tried using sub-routines where each gosub had incremental change in w0, but that too was rejected.

I don't know enough about coding, so I don't know where to proceed from here. Would appreciate advice on the direction I should be taking.

I have done this with DC motors, but I would like to try it with these cheap steppers because then I can adapt other rides, and even design my own. The slow output shaft speed, the high torque, and the cheap price make them perfect as a teaching tool for kids to get into this motor technology as well as PICAXEs.

Thanks ahead !
 

boriz

Senior Member
"Carnival Swing Ride"

How big is the swing? How is the motor connected? Direct? Gear/pulley?

Look at this line in the program: finish=4096

That's the number of steps the motor will go CW then CCW. If you want fewer steps, just reduce this number and experiment.

The rate of acceleration/deceleration is probably not a good analog of a pendulum ATM.

We can probably tune the code for a better pendulum effect, after the motor and swing are in place.

Most of the work will be hands on mechanical!
 

lemaxnut

Member
Thanks for your quick response Boriz.
"pendulum" - that's the word I was looking for.
The swing is about 8 inches long. but the ride itself stands less than 10 " high. I was going to try for a direct hook-up off the shaft as I think the small ebay motors that have been discuss extensively in this post are a nice neat unit with fair torque. I think I can lighten the swing if need be.
I will hook it up this weekend and revert.

I will probably go back to the original code with no momentum now that I know the correct operative word "Pendulum". Cheers.
 

erco

Senior Member
I opened one up a 5V stepper to check out the odd gear ratio. Probably a one-way trip, but it was worth $2.50 to satisfy my curiosity.

The metal case is staked in 4 places. Some gentle tapping with a hammer and small chisel is in order to open her up, then the flat mounting plate comes off with the output gear. All small nylon gears, with enough total backlash to be annoying. $2.50 doesn't buy perfection.

The motor & 9T pinion have 16 steps per revolution. 3 compound gears: 32x11, 22x9, 26x10 and the oddball output gear has 31 (yes, 31) teeth. So the overall gear ratio is 31/10 x 26/9 x 22/11 x 32/9 = 63.68395062 or 25792/405.

That times 16 steps per motor revolution yields a maddening 1018.94321 steps per output shaft revolution. Call it 1019. I had seen previous guestimates of 1024, about half a percent off. Pics attached.
 

Attachments

Goeytex

Senior Member
The 16 steps per motor shaft revolution does not seem to match the specified step angle of 5.25 degrees...

(360 / 5.625 = 64)
 

ZOR

Senior Member
Poor motor, so cheap, didn't ask to get it's head knocked off!! Hope you give it a good burial. I am very happy with his brothers.
 

lamxe

Senior Member
re stepp motor

Dear all
I would like to use this step. motor for driving wire guide axle on my small coil winding machine. in waiting my order(Ebay) arrive.Please help me to know the time delay(pause) at my code(if working) for motor revolve 1 turn per minute = 1RPM Thank you in advance for your time.
Code:
;5V 4 phase 5 line 28BYJ-48 5VDC Stepper Motor 25CM 28BYJ48  high torque run 1RPM
#picaxe 08m 
     do
     high 0 high 1 low  2 low 4
     pause ? ;delay
     low  0 high 1 high 2 low 4
     pause ?  ;delay
     low  0 low  1 high 2 high 4
     pause ? ;delay
     high 0 low  1 low  2 high 4
     loop
 

oracacle

Senior Member
well from the info in thread i would just do the maths.

60 / 1019 = 0.056 seconds.

so a pause 55 or 56 should do the job, how accurate does it need to be, how smooth and will you be testing and timing to get best results
 

lamxe

Senior Member
well from the info in thread i would just do the maths.

60 / 1019 = 0.056 seconds.

so a pause 55 or 56 should do the job, how accurate does it need to be, how smooth and will you be testing and timing to get best results
Dear orcacle
Thank you so much for your helpful. With my bad in the math ',could you help me more to know where is 1019 ?for calculating And if for motor run 6 turns per minute how to change 1019.please
 

oracacle

Senior Member
I opened one up a 5V stepper to check out the odd gear ratio. Probably a one-way trip, but it was worth $2.50 to satisfy my curiosity.

The metal case is staked in 4 places. Some gentle tapping with a hammer and small chisel is in order to open her up, then the flat mounting plate comes off with the output gear. All small nylon gears, with enough total backlash to be annoying. $2.50 doesn't buy perfection.

The motor & 9T pinion have 16 steps per revolution. 3 compound gears: 32x11, 22x9, 26x10 and the oddball output gear has 31 (yes, 31) teeth. So the overall gear ratio is 31/10 x 26/9 x 22/11 x 32/9 = 63.68395062 or 25792/405.

That times 16 steps per motor revolution yields a maddening 1018.94321 steps per output shaft revolution. Call it 1019. I had seen previous guestimates of 1024, about half a percent off. Pics attached.
Dear orcacle
Thank you so much for your helpful. With my bad in the math ',could you help me more to know where is 1019 ?for calculating And if for motor run 6 turns per minute how to change 1019.please
the info in eros' post, however i presumed you were using the same motor, seems you may having something different if you are only getting 6 steps per rotation
 

lamxe

Senior Member
the info in eros' post, however i presumed you were using the same motor, seems you may having something different if you are only getting 6 steps per rotation
Dear oracacle
whow,I am very sorry for not careful read all. Now I understand your point once again thank you so much for your time help me.
 
Top