Hall counting-based agricultural push rod motor stroke control method and system

文档序号:571620 发布日期:2021-05-18 浏览:22次 中文

阅读说明:本技术 一种基于霍尔计数的农用推杆电机行程控制方法及系统 (Hall counting-based agricultural push rod motor stroke control method and system ) 是由 刘勇 王运圣 骆静 李海平 杨剑锋 徐识溥 胡雯雯 于 2021-01-08 设计创作,主要内容包括:本发明涉及智慧农业领域,公开了一种基于霍尔计数的农用推杆电机行程控制方法及系统,包括设置两个相互垂直的霍尔传感器;根据A相输出信号和B相输出信号建立霍尔计数模块,获取行程实际值;建立行程控制接口模块,获取行程设定值;建立电机自动停止检测模块,获得电机自动停止检测结果;通过电机驱动模块提供控制农用推杆电机的若干不同基本驱动函数;利用行程判断模块根据行程设定值和实际值调用电机驱动模块中的若干不同基本驱动函数对农用推杆电机进行驱动控制。本发明解决了传统推杆电机无发自动控制行程的问题,能够实现精准控制和远程控制。可靠性高,成本低,适合在大田智慧农业中推广使用,实施方式灵活,可大大提高农业信息化水平。(The invention relates to the field of intelligent agriculture, and discloses an agricultural push rod motor stroke control method and system based on Hall counting, wherein the method comprises the steps of arranging two Hall sensors which are vertical to each other; establishing a Hall counting module according to the A-phase output signal and the B-phase output signal to obtain an actual stroke value; establishing a stroke control interface module to obtain a stroke set value; establishing a motor automatic stop detection module to obtain a motor automatic stop detection result; providing a plurality of different basic driving functions for controlling the agricultural push rod motor through the motor driving module; and calling a plurality of different basic driving functions in the motor driving module by using the stroke judging module according to the stroke set value and the actual value to carry out driving control on the agricultural push rod motor. The invention solves the problem that the traditional push rod motor has no power to automatically control the stroke, and can realize accurate control and remote control. The system has the advantages of high reliability, low cost, flexible implementation mode and capability of greatly improving the agricultural informatization level, and is suitable for popularization and use in field intelligent agriculture.)

1. An agricultural push rod motor stroke control method based on Hall counting is characterized by comprising the following steps:

s1) arranging two Hall sensors at the periphery of a rotating shaft of the agricultural push rod motor, wherein the two Hall sensors are respectively positioned on a concentric circle of the rotating shaft of the agricultural push rod motor, and the two Hall sensors are perpendicular to each other and do not rotate along with the rotation of the agricultural push rod motor; a magnet is arranged on a rotating shaft of an agricultural push rod motor, the magnet rotates along with the motor to do circular motion, and when the magnet rotates for one circle and is close to any one of the two Hall sensors, the magnet triggers the any one of the two Hall sensors to output a pulse signal, and the outputs of the two Hall sensors are respectively recorded as an A-phase output signal and a B-phase output signal;

s2) establishing a Hall counting module according to the phase A output signal and the phase B output signal, recording a current Hall counting value NowCount through the Hall counting module, and obtaining a total TOtalcount of the completely extended Hall counting of the push rod of the agricultural push rod motor;

s3), establishing a stroke control interface module, wherein the stroke control interface module is used for receiving the total totalcount of the Hall count of the complete extension of the push rod of the agricultural push rod motor and the stroke control quantity sent by a user or a calling program, the stroke control quantity is the percentage value of the extension length of the push rod of the agricultural push rod motor, and the stroke control quantity is converted into a corresponding Hall set value SetCount according to the total totalcount of the Hall count of the complete extension of the push rod of the agricultural push rod motor;

s4), establishing a motor automatic stop detection module, wherein the motor automatic stop detection module is used for acquiring the current running state of the agricultural push rod motor and the current value of the agricultural push rod motor, setting detection time, and judging whether the agricultural push rod motor automatically stops or not according to the current running state of the agricultural push rod motor and the current value of the agricultural push rod motor every detection time to obtain a motor automatic stop detection result;

s5), establishing a motor driving module which is used for providing a plurality of different basic driving functions for controlling the agricultural push rod motor; the plurality of different basic driving functions of the agricultural push rod motor comprise a motor extension control function, a motor retraction control function and a motor emergency stop control function;

s6), establishing a stroke judgment module, wherein the stroke judgment module is used for respectively calling a motor automatic stop detection result in the motor automatic stop detection module, a current Hall count value NowCount in the Hall count module, a total number totalcount of Hall counts of agricultural push rod motor push rods which are completely extended in the Hall count module and a Hall set value SetCount in the stroke control interface module; the stroke judging module acquires the current push rod operation position of the agricultural push rod motor according to the current Hall counting value NowCount, the total Hall counting number totalcount of the completely extended push rod of the agricultural push rod motor and the Hall setting value SetCount, and judges whether to stop the agricultural push rod motor or change the operation direction of the agricultural push rod motor; the stroke judgment module judges whether to cut off the power supply of the agricultural push rod motor according to the motor automatic stop detection result obtained in the motor automatic stop detection module; obtaining a plurality of different judgment results; the travel judgment module respectively and correspondingly calls a plurality of different basic driving functions in the motor driving module according to the plurality of different judgment results, and the agricultural push rod motor is driven and controlled according to the called plurality of different basic driving functions in the motor driving module.

2. The agricultural push rod motor stroke control method based on hall counting according to claim 1, wherein in step S2), a hall counting module is established according to the a phase output signal and the B phase output signal, the hall counting module records the current hall counting value NowCount and obtains the total number totalcount of the hall counting of the fully extended push rod of the agricultural push rod motor, including setting an interrupt program, triggering the interrupt program according to the high-low jump of the a phase output signal, judging whether the a phase output signal is the rising edge interrupt or the falling edge interrupt in the interrupt program, and judging whether the B phase output signal is the high level or the low level at the same time, obtaining the simultaneous judgment result of the a phase output signal and the B phase output signal, and judging whether the agricultural push rod motor rotates forward or reversely according to the simultaneous judgment result of the a phase output signal and the B phase output signal, and acquiring a positive and negative rotation judgment result of the agricultural push rod motor, and adding 1 to or subtracting 1 from the current count value NowCount according to the positive and negative rotation judgment result of the agricultural push rod motor.

3. The Hall-counting-based agricultural push rod motor stroke control method according to claim 2, wherein the interrupt program is triggered according to the high-low jump of the A-phase output signal, whether the A-phase output signal is a rising edge interrupt or a falling edge interrupt is judged in the interrupt program, whether the B-phase output signal is a high level or a low level is judged at the same time, a simultaneous judgment result of the A-phase output signal and the B-phase output signal is obtained, whether the agricultural push rod motor rotates forwards or backwards is judged according to the simultaneous judgment result of the A-phase output signal and the B-phase output signal, a positive and negative rotation judgment result of the agricultural push rod motor is obtained, and the current count value NowCount is added with or subtracted from 1 according to the positive and negative rotation judgment result of the agricultural push rod motor, comprising the steps of:

s21) triggering an interrupt program by the A-phase output signal, and clearing an interrupt flag bit;

