Stepper Motor and ULN2003: Difference between revisions

From Sketching with Hardware at LMU Wiki
Jump to navigation Jump to search
Line 23: Line 23:
= How to connect it electrically =
= How to connect it electrically =


[[File:Stepper-c.JPG|x320px]]
[[File:Stepper-c.JPG|x250px]]
[[File:Elko-stepper.JPG|x320px]]
[[File:Elko-stepper.JPG|x250px]]
 
We recommend to add the capacitor to keep the power supply more stable. This issue is similar to the power issue with the servo [[SG90 Servo]].


[[File:Stepper-cables01.JPG|x200px]]  
[[File:Stepper-cables01.JPG|x200px]]  

Revision as of 00:23, 30 December 2020

IMPORTANT

In many computers the current is not enough to drive the servo!!!

If it does not work, keeps disconnecting, or rebooting the ESP the power is not sufficent and you need an extra power supply.

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:

ULN2003 driver module.

How to connect it electrically

We recommend to add the capacitor to keep the power supply more stable. This issue is similar to the power issue with the servo SG90 Servo.

Required Module and Files

How to control it in MicroPython

import Stepper
from machine import Pin

# for the ESP8266 
# In1 = Pin(2,Pin.OUT) # IN1-> GPIO2 
# In2 = Pin(0,Pin.OUT) # IN1-> GPIO0 
# In3 = Pin(4,Pin.OUT) # IN1-> GPIO4 
# In4 = Pin(5,Pin.OUT) # IN1-> GPIO5 

# for ESP32
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