Stepper Motor and ULN2003: Difference between revisions
Jump to navigation
Jump to search
Created page with "see https://github.com/zhcong/ULN2003-for-ESP32" |
No edit summary |
||
Line 1: | Line 1: | ||
see https://github.com/zhcong/ULN2003-for-ESP32 | 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) | |||
= How to connect it electrically = | |||
== Required Module and Files == | |||
* We use '''[https://www.sketching-with-hardware.org/files/Stepper.py Stepper.py]''' | |||
* 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 | |||
* this is based on: https://github.com/IDWizard/uln2003 by (c) IDWizard 2017,MIT License. | |||
= How to control it in MicroPython = | |||
<syntaxhighlight lang="python" line='line'> | |||
import Stepper | |||
from machine import Pin | |||
In1 = Pin(32,Pin.OUT) | |||
In2 = Pin(33,Pin.OUT) | |||
In3 = Pin(25,Pin.OUT) | |||
In4 = Pin(26,Pin.OUT) | |||
s1 = Stepper.create(In1,In2,In3,In4, delay=10) | |||
s1.step(509,-1) | |||
s1 = Stepper.create(In1,In2,In3,In4, delay=1) | |||
s1.step(509) | |||
</syntaxhighlight> | |||
= Related Tutorial Videos = | |||
<youtube>PEKjvD1uQe4</youtube> |
Revision as of 16:53, 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)
How to connect it electrically
Required Module and Files
- We use Stepper.py
- 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
- this is based on: https://github.com/IDWizard/uln2003 by (c) IDWizard 2017,MIT License.
How to control it in MicroPython
import Stepper
from machine import Pin
In1 = Pin(32,Pin.OUT)
In2 = Pin(33,Pin.OUT)
In3 = Pin(25,Pin.OUT)
In4 = Pin(26,Pin.OUT)
s1 = Stepper.create(In1,In2,In3,In4, delay=10)
s1.step(509,-1)
s1 = Stepper.create(In1,In2,In3,In4, delay=1)
s1.step(509)
Related Tutorial Videos