s22) judging whether the A-phase output signal is in falling edge interruption or not, and if not, entering the step S24); if yes, go to step S23);

s23) judging whether the B-phase output signal is at a high level, if so, the agricultural push rod motor rotates forwards, and the current count value NowCount is added with 1; if not, the agricultural push rod motor is in reverse rotation, and the current count value NowCount is subtracted by 1;

s24) judging whether the A phase output signal is in rising edge interruption or not, if not, exiting the interruption program; if yes, go to step S25);

s25) judging whether the B-phase output signal is at a high level, if so, reversing the agricultural push rod motor, and subtracting 1 from the current count value NowCount; if not, the agricultural push rod motor rotates forwards, and the current count value NowCount is added with 1.

4. The Hall counting-based agricultural push rod motor stroke control method according to claim 1 or 3, wherein in step S6), the stroke judgment module respectively calls a plurality of different basic driving functions in the motor driving module according to the plurality of different judgment results, and performs driving control on the agricultural push rod motor according to the called plurality of different basic driving functions in the motor driving module, comprising the steps of:

s61) obtaining a Hall set value SetCount in the stroke control interface module;

s62) judging whether the Hall set value SetCount is an emergency stop parameter, if so, carrying out emergency stop control on the agricultural push rod motor; if not, go to step S63);

s63) judging whether the hall setting value SetCount is a complete retraction parameter, if so, performing complete retraction control of the agricultural push rod motor; if not, go to step S64);

s64) judging whether the Hall set value SetCount is the total Totalcount of the completely extended Hall counting of the push rod of the agricultural push rod motor, if so, controlling the completely extended of the agricultural push rod motor; if not, go to step S65);

s65) judging whether the Hall set value SetCount is more than or equal to NowCount-n and less than or equal to NowCount + n, wherein n is a counting allowable error value, if yes, controlling the critical state of the agricultural push rod motor; if not, go to step S66);

s66) judging whether the hall setting value SetCount is greater than the current hall count value NowCount or less than the current hall count value NowCount, if so, performing intermediate state control of the agricultural push rod motor; if not, ending the driving stroke control of the agricultural push rod motor.

5. The Hall count based agricultural push rod motor stroke control method according to claim 4, wherein in step S62), performing agricultural push rod motor scram control comprises the following steps:

s621) judging whether the current running state of the agricultural push rod motor is stopped, if so, entering the step S623); if not, go to step S622);

s622) calling and executing a motor emergency stop control function in the motor driving module, updating the running state of the agricultural push rod motor to a stop state, and entering the step S623);

s623) calculating and updating the current opening and closing degree of the push rod of the agricultural push rod motor, and ending the emergency stop control of the agricultural push rod motor.

6. The hall count based agricultural push rod motor stroke control method as claimed in claim 4, wherein in step S63), performing the agricultural push rod motor full retraction control comprises the steps of:

s631) judging whether the agricultural push rod motor is automatically stopped or not according to the motor automatic stop detection result of the motor automatic stop detection module, if so, entering the step S632), and if not, entering the step S633);

s632) determining whether the current operation state of the agricultural push rod motor is stopped, if so, entering step S634); if not, calling and executing a motor emergency stop control function in the motor driving module, updating the running state of the agricultural push rod motor to a stop state, setting the current Hall count value NowCount as a counting allowable error value n, and entering step S634);

s633) judging whether the current running state of the agricultural push rod motor is retracting, if so, entering step S634); if not, calling and executing a motor retraction control function in the motor driving module, updating the running state of the agricultural push rod motor to be retracting, and entering step S634);

s634) ends the agricultural pusher motor full retraction control.

7. The hall count based agricultural push rod motor stroke control method as claimed in claim 4, wherein in step S64), the agricultural push rod motor full extension control is performed, comprising the steps of:

s641) judging whether the agricultural push rod motor is automatically stopped or not according to the motor automatic stop detection result of the motor automatic stop detection module, if so, entering the step S642), and if not, entering the step S643);

s642) judging whether the current running state of the agricultural push rod motor is stopped, if so, entering the step S634); if not, calling and executing a motor emergency stop control function in the motor driving module, updating the running state of the agricultural push rod motor to a stop state, setting the current Hall count value NowCount as the total number totalcount of Hall counts for the push rod of the agricultural push rod motor to be completely stretched out, and entering step S644);

s643) judging whether the current running state of the agricultural push rod motor is extending, if yes, entering the step S644); if not, calling and executing a motor extension control function in the motor driving module, updating the running state of the agricultural push rod motor to be extended, and entering step S644);

s644) ends the agricultural pusher motor full-extension control.

8. The Hall counting based agricultural push rod motor stroke control method according to claim 4, wherein in step S65), critical state control of the agricultural push rod motor is performed, comprising the steps of:

s651) judging whether the current running state of the agricultural push rod motor is stopped, if so, entering step S653); if not, go to step S652);

s652) calling and executing a motor emergency stop control function in the motor driving module, updating the running state of the agricultural push rod motor to a stop state, and entering step S653);

s653) setting an opening degree set value, calculating and updating the current opening degree of the push rod of the agricultural push rod motor, updating the current opening degree of the push rod of the agricultural push rod motor to the opening degree set value, and finishing the critical state control of the agricultural push rod motor.

9. The Hall count based agricultural push rod motor stroke control method according to claim 4, wherein in step S66), the intermediate state control of the agricultural push rod motor is performed, comprising the steps of:

s661) determining whether the hall setting value SetCount is greater than the current hall count value NowCount, if so, proceeding to step S662); if not, go to step S663);

s662) judging whether the current running state of the agricultural push rod motor is extending, if so, entering the step S665); if not, calling and executing a motor extension control function in the motor driving module, updating the running state of the agricultural push rod motor to be extended, and entering step S665);

s663) determining whether the hall setting value SetCount is smaller than the current hall count value NowCount, if so, proceeding to step S664); if not, go to step S665);

s664) judging whether the current running state of the agricultural push rod motor is retracting, if so, entering step S665); if not, calling and executing a motor retraction control function in the motor driving module, updating the running state of the agricultural push rod motor to be retracting, and entering step S665);

s665) ending the intermediate state control of the agricultural push rod motor.

10. An agricultural push rod motor stroke control system based on Hall counting is suitable for the agricultural push rod motor stroke control method based on Hall counting as claimed in any one of claims 1 to 9, and is characterized by comprising an agricultural push rod motor setting module, a stroke judging module, a Hall counting module, a motor automatic stop detection module, a motor driving module and a stroke control interface;

the device comprises an agricultural push rod motor setting module, a control module and a control module, wherein the agricultural push rod motor setting module is used for setting two Hall sensors on the periphery of a rotating shaft of an agricultural push rod motor, the two Hall sensors are respectively positioned on concentric circles of the rotating shaft of the agricultural push rod motor, and the two Hall sensors are perpendicular to each other and do not rotate along with the rotation of the agricultural push rod motor; a magnet is arranged on a rotating shaft of the agricultural push rod motor, the magnet rotates along with the motor to do circular motion, and when the magnet rotates for one circle and is close to any one of the two Hall sensors, any one of the two Hall sensors is triggered to output a pulse signal; recording the outputs of the two Hall sensors as an A-phase output signal and a B-phase output signal respectively; when the agricultural push rod motor rotates forwards, the waveform of the A-phase output signal leads the waveform of the B-phase output signal by a quarter period; when the agricultural push rod motor rotates reversely, the waveform of the A-phase output signal lags behind the waveform of the B-phase output signal by a quarter period;

