In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-29 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >
Share
Shulou(Shulou.com)06/01 Report--
Today, I would like to share with you the relevant knowledge points about how to drive the 28BYJ-48 stepper motor by MicroPython. The content is detailed and the logic is clear. I believe most people still know too much about this, so share this article for your reference. I hope you can get something after reading this article. Let's take a look at it.
TPYBoard V102 drives 28BYJ-48 stepper motor
Experimental purpose
Understand the working principle of stepper motor
Learn the driving method of stepper motor
Experimental equipment
TPYBoard v102 1
One miniature stepper motor (28BYJ-48)
Stepper motor drive board (ULN2003APG) 1
1 micro USB cable
Some DuPont lines
Introduction of stepping Motor
This experiment uses 28BYJ-48 four-phase eight-beat motor, voltage DC5V~12V.
The meaning of the 24BYJ48 name:
24: motor outside diameter 24mm
B: the pinyin initials of step characters in stepper motors
Y: the pinyin initials of permanent characters in permanent magnets
J: the first letter of the decelerated Pinyin
48: four phases and eight steps
Physical drawing
working principle
Stepper motor is an open-loop control motor which converts electric pulse signal into angular displacement or linear displacement. it is the main executive component of modern digital program control system and is widely used. In the case of non-overload, the speed and stop position of the motor only depend on the frequency and number of pulses of the pulse signal, but are not affected by the change of the load. When the stepper driver receives a pulse signal, it drives the stepper motor to turn a fixed angle in the set direction, which is called "step angle". Its rotation runs step by step at a fixed angle. The angular displacement can be controlled by controlling the number of pulses to achieve the purpose of accurate positioning; at the same time, the speed and acceleration of motor rotation can be controlled by controlling pulse frequency, so as to achieve the purpose of speed regulation.
28BYJ-48 stepper motor parameter table
The start frequency in the above table is ≥ 550P.P.S (pulses per second), which means that in order to start normally, a single-chip microcomputer is required to give at least 550stepping pulses per second. Then the duration of each beat is 1S/550 ≈ 1.8ms, so the rate of controlling the beat refresh should be about 1.8ms.
Driving principle
When the control pulse is continuously sent to the motor, the motor will continue to rotate. When each pulse signal changes the power-up state of a phase or two-phase winding of the stepper motor, the corresponding rotor will turn over a certain angle (step angle). When the change of the electrified state completes a cycle, the rotor turns over a tooth pitch.
The four-phase stepper motor can operate in different power-up modes, and the common power-up modes are:
Four beats (single-phase winding electrified): A-B-C-D-A …
Double quadruple beat (two-phase winding electrified): AB-BC-CD-DA-AB-...
Eight beats: A-AB-B-BC-C-CD-D-DA-A...
Simulation effect diagram
Hardware connection
Insert the white connector of the stepper motor into the seat corresponding to the drive plate.
The wiring diagram of the TPYBoard v102 drive board and the drive board is as follows:
TPYBoard v102
ULN2003APG driver board
X1
IN1
X2
IN2
X3
IN3
X4
IN4
VIN
5V positive electrode
GND
Negative electrode
The source code of the program is as follows:
# main.py-- put your code hereafter rotation import pybfrom pyb import PinPin_All= [pin (pscene Pin.OUThumPP) for p in] # Speed (ms) the larger the number, the slower the speed is, the minimum value 1.8msspeed=2STEPER_ROUND=512 # the period ANGLE_PER_ROUND=STEPER_ROUND/360 # rotates once (360 degrees), the period print ('ANGLE_PER_ROUND:') ANGLE_PER_ROUND) def SteperWriteData (data): count=0 for i in data: Pin_ all [count] .value (I) count+=1def SteperFrontTurn (): global speed SteperWriteData ([1jue 1jue 0lt 0]) pyb.delay (speed) SteperWriteData ([0lje 1je 1je 0]) pyb.delay (speed) SteperWriteData ([0mme 0je 1jue 1]) pyb.delay (speed) SteperWriteData ([1d0] 0speed 1]) pyb.delay (speed) def SteperBackTurn (): global speed SteperWriteData pyb.delay (speed) SteperWriteData ([1Me 0je 0]) pyb.delay (speed) SteperWriteData ([0Med 1]) pyb.delay (speed) SteperWriteData ([0MJ 1J 0]) pyb.delay (speed) def SteperStop (): SteperWriteData ([0L0] ]) def SteperRun (angle): global ANGLE_PER_ROUND val=ANGLE_PER_ROUND*abs (angle) if (angle > 0): for i in range (0memval): SteperFrontTurn () else: for i in range (0) Val): SteperBackTurn () angle = 0 SteperStop () if _ name__=='__main__': SteperRun (180) SteperRun (- 180) these are all the contents of the article "how to drive a 28BYJ-48 stepper motor by MicroPython" Thank you for reading! I believe you will gain a lot after reading this article. The editor will update different knowledge for you every day. If you want to learn more knowledge, please pay attention to the industry information channel.
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.