ULN2003 Driver Board & Stepper Motor (Blue)

$0.93

Weight 0.061 kg

500 in stock

What is a Stepper Motor?

Stepper motors are brushless DC electric motors that rotate its shaft in discrete steps of equal angular rotation. This is possible due to the fact that the motor has coils in groups and can we to energize them in a specific sequence to get one step (i.e. an incremental rotational step). This very nature of stepper motors allow us to move a specific number of steps without having a position/displacement sensor, while maintaining good accuracy on the position and speed of rotation of the motor.

28BYJ-48 Stepper Motor

The 28BYJ-48 stepper motor is a great stepper motor for a wide range of applications. It’s also a great motor for anyone looking to learn about stepper motors.

Rated Voltage: 5V DC

Gear Ratio: 64:1

Net steps per revolution: 2048 (~0.1758deg/step)
*Motor has 32 steps/revolution, and the gear ratio is 64:1, resulting in a net steps/revolution of 32*64=2048.

Coil Type: Unipolar

ULN2003 Motor Controller

The ULN2003 motor controller is used to interface your stepper motor (in this case the 28BYJ-48) and your microcontroller (in this case an Arduino UNO). The motor controller accepts four digital inputs from the microcontroller (IN1 – IN4) and the 5 cables coming from the 28BYJ-48 stepper motor. There is also the power input, which can be set to 5V or 12V. For the specific motor in this example we would go with 5V. The motor controller also has 4 step indicator LEDs so you can see the state of the coils of the motor as it rotates. When running fast it can be hard to see.

Quick points about this motor & driver

They are wonderfully cheap and extremely accurate due to 1/64 gearing. They move by 0.087890625° per step! However, the gearing is made of plastic and will wear out overtime, especially if moving heavy objects. Lastly the motors can become a little toasty if you work them hard.

Code

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
#!/usr/bin/python3
import RPi.GPIO as GPIO
import time
in1 = 17
in2 = 18
in3 = 27
in4 = 22
# careful lowering this, at some point you run into the mechanical limitation of how quick your motor can move
step_sleep = 0.002
step_count = 4096 # 5.625*(1/64) per step, 4096 steps is 360°
direction = False # True for clockwise, False for counter-clockwise
# defining stepper motor sequence (found in documentation http://www.4tronix.co.uk/arduino/Stepper-Motors.php)
step_sequence = [[1,0,0,1],
                 [1,0,0,0],
                 [1,1,0,0],
                 [0,1,0,0],
                 [0,1,1,0],
                 [0,0,1,0],
                 [0,0,1,1],
                 [0,0,0,1]]
# setting up
GPIO.setmode( GPIO.BCM )
GPIO.setup( in1, GPIO.OUT )
GPIO.setup( in2, GPIO.OUT )
GPIO.setup( in3, GPIO.OUT )
GPIO.setup( in4, GPIO.OUT )
# initializing
GPIO.output( in1, GPIO.LOW )
GPIO.output( in2, GPIO.LOW )
GPIO.output( in3, GPIO.LOW )
GPIO.output( in4, GPIO.LOW )
motor_pins = [in1,in2,in3,in4]
motor_step_counter = 0 ;
def cleanup():
    GPIO.output( in1, GPIO.LOW )
    GPIO.output( in2, GPIO.LOW )
    GPIO.output( in3, GPIO.LOW )
    GPIO.output( in4, GPIO.LOW )
    GPIO.cleanup()
# the meat
try:
    i = 0
    for i in range(step_count):
        for pin in range(0, len(motor_pins)):
            GPIO.output( motor_pins[pin], step_sequence[motor_step_counter][pin] )
        if direction==True:
            motor_step_counter = (motor_step_counter - 1) % 8
        elif direction==False:
            motor_step_counter = (motor_step_counter + 1) % 8
        else: # defensive programming
            print( "uh oh... direction should *always* be either True or False" )
            cleanup()
            exit( 1 )
        time.sleep( step_sleep )
except KeyboardInterrupt:
    cleanup()
    exit( 1 )
cleanup()
exit( 0 )

Stuff you might need for this to run:

1
sudo apt-get update --fix-missing && sudo apt-get install python3-rpi.gpio

Results

This motor takes 5.625*(1/64)° per step, this means 2048 steps for 180°:

and 4096 steps for 360°:

One thing that is super cool about the driver board are the LEDs. Projects are always cooler with blinky LEDs, but these guys also help show what is actually going on inside the stepper, and can help you find issues. They are supposed to light up in sequence.

Reviews

There are no reviews yet.

Be the first to review “ULN2003 Driver Board & Stepper Motor (Blue)”

You may also like…