Stepper motor unipolar RPM

alex126

Member
Hello. I have a unipolar stepper motor 28BYJ48 with the ULN2003 Driver. I know there was a lot of questions about it on the forum, but my question is about the speed. I used some codes and the one is better is here. It's by AllyCat. (Thank you). The speed is 2-3RPM. Changing the PAUSE (symbol gapwid = 8) gives a little difference but it stops on 4. M08 doesn't go more than SETFREQ m16. So, how the speed can be changed or is there any better code to go faster.
Thank you

Code:
#picaxe 08m2
symbol A1 = c.0     ; Select as required
symbol A2 = c.2     ; *swapped
symbol cB1 = c.1   ; *swapped
symbol cB2 = c.4
symbol direction = pinc.3
symbol gapwid = 8          ; Adjust for speed
symbol gapwid1 = gapwid - 1
setfreq  m16                    ; Or as required
forwards:
  pause gapwid1  :  Low A2 : High A1      ; Enable coil A+
  pause gapwid  :   Low cB2 : High cB1     ; Enable coil B+
  pause gapwid  :  Low A1 : High A2     ; Enable coil A-
  pause gapwid  :  Low cB1 : High cB2     ; Enable coil B-
  if direction = 0 then forwards             ; Or fall into backwards
backwards:
  pause gapwid1 :  Low A2 : High A1     ; Enable coil A+
  pause gapwid   :  Low cB1 : High cB2     ; Enable coil B-
  pause gapwid  :  Low A1 : High A2     ; Enable coil A-
  pause gapwid   :   Low cB2 : High cB1     ; Enable coil B+
  if direction = 1 then backwards
  goto forwards
 
Last edited by a moderator:

westaust55

Moderator
Your statement" M08 doesn't go more than SETFREQ m16" is unclear.

Do you have a PICAXE 08M part, if so then SETFREQ M8 is the fastest you can use.
IF your part is 08M2 then you can set a frequency up to 32 MHz (M32) but this may not be of help in this case.


It may be that the unipolar stepper motor cannot operate at the faster frequencies you are trying to achieve.

From a 28BYJ-48 datasheet:
The frequency is indicated as 100 Hz.

For operation with Setfreq M16, and gapwid = 4
for each step you in effect have:
step time = (4 + 0.25 + 0.25) / 4 ==> 1.125 ms
this equate to a frequency of 1/0.00225 = 888 Hz
A complete cycle of the 4 steps is in effect 222 Hz.

Further possibility is that the voltage applied to the stepper motor windings is low to generate the torque to move the rotor/shaft.
Are you testing under load or no-load?
The stepper motor datasheet indicates the motor is rated for 5 V d.c.
The ULN2003 will at around 0.1 Amps have an internal volt drop of the order of 1 volt hence the stepper motor may only have about 4 Volts across the windings. The initial peak current may be even higher and the UNL2003 voltdrop could also briefly be higher such as around 1.3 Volts.
 

AllyCat

Senior Member
Hi,
Hello. I have a unipolar stepper motor 28BYJ48 with the ULN2003 Driver....... The speed is 2-3RPM. ...is there any better code to go faster.
Probably not, that motor is very heavily geared; it is mainly intended to move through less than a full revolution to (for example) open and close "flaps" on an Air Conditioning system. The specification says: Step angle: 5.625 x 1 / 64. Reduction ratio: 1 / 64 which means that each step is 1 / 64 of a revolution, which is then geared down by a further 64. So the motor needs 64 x 64 = 4096 steps to make one revolution.

Thus, a speed of 3 Revs/Minute corresponds to about 200 steps per second, or pulses of about 5ms, which is towards the maximum speed (or minimum pulse width) expected for a motor of that type. At SETFREQ M16, a PAUSE gapwid of 8 gives a pulse of about 2ms and the High/Lows will add about another 0.2 ms, giving a total of about 2.2 ms (which I calculate should correspond to about 6.5 rpm). Therefore the motor may already be "dropping" some steps if you are getting only 3 rpm.

To be honest, 3 rpm might be about as much as can realistically be obtained, but there are a few things you can try. Firstly, confirm my calculations at slower speeds, for example 14 ms pulses (gapwid= 56) should give 1 rpm. If this is correct, then try reducing the step width until the motor starts dropping pulses (i.e goes slower than expected). Then there are a few things you can try to improve the speed: The first is to increase the voltage to the Driver Board (NOT the PICaxe). An ebay listing suggests that it is a "5 volt" stepper, but the motor may "tolerate" rather more and anyway the "Darlington" Transistors in the ULN2003 can "lose" almost a volt each, so a supply rail of 7+ volts might be more appropriate.

The currents in the two coils already "Overlap" by almost 100% so there is not much more than can be done to increase the torque. You could try adding a short : PAUSE gapwid2 : between the LOW and HIGH commands in each line (with gapwid2 and gapwid each of about half of the present value). It's unlikely to make the motor turn any faster, but may reduce the power drain, which might be a "good thing", particularly if you (can) raise the supply voltage. Or there are "better" stepper drivers than the ULN2003.

Cheers, Alan
 

alex126

Member
Hi. We've got some speed :) So. here some results. The load was separated, for the picaxe 08M2 with his 5v, and the motor with the 7v. There is a drop of 3v!
SETFREQ M16, PAUSE 8 - 5rpm
SETFREQ M16, PAUSE 56 (last minimum number) - 2rpm. Downloaded twice to pic.

SETFREQ M8, PAUSE 8 - 3,1rpm
SETFREQ M8, PAUSE 6 - 5,4rpm
SETFREQ M8, PAUSE 4 (last minimum number)- 6rpm

The last one is definitely better. Thank you
 
Top