当前位置:网站首页>Design of stepping motor controller based on single chip microcomputer (forward rotation and reverse rotation indicator gear)
Design of stepping motor controller based on single chip microcomputer (forward rotation and reverse rotation indicator gear)
2022-07-05 10:08:00 【Chloroplasts don't forget to breathe】
WeChat official account : Chuangxiang diary
send out : Single chip microcomputer stepping motor
Get full report +AD Schematic source file +Proteus Simulation source file + SCM source program + Related information 
One 、 Design description
1. Design purpose
Through the specific small-scale test system design , Practice the whole process of single chip microcomputer system design and debugging , To deepen the understanding of the internal structure of MCU 、 Understanding of functions and instruction systems , And further learn the application of SCM development system and the interface and programming methods of some peripheral chips , Master the hardware of single chip microcomputer system preliminarily 、 Software design technology and debugging skills .
2. The design requirements
This time I choose to finish the project 1—— Design of stepping motor controller based on MCU .
The design requirements are as follows :
1) The motor speed can be controlled smoothly ;
2) Set the speed of the motor through the button on the test box or the dial switch , to turn to ;
3) Display the speed trend of the motor ;
4) Complete basic functions : start-up / stop it , Speed up , Slow down , Positive rotation , reverse ;
5) Use the controls on the experimental box to improve the control effect and control function ( Selected as ).
3. Instruments and equipment
This experiment is conducted online , Did not go to the laboratory for hardware physical verification , Use only Proteus Software simulation .
Two 、 Hardware circuit diagram and main chip description
The single chip microcomputer selected for this system is STC89C51. The stepping motor model is 28BYJ48, The motor has four phase windings , The working voltage is +5V, It can share a power supply with the MCU . For four phase winding of stepping motor P1 Oral P1.0~P1.3 control , because P1 Insufficient mouth drive , So use one piece ULN2803 Increase driving power . Use P0 The port is connected with a light emitting diode , Used to display the current status ,P3 Port control motor forward and reverse . According to the system requirements, draw based on STC89C51 The control block diagram of stepping motor controlled by single chip microcomputer 2.1 Shown .
The system mainly includes single chip microcomputer 、 Reset circuit 、 Crystal oscillator circuit 、 Key circuit 、 Digital display circuit 、 Stepping motor and driving circuit .
1. Minimum system circuit of single chip microcomputer
The minimum system of single chip microcomputer is the most basic and main part of the application of single chip microcomputer expansion development , It is generally composed of the following circuits , It is the core of the whole design, which ensures the expansion and Realization of other functions based on MCU . Pictured 2.2 Shown .
Reset circuit : Reset circuit is the most basic and important circuit in the application of single chip microcomputer , It is used to deal with urgent problems such as single chip microcomputer failure . When the reset port of MCU is at high level , The code in the MCU will not be executed . At the beginning of power on , The capacitor is not fully charged , Reset the port to high level , It avoids program errors caused by running the program directly after power on . When the capacitor is fully charged , The reset port becomes low , The program starts running .
Crystal oscillator circuit : Crystal oscillator circuit is also a necessary circuit in the design of MCU , Provide working sequence for the system . Crystal oscillator circuit provides 11.0592MHZ clock frequency , So as to form the whole stable oscillation circuit , Provide guarantee for the normal operation of single chip microcomputer .
2. Digital display circuit
The nixie tube shows the electrical route 1 position 7 paragraph LED The nixie tube displays the current speed and gear ( common 9 A gear ), See the picture for details 2.3 Shown .
3. Key circuit
The key circuit needs to realize the key to control the forward rotation of the stepping motor 、 reverse 、 Speed up 、 Slow down 、 stop it , All in all 5 A button , See the picture for details 2.4 Shown .
4. Motor and drive circuit
Electric motor and drive circuit ULN2003 Driver chip 、DC-5V Stepper motor 、 Revolution indicator light, etc , See the picture for details 2.5 Shown .
5. The overall circuit of the system 
3、 ... and 、 How the system works
1. Minimum control system
Pictured 3.1, This design uses STC89C51 Single chip microcomputer , This type of single chip microcomputer is STC A low power consumption produced by the company 、 High performance CMOS8 Bit microcontroller , have 4K In system programmable Flash Memory .. On a single chip , Have dexterous 8 position CPU And in system programmability Flash, It can completely meet the needs of this design . Yes STC89C51 Single chip microcomputer , The minimum control system should generally include : Reset circuit 、 Clock circuit .
Reset circuit : The reset circuit adopts manual reset , The so-called manual reset , It refers to turning on the button switch , Make the single chip microcomputer enter the reset state .
Clock circuit : use 22pF Capacitance and 12MHz The crystal oscillator provides the clock frequency for the whole circuit . The clock signal of single chip microcomputer is usually obtained by two circuit forms : Internal oscillation mode and external interruption mode . At pin XTAL1 and XTAL2 External crystal oscillator circuit ( Crystal oscillator for short ) Or ceramic crystal oscillator , It forms the internal crystal mode . Because there is a high gain inverting amplifier inside the MCU , After the external crystal oscillator , It forms a self-excited oscillator and generates an oscillating clock pulse . The capacitance of the external circuit with internal oscillation mode is generally 5~30 pF, The typical value of crystal oscillator frequency is 12MHz, use 6MHz There are more cases .
2. Drive circuit
ULN2803 High voltage and High Current Darlington transistor array , In this array 8 Ludlington transistor is a low logic level digital circuit (TTL、COMS、PMOS or NMOS) With high voltage and high current equipment ( Such as relay 、 Machine hammer 、 Light bulb: ) Ideal device for interface .ULN2803 The internal structure and external pins of the driver are shown in the figure 3.2 Shown .1-8 The foot is the input ,9 Foot joint GND,10 Pin connected load power supply +,11-18 Pin connected output . The left side of the figure below is the input ( Assuming that 1 foot ), The upper right corner is the output ( Corresponding 18 foot ),pin10 by 10 Pin connected load power supply +. When 1 Foot joint +5V When the triode is saturated , here 18 Foot output , The second triode from left to right turns on , Connect the load power GND, At this time, the load is powered on .
Darlington tube is also called composite tube . It is a common base combined amplifier , To form an equivalent new triode . This is equivalent to the amplification factor of the triode is the product of the two . In electronic circuit design , Darlington connection is often used in power amplifiers and regulated power supplies .
Darlington tube is a compound triode , He connected two triodes in series , The emitter of the first tube is connected to 2 The base of a tube , Therefore, the magnification of Darlington tube is the product of the magnification of two triodes . So it is characterized by very high magnification , The function of Darlington tube is generally to amplify very small signals in highly sensitive amplification circuits , Such as high-power switching circuit .
3. Stepper motor
Because the stepping angle of the stepping motor in this design is 18°, Stepping motor assembly Step Angle The default value of the property is 18, In the mode of four phases and eight beats , The step angle of each shot is 9°, Every output 8 Excitation sequence array of bytes FFW when , The motor steps in total 72°, so , Drive the motor for one revolution (360°) A common need 5 Row excitation sequence array FFW, Make the motor rotate n Circle needs to output 5n Row excitation sequence array FFW. The reverse rotation control principle of stepping motor is the same as that at this time .
Based on the above analysis , Can be designed separately STEP_MOTOR_FFW And STEP_MOTOR_REV function , They are respectively used to control the forward and reverse rotation of the stepping motor n circle , Its internal circulation is 8 Time , The external circulation is 5n Time .
choose ULN2803 As a driver chip , Through MCU P1.0P1.3 Output pulse to chip 1B4B mouth , After amplification, from 1C~4C The ports are respectively output to the A、B、C、D phase , Pictured 3.3 Shown .
Four 、 Programming
According to the design requirements , The following specific functions need to be realized through software programming :
1) Drive each module to work , Realize the clear display of digital tube , Realize motor drive ;
2) Realize the forward rotation of the stepping motor controlled by the key 、 reverse 、 Speed up 、 Slow down 、 stop it ;
3)2 LEDs show positive and negative ,1 position 7 paragraph LED The nixie tube displays the current speed and gear ;
4)4 A red LED, Indicates the speed of the motor .
( The following is omitted , See the original report for details )
边栏推荐
- 90%的人都不懂的泛型,泛型的缺陷和应用场景
- Are databases more popular as they get older?
- The most comprehensive promotion strategy: online and offline promotion methods of E-commerce mall
- [NTIRE 2022]Residual Local Feature Network for Efficient Super-Resolution
- From "chemist" to developer, from Oracle to tdengine, two important choices in my life
- mysql80服务不启动
- 写入速度提升数十倍,TDengine 在拓斯达智能工厂解决方案上的应用
- MySQL数字类型学习笔记
- Hard core, have you ever seen robots play "escape from the secret room"? (code attached)
- Baidu app's continuous integration practice based on pipeline as code
猜你喜欢

