Welcome to RoboSense

Thank you for coming this long, you can donate from following options.

Paypal- paypay.me/robosense

UPI Payment Options





April 4, 2021


Robots aiding human

Unipolar Stepper Motor with Raspberry pi

2 min read

Robotics is the next disruptor which is obvious, electronics, data science and hardware knowledge is very important to make a mark in this field. Robots ranging from small printing machines to huge arm movements are very precise which has been possible by introducing a new generation of motors known as STEP Motor or STEPPING Motor and popularly known as STEPPER Motor.

Unipolar Stepper Motor with Motor Driver(ULN2003)

Unipolar drivers, always energize the phases in the same way. One lead, the “common” lead, will always be negative. The other lead will always be positive. Unipolar drivers can be implemented with simple transistor circuitry. The disadvantage is that there is less available torque because only half of the coils can be energized at a time.

Bipolar drivers use H-bridge circuitry to actually reverse the current flow through the phases. By energizing the phases with alternating the polarity, all the coils can be put to work turning the motor.

Data used from STMicroelectronics Datasheet

Circuit Diagram

Image result for uln2003 connection with raspberry pi

The python script for actuating this Stepper Motor is written with the help of GPIO.BOARD. The code is given in the GitHub page of robosense.in and you can get the raw format there.

import RPi.GPIO as GPIO
import time
pins = [7,11,13,15]
for pin in pins:
  GPIO.setup(pin, GPIO.OUT)
  GPIO.output(pin, 0)
halfstep_seq = [
for i in range(512):
  for halfstep in range(8):
    for pin in range(4):
      GPIO.output(pins[pin], halfstep_seq[halfstep][pin])

Hope you got the information you wanted, stay tuned for more videos.

Leave a Reply

Your email address will not be published. Required fields are marked *