the Hall counting module is used for recording a current Hall counting value NowCount according to the phase A output signal and the phase B output signal and obtaining a total Totalcount of the completely extended Hall counting of the push rod of the agricultural push rod motor;

the stroke control interface module is used for receiving the total number totalcount of Hall counts completely extending out of the push rod of the agricultural push rod motor and stroke control quantity sent by a user or a calling program, wherein the stroke control quantity is a percentage value of the extension length of the push rod of the agricultural push rod motor, and the stroke control quantity is converted into a corresponding Hall set value SetCount according to the total number totalcount of Hall counts completely extending out of the push rod of the agricultural push rod motor;

the motor automatic stop detection module is used for acquiring the current running state of the agricultural push rod motor and the current value of the agricultural push rod motor, setting detection time, and judging whether the agricultural push rod motor automatically stops or not according to the current running state of the agricultural push rod motor and the current value of the agricultural push rod motor every detection time to obtain a motor automatic stop detection result;

the motor driving module is used for providing a plurality of different basic driving functions for controlling the agricultural push rod motor; the plurality of different basic driving functions of the agricultural push rod motor comprise a motor push rod extension control function, a motor push rod retraction control function and a motor emergency stop control function;

the stroke judging module is used for respectively calling a motor automatic stop detection result in the motor automatic stop detection module, a current Hall count value NowCount in the Hall counting module, a total Hall count number totalcount of a completely extended agricultural push rod motor push rod in the Hall counting module and a Hall set value SetCount in the stroke control interface module; the stroke judging module acquires the current push rod operation position of the agricultural push rod motor according to the current Hall counting value NowCount, the total Hall counting number totalcount of the completely extended push rod of the agricultural push rod motor and the Hall setting value SetCount, and judges whether to stop the agricultural push rod motor or change the operation direction of the agricultural push rod motor; the stroke judgment module judges whether to cut off the power supply of the agricultural push rod motor according to the motor automatic stop detection result obtained in the motor automatic stop detection module; obtaining a plurality of different judgment results; the travel judgment module respectively and correspondingly calls a plurality of different basic driving functions in the motor driving module according to the plurality of different judgment results, and the agricultural push rod motor is driven and controlled according to the called plurality of different basic driving functions in the motor driving module.

Technical Field

The invention relates to the field of intelligent agriculture, in particular to an agricultural push rod motor stroke control method and system based on Hall counting.

Background

The existing push rod motor stroke control method and system are mainly used for intelligent control of field irrigation gate opening degree or greenhouse skylight opening degree control in facility agriculture and other agricultural production environments. Stroke control is generally performed in the industry by a stepper motor, which is an electric motor that converts an electrical pulse signal into a corresponding angular or linear displacement. The rotor rotates an angle or one step before inputting a pulse signal, the output angular displacement or linear displacement is proportional to the input pulse number, and the rotating speed is proportional to the pulse frequency. Therefore, the stepping motor is also called a pulse motor. The stepping motor can realize accurate stroke control, however, the motor has complex structure and high cost, and is difficult to popularize in large area due to high cost for agricultural production, particularly field planting production, and the outdoor open-air environment of the agricultural field has high humidity and dustiness throughout the year, thereby being not beneficial to the application of the high-precision motor.

The push rod motor is an electric driving device which converts the rotary motion of the motor into the linear reciprocating motion of the push rod, has simple structure and low cost, and is also more suitable for agricultural production. However, the push rod motor is a simple direct current motor, and can only be powered on and off to realize the operation and stop of the motor, and can realize the forward rotation and the reverse rotation of the motor by switching the positive electrode and the negative electrode of the power supply, so that the current agricultural application can only realize the two states of complete opening or complete closing, and the current solution method for controlling the opening degree in some places is realized by manually closing the power supply of the motor when a manual visual gate or a skylight is opened to a required position, obviously, the method needs to consume manpower and is inaccurate in control.

The push rod motor can also realize automatic stroke control by a timing method. For a determined type of push rod motor, the maximum length of the extended part is certain, and the time period from the complete retraction to the complete extension is also certain, so that the travel of the push rod motor can be controlled by controlling the power-on time of the motor. However, the agricultural field irrigation environment is affected by water level, water pressure, sludge and the like, the load of the push rod motor is always changed, and if the stroke is controlled through the electrifying duration, the stroke control is disordered due to long-term accumulation of errors.

Disclosure of Invention

The invention provides an agricultural push rod motor stroke control method and system based on Hall counting, and therefore the problems in the prior art are solved.

In a first aspect, the invention provides an agricultural push rod motor stroke control method based on Hall counting, which comprises the following steps:

s1) arranging two Hall sensors at the periphery of a rotating shaft of the agricultural push rod motor, wherein the two Hall sensors are respectively positioned on the concentric circles of the rotating shaft of the agricultural push rod motor, and the two Hall sensors are perpendicular to each other and do not rotate along with the rotation of the agricultural push rod motor; a magnet is arranged on a rotating shaft of an agricultural push rod motor, the magnet rotates along with the motor to do circular motion, and when the magnet rotates for one circle and is close to any one of two Hall sensors, any one Hall sensor can be triggered to output a pulse signal, and the outputs of the two Hall sensors are respectively recorded as an A-phase output signal and a B-phase output signal;

s2) establishing a Hall counting module according to the A-phase output signal and the B-phase output signal, recording the current Hall counting value NowCount through the Hall counting module, and obtaining the total Totalcount of the completely extended Hall counting of the push rod of the agricultural push rod motor;

s3), establishing a stroke control interface module, wherein the stroke control interface module is used for receiving the total totalcount of the Hall count of the completely extended push rod of the agricultural push rod motor and the stroke control quantity sent by a user or a calling program, the stroke control quantity is the percentage value of the extension length of the push rod of the agricultural push rod motor, and the stroke control quantity is converted into a corresponding Hall set value SetCount according to the total totalcount of the completely extended push rod of the agricultural push rod motor;

s4), establishing a motor automatic stop detection module, wherein the motor automatic stop detection module is used for acquiring the current running state of the agricultural push rod motor and the current value of the agricultural push rod motor, setting detection time, and judging whether the agricultural push rod motor automatically stops or not according to the current running state of the agricultural push rod motor and the current value of the agricultural push rod motor every detection time to obtain a motor automatic stop detection result;

s5), establishing a motor driving module, wherein the motor driving module is used for providing a plurality of different basic driving functions for controlling the agricultural push rod motor; the method comprises the following steps that a plurality of different basic driving functions of an agricultural push rod motor comprise a motor extension control function, a motor retraction control function and a motor emergency stop control function;

