Window cleaning robot speed detection method and related device
By using single-phase Hall sensors and/or single-phase photoelectric sensors to replace dual-phase sensors, and combining pulse signal frequency calculation, the problem of high cost and low efficiency in speed detection of window cleaning robots is solved, achieving high-precision and high-reliability speed detection.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- WINDOW CLEAN TECHNOLOGY (SUZHOU) CO LTD
- Filing Date
- 2026-03-17
- Publication Date
- 2026-05-12
AI Technical Summary
Speed detection for window cleaning robots relies on complex sensors and detection algorithms, resulting in high costs and low efficiency.
By replacing dual-phase sensors with single-phase Hall effect sensors and/or single-phase photoelectric sensors, high-precision and high-reliability detection of the speed of the window cleaning robot can be achieved through pulse frequency calculation based on pulse signals and time windows.
It reduces the cost of speed detection for window cleaning robots, improves detection efficiency and accuracy, and simplifies system complexity.
Smart Images

Figure CN122017275A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of cleaning technology, and in particular to a method and device for detecting the speed of a window cleaning robot. Background Technology
[0002] Window cleaning robots, as a typical example of cleaning tools, are widely used in homes, office buildings, shopping malls and other scenarios.
[0003] The control system of a window cleaning robot needs to monitor its speed in real time. Precise speed adjustment ensures that the window cleaning robot maintains its balance in complex environments, avoids slipping, and achieves accurate path planning and cleaning coverage.
[0004] Currently, speed monitoring in control systems largely relies on complex sensors and detection algorithms, resulting in high costs and low efficiency for speed detection in window cleaning robots. Summary of the Invention
[0005] This application provides a method and related apparatus for detecting the speed of a window cleaning robot, which can reduce the high cost of detecting the speed of a window cleaning robot and improve the detection efficiency.
[0006] In a first aspect, embodiments of this application provide a method for detecting the speed of a window cleaning robot, including:
[0007] Acquire the pulse signal from the detection sensor; the detection sensor includes a single-phase Hall sensor and / or a single-phase photoelectric sensor;
[0008] Based on the pulse signal, determine the pulse quantity increment per unit time;
[0009] The speed of the window cleaning robot is determined based on the pulse count increment and the preset reduction ratio of the window cleaning robot motor.
[0010] In some embodiments, the detection sensor is a single-phase Hall sensor, and determining the speed of the window cleaning robot based on the pulse count increment and the preset reduction ratio of the window cleaning robot motor includes:
[0011] Based on the current directional state, determine the sign of the pulse quantity increment to obtain the target pulse increment; the sign can be positive or negative.
[0012] The speed of the window cleaning robot is determined based on the target pulse increment, the preset reduction ratio of the motor, and the wheel circumference of the window cleaning robot.
[0013] In some embodiments, determining the speed of the window cleaning robot based on the target pulse increment, the preset reduction ratio of the motor, and the wheel circumference of the window cleaning robot includes:
[0014] The first product of the target pulse increment and the wheel circumference of the window cleaning robot is determined, as well as the second product of the preset reduction ratio of the motor, the duration of the unit time, and the number of pulses per revolution of the single-phase Hall sensor;
[0015] The ratio of the first product to the second product is taken as the speed of the window cleaning robot.
[0016] In some embodiments, before determining the pulse number increment per unit time, the method further includes:
[0017] The pulse signal is subjected to overflow detection, and / or the pulse signal is subjected to loss detection;
[0018] If pulse signal overflow and / or pulse signal loss are detected, an alarm message is output and the window cleaning robot is controlled to enter a safe mode.
[0019] In some embodiments, the detection sensor is a single-phase photoelectric sensor, and determining the speed of the window cleaning robot based on the pulse count increment and the preset reduction ratio of the window cleaning robot motor includes:
[0020] The number of rotations of the window cleaning robot's wheels per unit time is determined based on the pulse quantity increment and the preset reduction ratio of the motor.
[0021] The speed of the window cleaning robot is determined based on the number of rotations, the wheel circumference of the window cleaning robot, and the environmental compensation factor.
[0022] In some embodiments, determining the speed of the window cleaning robot based on the number of rotations, the wheel circumference of the window cleaning robot, and an environmental compensation factor includes:
[0023] The travel distance of the window cleaning robot is determined based on the number of rotations and the wheel circumference of the window cleaning robot.
[0024] The initial speed of the window cleaning robot is determined based on the travel distance and the duration of the unit time.
[0025] The initial velocity is compensated based on the environmental compensation factor to determine the speed of the window cleaning robot.
[0026] In some embodiments, determining the pulse quantity increment per unit time based on the pulse signal includes:
[0027] Pulse signals whose time interval is outside the preset time interval range are excluded;
[0028] Determine whether the current pulse count deviates from the median of historical pulse counts by more than a preset deviation;
[0029] If not, then the pulse count increment is determined based on the current pulse count and the pulse count at the previous moment;
[0030] If so, the pulse count increment is determined based on the median of the historical pulse counts and the pulse count at the previous moment.
[0031] In some embodiments, before acquiring the pulse signal from the detection sensor, the method further includes:
[0032] Obtain ambient light intensity;
[0033] The brightness of the single-phase photoelectric sensor is adjusted according to the ambient light intensity, and the environmental compensation factor is determined according to the ambient light intensity.
[0034] In some embodiments, the detection sensor includes a single-phase photoelectric sensor and a single-phase Hall sensor, and determining the speed of the window cleaning robot based on the pulse number increment and the preset reduction ratio of the window cleaning robot motor includes:
[0035] Based on the pulse number increment and the preset deceleration ratio of the window cleaning robot motor, the first speed of the window cleaning robot detected by the single-phase photoelectric sensor and the second speed of the window cleaning robot detected by the single-phase Hall sensor are determined respectively.
[0036] Time alignment of the first speed and the second speed;
[0037] The speed of the window cleaning robot is obtained by fusing the first speed and the second speed, which are aligned in time.
[0038] Secondly, embodiments of this application provide an electronic device, including a processor, a transceiver, and a memory; the processor is communicatively connected to both the transceiver and the memory.
[0039] The memory stores computer-executed instructions;
[0040] The transceiver communicates and interacts with external devices.
[0041] The processor executes computer execution instructions stored in the memory, causing the processor to perform the first aspect and / or various possible implementations of the first aspect as described above.
[0042] Thirdly, this application provides a computer-readable storage medium having a computer program stored thereon, the computer program being executed by a processor to implement the method of any of the first aspects.
[0043] Fourthly, this application provides a computer program product, including a computer program that, when executed by a processor, implements the method of any one of the first aspects.
[0044] This application provides a method and related apparatus for detecting the speed of a window cleaning robot. The method involves acquiring pulse signals from a detection sensor, including a single-phase Hall effect sensor and / or a single-phase photoelectric sensor. Based on the pulse signals, the incremental number of pulses per unit time is determined. The speed of the window cleaning robot is then determined based on the incremental number of pulses and a preset reduction ratio of the robot's motor. This solution utilizes the pulse signals output by the single-phase Hall effect sensor and / or the single-phase photoelectric sensor, combined with pulse frequency calculations within a time window, to achieve high-precision and high-reliability detection of the window cleaning robot's speed. This effectively reduces the cost and system complexity of the window cleaning robot. Attached Figure Description
[0045] The accompanying drawings, which are incorporated in and form part of this specification, illustrate embodiments consistent with this application and, together with the description, serve to explain the principles of this application.
[0046] Figure 1 A schematic diagram of the architecture of a window cleaning robot provided in this application embodiment. Figure 1 ;
[0047] Figure 2 A schematic diagram of a pulse signal provided in an embodiment of this application;
[0048] Figure 3 A schematic diagram of the architecture of a window cleaning robot provided in this application embodiment. Figure 2 ;
[0049] Figure 4 The flowchart of a window cleaning robot speed detection method provided in this application embodiment is as follows: Figure 1 ;
[0050] Figure 5 The flowchart of a window cleaning robot speed detection method provided in this application embodiment is as follows: Figure 2 ;
[0051] Figure 6 A flowchart illustrating a window cleaning robot speed detection method provided in this application embodiment. Figure 3 ;
[0052] Figure 7 A flowchart illustrating a control method for a window cleaning robot provided in this application embodiment. Figure 1 ;
[0053] Figure 8 A flowchart illustrating a control method for a window cleaning robot provided in this application embodiment. Figure 2 ;
[0054] Figure 9 This is a schematic diagram of the structure of an electronic device provided in an embodiment of this application.
[0055] The accompanying drawings illustrate specific embodiments of this application, which will be described in more detail below. These drawings and descriptions are not intended to limit the scope of the concept in any way, but rather to illustrate the concept of this application to those skilled in the art through reference to particular embodiments. Detailed Implementation
[0056] To make the objectives, technical solutions, and advantages of the embodiments of this application clearer, the technical solutions of the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this application, not all embodiments. Based on the embodiments of this application, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this application.
[0057] In the embodiments of this application, the terms "first" and "second" are used to distinguish identical or similar items with essentially the same function and effect, without limiting their order. Those skilled in the art will understand that the terms "first" and "second" do not limit the quantity or execution order, and that the terms "first" and "second" do not necessarily imply that they are different.
[0058] It should be noted that, in the embodiments of this application, the terms "exemplary" or "for example" are used to indicate examples, illustrations, or descriptions. Any embodiment or design scheme described as "exemplary" or "for example" in this application should not be construed as being more preferred or advantageous than other embodiments or design schemes. Specifically, the use of terms such as "exemplary" or "for example" is intended to present the relevant concepts in a specific manner.
[0059] As the core component of a window cleaning robot, the precise control of the motor speed (also known as motor rotation speed, motor output shaft speed, etc.) directly affects the robot's movement trajectory, cleaning efficiency, and safety. For example, if the glass surface is tilted at a large angle, inaccurate motor speed control may cause the robot to slip.
[0060] In related technologies, window cleaning robots often use AB dual-phase Hall effect sensors or dual-phase photoelectric sensors to detect the motor speed and then calculate the robot's speed to achieve precise control. However, such solutions require additional dual-phase sensors, leading to a significant increase in hardware costs.
[0061] In addition, using AB phase detection requires two MCU pins, which increases the complexity of PCB routing and software processing.
[0062] To address the aforementioned issues, this application provides a method and related apparatus for detecting the speed of a window cleaning robot. It replaces traditional dual-phase Hall sensors or dual-phase photoelectric sensors with single-phase Hall sensors and / or single-phase photoelectric sensors. By utilizing the pulse signals output by the single-phase Hall sensors and / or single-phase photoelectric sensors, and combining this with pulse frequency calculations within a time window, high-precision and high-reliability detection of the window cleaning robot's speed is achieved. This effectively reduces the cost and system complexity of the window cleaning robot.
[0063] The technical solution of this application and how the technical solution of this application solves the above-mentioned technical problems are described in detail below with specific embodiments. These specific embodiments can be combined with each other, and the same or similar concepts or processes may not be described again in some embodiments. The embodiments of this application will now be described with reference to the accompanying drawings.
[0064] Figure 1 This is a schematic diagram of the architecture of a window cleaning robot provided in an embodiment of this application, as shown below. Figure 1 As shown:
[0065] The window cleaning robot 100 includes a drive system 101, a single-phase Hall sensor 102, and a controller 103, which is connected to the drive system 101 and the single-phase Hall sensor 102 respectively.
[0066] like Figure 1 As shown, the drive system 101 includes a motor 1011, the output shaft of which is connected to a magnetic ring 1022 configured with a single-phase Hall sensor 102. The magnetic ring 1022 rotates synchronously with the output shaft of the motor 1011. For example, the magnetic ring 1022 can be fixed on the output shaft of the motor 1011.
[0067] The magnetic ring 1022 has a south pole (S pole) and a north pole (N pole). During synchronous rotation of the magnetic ring 1022 and the output shaft of the motor 1011, when the S pole on the magnetic ring 1022 approaches the Hall element 1021 in the single-phase Hall sensor 102, the Hall element 1021 generates a Hall voltage. The magnitude of the Hall voltage generated by the Hall element 1021 continuously varies with the magnetic field strength. The stronger the magnetic field, the higher the Hall voltage; the weaker the magnetic field, the lower the Hall voltage.
[0068] When the signal trigger 1023 in the single-phase Hall sensor 102 detects that the Hall element 1021 generates a Hall voltage, it generates a pulse signal according to the magnitude of the Hall voltage and sends the pulse signal to the controller 103.
[0069] After receiving the pulse signal, the controller 103 can determine the speed of the motor 1011 based on the pulse signal. Then, the controller 103 can control the movement of the window cleaning robot 100 based on the rotation direction of the motor 1011.
[0070] For example, motor 1011 can be a motor of any power and structure, such as a DC motor. The output shaft of motor 1011 is the main shaft of the motor rotor and can output mechanical energy.
[0071] The single-phase Hall sensor 102 can refer to a unipolar Hall effect sensor (also known as a unipolar Hall switch). It is a magnetically sensitive electronic component based on the Hall effect, whose output state is determined solely by the magnetic field strength of a single magnetic pole (such as the S pole).
[0072] The magnetic ring 1022 (also known as a magnetic code disk) is a component that can work in conjunction with the single-phase Hall sensor 102. The magnetic ring 1022 can be understood as a disk or ring structure that rotates synchronously with the output shaft of the motor 1011, in which S pole and N pole can be set to change the output state of the single-phase Hall sensor 102.
[0073] The controller 103 can be an electronic control unit for receiving pulse signals and determining the direction of motor rotation, and can be integrated into the main control module of the window cleaning robot 100. For example, the controller 103 can be a microcontroller or a microprocessor.
[0074] For example, the window cleaning robot 100 drives the magnetic ring 1022 to rotate synchronously via the motor 1011 in the drive system 101. The S pole and N pole on the magnetic ring 1022 periodically approach the Hall element 1021 of the Hall sensor 102 to change the output state of the single-phase Hall sensor 102.
[0075] For example, when the S pole is close to the Hall element 1021, the magnetic field strength increases, and the Hall element 1021 generates a gradually increasing Hall voltage. When the S pole is away from the Hall element 1021 (and the N pole is close), the generated Hall voltage gradually decreases.
[0076] When the signal trigger 1023 detects that the Hall voltage is higher than the preset signal turn-on voltage, it generates an active or inactive level. When the signal trigger 1023 detects that the Hall voltage is lower than the preset signal turn-off voltage, it generates a level opposite to the level when the Hall voltage is higher than the preset signal turn-on voltage.
[0077] Valid and invalid voltage levels can be understood as an opposite pair of voltage levels. For example, if a high voltage level is preset as the valid level, then a low voltage level is the invalid level; conversely, if a high voltage level is preset as the invalid level, then a low voltage level is the valid level. If the voltage level is valid when the source (S) terminal is close to the Hall element 1021, then it is invalid when the source (S) terminal is far away from the Hall element 1021; conversely, if the voltage level is invalid when the source (S) terminal is close to the Hall element 1021, then it is valid when the source (S) terminal is far away from the Hall element 1021.
[0078] The signal trigger 1023 can generate a pulse signal based on whether the source (S) terminal is close to or far from the Hall element 1021. For example, when the pulse signal generated by the signal trigger 1023 is an alternating high level and low level, the high level can be preset as the active level and the low level as the inactive level; or the low level can be preset as the active level and the high level as the inactive level.
[0079] After the signal trigger 1023 generates a pulse signal that alternates between high and low levels, it can be synchronously input to the controller 103 for analysis and processing. For example, the controller 103 analyzes the frequency of the pulse signal to determine the speed (also known as rotational speed) of the motor 1011, and determines the speed of the window cleaning robot based on the speed of the motor 1011 to control the movement of the window cleaning robot 100.
[0080] Figure 2 This is a schematic diagram of a pulse signal provided in an embodiment of this application, as shown below. Figure 2 The image shows a received pulse signal, consisting of multiple high and low levels. If the pulse generated by the magnetic ring 1022 rotating one full revolution includes 5 high levels (active levels) and 5 low levels (inactive levels), then one pulse unit can represent the magnetic ring 1022 rotating one full revolution. Therefore, it can be understood that every 5 high levels and 5 low levels represent the magnetic ring 1022 rotating one full revolution, which is also the output shaft rotating one full revolution.
[0081] After determining the speed of the window cleaning robot, the controller 103 can adjust the working state of the drive system 101 to control the movement of the window cleaning robot 100.
[0082] For example, when the load of the drive system 101 is the walking part (track or wheels), the speed of the window cleaning robot can be determined based on the pulse signal, and the controller 103 can adjust the speed and direction of the walking part of the window cleaning robot 100 according to the speed of the window cleaning robot, so as to realize the start, stop, acceleration and deceleration of the walking part. As another example, when the load of the drive system 101 is the cleaning part (rotating cleaning disc, moving scraper), the speed of the window cleaning robot can be determined based on the pulse signal, and the controller can control the operation frequency and speed of the cleaning part of the window cleaning robot 100 according to the speed of the window cleaning robot. Yet another example, when the load of the drive system 101 is the negative pressure fan impeller, the speed of the window cleaning robot can be determined based on the pulse signal, and the controller can control the speed of the negative pressure fan impeller according to the speed of the window cleaning robot, thereby increasing or decreasing the adhesion of the window cleaning robot 100 to the surface of the object being cleaned.
[0083] Figure 3 A schematic diagram of the architecture of a window cleaning robot provided in this application embodiment. Figure 2 ,like Figure 3 As shown:
[0084] The window cleaning machine 100 also includes a single-phase photoelectric sensor 104, which is connected to the controller 103. The single-phase photoelectric sensor 104 can be, for example, an infrared photoelectric sensor, with the transmitter 1041 being an infrared emitting diode and the receiver 1042 being a photosensitive element. Of course, the single-phase photoelectric sensor 104 can also be a photoelectric sensor using visible light, laser, or other light sources; this embodiment does not limit its application to this type.
[0085] The single-phase photoelectric sensor 104 includes a transmitter 1041, a receiver 1042, and a grating disk 1043. The output shaft of the motor 1011 is connected to the grating disk 1043 of the single-phase photoelectric sensor 104, and the grating disk 1043 rotates synchronously with the output shaft.
[0086] The grating disk 1043 is provided with a light-transmitting part and a light-blocking part. During synchronous rotation, the light-transmitting part transmits the light signal between the transmitting end 1041 and the receiving end 1042 of the single-phase photoelectric sensor 104, while the light-blocking part blocks the light signal between the transmitting end 1041 and the receiving end 1042. The single-phase photoelectric sensor 104 generates a pulse signal based on the transmission and blocking of the light signal during the synchronous rotation of the grating disk 1043, and inputs the pulse signal to the controller 103.
[0087] The controller 103 receives pulse signals and can determine the speed of the motor 1011 based on the pulse signals. Then, the controller 103 can determine the speed of the window cleaning robot based on the speed of the motor 1011 in order to control the movement of the window cleaning robot 100.
[0088] The grating disk 1043 is a component of the single-phase photoelectric sensor 104. The grating disk 1043 can be understood as a disk structure that rotates synchronously with the output shaft of the motor 1011. Its surface can be provided with light-transmitting and light-blocking portions to periodically change the transmission state of the light signal. For example, the grating disk 1043 can be a ring-shaped or disk-shaped structure, with the light-transmitting portion being an opening and the light-blocking portion being an opaque material. The light-transmitting portion can be the area on the grating disk 1043 that allows the light signal to pass through, and its shape and arrangement can be flexibly designed. For example, the light-transmitting portion can be a circular, rectangular, or trapezoidal opening. The light-blocking portion can be the area on the grating disk 1043 that blocks the light signal from passing through, and its shape and arrangement can be flexibly designed. For example, the light-blocking portion can be solid metal or opaque plastic.
[0089] The window cleaning robot 100 drives the grating disk 1043 to rotate synchronously via the motor 1011 in the drive system 101. During the rotation, the light-transmitting part and the light-blocking part of the grating disk 1043 periodically transmit or block the light signal between the transmitter 1041 and the receiver 1042 of the single-phase photoelectric sensor 104.
[0090] When the light-transmitting part is in the optical signal path, the optical signal between the transmitting end 1041 and the receiving end 1042 can propagate normally, and the receiving end 1042 can receive the optical signal emitted by the transmitting end 1041, thus forming an effective or ineffective level at the receiving end 1042. When the light-blocking part is in the optical signal path, the optical signal between the transmitting end 1041 and the receiving end 1042 is blocked and cannot propagate normally, and the receiving end 1042 cannot receive the optical signal emitted by the transmitting end 1041, thus forming a level at the receiving end 1042 that is opposite to that during normal propagation.
[0091] After the single-phase photoelectric sensor 104 generates alternating high-level and low-level pulse signals based on the transmission and blocking of light signals, it can be synchronously input to the controller 103 so that the controller 103 can analyze and process the pulse signals to determine the speed of the window cleaning robot, and adjust the working state of the drive system 101 according to the speed of the window cleaning robot to realize the control of the movement of the window cleaning robot 100.
[0092] Figure 4 This is a flowchart illustrating a method for detecting the motor speed of a window cleaning robot, as provided in an embodiment of this application. Figure 4 As shown, it includes:
[0093] S401. Acquire the pulse signal from the detection sensor; the detection sensor includes a single-phase Hall sensor and / or a single-phase photoelectric sensor.
[0094] In some embodiments, as shown above, the pulse signal generated by the single-phase Hall sensor or the single-phase photoelectric sensor is a combination of high and low level signals, and the single-phase Hall sensor or the single-phase photoelectric sensor will trigger an interrupt once for each pulse signal generated.
[0095] After receiving an interrupt signal from a single-phase Hall sensor or a single-phase photoelectric sensor, the controller can read the pulse signal sent by the single-phase Hall sensor or single-phase photoelectric sensor from the pin (such as the GPIO pin) connected to the controller.
[0096] S402. Determine the pulse quantity increment per unit time based on the pulse signal.
[0097] In some embodiments, the pulse count increment can refer to the increase in the number of pulses recorded by the controller at the current moment compared to the number of pulses recorded at the previous moment. That is, pulse count increment = number of pulses recorded by the controller at the current moment - increase in the number of pulses recorded at the previous moment.
[0098] The controller updates the current pulse count every time it receives a pulse signal. For example, the pulse counter is incremented by 1.
[0099] It should be understood that the motors of the window cleaning robot may include a left wheel motor, a right wheel motor, and a fan motor. The controller can process the pulse signals corresponding to the left wheel motor, right wheel motor, and fan motor individually. For example, each time the left wheel motor triggers an interrupt, its pulse counter increments by 1; each time the right wheel motor triggers an interrupt, its pulse counter increments by 1; and each time the fan motor triggers an interrupt, its pulse counter increments by 1.
[0100] In some embodiments, the controller calculates the pulse count increment every unit of time (e.g., 10ms).
[0101] For example, the increase in the number of pulses per unit time = the current pulse counter count - the pulse counter count 10ms ago.
[0102] S403. Determine the speed of the window cleaning robot based on the pulse number increment and the preset reduction ratio of the window cleaning robot motor.
[0103] In some embodiments, the preset reduction ratio of the window cleaning robot motor may refer to the reduction ratio of the window cleaning robot reducer.
[0104] A speed reducer, also known as a gearbox or gearbox, is a mechanical transmission device installed between a motor and a load. Speed reducers are used to reduce the motor's speed and increase torque output. Examples of speed reducers include planetary speed reducers, gear reducers, worm gear reducers, and harmonic reducers.
[0105] The input end of the speed reducer is connected to the output shaft, and the output end is connected to the load of the drive system. The speed reducer provides a reduction ratio to the drive system. The reduction ratio can be understood as the ratio between the speed of the motor's output shaft (i.e., the speed at the input end of the speed reducer) and the speed at the output end of the speed reducer. It represents the ratio of the input speed to the output speed of the speed reducer, and thus the factor by which the speed is reduced and the torque is amplified. For example, if the speed of the motor's output shaft is 3000 rpm, and after being reduced by the speed reducer, the speed at the output end of the speed reducer is 100 rpm, then the reduction ratio is 3000:100 = 30.
[0106] In some embodiments, after obtaining the pulse number increment, the speed of the window cleaning robot motor can be calculated based on the pulse number increment, and the speed of the window cleaning robot can be determined based on the determined motor speed and the preset reduction ratio of the motor.
[0107] For example, the speed of the motor of a window cleaning robot can satisfy the following formula:
[0108]
[0109] in, Where N is the speed of the motor, T is the pulse increment, PPR is the number of pulses output by the Hall sensor per revolution (referred to as pulses per revolution).
[0110] The PPR (Power Proportion) is related to the number of magnetic pole pairs in a single-phase Hall sensor or the number of light-transmitting and light-blocking portions in a single-phase photoelectric sensor. For example, if a single-phase Hall sensor includes one pair of magnetic poles or a single-phase photoelectric sensor includes one pair of light-transmitting and light-blocking portions, then the PPR value is 1.
[0111] After determining the motor speed, the motor speed can be converted into the speed of the window cleaning robot based on a preset reduction ratio.
[0112] For example, the speed of a window cleaning robot can satisfy the following formula:
[0113]
[0114] in, For the speed of window cleaning robots, S is the preset reduction ratio, and S is the wheel circumference of the window cleaning robot.
[0115] The window cleaning robot speed detection method provided in this application acquires pulse signals from detection sensors, including single-phase Hall sensors and / or single-phase photoelectric sensors. Based on the pulse signals, the pulse count increment per unit time is determined. The speed of the window cleaning robot is determined based on the pulse count increment and the preset reduction ratio of the window cleaning robot's motor. This solution utilizes the pulse signals output by single-phase Hall sensors and / or single-phase photoelectric sensors, combined with pulse frequency calculations within a time window, to achieve high-precision and high-reliability detection of the window cleaning robot's speed. This effectively reduces the cost and system complexity of the window cleaning robot.
[0116] Based on the above embodiments, the following is combined with Figure 5 The process of detecting the speed of a window cleaning robot based on a single-phase Hall sensor, as provided in the embodiments of this application, will be further explained.
[0117] Figure 5 A flowchart illustrating a window cleaning robot speed detection method provided in this application embodiment. Figure 2 ,like Figure 5 As shown, it includes:
[0118] S501, Obtain the pulse signal from the single-phase Hall sensor.
[0119] The specific implementation of step S501 in this embodiment can be found by referring to... Figure 4 The specific implementation methods in the illustrated embodiments will not be described in detail here.
[0120] S502, perform overflow detection on the pulse signal, and / or perform loss detection on the pulse signal.
[0121] In some embodiments, pulse signal overflow may refer to the pulse count at the current moment being less than the pulse count at the previous moment.
[0122] Since counters typically have an upper limit, if the counter reaches its limit during prolonged operation of the window cleaning robot, it will reset to zero upon receiving the next pulse signal. If pulse increment calculations are performed at this point, the calculated pulse increment will be negative, leading to abnormal speed calculations for the window cleaning robot and potentially posing a safety risk.
[0123] In some embodiments, pulse signal loss can refer to the phenomenon where, due to factors such as loose magnets, damaged Hall sensors, or strong electromagnetic interference, the controller detects that the pulse count has not changed for a long time during the operation of the window cleaning robot, or that the received pulse signals have irregular intervals. If pulse signal loss occurs, the calculated pulse count increment may be 0 or randomly jump, resulting in abnormalities such as the calculated window cleaning robot speed remaining at 0 or randomly jumping. When the calculated speed remains at 0, the controller may consider the current speed insufficient, causing it to continuously increase the PWM, leading to phenomena such as motor overcurrent and overheating. When the calculated speed randomly jumps, the controller may mistakenly determine that the window cleaning robot is in a sliding or out-of-control state, potentially causing safety risks.
[0124] Therefore, after receiving a pulse signal, the controller can perform overflow detection and / or loss detection on the pulse signal. If it is determined that there is a pulse signal overflow and / or a pulse signal loss, the controller executes the step shown in S503. If it is determined that there is no pulse signal overflow and / or a pulse signal loss, the controller executes the step shown in S504.
[0125] In some embodiments, when calculating the pulse increment upon receiving a pulse signal, the current pulse count can be read, and it can be determined whether the current pulse count is greater than the previously read pulse count. If the current pulse count is greater than the previously read pulse count, it is determined that there is no pulse signal overflow. If the current pulse count is less than the previously read pulse count, it is determined that there is a pulse signal overflow.
[0126] In some embodiments, when calculating the pulse increment upon receiving a pulse signal, if it is determined that no new pulse signal has been received for N consecutive unit time periods, then it can be determined that a pulse signal has been lost. Alternatively, when calculating the pulse increment upon receiving a pulse signal, if the time interval between adjacent pulses is much smaller than the theoretical minimum or greater than the theoretical maximum, then it can be determined that a pulse signal has been lost.
[0127] S503. If it is determined that there is pulse signal overflow and / or pulse signal loss, output alarm information and control the window cleaning robot to enter the safety mode.
[0128] In some embodiments, a safety mode can refer to a fall protection mechanism for the window cleaning robot. For example, the window cleaning robot stops its current cleaning task and increases suction to firmly adhere to the glass, preventing it from falling.
[0129] When the controller receives a large pulse signal, if it determines that there is a pulse signal overflow and / or pulse signal loss, it can control the motors of the left and right wheels to stop running and the cleaning system to stop running. It can also output alarm information to the user through voice or light, and at the same time increase the motor speed of the fan to enhance the suction power of the window cleaning robot.
[0130] Optionally, in the event of pulse signal overflow, the overflow can be corrected to obtain the correct pulse quantity increment.
[0131] For example, if the current pulse count is 5 and the previous pulse count was 12580, the current pulse count is less than the previous pulse count, indicating a pulse signal overflow. Since pulse counts are typically incremental, once the count reaches its maximum value, the next count wraps back to 0. Therefore, when a pulse signal overflow is confirmed, a reasonable pulse count for the current moment can be determined based on the upper limit of the pulse count and the current pulse count.
[0132] For example, the reasonable pulse count at the current moment = the upper limit of the pulse count + the current pulse count.
[0133] After determining the reasonable pulse count for the current moment, the pulse count increment for the current moment can be obtained by subtracting the pulse count from the previous reading.
[0134] By correcting the pulse count, the system can accurately calculate the pulse increment even when pulse signal overflow occurs. This effectively improves the operational stability of the window cleaning robot, reduces the likelihood of alarms, and enhances the user experience.
[0135] S504. If it is determined that there is no pulse signal overflow and / or pulse signal loss, determine the sign of the pulse quantity increment according to the current direction state to obtain the target pulse increment.
[0136] In some embodiments, the current orientation state may refer to the rotation direction of the motor recorded by the controller. For example, the current orientation state may be forward rotation or reverse rotation.
[0137] The controller can record the current direction of the motor based on external control signals. For example, when the control signal instructs the window cleaning robot to move forward, the motor can rotate in the forward direction; when the control signal instructs the window cleaning robot to move backward, the motor can rotate in the reverse direction.
[0138] The rotation direction indicated by the control signal can be determined based on a set target speed. For example, a target speed of +200 mm / s corresponds to forward rotation, and a target speed of -200 mm / s corresponds to reverse rotation.
[0139] After determining the pulse count increment based on the pulse count at the current moment and the pulse count at the previous moment, the sign of the pulse count increment can be determined based on the rotation direction read, thus obtaining the target pulse increment.
[0140] For example, if the pulse count increment is 100 and the rotation direction is forward, the corresponding target pulse count increment is +100; if the pulse count increment is 100 and the rotation direction is reverse, the corresponding target pulse count increment is -100.
[0141] S505, determine the first product of the target pulse increment and the wheel circumference of the window cleaning robot, and the second product of the preset reduction ratio of the motor, the duration of the unit time, and the number of pulses per revolution of the single-phase Hall sensor.
[0142] S506. The ratio of the first product to the second product is taken as the speed of the window cleaning robot.
[0143] In some embodiments, after determining the target pulse increment, the speed of the window cleaning robot can be determined based on the target pulse increment, the wheel circumference of the window cleaning robot, the preset reduction ratio of the motor, the duration of unit time, and the number of pulses per revolution of the single-phase Hall sensor.
[0144] For example, the speed of the window cleaning robot satisfies the following formula:
[0145]
[0146] in, The duration of a unit of time is measured in milliseconds (ms). This refers to the number of pulses per revolution of a single-phase Hall sensor. S represents the speed of the window cleaning robot, in mm / s, and S represents the wheel circumference of the window cleaning robot, in millimeters (mm).
[0147] For example, if the wheel circumference of a window cleaning robot is 30mm, the single-phase Hall sensor has 1 pulse per revolution, the preset reduction ratio is 10, the unit time duration is 10ms, and the target pulse increment is +1, substituting these values into the above formula, we can obtain:
[0148]
[0149] In some embodiments, after determining the speed of the window cleaning robot, the set target speed and the detected speed can be input to the PID controller. The PID control algorithm is used to adjust the PWM duty cycle of the motor so that the speed of the window cleaning robot is infinitely close to the set target speed, thereby improving the accuracy of the speed control of the window cleaning robot.
[0150] The window cleaning robot speed detection method provided in this application calculates the motor speed by pulse increment within a time window and adjusts the sign according to the direction to estimate the robot's speed. Finally, the speed is fed back to the PID control algorithm to dynamically adjust the PWM duty cycle, making the actual speed approach the target speed. The entire process uses a single-phase sensor instead of a two-phase sensor and software algorithm optimization, which reduces hardware costs and system complexity while improving control accuracy and resource utilization.
[0151] Based on the above embodiments, the following is combined with Figure 6 The process of detecting the speed of a window cleaning robot based on a single-phase photoelectric sensor, as provided in the embodiments of this application, will be further explained.
[0152] Figure 6 A flowchart illustrating a window cleaning robot speed detection method provided in this application embodiment. Figure 3 ,like Figure 6 As shown, it includes:
[0153] S601. Acquire ambient light intensity and pulse signals from a single-phase photoelectric sensor.
[0154] In some embodiments, ambient light intensity can refer to a physical parameter used to characterize the overall brightness of the environment in which the window cleaning robot is currently located. The higher the ambient light intensity, the higher the overall brightness of the environment in which the window cleaning robot is currently located.
[0155] The controller can obtain the ambient light intensity through the light sensor installed on the window cleaning robot, or by interacting with an external light sensor (such as the light sensor in the user's home).
[0156] The method for obtaining the pulse signal of the single-phase photoelectric sensor in this embodiment can be referred to Figure 4 The implementation method of the illustrated embodiment will not be described in detail here.
[0157] S602. Determine the pulse quantity increment per unit time based on the pulse signal.
[0158] In some embodiments, the pulse count increment per unit time can be determined based on the pulse count at the current moment and the pulse count at the previous moment.
[0159] In some embodiments, to further improve the accuracy of the determined pulse quantity increment and avoid transient interference pulses caused by factors such as electromagnetic noise or mechanical vibration, the pulse signal can also be filtered when determining the pulse quantity increment.
[0160] For example, pulse signals whose time interval is not within the preset time interval range are removed; it is determined whether the deviation between the current pulse count and the median of the historical pulse count is greater than the preset deviation; if not, the pulse count increment is determined based on the current pulse count and the pulse count at the previous moment; if so, the pulse count increment is determined based on the median of the historical pulse count and the pulse count at the previous moment.
[0161] For example, after acquiring a pulse signal, the time interval between it and the previously received pulse signal can be checked to determine if this time interval is less than the minimum or maximum effective interval, i.e., whether the time interval is within a preset time interval range. If the time interval is not within this range, it can be determined that the pulse signal may be an invalid pulse signal caused by interference or sensor malfunction, and this invalid pulse signal can be discarded. Correspondingly, the pulse count for this pulse signal will not be incremented by 1.
[0162] If the time interval falls within the specified range, the pulse signal can be determined to be a valid pulse signal. Upon determining that the pulse signal is valid, the current pulse count can be read, stored in a pre-maintained historical pulse count array, and sorted to determine the median historical pulse count.
[0163] After obtaining the median historical pulse count, it can be determined whether the deviation between the current pulse count and the median historical pulse count is greater than a preset threshold. If the deviation is greater than the preset threshold, it indicates that the current pulse count may be due to a count jump caused by interference, and this pulse count is an abnormal count. In this case, the median historical pulse count can be replaced with the current pulse count, and the pulse count increment can be calculated using the median historical pulse count and the median pulse count from the previous moment. If the deviation is less than or equal to the preset threshold, it indicates that the current pulse count is normal, and the pulse count increment can be calculated using the current pulse count and the median pulse count from the previous moment.
[0164] The above method, by performing quality detection and filtering on the pulse signal, can effectively improve the accuracy of the determined pulse quantity increment, thereby improving the accuracy of the subsequent determination of the window cleaning robot speed.
[0165] S603. Adjust the brightness of the single-phase photoelectric sensor according to the ambient light intensity, and determine the environmental compensation factor according to the ambient light intensity.
[0166] In some embodiments, after obtaining the light intensity, the brightness (sensitivity) of the single-phase photoelectric sensor can be dynamically adjusted according to the relationship between the light intensity and a preset threshold, so as to improve the data accuracy of the single-phase photoelectric sensor.
[0167] For example, when the light intensity is greater than the preset upper limit of the illumination threshold, the brightness of the single-phase photoelectric sensor can be increased to prevent overexposure and pulse loss. When the light intensity is less than the preset lower limit of the illumination threshold, the brightness of the single-phase photoelectric sensor can be reduced to prevent false triggering due to noise. When the light intensity is between the preset lower and upper limits of the illumination threshold, the brightness of the single-phase photoelectric sensor can be set to the default brightness.
[0168] It should be understood that when adjusting the brightness of a single-phase photoelectric sensor, the specific adjustment value can be determined based on actual experience or prior knowledge, and this application embodiment does not limit this.
[0169] In some embodiments, the response of a single-phase photoelectric sensor is not an ideal "step." Under critical illumination, the edge transition may become slower, leading to jitter or delay near the trigger threshold. This causes the actual detected pulse edge time to deviate slightly from the actual mechanical position. This deviation results in slight differences in the pulse frequency measured under different lighting environments at the same rotational speed. For example, under strong light, signal overshoot may cause premature triggering; under weak light, slow rise time may cause delayed triggering. In this case, even without missed or multiple pulses, the "effective pulse count" counted per unit time still has a systematic bias. Therefore, by setting an environmental compensation factor, the obtained pulse data is calibrated and corrected during subsequent speed calculations, thereby improving the accuracy of the calculated window cleaning robot speed.
[0170] In some embodiments, a mapping relationship between ambient light intensity and environmental compensation factor can be obtained through prior calibration. After the controller obtains the current ambient light intensity, it can determine the environmental compensation factor based on the ambient light intensity and the calibrated mapping relationship.
[0171] For example, if the ambient light intensity is less than 50 lux, the corresponding environmental compensation factor is set to 1.09; if the ambient light intensity is greater than 10,000 lux, the corresponding environmental compensation factor is set to 0.87; and if the ambient light intensity is between 50 lux and 10,000 lux, the corresponding environmental compensation factor is set to 1.
[0172] S604. Determine the number of rotations of the window cleaning robot's wheels per unit time based on the pulse quantity increment and the preset reduction ratio of the motor.
[0173] In some embodiments, after determining the pulse number increment, the number of rotations of the single-phase photoelectric sensor per unit time can be determined based on the number of pulses output per revolution of the single-phase photoelectric sensor (referred to as the number of pulses per revolution) and the pulse number increment.
[0174] For example, if the pulse count increment is +100 and the pulse count per revolution is 2, then the single-phase photoelectric sensor will rotate 50 times per unit time (100 / 2).
[0175] After obtaining the number of rotations of the single-phase photoelectric sensor per unit time, the number of rotations of the window cleaning robot's wheels per unit time can be determined based on the preset reduction ratio of the motor. For example, if the preset reduction ratio is 10, then the number of rotations of the window cleaning robot's wheels per unit time is 5 (50 / 10).
[0176] S605. Determine the moving distance of the window cleaning robot based on the number of rotations and the wheel circumference of the window cleaning robot, and determine the initial speed of the window cleaning robot based on the moving distance and the duration of the unit time.
[0177] In some embodiments, after determining the number of rotations of the window cleaning robot's wheels per unit time, the distance the window cleaning robot travels per unit time can be determined based on the wheel circumference. For example, if the number of rotations of the window cleaning robot's wheels per unit time is 0.01, and the wheel circumference is 300mm, then the distance the window cleaning robot travels per unit time is 300mm * 0.01 = 3mm.
[0178] After obtaining the distance the window cleaning robot travels per unit time, its initial speed can be determined based on the duration of that unit time. For example, if the unit time is 10ms, then the initial speed of the window cleaning robot is 3mm / 10ms = 0.3mm / ms = 300mm / s.
[0179] S606. The initial velocity is compensated based on the environmental compensation factor to determine the speed of the window cleaning robot.
[0180] In some embodiments, after obtaining the initial speed of the window cleaning robot, the initial speed can be compensated according to an environmental compensation factor to obtain the actual speed of the window cleaning robot. For example, if the environmental compensation factor is 1.1, then the speed of the window cleaning robot is 300mm / s * 1.1 = 330mm / s.
[0181] In some embodiments, after determining the speed of the window cleaning robot, the set target speed and the detected speed can be input to the PID controller. The PID control algorithm is used to adjust the PWM duty cycle of the motor so that the speed of the window cleaning robot is infinitely close to the set target speed, thereby improving the accuracy of the speed control of the window cleaning robot.
[0182] The speed detection method for window cleaning robots provided in this application calculates the motor speed by pulse increments within a time window and adjusts the sign according to the direction to estimate the robot's speed. Finally, the speed is fed back to the PID control algorithm to dynamically adjust the PWM duty cycle, making the actual speed approach the target speed. The entire process uses a single-phase photoelectric sensor to replace a two-phase sensor and optimizes the software algorithm, reducing hardware costs and system complexity while improving control accuracy and resource utilization. Furthermore, the photoelectric sensor has strong anti-electromagnetic interference capabilities and is completely unaffected by the motor's magnetic field, improving stability in strong electromagnetic environments. This makes the window cleaning robot more environmentally adaptable, with a wider operating temperature range (e.g., -40 degrees Celsius to 85 degrees Celsius) and better humidity adaptability, suitable for diverse working environments.
[0183] Furthermore, since the accuracy of photoelectric sensors is unaffected by the quality of magnets or their installation location, the consistency of mass production of window cleaning robots can be improved, resulting in higher accuracy uniformity. Due to the absence of magnet demagnetization issues, the lifespan of photoelectric sensors can be extended several times, and maintenance cycles are also prolonged, improving maintenance convenience. Photoelectric sensors are non-magnetic, so they will not affect other electronic devices, thus enhancing safety. The use of photoelectric sensors also reduces the cost of magnetic shielding and magnets, lowering the overall system cost and offering significant potential for cost optimization in window cleaning robots.
[0184] In some embodiments, when the window cleaning robot includes both a single-phase photoelectric sensor and a single-phase Hall sensor, the speeds detected by the single-phase photoelectric sensor and the single-phase Hall sensor can be fused together to further improve the accuracy of speed detection.
[0185] For example, based on the pulse number increment and the preset reduction ratio of the window cleaning robot motor, the first speed of the window cleaning robot detected by the single-phase photoelectric sensor and the second speed of the window cleaning robot detected by the single-phase Hall sensor are determined respectively; the first speed and the second speed are time-aligned; the time-aligned first speed and second speed are fused to obtain the speed of the window cleaning robot.
[0186] The specific implementation methods for determining the first and second speeds of the window cleaning robot can be found in [reference needed]. Figure 5 and Figure 6 The specific implementation method shown will not be elaborated here.
[0187] After obtaining the first and second velocities, interpolation alignment or buffer alignment can be used to align the first and second velocities to the same time point, and the units of the first and second velocities can be unified. After unifying the units of the first velocity, weighted averaging, Kalman filtering, or other methods can be used to fuse the first and second velocities to obtain the speed of the window cleaning robot.
[0188] By rationally integrating the speed detected by single-phase Hall sensors and single-phase photoelectric sensors, not only can the accuracy of speed detection be improved, but the reliability of the system in complex environments can also be enhanced, avoiding speed detection errors caused by the failure of a single sensor.
[0189] In some embodiments, to avoid the possibility of a sensor malfunctioning, the first speed and the second speed can be cross-referenced to eliminate the interference of abnormal data on speed detection.
[0190] For example, after obtaining the first and second speeds, the difference between them can be calculated. If this difference exceeds a preset threshold, it indicates that at least one sensor has malfunctioned. In this case, the first and second speeds can be compared with the effective speed from the previous moment. If the first speed shows a sudden change (i.e., the deviation between the first speed and the effective speed from the previous moment exceeds a preset deviation threshold), it indicates that the first speed may be incorrect speed data, and the second speed is used as the speed of the window cleaning robot. If the second speed shows a sudden change, it indicates that the second speed may be incorrect speed data, and the first speed is used as the speed of the window cleaning robot.
[0191] It should be understood that the aforementioned preset thresholds and deviation thresholds can be set based on actual needs or prior knowledge.
[0192] Below, in conjunction with Figure 7 The window cleaning robot based on a single-phase Hall sensor according to the embodiments of this application will be further described. Figure 7 This is a flowchart illustrating a window cleaning robot control method provided in an embodiment of this application. The execution subject of this control method can be an electronic device, such as a controller.
[0193] like Figure 7 As shown, after the window cleaning robot system is started, the steps of Hall sensor initialization, TIMER input capture configuration and PID parameter initialization can be performed first.
[0194] For example, Hall sensor initialization and TIMER input capture configuration may include the following steps:
[0195] 1. Clock Enable:
[0196] Enable GPIOA, GPIOD, and AF clock (GPIOD is used for Hall sensor input).
[0197] 2. Pin remapping:
[0198] Map TIMER3 channels 1 / 2 / 3 to GPIOD.13 / 14 / 15 (Fan / Right Wheel / Left Wheel Hall signals).
[0199] 3. GPIO (General Purpose Input / Output) Configuration:
[0200] GPIOD.13 / 14 / 15 is set to floating input mode to avoid external pull-up / pull-down interference.
[0201] 4. TIMER3 initialization:
[0202] Clock configuration: Prescaler = 71 → 72MHz / 72 = 1MHz counting frequency (1μs / count).
[0203] Counting mode: TIMER_COUNTER_UP, period = 65535 (maximum count value).
[0204] Input capture configuration:
[0205] Capture the falling edge (TIMER_IC_POLARITY_FALLING).
[0206] Filter setting = 0x02 (anti-interference, avoid jitter and false triggering).
[0207] Channels 1, 2, and 3 are all in use (corresponding to the fan, right wheel, and left wheel).
[0208] 5. Interrupt enable:
[0209] Enable TIMER3 interrupt and enable capture interrupt for Channel 1 / Channel 2 / Channel 3.
[0210] After initializing the single-phase Hall sensor and configuring its parameters, the main control loop can be entered.
[0211] After entering the main control loop, the controller detects and receives the pulse signal sent by the single-phase Hall sensor, and calculates the pulse increment based on the pulse signal. Then, the speed of the window cleaning robot is calculated based on the calculated pulse increment.
[0212] After speed calculation, the rotation direction of the motor output shaft can be determined. Motion control can then be implemented based on the speed and direction determination results. For example, if the speed is ≥0 m / s, forward rotation PWM can be set; if the speed is <0 m / s, reverse rotation PWM can be set; and if the speed is 0 m / s, braking control can be implemented.
[0213] When controlling a motor, proportional-integral-derivative (PID) control can be used, or other control methods can be employed. For example, the PWM output can be updated based on the PID speed adjustment.
[0214] During the control process, the health status of the Hall sensors can be continuously monitored to determine if the Hall sensors are abnormal. If so, fault handling and degraded control are performed, the controller can report the current status, and wait for the next cycle to jump to the main control loop execution flow; if not, the mileage and position calculations of the walking unit and other components can be continuously performed, and the controller can wait for the next cycle to jump to the main control loop execution flow.
[0215] Below, in conjunction with Figure 8 The window cleaning robot based on a single-phase photoelectric sensor according to the embodiments of this application will be further described. Figure 8 A flowchart illustrating a window cleaning robot control method provided in this application embodiment. Figure 2 The execution entity of this control method can be an electronic device, such as a controller. Figure 8 As shown, after the window cleaning robot system is started, the photoelectric sensor initialization step can be performed first. In addition, changes in ambient light can be detected to perform ambient light detection and adaptive adjustment.
[0216] For example, parameters of a photoelectric sensor include photoelectric pulse count, sensor brightness (adjustable), and sensor health status (e.g., a Boolean value of 1 indicating health and a Boolean value of 0 indicating a fault). Motor control parameters include, for example, set speed (target speed), actual speed, Pulse Width Modulation (PWM) duty cycle, and rotation direction. When initializing the photoelectric sensor, the controller pin connected to the sensor can be configured as a pull-up input to reduce interference signals.
[0217] It detects ambient light intensity and can automatically adjust the sensitivity of the sensor receiver based on the ambient light intensity. For example, if a strong light environment is detected, the sensor sensitivity can be increased; if a weak light environment is detected, the sensitivity can be decreased to avoid false triggering; if a normal environment is detected, the photoelectric sensor receiver can be controlled according to a preset value.
[0218] During the initialization and subsequent stages of the photoelectric sensor, its health status can also be monitored. For example, before officially starting the motor, a first speed signal can be given to the motor, causing it to rotate several revolutions at the known first speed. During this process, the photoelectric sensor receives a pulse signal. The motor speed can be calculated based on this pulse signal. If the difference between the tested speed and the first speed is within a preset error range, the photoelectric sensor is considered to be in a healthy state. If the difference is not within the preset error range, the photoelectric sensor is considered to be in an unhealthy state, i.e., a faulty state, which may affect the accuracy of speed measurement.
[0219] After performing health checks and parameter configuration on the photoelectric sensor, the main control loop can be entered. Once in the main control loop, the photoelectric sensor detects and generates pulse signals, and the quality of these pulse signals can be verified at this point. This quality verification of the photoelectric sensor's pulse signals can be implemented using a quality verification algorithm. For example, it can check the reasonableness of the interval between any two pulses in the pulse signal to eliminate interfering pulses.
[0220] For example, if the interval between any two pulses is too short, it may be due to motor vibration or signal interference; if the interval between any two pulses is too long, it may be due to sensor malfunction. If the current pulse quality is low (e.g., the pulse interval is significantly too high or too low), the rotational speed can be calculated using a valid pulse signal from the previous cycle that meets the preset conditions, in order to avoid excessive error.
[0221] When calculating rotational speed, the pulse width of the pulse signal can be recorded for calculation. Alternatively, the calculation can be based on the interrupt handling function of the photoelectric sensor. For example, an interruption (such as a light signal being blocked once) indicates the acquisition of a valid level, and the width of the valid level can be used to calculate the rotational speed. Alternatively, the angular velocity corresponding to the pulse interval width between two pulse signals can be calculated, thereby determining the motor's rotational speed. After verifying the pulse signal quality, compensation can be made based on environmental factors, such as compensating the calculated rotational speed with a preset supplementary coefficient based on the intensity of ambient light.
[0222] When processing pulse signals, anti-interference filtering can also be performed. For example, updating the historical records of pulse signals and filtering them by taking the median value can eliminate abnormal pulses. Alternatively, pulse signals within a sliding window period can be sorted, and the median value can be determined; this median value serves as the basis for filtering. When the difference between the value of a pulse signal and the median value is greater than a preset high-value threshold, the pulse signal is considered an interference signal and can be replaced by the median value. Conversely, when the difference between the value of a pulse signal and the median value is less than a preset low-value threshold, the pulse signal can also be considered an interference signal and can be replaced by the median value. Here, the pulse signal value can be understood as the pulse width, and the median value can be understood as the median of the pulse width.
[0223] After speed calculation, the rotation direction of the output shaft can be determined. Motion control can then be implemented based on the speed and direction determination results. For example, if the speed is ≥0 m / s, forward rotation PWM can be set; if the speed is <0 m / s, reverse rotation PWM can be set; and if the speed is 0 m / s, braking control can be implemented.
[0224] When controlling the motor, Proportional-Integral-Derivative (PID) control can be used, or other control methods can be employed. For example, the PWM output can be updated based on PID speed adjustment. During the control process, continuous monitoring of the photoelectric sensor's health status can be performed in conjunction with sensor contamination (affected by ambient light, etc.) to determine if the photoelectric sensor is malfunctioning. If so, fault handling and degraded control are implemented, the controller can report the current status, and wait for the next cycle to jump to the main control loop execution flow; if not, the mileage and position calculations for the traveling mechanism can continue, and the controller waits for the next cycle to jump to the main control loop execution flow.
[0225] This application also provides an electronic device.
[0226] Figure 9 This is a schematic diagram of the structure of the electronic device 90 provided in the embodiments of this application, such as... Figure 9 As shown, the electronic device may include: a transceiver 901, a processor 902, and a memory 903. The electronic device may be a controller as described in any of the above embodiments.
[0227] Processor 902 executes computer execution instructions stored in memory, causing processor 902 to perform the scheme in the above embodiments. Processor 902 can be a general-purpose processor, including a central processing unit (CPU), a network processor (NP), etc.; it can also be a digital signal processor (DSP), an application-specific integrated circuit (ASIC), a field-programmable gate array (FPGA), or other programmable logic devices, discrete gate or transistor logic devices, or discrete hardware components.
[0228] The memory 903 is connected to the processor 902 via the system bus and completes communication between them. The memory 903 is used to store computer program instructions.
[0229] The transceiver 901 can receive and send data and instructions.
[0230] Optionally, the electronic device 90 may also include a communication interface to communicate and interact with external or internal devices, such as client devices (e.g., mobile phones, tablets). In specific implementations, if the communication interface, memory 903, and processor 902 are implemented independently, they can be interconnected via a bus to complete communication with each other.
[0231] The system bus can be a Peripheral Component Interconnect (PCI) bus or an Extended Industry Standard Architecture (EISA) bus, etc. The system bus can be divided into address bus, data bus, control bus, etc. For ease of representation, only one thick line is used in the diagram, but this does not indicate that there is only one bus or one type of bus. Transceivers are used to enable communication between database access devices and other computers (e.g., clients, read-write libraries, and read-only libraries). Memory may include random access memory (RAM) and may also include non-volatile memory.
[0232] Optionally, in a specific implementation, if the communication interface, memory 903, and processor 902 are integrated on a single chip, then the communication interface, memory 903, and processor 902 can communicate through an internal interface.
[0233] This application also provides a chip for executing instructions, which is used to execute the technical solutions in the above method embodiments.
[0234] This application also provides a computer-readable storage medium storing a computer program thereon. When the computer program is executed by a processor, it implements the technical solution of the above method embodiment. Its implementation principle and technical effect are similar, and will not be repeated here.
[0235] In one possible implementation, a computer-readable medium may include random access memory (RAM), read-only memory (ROM), compact discread-only memory (CD-ROM) or other optical disc storage, disk storage or other magnetic storage devices, or any other medium targeted to carry or to store the required program code in the form of instructions or data structures, and accessible by a computer. Furthermore, any connection is appropriately referred to as a computer-readable medium. For example, if software is transmitted from a website, server, or other remote source using coaxial cable, fiber optic cable, twisted pair, Digital Subscriber Line (DSL), or wireless technologies such as infrared, radio, and microwave, then coaxial cable, fiber optic cable, twisted pair, DSL, or wireless technologies such as infrared, radio, and microwave are included in the definition of medium. As used herein, disks and optical discs include optical discs, laser discs, optical discs, Digital Versatile Discs (DVDs), floppy disks, and Blu-ray discs, where disks typically reproduce data magnetically, while optical discs optically reproduce data using lasers. Combinations of the above should also be included within the scope of computer-readable media.
[0236] This application also provides a computer program product, including a computer program that, when executed by a processor, implements the technical solution of the above method embodiments. Its implementation principle and technical effects are similar, and will not be repeated here.
[0237] In the specific implementation of the aforementioned terminal device or server, it should be understood that the processor can be a Central Processing Unit (CPU), or other general-purpose processors, digital signal processors (DSPs), application-specific integrated circuits (ASICs), etc. A general-purpose processor can be a microprocessor or any conventional processor. The steps of the method disclosed in the embodiments of this application can be directly manifested as execution by a hardware processor, or execution by a combination of hardware and software modules within the processor.
[0238] Those skilled in the art will understand that all or part of the steps in any of the above method embodiments can be implemented by hardware associated with program instructions. The aforementioned program can be stored in a computer-readable storage medium, and when the program is executed, all or part of the steps in the above method embodiments are performed.
[0239] If the technical solution of this application is implemented in software form and sold or used as a product, it can be stored in a computer-readable storage medium. Based on this understanding, all or part of the technical solution of this application can be embodied in the form of a software product, which is stored in a storage medium and includes a computer program or several instructions. This computer software product enables a computer device (which may be a personal computer, server, network device, or similar electronic device) to execute all or part of the steps of the methods in the embodiments of this application.
[0240] It should be noted that, for the sake of simplicity, the foregoing method embodiments are all described as a series of actions. However, those skilled in the art should understand that this application is not limited to the described order of actions, as some steps may be performed in other orders or simultaneously according to this application. Furthermore, those skilled in the art should also understand that the embodiments described in the specification are all optional embodiments, and the actions and modules involved are not necessarily essential to this application.
[0241] It should be further noted that although the steps in the flowchart are shown sequentially according to the arrows, these steps are not necessarily executed in the order indicated by the arrows. Unless explicitly stated herein, there is no strict order restriction on the execution of these steps, and they can be executed in other orders. Moreover, at least some steps in the flowchart may include multiple sub-steps or multiple stages. These sub-steps or stages are not necessarily completed at the same time, but can be executed at different times. The execution order of these sub-steps or stages is not necessarily sequential, but can be performed alternately or in turn with other steps or at least some of the sub-steps or stages of other steps.
[0242] It should be understood that the above-described device embodiments are merely illustrative, and the device of this application can also be implemented in other ways. For example, the division of units / modules in the above embodiments is only a logical functional division, and there may be other division methods in actual implementation. For example, multiple units, modules, or components may be combined, or integrated into another system, or some features may be ignored or not executed.
[0243] Furthermore, unless otherwise specified, the functional units / modules in the various embodiments of this application can be integrated into one unit / module, or each unit / module can exist physically separately, or two or more units / modules can be integrated together. The integrated units / modules described above can be implemented in hardware or as software program modules.
[0244] When integrated units / modules are implemented in hardware, the hardware can be digital circuits, analog circuits, etc. The physical implementation of the hardware structure includes, but is not limited to, transistors, memristors, etc. Unless otherwise specified, the processor can be any suitable hardware processor, such as a CPU, GPU, FPGA, DSP, and ASIC, etc. Unless otherwise specified, the storage unit can be any suitable magnetic or magneto-optical storage medium, such as Resistive Random Access Memory (RRAM), Dynamic Random Access Memory (DRAM), Static Random Access Memory (SRAM), Enhanced Dynamic Random Access Memory (EDRAM), High-Bandwidth Memory (HBM), Hybrid Memory Cube (HMC), etc.
[0245] If the integrated unit / module is implemented as a software program module and sold or used as an independent product, it can be stored in a computer-readable storage device (CMD). Based on this understanding, the technical solution of this application, in essence, or the part that contributes to the prior art, or all or part of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a memory and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods of the various embodiments of this application. The aforementioned memory includes various media capable of storing program code, such as a USB flash drive, read-only memory (ROM), random access memory (RAM), portable hard drive, magnetic disk, or optical disk.
[0246] In the above embodiments, the descriptions of each embodiment have their own emphasis. For parts not described in detail in a certain embodiment, please refer to the relevant descriptions of other embodiments. The technical features of the above embodiments can be combined arbitrarily. For the sake of brevity, not all possible combinations of the technical features in the above embodiments are described. However, as long as the combination of these technical features does not contradict each other, it should be considered within the scope of this specification.
[0247] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of this application, and are not intended to limit them. Although this application has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that modifications can still be made to the technical solutions described in the foregoing embodiments, or equivalent substitutions can be made to some or all of the technical features therein. Such modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the scope of the technical solutions of the embodiments of this application.
Claims
1. A method for detecting the speed of a window cleaning robot, characterized in that, include: Acquire the pulse signal from the detection sensor; The detection sensor includes a single-phase Hall sensor and / or a single-phase photoelectric sensor; Based on the pulse signal, determine the pulse quantity increment per unit time; The speed of the window cleaning robot is determined based on the pulse count increment and the preset reduction ratio of the motor of the window cleaning robot.
2. The method according to claim 1, characterized in that, The detection sensor is a single-phase Hall sensor. Determining the speed of the window cleaning robot based on the pulse count increment and the preset reduction ratio of the window cleaning robot motor includes: Based on the current directional state, determine the sign of the pulse quantity increment to obtain the target pulse increment; the sign can be positive or negative. The speed of the window cleaning robot is determined based on the target pulse increment, the preset reduction ratio of the motor, and the wheel circumference of the window cleaning robot.
3. The method according to claim 2, characterized in that, Determining the speed of the window cleaning robot based on the target pulse increment, the preset reduction ratio of the motor, and the wheel circumference of the window cleaning robot includes: The first product of the target pulse increment and the wheel circumference of the window cleaning robot is determined, as well as the second product of the preset reduction ratio of the motor, the duration of the unit time, and the number of pulses per revolution of the single-phase Hall sensor; The ratio of the first product to the second product is taken as the speed of the window cleaning robot.
4. The method according to claim 2, characterized in that, Before determining the pulse number increment per unit time, the method further includes: The pulse signal is subjected to overflow detection, and / or the pulse signal is subjected to loss detection; If pulse signal overflow and / or pulse signal loss are detected, an alarm message is output and the window cleaning robot is controlled to enter a safe mode.
5. The method according to claim 1, characterized in that, The detection sensor is a single-phase photoelectric sensor. Determining the speed of the window cleaning robot based on the pulse count increment and the preset reduction ratio of the window cleaning robot motor includes: The number of rotations of the window cleaning robot's wheels per unit time is determined based on the pulse quantity increment and the preset reduction ratio of the motor. The speed of the window cleaning robot is determined based on the number of rotations, the wheel circumference of the window cleaning robot, and the environmental compensation factor.
6. The method according to claim 5, characterized in that, Determining the speed of the window cleaning robot based on the number of rotations, the wheel circumference of the window cleaning robot, and the environmental compensation factor includes: The travel distance of the window cleaning robot is determined based on the number of rotations and the wheel circumference of the window cleaning robot. The initial speed of the window cleaning robot is determined based on the travel distance and the duration of the unit time. The initial velocity is compensated based on the environmental compensation factor to determine the speed of the window cleaning robot.
7. The method according to claim 5 or 6, characterized in that, Determining the pulse quantity increment per unit time based on the pulse signal includes: Pulse signals whose time interval is outside the preset time interval range are excluded; Determine whether the current pulse count deviates from the median of historical pulse counts by more than a preset deviation; If not, then the pulse count increment is determined based on the current pulse count and the pulse count at the previous moment; If so, the pulse count increment is determined based on the median of the historical pulse counts and the pulse count at the previous moment.
8. The method according to claim 5, characterized in that, Before acquiring the pulse signal from the detection sensor, the method further includes: Obtain ambient light intensity; The brightness of the single-phase photoelectric sensor is adjusted according to the ambient light intensity, and the environmental compensation factor is determined according to the ambient light intensity.
9. The method according to claim 1, characterized in that, The detection sensors include a single-phase photoelectric sensor and a single-phase Hall sensor. Determining the speed of the window cleaning robot based on the pulse count increment and the preset reduction ratio of the window cleaning robot motor includes: Based on the pulse number increment and the preset reduction ratio of the motor of the window cleaning robot, the first speed of the window cleaning robot detected by the single-phase photoelectric sensor and the second speed of the window cleaning robot detected by the single-phase Hall sensor are determined respectively. Time alignment of the first speed and the second speed; The speed of the window cleaning robot is obtained by fusing the first speed and the second speed, which are aligned in time.
10. An electronic device, characterized in that, include: The processor, transceiver, and memory are provided; the processor is communicatively connected to both the transceiver and the memory. The memory stores computer-executed instructions; The transceiver communicates and interacts with external devices. The processor executes computer execution instructions stored in the memory to implement the method as described in any one of claims 1-9.
11. A computer-readable storage medium, characterized in that, It stores a computer program thereon, which is executed by a processor to implement the method of any one of claims 1-9.
12. A computer program product, characterized in that, Includes a computer program that, when executed by a controller, implements the method of any one of claims 1-9.