0 Introduction
The PTZ controller designed with a single-chip microcomputer as the core can control the camera to move over a large range and at a wide angle in monitoring situations, so that the LCD screen camera can achieve nearly 360° panoramic recording, and it has unique advantages in terms of economy, flexibility, scalability and maintainability.
1 System overall structure
The system consists of the following parts: ① Single-chip microcomputer: the core of the design, which recognizes the information input by the keyboard with the cooperation of the software, and sends instructions to the stepper motor in the pan-tilt according to the input information, so that it can realize functions such as forward/reverse, speed control, program control, etc., and the speed of the stepper motor is displayed through a digital tube; ② Stepper motor and drive: responsible for the rotation of the pan-tilt system in the vertical and horizontal directions, and is the executive component of the system; ③ Keyboard: an input device for external information, and an important component for the control personnel to command the work of the pan-tilt system; ④ Display device: displays the real-time speed of the stepper motor so that the LCD screen controller can determine the control strategy for the pan-tilt according to the speed.
2 System Hardware Design
The hardware circuit is divided into three parts according to the system function: stepper motor and its drive module, single chip microcomputer and its peripheral circuit, keyboard and display circuit. The system hardware function block diagram is shown in Figure 1.
2.1 Stepper motor control and drive module selection
After receiving the pulse signal, the driver drives the stepper motor to rotate a fixed angle in the set direction. 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 the motor rotation can be controlled by controlling the pulse frequency to achieve the purpose of speed regulation. The selected stepper motors are two hybrid stepper motors 57BYG250C, which have two-phase/four-phase operation capabilities. The step angle is 1.8° when working in four beats and 0.9° when working in eight beats. The stepper motor drive module model is HB202A, which has functions such as 4/8 beat conversion control signal, offline (FREE) control signal, and input signal photoelectric isolation. An offline control key is added to the design. When a fault occurs or debugging occurs, the two motors are placed in an offline state, and the stepper motor can be manually adjusted. The offline control key is directly connected to the microcontroller INT0, and INT0 is set as the highest priority so that offline control can be quickly achieved in the event of a fault. Since it is directly connected to the microcontroller without passing through 8279, a keyboard de-bouncing circuit must be set up to avoid malfunction of the microcontroller.
2.2 Keyboard and display circuit design
The LCD screen keyboard and display circuit are implemented by INTEL8279. The keyboard adopts N-key loop mode, and the display is 8-bit left input. 8279 is connected to a 2*8 keyboard and an 8-bit display, and adopts a coded scanning mode. The IRQ of 8279 is connected to the INT1 of the microcontroller, and an interrupt will be requested as long as a key is pressed. When the microcontroller is connected to a 12M crystal oscillator, ALE is 2M, and it is connected to CLK, so its frequency division command word is 34H. There are 16 keys expanded by 8279, 8 of which are responsible for the forward and reverse rotation of the stepper motor in both directions, and 8 are function keys, which are responsible for the acceleration and deceleration of the stepper motor, program control, and the limit switch of the stepper motor.
3 System Software Design
The system software mainly consists of initialization program, keyboard program, speed control program, speed detection and display program. Except for the initialization program, the rest of the programs adopt interrupt working mode to improve the CPU utilization.
3.1 System initialization program design
First, initialize each interrupt source of the MCU, and use five interrupt sources: INT0, INT1, T0, T1, T2. INT0, T0, T1 are high priority, and INT1, T2 are low priority. When INT0 requests an interrupt, the program immediately causes the stepper motor to enter the offline control program. The stepper motor is no longer controlled by the MCU, and it is level-triggered. The MCU always executes the offline program until the external trigger signal is manually canceled by the operator, and the system resumes normal operation. Then set the working mode of T0, T1, and T2, write the count disposal, turn on the enable bits of these interrupt sources, and turn on the CPU interrupt.
3.2 Design of keyboard program
When a keyboard key is pressed, an interrupt request is generated. After the MCU responds to the interrupt, the interrupt program starts to execute. The generated key value is read from the 8279, and the corresponding program is executed according to the key value. After the CPU receives the information, it does not act immediately. In order to ensure the stability of the stepper motor speed control, the command corresponding to the key value is first saved. After T0/T1 reaches the set count value, when a pulse needs to be output at a certain speed, the information is sent to the stepper motor. [page]
3.3 Stepper Motor Speed Control Software Design
Changing the frequency of the CP signal of the driver module can change the speed of the stepper motor. Changing the frequency of the CP signal can be achieved through the timer/counter. First, the timer/counter is loaded with the initial setting, and then it starts running. After the specified time is reached, the interrupt program is executed. At this time, the program that generates the CP signal can be placed in this interrupt program, and the purpose of changing the speed of the stepper motor is achieved. T0 and T1 inside S52 correspond to the speed control of the two stepper motors respectively, and its working process is shown in Figure 2.
3.4 Speed detection and display software design
The timing counting method is used to count the step pulses sent by the microcontroller to the stepper motor within a certain period of time. Assume that the microcontroller detects the number of pulses N sent to the stepper motor every 50ms, and the relationship between N and the speed is as follows:
The rotation speed per minute can be obtained by multiplying the detected pulse number N by 3. The 50ms timing is realized by the third timer/counter T2 inside S52.
4 Conclusion
The pan/tilt controller composed of a single chip not only has the characteristics of high control accuracy, flexible control method, simple programming, low power consumption, and high reliability, but some new single-chip microcomputers also have online programming functions. The program can be updated without removing the LCD microcontroller from the working environment, which facilitates software maintenance. According to needs, the LCD drive motors in both directions can be automatically coordinated and controlled by pre-compiled programs.
Previous article:Design of automatic alarm system for home anti-theft
Next article:Infrared remote control mouse
Recommended ReadingLatest update time:2024-11-16 20:55
- Popular Resources
- Popular amplifiers
- Wireless Sensor Network Technology and Applications (Edited by Mou Si, Yin Hong, and Su Xing)
- Modern Electronic Technology Training Course (Edited by Yao Youfeng)
- Modern arc welding power supply and its control
- Small AC Servo Motor Control Circuit Design (by Masaru Ishijima; translated by Xue Liang and Zhu Jianjun, by Masaru Ishijima, Xue Liang, and Zhu Jianjun)
Professor at Beihang University, dedicated to promoting microcontrollers and embedded systems for over 20 years.
- Innolux's intelligent steer-by-wire solution makes cars smarter and safer
- 8051 MCU - Parity Check
- How to efficiently balance the sensitivity of tactile sensing interfaces
- What should I do if the servo motor shakes? What causes the servo motor to shake quickly?
- 【Brushless Motor】Analysis of three-phase BLDC motor and sharing of two popular development boards
- Midea Industrial Technology's subsidiaries Clou Electronics and Hekang New Energy jointly appeared at the Munich Battery Energy Storage Exhibition and Solar Energy Exhibition
- Guoxin Sichen | Application of ferroelectric memory PB85RS2MC in power battery management, with a capacity of 2M
- Analysis of common faults of frequency converter
- In a head-on competition with Qualcomm, what kind of cockpit products has Intel come up with?
- Dalian Rongke's all-vanadium liquid flow battery energy storage equipment industrialization project has entered the sprint stage before production
- Allegro MicroSystems Introduces Advanced Magnetic and Inductive Position Sensing Solutions at Electronica 2024
- Car key in the left hand, liveness detection radar in the right hand, UWB is imperative for cars!
- After a decade of rapid development, domestic CIS has entered the market
- Aegis Dagger Battery + Thor EM-i Super Hybrid, Geely New Energy has thrown out two "king bombs"
- A brief discussion on functional safety - fault, error, and failure
- In the smart car 2.0 cycle, these core industry chains are facing major opportunities!
- The United States and Japan are developing new batteries. CATL faces challenges? How should China's new energy battery industry respond?
- Murata launches high-precision 6-axis inertial sensor for automobiles
- Ford patents pre-charge alarm to help save costs and respond to emergencies
- New real-time microcontroller system from Texas Instruments enables smarter processing in automotive and industrial applications
- 5G carrier aggregation technology is here, take a look if you are interested.
- "Recommend Chinese Chip" + STC8 series
- EEWORLD University ---- Hinton Machine Learning and Neural Networks
- T12 electric soldering iron production sharing process 1
- Application Note (AN5063) LPS33HW Digital Pressure Sensor: System Integration Guide
- Practical sharing | Key technologies and solutions for 5G Internet of Vehicles
- Introduction and description of domestic mainstream PIC microcontrollers
- [GD32L233C-START Review] ML Component Control
- Ntrip Communication Protocol 1.0
- GaN finishing station 1