s6), establishing a stroke judgment module, wherein the stroke judgment module is used for respectively calling a motor automatic stop detection result in the motor automatic stop detection module, a current Hall count value NowCount in the Hall count module, a total Hall count number totalcount of a completely extended agricultural push rod motor push rod in the Hall count module and a Hall set value SetCount in the stroke control interface module; the stroke judging module acquires the current push rod operation position of the agricultural push rod motor according to the current Hall counting value NowCount, the total Hall counting number totalcount for the push rod of the agricultural push rod motor to be completely stretched out and a Hall setting value SetCount, and judges whether to stop the agricultural push rod motor or change the operation direction of the agricultural push rod motor; the stroke judgment module judges whether to cut off the power supply of the agricultural push rod motor according to the motor automatic stop detection result obtained in the motor automatic stop detection module; obtaining a plurality of different judgment results; the travel judgment module respectively calls a plurality of different basic driving functions in the motor driving module according to a plurality of different judgment results, and drives and controls the agricultural push rod motor according to the called plurality of different basic driving functions in the motor driving module.

When the agricultural push rod motor rotates forwards, the waveform of the A-phase output signal leads the waveform of the B-phase output signal by a quarter period; when the agricultural push rod motor rotates reversely, the waveform of the A-phase output signal lags behind the waveform of the B-phase output signal by a quarter period.

Further, in step S2), a hall counting module is established according to the a-phase output signal and the B-phase output signal, recording the current Hall count value NowCount through a Hall counting module, obtaining the total Totalcount of the completely extended Hall count value of the push rod of the agricultural push rod motor, setting an interrupt program, triggering the interrupt program according to the high-low jump of an A-phase output signal, judging whether the A phase output signal is in rising edge interruption or falling edge interruption in the interruption program, and simultaneously judging whether the B phase output signal is in high level or low level, obtaining the simultaneous judgment results of the A phase output signal and the B phase output signal, judging whether the agricultural push rod motor rotates forwards or backwards according to the simultaneous judgment result of the A-phase output signal and the B-phase output signal to obtain a positive and negative rotation judgment result of the agricultural push rod motor, and adding 1 to or subtracting 1 from the current count value NowCount according to the positive and negative rotation judgment result of the agricultural push rod motor.

Further, triggering an interrupt program according to the high-low jump of the phase A output signal, judging whether the phase A output signal is in rising edge interrupt or falling edge interrupt in the interrupt program, judging whether the phase B output signal is in high level or low level at the same time, obtaining a simultaneous judgment result of the phase A output signal and the phase B output signal, judging whether the agricultural push rod motor rotates forwards or backwards according to the simultaneous judgment result of the phase A output signal and the phase B output signal, obtaining a positive and negative rotation judgment result of the agricultural push rod motor, and adding 1 to or subtracting 1 from a current count value NowCount according to the positive and negative rotation judgment result of the agricultural push rod motor, wherein the method comprises the following steps:

s21) triggering an interrupt program by the A-phase output signal, and clearing an interrupt flag bit;

s22) judging whether the A-phase output signal is in falling edge interruption or not, and if not, entering the step S24); if yes, go to step S23);

s23) judging whether the B-phase output signal is at high level, if so, the agricultural push rod motor rotates forwards, and the current count value NowCount is added with 1; if not, the agricultural push rod motor is in reverse rotation, and the current count value NowCount is subtracted by 1;

s24) judging whether the phase A output signal is in rising edge interruption or not, if not, exiting the interruption program; if yes, go to step S25);

s25) judging whether the B-phase output signal is at high level, if so, reversing the agricultural push rod motor, and subtracting 1 from the current count value NowCount; if not, the agricultural push rod motor rotates forwards, and the current count value NowCount is added with 1.

Further, in step S6), the stroke determining module respectively calls a plurality of different basic driving functions in the motor driving module according to a plurality of different determination results, and performs driving control on the agricultural push rod motor according to the called plurality of different basic driving functions in the motor driving module, including the following steps:

s61) obtaining a Hall set value SetCount in the stroke control interface module;

s62) judging whether the Hall set value SetCount is an emergency stop parameter, if so, carrying out emergency stop control on the agricultural push rod motor; if not, go to step S63);

s63) determining whether the hall setting value SetCount is a full retraction parameter, if so, performing full retraction control of the agricultural push rod motor; if not, go to step S64);

s64) judging whether the Hall set value SetCount is the total Totalcount of the Hall count of the completely extended push rod of the agricultural push rod motor, if so, controlling the completely extended push rod motor; if not, go to step S65);

s65) judging whether the Hall set value SetCount is more than or equal to NowCount-n and less than or equal to NowCount + n, wherein n is a counting allowable error value, if yes, controlling the critical state of the agricultural push rod motor; if not, go to step S66);

s66) determining whether the hall setting value SetCount is greater than the current hall count value NowCount or less than the current hall count value NowCount, if so, performing intermediate state control of the agricultural push rod motor; if not, ending the driving stroke control of the agricultural push rod motor.

Further, in step S62), performing the agricultural push rod motor emergency stop control, comprising the steps of:

s621) judging whether the current running state of the agricultural push rod motor is stopped, if so, entering the step S623); if not, go to step S622);

s622) calling and executing a motor emergency stop control function in the motor driving module, updating the running state of the agricultural push rod motor to a stop state, and entering the step S623);

s623) calculating and updating the current opening and closing degree of the push rod of the agricultural push rod motor, and ending the emergency stop control of the agricultural push rod motor.

Further, in step S63), performing full retraction control of the agricultural pusher motor, including the steps of:

s631) judging whether the agricultural push rod motor is automatically stopped or not according to the motor automatic stop detection result of the motor automatic stop detection module, if so, entering the step S632), and if not, entering the step S633);

s632) determining whether the current operation state of the agricultural push rod motor is stopped, if so, entering step S634); if not, calling and executing a motor emergency stop control function in the motor driving module, updating the running state of the agricultural push rod motor to a stop state, setting the current Hall count value NowCount as a counting allowable error value n, and entering step S634);

s633) judging whether the current operation state of the agricultural push rod motor is retracting, if yes, entering step S634); if not, calling and executing a motor retraction control function in the motor driving module, updating the running state of the agricultural push rod motor to be retracting, and entering step S634);

s634) ends the agricultural pusher motor full retraction control.

Further, in step S64), the agricultural push rod motor full extension control is performed, including the steps of:

s641) judging whether the agricultural push rod motor is automatically stopped or not according to the motor automatic stop detection result of the motor automatic stop detection module, if so, entering the step S642), and if not, entering the step S643);

s642) judging whether the current running state of the agricultural push rod motor is stopped, if so, entering the step S634); if not, calling and executing a motor emergency stop control function in the motor driving module, updating the running state of the agricultural push rod motor to a stop state, setting the current Hall count value NowCount as the total number totalcount of Hall counts for the push rod of the agricultural push rod motor to be completely stretched out, and entering step S644);

s643) judging whether the current running state of the agricultural push rod motor is extending, if yes, entering the step S644); if not, calling and executing a motor extension control function in the motor driving module, updating the running state of the agricultural push rod motor to be extended, and entering step S644);

s644) ends the agricultural pusher motor full-extension control.

Further, in step S65), the method for controlling the critical state of the agricultural push rod motor includes the following steps:

s651) judging whether the current running state of the agricultural push rod motor is stopped, if so, entering step S653); if not, go to step S652);

