In order to meet the actual control requirements of a certain type of ship-borne searchlight and turntable, a new controller based on three-dimensional rocker is designed by using ATmega8 microprocessor. The azimuth and pitch rotation of the turntable are realized, and the speed proportional control of the turntable is synthesized. At the same time, the functions of turning on and off of the searchlight and adjusting the focal length of the searchlight are realized, and the expected control targets are achieved. The design opens up a new way in the integrated control and control of turntable, and has a strong practical value at the same time.
With the rapid development of information technology, searchlights are widely used in many fields such as security, lighting and so on. The special use environment puts forward higher requirements for the operability, convenience and reliability of the control equipment. In view of the strong controllability, convenient use and easy development of rocker, this controller uses three-dimensional rocker to realize the special requirements of searchlight and turntable control.
The ship-borne searchlight turntable system includes four parts: searchlight, turntable, control box and controller, as shown in the system block diagram of Figure 1. After the controller is powered on, the switch of the searchlight can be directly controlled by the switch of the switch light button; the control signal can be sent out by the rotation of the rocker, the control signal can be accepted and analyzed by the control box, and then the control command can be sent to the turntable and the searchlight, thus realizing the control of the turntable’s orientation, pitch and the focal length adjustment of the searchlight. This controller uses ATmega8 microprocessor of ATMEL company as the main control chip.
The chip is an enhanced, low-power AVR microprocessor based on RISC architecture, with data throughput capacity of 1 MIPS/MHz, which can effectively alleviate the contradiction between processor power consumption and processing speed. In addition, it integrates hardware interface circuits such as A/D conversion, serial port and so on, which can realize analog-to-digital conversion of rocker three-dimensional data. FLASH and EEPROM can download and upload with common downloaders, and the cost-effective ratio is very high. The three-dimensional rocker, as shown in Figure 2, has three axes: X, Y and Z. The design uses X and Y axes to control the azimuth and pitch of the turntable, and Z axes to control the focal length transformation of the searchlight. In hardware design, a set of low-pass filters consisting of capacitors and resistors are connected to each of the three axes to filter the control signals of the three axes in order to eliminate interference and jitter. Through analog-to-digital conversion, the control angle of rocker is corresponded to the digital quantity of turntable speed, and the proportional control of turntable speed is realized. In addition, a zero-value button is set on the circuit board for zero-value calibration of three-dimensional rocker action. RS485 communication mode, long transmission distance, combined with Modbus communication protocol, can achieve efficient and reliable information communication. This design uses MAX485 chip as the core chip of communication module to complete the communication between controller and control box. The circuit diagram is shown in Figure 3.
RS485 master-slave communication mode is adopted in serial communication. The baud rate of communication is 9600 bit/s. The data format is 1-bit start bit, 8-bit data, 1-bit stop bit and no check bit. Modbus protocol is a network protocol developed by Modicon Company in 1979.
It is the first real field bus protocol used in industry. It defines the mode of information transmission between devices, which enables communication and data transmission between controllers, controllers and other devices. This design adopts the simplified RTU protocol of Modbus communication. Communication command format, as shown in Table 1.
Among them, CRC0 and CRC1 are CRC check values, thermostatic element which are used to ensure the accuracy and reliability of data transmission. In order to effectively filter impulse noise and protect effective data, the software design converts analog data of rocker from A/D to digital data, and then carries out median filtering. The median filtering algorithm is shown in formula (1). In order to effectively improve the efficiency of CPU execution program, the data acquisition, data transmission and reception of rocker are processed by interruption execution. The controller collects analog signals every 10ms through A/D interrupt program and sends them to the corresponding channel for A/D conversion, and returns the interrupt at the end of conversion and caches the corresponding data; the channel selection of A/D conversion is completed by interruption of timer 2; the processing of three control action data of three-dimensional rocker and the control of switch lights are all in the interruption process of timer 1.
Serial data transmission is initiated by T1 interrupt, and terminates serial interrupt when data transmission is completed.
The sampling, starting button and data transmission of the rocker in this controller are all processed by interrupt program. The main program only deals with zero calibration of the three-dimensional rocker.
When the calibration button is pressed, the main program segment processes the value of the rocker in the reset state and writes the value to EEPROM as the initial value thereafter. After that, the program is initialized again, and after the release of the calibration button, it re-enters the calibration button judgment cycle. The flow chart of the main program is shown in Figure 4.
The controller has been successfully applied to the control system of a certain type of ship-borne searchlight turntable. Practice shows that the controller can accurately control the turntable’s azimuth and pitch, and can control the turning speed in proportion to the rocker’s amplitude. At the same time, the functions of turning on, turning off and adjusting the focal length of the searchlight are realized, and the technical requirements are satisfactorily fulfilled. 。 In addition, the design is compatible with ATmega48 and ATmega88 chips, and there is room for further expansion of functions and improvement of reliability.