Tdengine already supports the industrial Intel edge insight package

On July 2, I invite you to TD Hero online press conference

TDengine可通过数据同步工具 DataX读写

Wechat applet - simple diet recommendation (4)

Implementation of smart home project

Uncover the practice of Baidu intelligent testing in the field of automatic test execution

卷起來,突破35歲焦慮,動畫演示CPU記錄函數調用過程

Three-level distribution is becoming more and more popular. How should businesses choose the appropriate three-level distribution system?

Node red series (29): use slider and chart nodes to realize double broken line time series diagram
![[200 opencv routines] 219 Add digital watermark (blind watermark)](/img/ac/f6d16e74538bd589a1f6faee08d59a.png)
[200 opencv routines] 219 Add digital watermark (blind watermark)
随机推荐
La voie de l'évolution du système intelligent d'inspection et d'ordonnancement des petites procédures de Baidu
【小技巧】获取matlab中cdfplot函数的x轴,y轴的数值
TDengine 离线升级流程
卷起來,突破35歲焦慮,動畫演示CPU記錄函數調用過程
How to use sqlcipher tool to decrypt encrypted database under Windows system
Tdengine offline upgrade process
Coordinate system of view
盗版DALL·E成梗图之王?日产5万张图像,挤爆抱抱脸服务器,OpenAI勒令改名
苹果 5G 芯片研发失败?想要摆脱高通为时过早
Implementation of smart home project
TDengine可通过数据同步工具 DataX读写
Oracle combines multiple rows of data into one row of data
一文读懂TDengine的窗口查询功能
What are the advantages of the live teaching system to improve learning quickly?
How to choose the right chain management software?
Meitu lost 300 million yuan in currency speculation for half a year. Huawei was exposed to expand its enrollment in Russia. Alphago's peers have made another breakthrough in chess. Today, more big new
如何正确的评测视频画质
如何獲取GC(垃圾回收器)的STW(暫停)時間?
How to implement complex SQL such as distributed database sub query and join?
Tdengine already supports the industrial Intel edge insight package