s652) calling and executing a motor emergency stop control function in the motor driving module, updating the running state of the agricultural push rod motor to a stop state, and entering step S653);

s653) setting an opening degree set value, calculating and updating the current opening degree of the push rod of the agricultural push rod motor, updating the current opening degree of the push rod of the agricultural push rod motor to the opening degree set value, and finishing the critical state control of the agricultural push rod motor.

Further, in step S66), the method for controlling the intermediate state of the agricultural push rod motor includes the following steps:

s661) determining whether the hall setting value SetCount is greater than the current hall count value NowCount, if so, proceeding to step S662); if not, go to step S663);

s662) judging whether the current running state of the agricultural push rod motor is extending, if so, entering the step S665); if not, calling and executing a motor extending control function in the motor driving module, updating the running state of the agricultural push rod motor to be extending, and entering step S665);

s663) determining whether the hall setting value SetCount is smaller than the current hall count value NowCount, if so, proceeding to step S664); if not, go to step S665);

s664) judging whether the current running state of the agricultural push rod motor is retracting, if so, entering step S665); if not, calling and executing a motor retraction control function in the motor driving module, updating the running state of the agricultural push rod motor to be retracting, and entering step S665);

s665) ending the intermediate state control of the agricultural push rod motor.

On the other hand, the invention provides an agricultural push rod motor stroke control system based on Hall counting, which comprises an agricultural push rod motor setting module, a stroke judging module, a Hall counting module, a motor automatic stop detection module, a motor driving module and a stroke control interface;

the device comprises an agricultural push rod motor setting module, a control module and a control module, wherein the agricultural push rod motor setting module is used for setting two Hall sensors on the periphery of a rotating shaft of an agricultural push rod motor, the two Hall sensors are respectively positioned on concentric circles of the rotating shaft of the agricultural push rod motor, and the two Hall sensors are perpendicular to each other and do not rotate along with the rotation of the agricultural push rod motor; a magnet is arranged on a rotating shaft of an agricultural push rod motor, the magnet does circular motion along with the rotation of the motor, and when the magnet rotates for one circle and is close to any one of two Hall sensors, any one Hall sensor is triggered to output a pulse signal; the outputs of the two Hall sensors are respectively recorded as an A-phase output signal and a B-phase output signal; when the agricultural push rod motor rotates forwards, the waveform of the A-phase output signal leads the waveform of the B-phase output signal by a quarter period; when the agricultural push rod motor rotates reversely, the waveform of the A-phase output signal lags behind the waveform of the B-phase output signal by a quarter period;

the Hall counting module is used for recording a current Hall counting value NowCount according to the phase A output signal and the phase B output signal and obtaining the total number totata lcount of Hall counting the push rod of the agricultural push rod motor which is completely stretched out;

the stroke control interface module is used for receiving the total number totalcount of Hall counts completely extending out of the push rod of the agricultural push rod motor and stroke control quantity sent by a user or a calling program, wherein the stroke control quantity is a percentage value of the extension length of the push rod of the agricultural push rod motor, and the stroke control quantity is converted into a corresponding Hall set value SetCount according to the total number totalcount of Hall counts completely extending out of the push rod of the agricultural push rod motor;

the motor automatic stop detection module is used for acquiring the current running state of the agricultural push rod motor and the current value of the agricultural push rod motor, setting detection time, and judging whether the agricultural push rod motor automatically stops or not according to the current running state of the agricultural push rod motor and the current value of the agricultural push rod motor every detection time to obtain a motor automatic stop detection result;

the motor driving module is used for providing a plurality of different basic driving functions for controlling the agricultural push rod motor; the plurality of different basic driving functions of the agricultural push rod motor comprise a motor push rod extension control function, a motor push rod retraction control function and a motor emergency stop control function;

the stroke judgment module is used for respectively calling a motor automatic stop detection result in the motor automatic stop detection module, a current Hall count value NowCount in the Hall count module, a total Hall count number totalcount of a push rod of an agricultural push rod motor in the Hall count module, and a Hall set value SetCount in the stroke control interface module; the stroke judging module acquires the current push rod operation position of the agricultural push rod motor according to the current Hall counting value NowCount, the total Hall counting number totalcount of the completely extended push rod of the agricultural push rod motor and the Hall setting value SetCount, and judges whether to stop the agricultural push rod motor or change the operation direction of the agricultural push rod motor; the stroke judgment module judges whether to cut off the power supply of the agricultural push rod motor according to the motor automatic stop detection result obtained in the motor automatic stop detection module; obtaining a plurality of different judgment results; the travel judgment module respectively and correspondingly calls a plurality of different basic driving functions in the motor driving module according to the plurality of different judgment results, and the agricultural push rod motor is driven and controlled according to the called plurality of different basic driving functions in the motor driving module.

The invention has the beneficial effects that: the invention solves the problem of the traditional push rod motor that the stroke is automatically controlled without power, so that the original mode that the stroke can be controlled only by manpower on site is changed into unattended automatic control, and then the accurate control and the remote control can be realized. The counting function of the invention selects two Hall sensors with single cost less than the RMB, and is very suitable for field agriculture sensitive to cost. Aiming at the characteristics of high humidity and dust in the agricultural field environment, the invention realizes a simple and reliable motor stroke control algorithm, and is suitable for popularization and application in field intelligent agriculture. The travel control method provided by the invention can be used as a single module, can be integrated into the existing agricultural gate controller to be used as an intelligent driving module, and is flexible in implementation mode. The characteristic of low cost and easy popularization of the invention enables the invention to play an important role in agricultural informatization, and can greatly improve the agricultural informatization level.

Drawings

In order to more clearly illustrate the technical solutions of the embodiments of the present invention, the drawings used in the embodiments are briefly described below, and it is obvious that the drawings in the following description are some embodiments of the present invention, and it is obvious for those skilled in the art to obtain other drawings without creative efforts.

Fig. 1 is a schematic flow chart of a hall counting-based agricultural push rod motor stroke control method according to a first embodiment of the present disclosure.

Fig. 2 is a schematic diagram of pulse waveforms output by two hall sensors when the motor operates according to the first embodiment.

Fig. 3 is a waveform diagram of a working example of the hall counting module according to the embodiment of the present invention.

Fig. 4 is a schematic diagram of a working flow of the hall counting module according to the first embodiment.

Fig. 5 is a schematic flow chart illustrating a driving control process of the agricultural push rod motor according to the first embodiment.

Fig. 6 is a schematic view of a flow of performing an emergency stop control of the agricultural push rod motor according to the first embodiment.

Fig. 7 is a schematic flow chart illustrating a control process for performing the complete retraction of the agricultural push rod motor according to the first embodiment.

Fig. 8 is a schematic view of a flow chart of a control process for fully extending the motor of the agricultural push rod according to the first embodiment.

Fig. 9 is a schematic flow chart illustrating a critical state control process of the agricultural push rod motor according to the first embodiment of the present invention.

Fig. 10 is a schematic flow chart illustrating a control process for performing an intermediate state of the agricultural push rod motor according to the first embodiment.

Fig. 11 is a schematic view of a hall counting-based agricultural push rod motor stroke control system according to a first embodiment of the present invention.

