0 Introduction
The pan/tilt 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 camera can achieve nearly 360° panoramic shooting, 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, and program control, and display the speed of the stepper motor 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 control personnel 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 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 an external 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 microcontroller responds to the interrupt, it starts to execute the interrupt program. 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 single chip microcomputer from the working environment, which facilitates software maintenance. According to needs, the drive motors in both directions can be automatically coordinated and controlled by the pre-compiled program.
Previous article:Various knowledge analysis solutions related to the single-chip monitoring chip X25043
Next article:Analysis scheme for relevant situations of control circuits using single chip microcomputers
Recommended ReadingLatest update time:2024-11-16 19:54
- 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
- Most Popular Blogs of 2021: Connect, Power, and Protect
- Recruiting circuit engineers with high salary (Nantong Intelligent Perception Research Institute, Shanghai Institute of Technical Physics, Chinese Academy of Sciences)
- Does anyone have the schematic diagram of jmb366?
- If the clamp meter (multimeter) does not measure but there are still numbers, is it a malfunction?
- RK3399 open source motherboard hardware and software information released - free download
- EEWORLD University Hall - Digital Oscilloscope Operation Digital Oscilloscope Operation_National Taiwan Normal University_Teacher Zhang Guowei
- [ESP32-Audio-Kit Audio Development Board Review] Part 1: Building esp-idf and esp-adf development environments based on vs code
- Live broadcast has ended | Microchip's latest SAM and PIC32 microcontroller software development platform - MPLAB Harmony V3
- [GD32E503 Review]——07.LCD Part 2: Drawing Custom Patterns
- Xiaozhi Science Popularization丨Why do instruments generally have set values and readback values?