Stepper motor learning (1) - Basics

Learning the stepping motor (1)

Stepper motor control

A stepping motor type:
14HS13-0804S-PG19

2 PLC Model:
DM542T (Raiser)

Figure 3 GPIO (1, 2 against the edge)
Here Insert Picture Description
4 stepper motor drive required to achieve stable pulse, wrote pwm more difficult to estimate, and the current raspberry pie is not big enough.

5 stepper motor driver
1. The signal input
PUL +: positive pulse signal. 5V
PUL-: negative pulse signal. (Green Line -> blue line)
the DIR +: Positive motor, positive inversion control. 5V
DIR-: the motor, the reverse negative control. (Red Line -> white line)
EN +: positive control motor off. I can not answer.
EN-: motor off control negative.

2. The motor connecting section line
A +: A + phase motor winding connection.
A-: A- phase motor winding connection.
B +: B + phase motor winding connection.
B-: B- phase motor winding connection.
Power connector 24V.

6 Wiring and procedures
reference
https://www.jianshu.com/p/61769347f933
hardware
Raspberry Pi * 1

57H76 two-phase four-wire stepper motor 1 *

DM542 Drive 1 *

36V DC switching power supply

3.3V-5V level converter (5V required driver input pulse, raspberry send enough voltage controlled output pin)

Connection
wiring are as follows:

Drive wiring .png
drive uses common anode connection, raspberry sent after converting the amplified 5V pin level access drive PUL +, DIR +, ENA + . PUL- 26 is connected with the control pulse signal ,, DIR + 19 connected to the control and direction of the motor, ENA + and 13 are connected to the motor control is enabled, the motor is disabled when the potential is 1, the influence from pulse (BCM coding Raspberry Pi)

Red, green, yellow and blue, respectively, the stepping motor connected to the drive terminal A + A- B + B-
depending on the motor type, the connection is different. Just find two-phase, respectively, then A + A- B + B- can.
Shorting is determined whether the stepping motor with phases: two arbitrary wiring shorting the motor, the motor is rotated, when there is resistance in phase two line

rpi-pins-40-0.png
code for
Method 1: while loop + time.sleep
stepping motor drive Many articles used to control the potential level of a while loop, whereby the pulse grasp

AS the GPIO RPi.GPIO Import
Import Time
GPIO.setwarnings (False)
GPIO.setmode (GPIO.BCM)
GPIO.setup (. 19, GPIO.OUT)
GPIO.setup (26 is, GPIO.OUT)
GPIO.output (. 19, False)
= 0 n-
the while True:
n-n-+. 1 =
the time.sleep (from 0.0001)
GPIO.output (26 is, False)
the time.sleep (from 0.0001)
GPIO.output (26 is, True)
Print (n-)
IF n-== 10000:
BREAK
method 2: using pwm
more recommended practice is to use the pwm function GPIO
control is more precise

import RPi.GPIO as GPIO
import time

GPIO.setmode(GPIO.BCM)
GPIO.setwarnings(False)
GPIO.setmode(GPIO.BCM)
GPIO.setup(19, GPIO.OUT)
GPIO.setup(26, GPIO.OUT)
GPIO.setup(19, 0)
p = GPIO.PWM(26, 1000)

while True:
p.start(100)
time.sleep(1)
p.ChangeDutyCycle(50)
p.ChangeFrequency(1000)
time.sleep(10)
p.stop()
time.sleep(10)

Author: IT goddess _
link: https: //www.jianshu.com/p/61769347f933
Source: Jane books
are copyrighted by the author. Commercial reprint please contact the author authorized, non-commercial reprint please indicate the source.

Released seven original articles · won praise 1 · views 296

Guess you like

Origin blog.csdn.net/weixin_43103295/article/details/103939961