Detailed Description

In order to make the objects, technical solutions and advantages of the present invention more apparent, the present invention is further described in detail below with reference to the accompanying drawings. It should be understood that the detailed description and specific examples, while indicating the invention, are intended for purposes of illustration only and are not intended to limit the scope of the invention.

In a first aspect, a first embodiment of the present invention provides a method for controlling a stroke of an agricultural push rod motor based on hall counting, as shown in fig. 1, including the following steps:

s1) arranging two Hall sensors at the periphery of a rotating shaft of the agricultural push rod motor, wherein the two Hall sensors are respectively positioned on the concentric circles of the rotating shaft of the agricultural push rod motor, and the two Hall sensors are perpendicular to each other and do not rotate along with the rotation of the agricultural push rod motor; a magnet is arranged on a rotating shaft of an agricultural push rod motor, the magnet rotates along with the motor to do circular motion, and when the magnet rotates for one circle and is close to any one of two Hall sensors, any one Hall sensor can be triggered to output a pulse signal, and the outputs of the two Hall sensors are respectively recorded as an A-phase output signal and a B-phase output signal; when the agricultural push rod motor rotates forwards, the waveform of the A-phase output signal leads the waveform of the B-phase output signal by a quarter period; when the agricultural push rod motor rotates reversely, the waveform of the A-phase output signal lags behind the waveform of the B-phase output signal by a quarter period.

In the embodiment of the invention, two Hall sensors are additionally arranged on an agricultural push rod motor and are respectively arranged at 12 o 'clock and 3 o' clock positions of a concentric circle of a motor rotating shaft, namely the two Hall sensors are vertically arranged at an angle of 90 degrees, and pulse waveforms output by the two Hall sensors when the motor is operated after the two Hall sensors are arranged are shown in figure 2. The outputs of the two hall sensors are respectively defined as an a-phase output signal and a B-phase output signal, as can be seen from fig. 2, when the motor rotates forwards, the a-phase waveform advances by a quarter period compared with the B-phase, and when the a-phase output signal waveform is a falling edge, the B-phase output signal is necessarily high level, and when the a-phase output signal waveform is a rising edge, the B-phase output signal is necessarily low level; when the motor rotates reversely, the waveform of the A-phase output signal lags behind the waveform of the B-phase output signal by a quarter period, the B-phase output signal is necessarily at a low level when the waveform of the A-phase output signal is at a falling edge, and the B-phase output signal is necessarily at a high level when the waveform of the A-phase output signal is at a rising edge.

S2) establishing a Hall counting module according to the A-phase output signal and the B-phase output signal, recording the current Hall counting value NowCount through the Hall counting module, and obtaining the total Totalcount of the completely extended Hall counting of the push rod of the agricultural push rod motor;

in step S2), a hall count module is established based on the a-phase output signal and the B-phase output signal, the current Hall counting value NowCount is recorded through a Hall counting module, the total number tota lcount of the Hall counting of the completely extended push rod of the agricultural push rod motor is obtained, an interrupt program is set, the interrupt program is triggered according to the high-low jump of an A-phase output signal, judging whether the A phase output signal is in rising edge interruption or falling edge interruption in the interruption program, and simultaneously judging whether the B phase output signal is in high level or low level, obtaining the simultaneous judgment results of the A phase output signal and the B phase output signal, judging whether the agricultural push rod motor rotates forwards or backwards according to the simultaneous judgment result of the A-phase output signal and the B-phase output signal to obtain a positive and negative rotation judgment result of the agricultural push rod motor, and adding 1 to or subtracting 1 from the current count value NowCount according to the positive and negative rotation judgment result of the agricultural push rod motor.

Triggering an interrupt program according to the high-low jump of the phase A output signal, simultaneously judging whether the phase A output signal is a rising edge and whether the phase B output signal is a high-low level in the interrupt program, obtaining a simultaneous judgment result of the phase A output signal and the phase B output signal, judging whether the agricultural push rod motor rotates forwards according to the simultaneous judgment result of the phase A output signal and the phase B output signal, obtaining a forward rotation judgment result of the agricultural push rod motor, and adding 1 to or subtracting 1 from a current count value NowCount according to the forward rotation judgment result of the agricultural push rod motor, as shown in FIG. 4, the method comprises the following steps:

s21) triggering an interrupt program by the A-phase output signal, and clearing an interrupt flag bit;

s22) judging whether the A-phase output signal is in falling edge interruption or not, and if not, entering the step S24); if yes, go to step S23);

s23) judging whether the B-phase output signal is at high level, if so, the agricultural push rod motor rotates forwards, and the current count value NowCount is added with 1; if not, the agricultural push rod motor is in reverse rotation, and the current count value NowCount is subtracted by 1;

s24) judging whether the phase A output signal is in rising edge interruption or not, if not, exiting the interruption program; if yes, go to step S25);

s25) judging whether the B-phase output signal is at high level, if so, reversing the agricultural push rod motor, and subtracting 1 from the current count value NowCount; if not, the agricultural push rod motor rotates forwards, and the current count value NowCount is added with 1; and exiting the interrupt program.

The working principle of the Hall counting module is that the interruption is triggered by the high-low jump of the A-phase output signal, whether the A-phase output signal is a rising edge or a falling edge and the level of the B-phase output signal are judged simultaneously in an interruption program, the current counting value NowCount is added with 1 when the judgment combination of the A-phase output signal and the falling edge accords with the forward rotation characteristic, and the current counting value NowCount is subtracted with 1 when the judgment combination of the A-phase output signal and the falling edge accords with the reverse rotation characteristic.

Fig. 3 is a schematic diagram of a working flow of the hall counting module in the embodiment of the present invention, in which intervals 1-4 and 13-16 respectively represent the forward rotation of the motor, and the current count value NowCount is increased; the interval of 9-12 is motor reverse rotation, and the current count value NowCount is reduced; the interval of 5-8 is the condition that the A phase output signal is interfered and jitters, at the moment, the counting value NowCount is increased and then reduced, and finally the interference is counteracted; the interval 12-13 is that the B phase output signal is interfered, and the A phase output signal has no jump, so that the current count value NowCount is unchanged, and the anti-interference effect can be achieved by the invention.

S3), establishing a stroke control interface module, wherein the stroke control interface module is used for receiving the total totalcount of the Hall count of the completely extended push rod of the agricultural push rod motor and the stroke control quantity sent by a user or a calling program, the stroke control quantity is the percentage value of the extension length of the push rod of the agricultural push rod motor, and the stroke control quantity is converted into a corresponding Hall set value SetCount according to the total totalcount of the completely extended push rod of the agricultural push rod motor;

s4), establishing a motor automatic stop detection module, wherein the motor automatic stop detection module is used for acquiring the current running state of the agricultural push rod motor and the current value of the agricultural push rod motor, setting detection time, and judging whether the agricultural push rod motor automatically stops or not according to the current running state of the agricultural push rod motor and the current value of the agricultural push rod motor every detection time to obtain a motor automatic stop detection result;

in the embodiment of the invention, the motor automatic stop detection module judges whether the motor is automatically stopped because the push rod limit switch is triggered by complete extension or complete retraction according to the recorded current running state (whether the motor is running) of the motor and the current value of the motor, the detection is carried out once every second, and the detection result is called by the stroke judgment module.

S5), establishing a motor driving module, wherein the motor driving module is used for providing a plurality of different basic driving functions for controlling the agricultural push rod motor; the method comprises the following steps that a plurality of different basic driving functions of an agricultural push rod motor comprise a motor extension control function, a motor retraction control function and a motor emergency stop control function;

s6), establishing a stroke judgment module, wherein the stroke judgment module is used for respectively calling a motor automatic stop detection result in the motor automatic stop detection module, a current Hall count value NowCount in the Hall count module, a total Hall count number totalcount of a completely extended agricultural push rod motor push rod in the Hall count module and a Hall set value SetCount in the stroke control interface module; the stroke judging module acquires the current push rod operation position of the agricultural push rod motor according to the current Hall counting value NowCount, the total Hall counting number totalcount for the push rod of the agricultural push rod motor to be completely stretched out and a Hall setting value SetCount, and judges whether to stop the agricultural push rod motor or change the operation direction of the agricultural push rod motor; the stroke judgment module judges whether to cut off the power supply of the agricultural push rod motor according to the motor automatic stop detection result obtained in the motor automatic stop detection module; obtaining a plurality of different judgment results; the travel judgment module respectively calls a plurality of different basic driving functions in the motor driving module according to a plurality of different judgment results, and drives and controls the agricultural push rod motor according to the called plurality of different basic driving functions in the motor driving module.

In step S6), the stroke determining module respectively calls a plurality of different basic driving functions in the motor driving module according to a plurality of different determination results, and performs driving control on the agricultural push rod motor according to the called plurality of different basic driving functions in the motor driving module, as shown in fig. 5, including the following steps:

s61) obtaining a Hall set value SetCount in the stroke control interface module;

s62) judging whether the Hall set value SetCount is an emergency stop parameter, wherein the emergency stop parameter is 0xFF in the embodiment of the invention, if so, performing emergency stop control on the agricultural push rod motor; if not, go to step S63);

in step S62), the agricultural push rod motor scram control is performed, as shown in fig. 6, including the steps of:

s621) judging whether the current running state of the agricultural push rod motor is stopped, if so, entering the step S623); if not, go to step S622);

s622) calling and executing a motor emergency stop control function in the motor driving module, updating the running state of the agricultural push rod motor to a stop state, and entering the step S623);

s623) calculating and updating the current opening and closing degree of the push rod of the agricultural push rod motor, and ending the emergency stop control of the agricultural push rod motor.

S63) determining whether the hall setting value SetCount is a full retraction parameter, in the embodiment of the present invention, the scram parameter is 0x00, if so, performing full retraction control of the agricultural push rod motor; if not, go to step S64);

in step S63), the agricultural pusher motor full-retraction control is performed, as shown in fig. 7, including the steps of:

s631) judging whether the agricultural push rod motor is automatically stopped or not according to the motor automatic stop detection result of the motor automatic stop detection module, if so, entering the step S632), and if not, entering the step S633);

s632) determining whether the current operation state of the agricultural push rod motor is stopped, if so, entering step S634); if not, calling and executing a motor emergency stop control function in the motor driving module, updating the running state of the agricultural push rod motor to a stop state, setting the current Hall count value NowCount as a counting allowable error value n, and entering step S634);

s633) judging whether the current operation state of the agricultural push rod motor is retracting, if yes, entering step S634); if not, calling and executing a motor retraction control function in the motor driving module, updating the running state of the agricultural push rod motor to be retracting, and entering step S634);

s634) ends the agricultural pusher motor full retraction control.

S64) judging whether the Hall set value SetCount is the total Totalcount of the Hall count of the completely extended push rod of the agricultural push rod motor, if so, controlling the completely extended push rod motor; if not, go to step S65);

in step S64), the agricultural pusher motor full-extension control is performed, as shown in fig. 8, including the steps of:

s641) judging whether the agricultural push rod motor is automatically stopped or not according to the motor automatic stop detection result of the motor automatic stop detection module, if so, entering the step S642), and if not, entering the step S643);

s642) judging whether the current running state of the agricultural push rod motor is stopped, if so, entering the step S634); if not, calling and executing a motor emergency stop control function in the motor driving module, updating the running state of the agricultural push rod motor to a stop state, setting the current Hall count value NowCount as the total number totalcount of Hall counts for the push rod of the agricultural push rod motor to be completely stretched out, and entering step S644);

s643) judging whether the current running state of the agricultural push rod motor is extending, if yes, entering the step S644); if not, calling and executing a motor extension control function in the motor driving module, updating the running state of the agricultural push rod motor to be extended, and entering step S644);

s644) ends the agricultural pusher motor full-extension control.

S65) determining whether the hall setting SetCount is greater than or equal to NowCount-n and less than or equal to NowCount + n, where n is a count tolerance value, and in the embodiment of the present invention, the count tolerance value n is 3, and if so, performing critical state control on the agricultural push rod motor; if not, go to step S66);

in step S65), critical state control of the agricultural push rod motor is performed, as shown in fig. 9, including the steps of:

s651) judging whether the current running state of the agricultural push rod motor is stopped, if so, entering step S653); if not, go to step S652);

s652) calling and executing a motor emergency stop control function in the motor driving module, updating the running state of the agricultural push rod motor to a stop state, and entering step S653);

s653) setting an opening degree set value, calculating and updating the current opening degree of the push rod of the agricultural push rod motor, updating the current opening degree of the push rod of the agricultural push rod motor to the opening degree set value, and finishing the critical state control of the agricultural push rod motor.

S66) determining whether the hall setting value SetCount is greater than the current hall count value NowCount or less than the current hall count value NowCount, if so, performing intermediate state control of the agricultural push rod motor; if not, ending the driving stroke control of the agricultural push rod motor.

In step S66), the intermediate state control of the agricultural pusher motor is performed, as shown in fig. 10, including the steps of:

s661) determining whether the hall setting value SetCount is greater than the current hall count value NowCount, if so, proceeding to step S662); if not, go to step S663);

s662) judging whether the current running state of the agricultural push rod motor is extending, if so, entering the step S665); if not, calling and executing a motor extending control function in the motor driving module, updating the running state of the agricultural push rod motor to be extending, and entering step S665);

s663) determining whether the hall setting value SetCount is smaller than the current hall count value NowCount, if so, proceeding to step S664); if not, go to step S665);

s664) judging whether the current running state of the agricultural push rod motor is retracting, if so, entering step S665); if not, calling and executing a motor retraction control function in the motor driving module, updating the running state of the agricultural push rod motor to be retracting, and entering step S665);

s665) ending the intermediate state control of the agricultural push rod motor.

In the embodiment of the present invention, according to the size of the hall setting value SetCount, the stroke control of the motor is divided into 5 cases: scram control, full retraction control, full extension control, critical state control, intermediate state control, the execution sequence and execution mode of 5 cases are as follows:

and (4) performing sudden stop control. If the Hall set value SetCount transmitted by the stroke control interface module is 0xFF, entering an emergency stop control program (see figure 6), firstly judging whether the current running state (totally recording 3 states of stopping, extending and retracting) of the motor is a stopping state, if so, calculating and updating the current opening and closing degree of the push rod; if not, immediately executing a motor emergency stop control function to control the motor to stop running, then sequentially updating the current running state of the motor to be stop, calculating and updating the current opening and closing degree of the push rod, and finally ending the motor emergency stop control.

Full retraction control. When the hall setting value SetCount sent by the stroke control interface module is 0, a full retraction control process (see fig. 7) is executed, and the process mainly judges whether to execute a motor full retraction function according to whether the motor is automatically stopped and the current running state of the motor recorded by a program. If the motor is automatically stopped and the current running state of the motor is also stopped, directly ending the full retraction control; if not, the current running state of the motor is updated to be stopped or retracting, wherein when the motor is completely retracted, zero returning processing is also carried out on the current count value NowCount. In the embodiment of the present invention, the return-to-zero is not set to 0 but set to 3.

Fully extended control. When the hall setting value SetCount transmitted from the stroke control interface module is totalcount, a complete extension control process is executed (see fig. 8), the execution process of the complete extension control is similar to the complete retraction process, except that the process may call a motor extension function, the current operation state of the motor may be updated to stop or extending, and when the push rod is completely extended, the current counting value NowCount is also set to be maximum, that is, the value is set to totalcount.

And controlling the critical state. When the hall set value SetCount sent by the stroke control interface module is greater than or equal to (NowCount-3) and less than or equal to (NowCount +3), a critical state control process (see fig. 9) is executed, the critical state control is directed to the situation that the motor is about to run to the set opening degree, the invention considers that the motor has run to the set stroke when the difference between the hall set value SetCount and the actual value is within 3, a stop function is executed, the relevant state is updated, and if the current running state of the motor is stop, the critical state control is ended.

And (5) intermediate state control. When the hall setting value SetCount sent by the stroke control interface module is greater than or less than NowCount, an intermediate state control process (see fig. 10) is executed, and the intermediate state control process is mainly used for judging whether the current operation direction of the motor should be changed, so that a motor extending function or a motor retracting function is called, and the current operation state of the motor is changed into extending or retracting.

Except that the sequence of the complete retraction control and the complete extension control can be exchanged in the above 5 control flows, the other control flows are executed according to the sequence in the flow chart, and the stroke control of the motor can be realized by the infinite loop operation of the whole flow shown in fig. 5.

On the other hand, the embodiment of the invention provides an agricultural push rod motor stroke control system based on hall counting, as shown in fig. 11, the agricultural push rod motor stroke control system comprises an agricultural push rod motor setting module, a stroke judging module, a hall counting module, a motor automatic stop detection module, a motor driving module and a stroke control interface;

the device comprises an agricultural push rod motor setting module, a control module and a control module, wherein the agricultural push rod motor setting module is used for setting two Hall sensors on a rotating shaft of an agricultural push rod motor, the two Hall sensors are respectively positioned on a concentric circle of the rotating shaft of the agricultural push rod motor, and the two Hall sensors are mutually vertical and do not rotate along with the rotation of the motor; a magnet is arranged on a motor rotating shaft, the magnet does circular motion along with the rotation of the motor, and each circle of rotation is close to any one Hall sensor to trigger the Hall sensor to output a pulse signal; the outputs of the two Hall sensors are respectively recorded as an A-phase output signal and a B-phase output signal; when the agricultural push rod motor rotates forwards, the waveform of the A-phase output signal leads the waveform of the B-phase output signal by a quarter period; when the agricultural push rod motor rotates reversely, the waveform of the A-phase output signal lags behind the waveform of the B-phase output signal by a quarter period;

the Hall counting module is used for recording a current Hall counting value NowCount according to the phase A output signal and the phase B output signal and obtaining the total number totata lcount of Hall counting the push rod of the agricultural push rod motor which is completely stretched out;

the stroke control interface module is used for receiving the total number totalcount of Hall counts completely extending out of the push rod of the agricultural push rod motor and stroke control quantity sent by a user or a calling program, wherein the stroke control quantity is a percentage value of the extension length of the push rod of the agricultural push rod motor, and the stroke control quantity is converted into a corresponding Hall set value SetCount according to the total number totalcount of Hall counts completely extending out of the push rod of the agricultural push rod motor;

the motor automatic stop detection module is used for acquiring the current running state of the agricultural push rod motor and the current value of the agricultural push rod motor, setting detection time, and judging whether the agricultural push rod motor automatically stops or not according to the current running state of the agricultural push rod motor and the current value of the agricultural push rod motor every detection time to obtain a motor automatic stop detection result;

the motor driving module is used for providing a plurality of different basic driving functions for controlling the agricultural push rod motor; the method comprises the following steps that a plurality of different basic driving functions of an agricultural push rod motor comprise a motor extension control function, a motor retraction control function and a motor emergency stop control function;

the stroke judging module is used for respectively calling a motor automatic stop detection result in the motor automatic stop detection module, a current Hall counting value NowCount in the Hall counting module, a total Hall counting number totalcount of a push rod of an agricultural push rod motor in the Hall counting module, and a Hall set value SetCount in the stroke control interface module; the stroke judging module acquires the current push rod operation position of the agricultural push rod motor according to the current Hall counting value NowCount, the total Hall counting number totalcount for the push rod of the agricultural push rod motor to be completely stretched out and a Hall setting value SetCount, and judges whether to stop the agricultural push rod motor or change the operation direction of the agricultural push rod motor; the stroke judgment module judges whether to cut off the power supply of the agricultural push rod motor according to the motor automatic stop detection result obtained in the motor automatic stop detection module; obtaining a plurality of different judgment results; the travel judgment module respectively calls a plurality of different basic driving functions in the motor driving module according to a plurality of different judgment results, and drives and controls the agricultural push rod motor according to the called plurality of different basic driving functions in the motor driving module.

By adopting the technical scheme disclosed by the invention, the following beneficial effects are obtained:

the invention solves the problem that the traditional push rod motor can not automatically control the stroke, so that the original mode that the stroke can only be controlled manually on site is changed into unattended automatic control, and then accurate control and remote control can be realized. The counting function of the invention selects two Hall sensors with single cost less than the RMB, and is very suitable for field agriculture sensitive to cost. Aiming at the characteristics of high humidity and dust in the agricultural field environment, the invention realizes a simple and reliable motor stroke control algorithm, and is suitable for popularization and application in field intelligent agriculture. The travel control method provided by the invention can be used as a single module, can be integrated into the existing agricultural gate controller to be used as an intelligent driving module, and is flexible in implementation mode. The characteristic of low cost and easy popularization of the invention enables the invention to play an important role in agricultural informatization, and can greatly improve the agricultural informatization level.

The foregoing is only a preferred embodiment of the present invention, and it should be noted that it will be apparent to those skilled in the art that various modifications and improvements can be made without departing from the principle of the present invention, and such modifications and improvements should also be considered within the scope of the present invention.

26页详细技术资料下载
上一篇:一种医用注射器针头装配设备
下一篇:一种开关磁阻电机断路故障容错控制方法

网友询问留言

已有0条留言

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

精彩留言,会给你点赞!