Skip to content

ludwigschuster/RasPi-GPIO-Stepmotor

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

17 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

This is a Stepmotor Python class

It is based on this article. The Stepmotors described there can be found [here] (http://www.ebay.de/itm/290974735618?clk_rvr_id=1055052146819&rmvSB=true) or here. Those are unipolar 5 pin motors. This is the datasheet.

##Usage

Put stepmotor.py (located in /bin) into your working directory and import it with from stepmotor import Stepmotor. You can now create an object with motor = Stepmotor() and use this object.

Following methods are available:

  • use turnSteps(n) for turning n steps
  • use turnDegrees(n) for turning n degrees (small values can lead to inaccuracy)
  • use turnDistance(distance, radius) turn for translation of wheels or a coil (inaccuracies involved e.g. due to thickness of rope)

See the example below.

from stepmotor import Stepmotor
from time import sleep

print("moving started")
motor = Stepmotor()
print("One Step")
motor.turnSteps(1)
sleep(0.5)
print("20 Steps")
motor.turnSteps(20)
sleep(0.5)
print("quarter turn")
motor.turnDegrees(90)
print("moving stopped")
motor.close()

It is important, that you close with close() when you are done.

About

A python class to use with Raspberry Pi and Stepmoters

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages