Antenna inclination angle adjusting control method based on STM32F0 microcontroller

文档序号:1630192 发布日期:2020-01-14 浏览:28次 中文

阅读说明:本技术 一种基于stm32f0微控制器的天线倾角调节控制方法 (Antenna inclination angle adjusting control method based on STM32F0 microcontroller ) 是由 杨华 张志成 胡泽伟 陈志兴 黄瑞锋 申志科 王敏强 于 2019-09-12 设计创作,主要内容包括:本发明公开一种基于STM32F0微控制器的天线倾角调节控制方法,它是通过RCU来实现的;其特征在于,所述RCU包括:电机,用来充当改变天线倾角的动力机构;霍尔开关,用来反馈所述电机的转动圈数;STM32F0微控制器,用来接收所述霍尔开关反馈的信号并控制所述电机工作;实际工作时,采用所述STM32F0微控制器内部的定时器产生PWM信号,所述STM32F0微控制器通过RS485接口与外部设备连接,并根据所述外部设备发出的指令改变所述PWM信号的频率和占空比,进而改变所述电机的运转速度、扭矩力。本发明具有低成本、可调转速及扭矩力、控制精准等优势。(The invention discloses an antenna inclination angle adjusting control method based on an STM32F0 microcontroller, which is realized by an RCU (remote control Unit); wherein the RCU comprises: a motor for acting as a power mechanism for changing the inclination angle of the antenna; the Hall switch is used for feeding back the number of turns of the motor; the STM32F0 microcontroller is used for receiving signals fed back by the Hall switches and controlling the motor to work; during actual work, adopt the inside timer of STM32F0 microcontroller produces the PWM signal, STM32F0 microcontroller passes through the RS485 interface and is connected with external equipment to according to the instruction that external equipment sent changes the frequency and the duty cycle of PWM signal, and then change the functioning speed, the torque force of motor. The invention has the advantages of low cost, adjustable rotating speed and torque force, accurate control and the like.)

1. An antenna tilt angle adjusting control method based on an STM32F0 microcontroller is realized by an RCU; wherein the RCU comprises: a motor for acting as a power mechanism for changing the inclination angle of the antenna; the Hall switch is used for feeding back the number of turns of the motor; the STM32F0 microcontroller is used for receiving signals fed back by the Hall switches and controlling the motor to work;

during actual work, adopt the inside timer of STM32F0 microcontroller produces the PWM signal, STM32F0 microcontroller passes through the RS485 interface and is connected with external equipment to according to the instruction that external equipment sent changes the frequency and the duty cycle of PWM signal, and then change the functioning speed, the torque force of motor.

2. The antenna tilt angle adjustment control method based on the STM32F0 microcontroller is characterized in that the motor is a direct current brush motor, and the Hall switch is mounted on the motor.

3. The antenna tilt angle adjustment control method based on the STM32F0 microcontroller according to claim 1, wherein the STM32F0 microcontroller is an STM32F072 type microcontroller.

4. The antenna tilt angle adjustment control method based on the STM32F0 microcontroller according to claim 1, wherein the external device is one or more of an upper computer and a handheld controller.

5. The antenna tilt angle adjustment control method based on the STM32F0 microcontroller according to claim 1, wherein the method for interrupting the acquisition of the Hall switch feedback signal comprises the following steps:

1) connecting the Hall switch detection signal to a U6_18 pin of the STM32F0 microcontroller, wherein the pin is configured in an external interrupt falling edge triggering mode, the disc of the Hall switch is provided with two detection points, when the motor rotates once by C1, the Hall switch detects the falling edge signal twice and triggers the STM32F0 microcontroller to carry out external interrupt twice, and an interrupt processing function is entered when the interrupt is triggered each time, and Hall count H in the interrupt processing function is accumulated once;

2) calculating the number of turns C2 of the motor after being decelerated, wherein C2 is H/(2R), and R represents the speed reduction ratio of the motor reduction box;

3) calculating the moving distance S2 of the phase shifter, wherein S2 is S1C 2, the phase shifter is connected with the output shaft of the speed reducer through a pull rod, a switching piece, a screw rod connecting piece, a screw rod and a transmission plum blossom head, and S1 represents the thread pitch of the screw rod;

4) calculating a Hall count HQ corresponding to each 0.1-degree inclination angle, wherein HQ is HZ/(A1 × 10), HZ is a total Hall count corresponding to the maximum adjusting pitch L1 of the screw, and HZ is L1/S1 × 2R; a1 is the maximum adjusting angle of the phase shifter of the antenna, and the adjusting distance and the adjusting angle are in an equal dividing state;

5) when the inclination angle is adjusted, the Hall counting machine is stopped according to the detected Hall calculation equal to the calculated Hall counting, so that the aim of accurately adjusting the inclination angle is fulfilled.

6. The antenna tilt angle adjustment control method based on the STM32F0 microcontroller according to claim 1, characterized by comprising the following steps:

1) initializing a system;

2) sending an inclination angle adjusting instruction by using the external equipment, after receiving the inclination angle adjusting instruction, the STM32F0 microcontroller controls the motor to start to adjust the inclination angle by generating a PWM signal through timer interruption and interrupts acquisition of the Hall switch signal until the motor runs to the position specified by the inclination angle adjusting instruction;

3) the external equipment is utilized to send out a calibration instruction, and after the STM32F0 microcontroller receives an inclination angle adjusting instruction, the motor is controlled to start to calibrate the inclination angle by generating a PWM signal through timer interruption.

7. The antenna tilt angle adjustment control method based on the STM32F0 microcontroller according to claim 6, characterized in that the calibration step is: firstly, controlling the motor to rotate to an original position, then controlling the motor to rotate reversely and operating to a maximum adjustable position; and then controlling the motor to rotate forwards and return to the inclination angle position of the stored parameter in the system to finish the whole calibration process.

8. The antenna tilt angle adjustment control method based on the STM32F0 microcontroller according to claim 7, wherein the method for judging the position of the motor running to the original position is as follows: the counting time duration of the Hall switch is detected to determine, and when the counting time duration is not detected within a certain time T1, the motor is judged to be blocked and is operated to the original position.

Technical Field

The invention relates to the technical field of communication, in particular to an antenna inclination angle adjusting control method based on an STM32F0 microcontroller.

Background

In an antenna network, if the height of a part of stations is too high, the problem of cross-zone coverage is caused, and the cross-zone coverage causes the network structure to be complex, thereby affecting the network quality. To solve the problem of coverage in the handover area, the down tilt of the base station antenna is adjusted.

Disclosure of Invention

Aiming at the problems in the prior art, the invention aims to provide an antenna inclination angle adjusting and controlling method which is low in cost, can adjust the rotating speed and the torque force and is accurately controlled.

In order to achieve the purpose, the invention adopts the following technical scheme.

An antenna tilt angle adjusting control method based on an STM32F0 microcontroller is realized by an RCU; wherein the RCU comprises: a motor for acting as a power mechanism for changing the inclination angle of the antenna; the Hall switch is used for feeding back the number of turns of the motor; the STM32F0 microcontroller is used for receiving signals fed back by the Hall switches and controlling the motor to work; during actual work, adopt the inside timer of STM32F0 microcontroller produces the PWM signal, STM32F0 microcontroller passes through the RS485 interface and is connected with external equipment to according to the instruction that external equipment sent changes the frequency and the duty cycle of PWM signal, and then change the functioning speed, the torque force of motor.

More preferably, the motor is a direct current brush motor, and the hall switch is mounted on the motor.

More preferably, the STM32F0 microcontroller is an STM32F072 type microcontroller.

More preferably, the external device is one or more of an upper computer and a handheld controller.

More preferably, the method for interrupting the collection of the feedback signal of the hall switch comprises: 1) connecting the Hall switch detection signal to a U6_18 pin of the STM32F0 microcontroller, wherein the pin is configured in an external interrupt falling edge triggering mode, the disc of the Hall switch is provided with two detection points, when the motor rotates once by C1, the Hall switch detects the falling edge signal twice and triggers the STM32F0 microcontroller to carry out external interrupt twice, and an interrupt processing function is entered when the interrupt is triggered each time, and Hall count H in the interrupt processing function is accumulated once; 2) calculating the number of turns C2 of the motor after being decelerated, wherein C2 is H/(2R), and R represents the speed reduction ratio of the motor reduction box; 3) calculating the moving distance S2 of the phase shifter, wherein S2 is S1C 2, the phase shifter is connected with the output shaft of the speed reducer through a pull rod, a switching piece, a screw rod connecting piece, a screw rod and a transmission plum blossom head, and S1 represents the thread pitch of the screw rod; 4) calculating a Hall count HQ corresponding to each 0.1-degree inclination angle, wherein HQ is HZ/(A1 × 10), HZ is a total Hall count corresponding to the maximum adjusting pitch L1 of the screw, and HZ is L1/S1 × 2R; a1 is the maximum adjusting angle of the phase shifter of the antenna, and the adjusting distance and the adjusting angle are in an equal dividing state; 5) when the inclination angle is adjusted, the Hall counting machine is stopped according to the detected Hall calculation equal to the calculated Hall counting, so that the aim of accurately adjusting the inclination angle is fulfilled.

More preferably, the antenna tilt angle adjustment control method includes the steps of: 1) initializing a system; 2) sending an inclination angle adjusting instruction by using the external equipment, after receiving the inclination angle adjusting instruction, the STM32F0 microcontroller controls the motor to start to adjust the inclination angle by generating a PWM signal through timer interruption and interrupts acquisition of the Hall switch signal until the motor runs to the position specified by the inclination angle adjusting instruction; 3) the external equipment is utilized to send out a calibration instruction, and after the STM32F0 microcontroller receives an inclination angle adjusting instruction, the motor is controlled to start to calibrate the inclination angle by generating a PWM signal through timer interruption.

More preferably, the calibration step is: firstly, controlling the motor to operate to an original point position, wherein the original point position corresponds to a maximum inclination angle; then controlling the motor to rotate reversely and operating to a maximum adjustable position, wherein the position corresponds to a minimum inclination angle; and then controlling the motor to rotate forwards and return to the inclination angle position of the stored parameter in the system to finish the whole calibration process.

More preferably, the method for determining the position of the motor at the home position includes: the counting time duration of the Hall switch is detected to determine, and when the counting time duration is not detected within a certain time T1, the motor is judged to be blocked and is operated to the original position.

The invention has the beneficial effects that:

adopt the STM32F0 microcontroller that the price/performance ratio is high as control center, utilize the inside timer of microcontroller to produce accurate PWM signal, external equipment (including host computer software, hand-held controller etc.) sends the instruction through the RS485 interface and changes this PWM signal frequency and duty cycle, and then reach the purpose of transfer drive motor speed of rotation and torque force, this scheme compares with prior art, has with low costs, small, rotational speed increase torsion moment does not diminish (the electric current size determines the rotational speed size) advantage such as. Meanwhile, a motor Hall switch signal is received in an external interrupt mode of the microcontroller, the microcontroller can accurately obtain the motor running condition through analyzing and processing the motor Hall switch signal, and then the motor is accurately controlled to adjust the inclination angle of the antenna. In addition, the interface resources of the STM32F072 microcontroller are rich, the IO port is conveniently distributed to realize control of a plurality of motors, the remote control unit is a low-cost RCU (remote control unit), and the market competitiveness is improved.

Drawings

Fig. 1 is a flow chart for adjusting the inclination angle of an antenna by interrupting the acquisition of hall switch signals.

Fig. 2 shows an antenna calibration flow chart.

Detailed Description

The following describes the embodiments of the present invention with reference to the drawings of the specification, so that the technical solutions and the advantages thereof are more clear and clear. The embodiments described below are exemplary and are intended to be illustrative of the invention, but are not to be construed as limiting the invention.

Additional aspects and advantages of the invention will be set forth in part in the description which follows, and in part will be obvious from the description, or may be learned by practice of the invention.

An antenna tilt angle adjustment control method based on an STM32F0 microcontroller is realized by an RCU.

Wherein the RCU includes: a motor for acting as a power mechanism for changing the inclination angle of the antenna; the Hall switch is used for feeding back the number of turns of the motor; and the STM32F0 microcontroller is used for receiving the signals fed back by the Hall switches and controlling the motor to work.

In this embodiment, the motor is preferably a dc brush motor, and the hall switch is mounted on the motor. The STM32F0 microcontroller is preferably an STM32F072 type microcontroller. The external equipment is preferably an upper computer. In other embodiments, the external device is a handheld controller or a tablet computer, and is not limited to this embodiment.

When actually adjusting the antenna inclination, utilize the inside timer of STM32F0 microcontroller produces the PWM signal, STM32F0 microcontroller passes through the RS485 interface and is connected with external equipment to according to the instruction that external equipment sent changes the frequency and the duty cycle of PWM signal, and then change the functioning speed, the torque force of motor.

Specifically, the antenna tilt angle adjustment includes the following steps: 1) initializing a system; 2) sending an inclination angle adjusting instruction by using external equipment, after receiving the inclination angle adjusting instruction, the STM32F0 microcontroller controls the motor to start to adjust the inclination angle by generating a PWM signal through timer interruption and interrupts acquisition of the Hall switch signal until the motor runs to the position specified by the inclination angle adjusting instruction; 3) and an external device is used for sending a calibration instruction, and after the STM32F0 microcontroller receives an inclination angle adjusting instruction, a timer is interrupted to generate a PWM signal to control the motor to start to calibrate the inclination angle.

Referring to fig. 1, the method for interrupting the acquisition of the hall switch feedback signal to control the tilt angle includes:

1) and connecting the Hall switch detection signal to a U6_18 pin of the STM32F0 microcontroller, wherein the pin is configured in an external interrupt falling edge triggering mode, the disc of the Hall switch is provided with two detection points, when the motor rotates once for one circle, C1, the Hall switch detects the falling edge signal twice and triggers the STM32F0 microcontroller to externally interrupt twice, and an interrupt processing function is entered when the interrupt is triggered each time, and Hall count H in the interrupt processing function is accumulated once.

2) And calculating the number of turns C2 of the motor after speed reduction according to the Hall count H, wherein C2 is H/(2R), and R represents the speed reduction ratio of the speed reduction box because the motor is provided with the speed reduction box.

3) A transmission quincuncial head is fixed on an output shaft of the speed reducer, the transmission quincuncial head is fastened together with a screw rod, a screw rod connecting piece with internal threads is sleeved outside the screw rod, and the screw rod connecting piece is connected with the phase shifter through a switching piece and a pull rod; and the motor rotates for one turn after being decelerated to drive the screw rod connecting piece to move forward or backward by the thread space S1 of one screw rod, and the moving distance S2 of the phase shifter can be obtained according to the total number of turns, wherein S2 is S1C 2.

4) Assuming that the maximum adjustment angle a1 of the antenna phase shifter corresponds to the maximum adjustment distance L1, the adjustment distance and the adjustment angle are in an average state, the total hall count HZ is calculated as L1/S1R according to the maximum adjustment pitch L1 and the thread pitch S1, and further the hall count HQ corresponding to each 0.1 ° inclination angle is calculated as HZ/(a1 10).

5) When the inclination angle is adjusted, the Hall counting machine is stopped according to the detected Hall calculation equal to the calculated Hall counting, so that the aim of accurately adjusting the inclination angle is fulfilled.

Referring to fig. 2, the tilt angle calibration step includes: firstly, controlling the motor to run to an original position, wherein the original position corresponds to the maximum position of the inclination angle; then controlling the motor to rotate reversely and operating to a maximum adjustable position, wherein the position corresponds to the minimum position of the inclination angle; and then controlling the motor to rotate forwards and return to the inclination angle position of the stored parameter in the system to finish the whole calibration process.

In this embodiment, the method for determining the position of the motor at the home position includes: the counting time duration of the Hall switch is detected to determine, and when the counting time duration is not detected within a certain time T1, the motor is judged to be blocked and is operated to the original position.

According to the antenna inclination angle adjusting control method provided by the embodiment, an STM32F072 microcontroller with high cost performance is used as a control center, an internal timer of the microcontroller is used for generating an accurate PWM signal, and external equipment (including upper computer software, a handheld controller and the like) sends an instruction through an RS485 interface to change the frequency and the duty ratio of the PWM signal, so that the purposes of adjusting and driving the running speed and the torque force of a motor are achieved. Meanwhile, a motor Hall switch signal is received in an external interrupt mode of the microcontroller, the microcontroller can accurately obtain the motor running condition through analyzing and processing the motor Hall switch signal, and then the motor is accurately controlled to adjust the inclination angle of the antenna. In addition, the interface resources of the STM32F072 microcontroller are rich, the IO port is conveniently distributed to realize control of a plurality of motors, the remote control unit is a low-cost RCU (remote control unit), and the market competitiveness is improved.

It will be appreciated by those skilled in the art from the foregoing description of construction and principles that the invention is not limited to the specific embodiments described above, and that modifications and substitutions based on the teachings of the art may be made without departing from the scope of the invention as defined by the appended claims and their equivalents. The details not described in the detailed description are prior art or common general knowledge.

9页详细技术资料下载
上一篇:一种医用注射器针头装配设备
下一篇:一种小型5G信号接发天面

网友询问留言

已有0条留言

还没有人留言评论。精彩留言会获得点赞!

精彩留言,会给你点赞!