Micropython stepper motor driver on ULN2003
Go to file
yanivcohen1 87e71db29c
Update Stepper.py
# spec: http://www.geeetech.com/wiki/index.php/Stepper_Motor_5V_4-Phase_5-Wire_%26_ULN2003_Driver_Board_for_Arduino#Interfacing_circuits
 # from spec- Speed Variation Ratio :1/64, the ratio between input wheel to output wheel is 64
 # from the spec (5.625'/64) angle for one HALF_STEP, and for one internal cycle you need 8 HALF_STEPs
 # so for 360' is: (360/(5.625'/64))/8=512(before any step) and multiply it by one cycle(8 HALF_STEPs or 4 FULL_STEPs)

# this is added angle not absolute- call it addAngle()
# the direction can calculate if the angle is negative, no need this input
# and the name is angle, not r for radius
2021-08-05 17:54:38 +03:00
img upload v1.0 2018-12-18 15:50:06 +08:00
README.MD upload v1.0 2018-12-18 15:50:06 +08:00
Stepper.py Update Stepper.py 2021-08-05 17:54:38 +03:00
boot.py upload v1.0 2018-12-18 15:50:06 +08:00
main.py upload v1.0 2018-12-18 15:50:06 +08:00

README.MD

ULN2003 for ESP32

uln2003 for MicroPython has been in github, here's the link. But it's work for microbit, so I change a little to transplant for my NodeMCU's ESP-32s. Here's the example:

import Stepper
from machine import Pin
s1 = Stepper.create(Pin(16,Pin.OUT),Pin(17,Pin.OUT),Pin(5,Pin.OUT),Pin(18,Pin.OUT), delay=2)
s1.step(100)
s1.step(100,-1)
s1.angle(180)
s1.angle(360,-1)

function angle is angle, and the PIN map: IN1 link PIN_16 IN2 link PIN_17 IN3 link PIN_5 IN4 link PIN_18 My uln2003 board like this, and stepper runing:
uln2003 uln2003