Difference between revisions of "Stepper Motor and ULN2003"

From Sketching with Hardware at LMU Wiki
Jump to navigation Jump to search
Line 19: Line 19:
 
= How to connect it electrically =
 
= How to connect it electrically =
  
[[File:Stepper-cables01.JPG|x200px]]
+
[[File:Stepper-cables01.JPG|x200px]]  
 
 
 
[[File:Stepper-cable02.JPG|x200px]]
 
[[File:Stepper-cable02.JPG|x200px]]
  
== Required Module and Files ==
+
= Required Module and Files =
 
* We use '''[https://www.sketching-with-hardware.org/files/Stepper.py Stepper.py]'''
 
* We use '''[https://www.sketching-with-hardware.org/files/Stepper.py Stepper.py]'''
 
* this is downloaded from https://github.com/zhcong/ULN2003-for-ESP32
 
* this is downloaded from https://github.com/zhcong/ULN2003-for-ESP32
 
* the original file is at https://github.com/zhcong/ULN2003-for-ESP32/blob/master/Stepper.py
 
* the original file is at https://github.com/zhcong/ULN2003-for-ESP32/blob/master/Stepper.py
 
* this is based on: https://github.com/IDWizard/uln2003 by (c) IDWizard 2017,MIT License.
 
* this is based on: https://github.com/IDWizard/uln2003 by (c) IDWizard 2017,MIT License.
 
 
  
 
= How to control it in MicroPython =
 
= How to control it in MicroPython =

Revision as of 16:01, 30 August 2020

see https://github.com/zhcong/ULN2003-for-ESP32


Description

A stepper motor is a motor where the turning can be controlled in steps.

Our motor has about 508 steps for 360° (the motor itself has 64 steps but there is a gear train on top)

more details:

Stepper03.JPG

ULN2003 driver module.

Stepper02.JPG

How to connect it electrically

Stepper-cables01.JPG Stepper-cable02.JPG

Required Module and Files

How to control it in MicroPython

 1 import Stepper
 2 from machine import Pin
 3 
 4 In1 = Pin(32,Pin.OUT)
 5 In2 = Pin(33,Pin.OUT)
 6 In3 = Pin(25,Pin.OUT)
 7 In4 = Pin(26,Pin.OUT)
 8 
 9 s1 = Stepper.create(In1,In2,In3,In4, delay=10)
10 
11 s1.step(509,-1)
12 
13 s1 = Stepper.create(In1,In2,In3,In4, delay=1)
14 
15 s1.step(509)



Related Tutorial Videos