Micropython Tpyboard v102 Drive 28byj-48 Stepper Motor

Source: Internet
Author: User

Experimental purpose

Understand how stepper motors work
Learn how to drive a stepper motor

Laboratory equipment

Tpyboard v102 1 Pieces
Miniature Stepper Motor (28BYJ-48) One
Stepper Motor Drive Plate (ULN2003APG) 1 blocks
Micro USB Data Cable 1 article
DuPont Line several
Introduction of Stepper motor
This experiment uses the 28byj-48 four-phase eight beats the motor, the voltage dc5v~12v.

Meaning of the 24byj48 name:
24: Motor diameter 24mm
B: Stepping motor in the pinyin first letter of the word
Y: the pinyin initials of permanent characters
J: reduced pinyin first letter of deceleration
48: Four-Phase 8-Step

Physical map


Working principle

Stepping motor is an open-loop control motor which transforms electric pulse signal into angular displacement or line displacement, and is the main executing element in modern Digital program control system, which is widely used. In the case of non-overloading, the speed of the motor, the position of the stop only depends on the frequency of the pulse signal and the number of pulses, and is not affected by the load changes, when the stepper driver receives a pulse signal, it will drive the stepper motor in the direction set to rotate a fixed angle, called "Step Angle", Its rotation is run at a fixed angle step-by-step. The angular displacement can be controlled by controlling the number of pulses to achieve accurate positioning, and the speed and acceleration of motor rotation can be controlled by controlling the pulse frequency to achieve the purpose of speed regulation.

28BYJ-48 Stepper Motor Parameter table


The starting frequency of the above table ≥550 P.p.s (pulses per second), meaning that in order to start normally, you need a microcontroller to give at least 550 step pulses per second. The time required for each beat to last is 1s/550≈1.8ms, so the rate at which the tempo is controlled should be approximately 1.8ms.
Driving principle
When the continuous transmission of control pulses to the motor, the motor will continue to rotate. Each pulse signal corresponding to the stepper motor of a phase or two-phase winding power state change once, corresponding to the rotor will be turned over a certain angle (step angle). When the power state changes to complete a cycle, the rotor turns over a pitch.
Four-phase stepper motors can operate in different power modes, common power-on mode:
Four-shot (single-phase winding power): A-b-c-d-a ...
Double four-shot (dual-phase winding power): Ab-bc-cd-da-ab-...
Eight beats: a-ab-b-bc-c-cd-d-da-a ...

Simulation


Hardware connection

Insert the stepper motor white connector into the driver board corresponding to the Chair.
Tpyboard the wiring diagram of the v102 Drive Board and the drive Board, as follows:

The program source code is as follows:

#main.py--Put your code here!ImportPyb fromPybImportPin Pin_all=[pin (P,PIN.OUT_PP) forPinch['X1','X2','X3','X4']] #speed (ms) the higher the speed, the slower the minimum value of 1.8msspeed=2Steper_round=512#the cycle of turning one lap (360 degrees)angle_per_round=steper_round/360#1-degree rotation cyclePrint('Angle_per_round:', Angle_per_round)defsteperwritedata (data): Count=0 forIinchData:pin_all[count].value (i) Count+=1defSteperfrontturn ():GlobalSpeed Steperwritedata ([The, 0,0]) Pyb.delay (Speed) Steperwritedata ([0,The, 0]) Pyb.delay (Speed) steperwritedata ([0,0,The]) Pyb.delay (speed) steperwritedata ([1,0,0,1]) Pyb.delay (speed)defSteperbackturn ():GlobalSpeed Steperwritedata ([The, 0,0]) Pyb.delay (Speed) steperwritedata ([1,0,0,1]) Pyb.delay (speed) steperwritedata ([0,0,The]) Pyb.delay (speed) Steperwritedata ([0,The, 0]) Pyb.delay (Speed)defsteperstop (): Steperwritedata ([0,0,0,0])defSteperrun (angle):GlobalAngle_per_round Val=angle_per_round*ABS (angle)if(angle>0): forIinchRange (0,val): Steperfrontturn ()Else:         forIinchRange (0,val): Steperbackturn () angle=0 steperstop ()if __name__=='__main__': Steperrun (180) Steperrun (-180)

Micropython Tpyboard v102 Drive 28byj-48 Stepper Motor

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.