Bipolar stepper motors tend to have just two motor windings; they are called bipolar because these windings must change polarity in a determined order sequence to move with each step. They require more circuitry to be adequately controlled, but in exchange they offer some advantages compared to unipolar motors.
We should note that the main advantage of bipolar stepper motors, as opposed to unipolar, is that the torque of a bipolar stepper motor can be up to 40% greater than that of a unipolar stepper motor of equal dimensions and consumption. This means that we can achieve greater power with smaller motors and/or motors with lower consumption. We will access its two motor windings via four connection threads as shown in Figure 1.
The excitation of each winding and the direction of current flow are typically controlled by a configuration known as an H-Bridge (Figure 2), and we will need an H-Bridge for each winding. The way it works is very simple: when the Q1 and Q4 transistors are excited, a current is circulated which polarizes the winding in one direction, and when you want to flip the direction of polarization you excite the Q2 and Q3 transistors. The four diodes are used exclusively to protect the transistors from voltage peaks generated by the coils. Currently there exist integrated circuits specializing in controlling bipolar stepper motors, such as the L293B or the L298N, which will really help us simplify things in terms of the circuitry. In addition, there are electronics boards on the market designed to interconnect and control this type of motor, such as the one I have used.
For the motor to move, we must flip the polarity of the terminals of coils 1 and 2 in the sequence given in the table below. It consists of four possible combinations which will allow us to move the motor in one direction; if we want to change the direction, we simply have to send the sequence reverse direction.
In the sample Python code I’ve defined four channels as the output needed to control the motor correctly. The bipolar motor used in these tests is a KP54FP8-755 salvaged from an old laser printer. This motor advances 7.5° per step, so to make a complete turn it needs 48 steps (360/7.5). If you have some other motor on hand, you’ll just have to make some small adjustments with the function “set_degrees” to get a similar result.
See you next time!
#!/usr/bin/env python # -+- coding: utf-8 -+- #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~# # # Name: tests/motorstepper3 # Purpose: Testing MotorStepperBipolar object with InterfaceGPIO # # Created: 07/13/2015 # Modified: 12/17/2015 # #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~# import time from raspybot.devices.motor import MotorStepperBipolar from raspybot.io.interface import InterfaceManager, InterfaceGPIO #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~# def startinfo(motor): print 'Starting Motor => %s' % motor.get_name() def stopinfo(motor): print 'Stopping Motor => %s' % motor.get_name() #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~# manager = InterfaceManager() iface1 = InterfaceGPIO(manager, pinout=(16, 19, 20, 26)) motor1 = MotorStepperBipolar(iface1, 'Motor 1', start=startinfo, stop=stopinfo) try: motor1.set_degrees(7.5) # Default degreess by step for stepper motor KP54FP8-755 motor1.set_speed(5) motor1.forward(48) motor1.join() time.sleep(0.5) motor1.backward(48) motor1.join() motor1.set_speed(30) count = 5 while count: if not motor1.alive(): print 'Running...', count if count % 2: motor1.forward(degrees=180) else: motor1.backward(degrees=180) count -= 1 time.sleep(0.5) motor1.join() except KeyboardInterrupt: print '\nScript stopped...' except Exception, error: print 'Error :', error finally: motor1.stop() manager.delete(iface1) manager.cleanup()