Design of PTZ controller monitoring scheme using single chip microcomputer

Publisher:电子艺术大师Latest update time:2012-07-02 Source: 21ic Keywords:MCU Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere

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.

Keywords:MCU Reference address:Design of PTZ controller monitoring scheme using single chip microcomputer

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

Application of inkjet printer in single chip microcomputer measurement and control system
151 Single-chip microcomputer and printer interface design 1.1 Parallel port printer working sequence Normally, the parallel port inkjet printer ( hereinafter referred to as the printer ) is driven by an ordinary PC . The p
[Microcontroller]
Application of inkjet printer in single chip microcomputer measurement and control system
【Blue Bridge Cup MCU Group】(6)UART
(1) Concept of baud rate: 1bps = 1 bit/s (2) There are two serial ports on the board, and only UART1 can be connected to a computer via USB. (3) Four baud rate calculation formulas: (fosc: crystal oscillator frequency) Method 1: baud = fosc / 12; Method 2: baud = (2^smod / 32) * (T1 overflow rate) Method 3:
[Microcontroller]
51 single chip microcomputer - remote control servo
1. Question requirements Based on the first routine "Button control of servo propellers" in Chapter 9, Lecture 2, we use the first three rows of buttons on the infrared remote control to control the servo propellers to stay in the desired position, thus realizing the simple function of wireless remote control of mec
[Microcontroller]
External interface expansion of 51 single chip microcomputer
I have been in contact with microcontrollers for some years and have some understanding of CPLD, but to be honest, I have never used it in a design. Once I had an interview, and a senior engineer asked me some questions, among which was CPLD. I told him honestly that I had never used it, so he asked me why not. I re
[Microcontroller]
External interface expansion of 51 single chip microcomputer
Design of DC Motor Speed ​​Measurement and Control System Based on MCS-51 Single Chip Microcomputer
Abstract: The hardware composition and key unit design method of a high-precision, high-stability, multi-task DC motor speed measurement and control system based on 89C51 single-chip microcomputer and PWM control concept are given. The experimental results show that the system can monitor and control the DC motor sp
[Microcontroller]
Design of DC Motor Speed ​​Measurement and Control System Based on MCS-51 Single Chip Microcomputer
Functions and characteristics of the parallel P3 port of the MCS-51 single-chip microcomputer
The parallel P3 port of the MCS-51 series microcontroller is a multi-function port. Its first function is a quasi-bidirectional port, which can be used as a general I/O port. Its characteristics are similar to those of the P1 port. However, in actual applications, its second function has more signals. The port latch
[Microcontroller]
Functions and characteristics of the parallel P3 port of the MCS-51 single-chip microcomputer
MCU timer within 100000 seconds
Hardware Connection: Code: #include reg52.h #include intrins.h #define uchar unsigned char #define uint unsigned int uchar Count; sbit Dot = P0^7; uchar code DSY_CODE = {   0x3f,0x06,0x5b,0x4f,0x66,0x6d,0x7d,0x07,0x7f,0x6f }; uchar Digits_of_6DSY ={0,0,0,0,0,0}; void DelayMS(uint x) {   flying i; while(-
[Microcontroller]
MCU timer within 100000 seconds
Teach you how to learn microcontrollers step by step
What is a single-chip microcomputer? How should we learn single-chip microcomputers? The following Electrical Automation Technology Network Li Gong will take you to understand single-chip microcomputers, learn single-chip microcomputers, and teach you how to learn single-chip microcomputers. 1. What can you do with si
[Microcontroller]
Latest Microcontroller Articles
  • Download from the Internet--ARM Getting Started Notes
    A brief introduction: From today on, the ARM notebook of the rookie is open, and it can be regarded as a place to store these notes. Why publish it? Maybe you are interested in it. In fact, the reason for these notes is ...
  • Learn ARM development(22)
    Turning off and on interrupts Interrupts are an efficient dialogue mechanism, but sometimes you don't want to interrupt the program while it is running. For example, when you are printing something, the program suddenly interrupts and another ...
  • Learn ARM development(21)
    First, declare the task pointer, because it will be used later. Task pointer volatile TASK_TCB* volatile g_pCurrentTask = NULL;volatile TASK_TCB* vol ...
  • Learn ARM development(20)
    With the previous Tick interrupt, the basic task switching conditions are ready. However, this "easterly" is also difficult to understand. Only through continuous practice can we understand it. ...
  • Learn ARM development(19)
    After many days of hard work, I finally got the interrupt working. But in order to allow RTOS to use timer interrupts, what kind of interrupts can be implemented in S3C44B0? There are two methods in S3C44B0. ...
  • Learn ARM development(14)
  • Learn ARM development(15)
  • Learn ARM development(16)
  • Learn ARM development(17)
Change More Related Popular Components

EEWorld
subscription
account

EEWorld
service
account

Automotive
development
circle

About Us Customer Service Contact Information Datasheet Sitemap LatestNews


Room 1530, 15th Floor, Building B, No.18 Zhongguancun Street, Haidian District, Beijing, Postal Code: 100190 China Telephone: 008610 8235 0740

Copyright © 2005-2024 EEWORLD.com.cn, Inc. All rights reserved 京ICP证060456号 京ICP备10001474号-1 电信业务审批[2006]字第258号函 京公网安备 11010802033920号