CN115325980A - Method and device for detecting stroke of mechanical lock body, electronic equipment and storage medium - Google Patents

Method and device for detecting stroke of mechanical lock body, electronic equipment and storage medium Download PDF

Info

Publication number
CN115325980A
CN115325980A CN202211086921.5A CN202211086921A CN115325980A CN 115325980 A CN115325980 A CN 115325980A CN 202211086921 A CN202211086921 A CN 202211086921A CN 115325980 A CN115325980 A CN 115325980A
Authority
CN
China
Prior art keywords
mechanical lock
lock body
value
stroke
encoder
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202211086921.5A
Other languages
Chinese (zh)
Inventor
苏祺云
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Shenzhen Kaadas Intelligent Technology Co Ltd
Original Assignee
Shenzhen Kaadas Intelligent Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Shenzhen Kaadas Intelligent Technology Co Ltd filed Critical Shenzhen Kaadas Intelligent Technology Co Ltd
Priority to CN202211086921.5A priority Critical patent/CN115325980A/en
Publication of CN115325980A publication Critical patent/CN115325980A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G01MEASURING; TESTING
    • G01BMEASURING LENGTH, THICKNESS OR SIMILAR LINEAR DIMENSIONS; MEASURING ANGLES; MEASURING AREAS; MEASURING IRREGULARITIES OF SURFACES OR CONTOURS
    • G01B21/00Measuring arrangements or details thereof, where the measuring technique is not covered by the other groups of this subclass, unspecified or not relevant
    • G01B21/02Measuring arrangements or details thereof, where the measuring technique is not covered by the other groups of this subclass, unspecified or not relevant for measuring length, width, or thickness
    • G01B21/04Measuring arrangements or details thereof, where the measuring technique is not covered by the other groups of this subclass, unspecified or not relevant for measuring length, width, or thickness by measuring coordinates of points
    • G01B21/042Calibration or calibration artifacts
    • EFIXED CONSTRUCTIONS
    • E05LOCKS; KEYS; WINDOW OR DOOR FITTINGS; SAFES
    • E05BLOCKS; ACCESSORIES THEREFOR; HANDCUFFS
    • E05B47/00Operating or controlling locks or other fastening devices by electric or magnetic means
    • E05B47/0001Operating or controlling locks or other fastening devices by electric or magnetic means with electric actuators; Constructional features thereof
    • E05B47/0012Operating or controlling locks or other fastening devices by electric or magnetic means with electric actuators; Constructional features thereof with rotary electromotors
    • EFIXED CONSTRUCTIONS
    • E05LOCKS; KEYS; WINDOW OR DOOR FITTINGS; SAFES
    • E05BLOCKS; ACCESSORIES THEREFOR; HANDCUFFS
    • E05B47/00Operating or controlling locks or other fastening devices by electric or magnetic means
    • E05B47/0001Operating or controlling locks or other fastening devices by electric or magnetic means with electric actuators; Constructional features thereof
    • E05B2047/0014Constructional features of actuators or power transmissions therefor
    • E05B2047/0018Details of actuator transmissions
    • E05B2047/002Geared transmissions

Landscapes

  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Transmission Devices (AREA)
  • Measurement Of Length, Angles, Or The Like Using Electric Or Magnetic Means (AREA)

Abstract

The application provides a method, a device, electronic equipment and a storage medium for detecting the stroke of a mechanical lock body, wherein the method comprises the following steps: the motor drives the gears to rotate the mechanical lock body, the mechanical lock body rotates to a locked state in a first direction, and the encoder is driven to encode to obtain a first encoding value; the motor drives the gears to rotate the mechanical lock body, the mechanical lock body rotates to a locked position in a second direction, and the encoder is driven to encode to obtain a second encoded value, wherein the first direction is opposite to the second direction; and calculating the absolute value of the difference value of the first encoding value and the second encoding value to obtain the calibration stroke of the mechanical lock body, wherein the calibration stroke is the stroke of the mechanical lock body from locking locked rotation to unlocking locked rotation.

Description

Method and device for detecting stroke of mechanical lock body, electronic equipment and storage medium
Technical Field
The present disclosure relates to the field of intelligent mechanical locks, and in particular, to a method and an apparatus for detecting a stroke of a mechanical lock, an electronic device, and a storage medium.
Background
At present, the technology for automatically detecting the opening and closing positions of a general mechanical lock body can install a door magnetic sensor on a door lock, and the opening and closing positions of the lock are judged through the opening and closing of the door; an internal feedback sensor can also be arranged in the mechanical lock body to judge the position of the lock. However, the sampling door magnetic sensor judges the opening and closing position of the lock body, and only the position of the lock body which is completely opened or closed can be simply detected, the middle position cannot be detected, and the lock body cannot be detected under the conditions of locked rotation and the like when the lock body sends the locked rotation; the sensor is additionally arranged in the lock body, so that the original door and the original lock can be damaged, the cost is increased, and the problems of structural incompatibility and the like can be caused.
Disclosure of Invention
In order to solve the problems, the application provides a method and a device for detecting the stroke of a mechanical lock body, electronic equipment and a storage medium, so that the stroke calibration of the mechanical lock body of an intelligent panel lock can be realized, and the problem of incompatibility cannot be caused. Meanwhile, the lock can be matched with most intelligent mechanical locks on the market.
In order to achieve the above object, a first aspect of the embodiments of the present application provides a method for detecting a stroke of a mechanical lock body, where the method includes:
the motor drives the gears to rotate the mechanical lock body, the mechanical lock body rotates to a locked position in a first direction, and the encoder is driven to encode to obtain a first encoding value;
the motor drives the gears to rotate the mechanical lock body, the mechanical lock body rotates to a locked state in a second direction, and the encoder is driven to encode to obtain a second encoded value, wherein the first direction is opposite to the second direction;
and calculating the absolute value of the difference value of the first encoding value and the second encoding value to obtain the calibration stroke of the mechanical lock body, wherein the calibration stroke is the stroke of the mechanical lock body from locking locked rotation to unlocking locked rotation.
With reference to the first aspect, in a possible implementation manner, the driving an encoder to perform encoding to obtain a first encoded value includes:
acquiring a first electric signal image when the encoder finishes encoding, an initial electric signal image when the encoder does not encode, and an initial encoding value;
obtaining the change number of pulses according to the first electric signal diagram and the initial electric signal diagram, wherein the pulses comprise a low level and a high level which are adjacent;
obtaining a change value of the encoder according to the change number of the pulses;
determining the change direction of an encoder according to the pulse edge increment values of A-phase pulses and B-phase pulses in the initial electrical signal diagram and the pulse edge increment values of the A-phase pulses and the B-phase pulses in the first electrical signal diagram, wherein the A-phase pulses and the B-phase pulses are orthogonal pulses of the A-phase pulses and the B-phase pulses which are sent by the encoder during encoding, and the pulse edge increment values are determined by the A-phase pulses and the B-phase pulses;
and obtaining a first coding value according to the initial coding value, the change value of the coder and the change direction of the coder.
With reference to the first aspect, in one possible implementation, the method further includes:
when the mechanical lock body is electrified again, the mechanical lock body is calibrated again based on the calibration stroke.
With reference to the first aspect, in one possible implementation, recalibrating the mechanical lock body based on the calibration stroke includes:
taking the code value when the mechanical lock body is rotated to the first locked rotor as a third code value, wherein the first locked rotor is any one of locked rotor or unlocked rotor;
taking the code value when the mechanical lock body is rotated to the second locked rotation as a fourth code value, wherein the second locked rotation is opposite to the first locked rotation;
and recalibrating the mechanical lock body according to the third code value, the fourth code value and the calibration stroke.
With reference to the first aspect, in one possible implementation manner, recalibrating the mechanical lock body according to the third code value, the fourth code value, and the calibration stroke includes:
when the absolute value of the difference value between the third code value and the fourth code value is the same as the calibration stroke, displaying first prompt information, wherein the first prompt information is used for representing that the mechanical lock body is successfully calibrated again;
and when the absolute value of the difference value between the third code value and the fourth code value is different from the calibration stroke, displaying second prompt information, wherein the second prompt information is used for representing that the mechanical lock body fails to be calibrated again.
With reference to the first aspect, in a possible implementation manner, after obtaining the calibration stroke of the mechanical lock body, the method further includes:
acquiring the working state of the mechanical lock body;
and determining the first code value as a locking locked-rotor code value or an unlocking locked-rotor code value according to the working state of the mechanical lock body.
With reference to the first aspect, in a possible implementation, after recalibrating the mechanical lock body, the panel further includes an indicator light, and the method further includes:
turning on an indicator light when the mechanical lock body is turned to be unlocked in place to represent that the mechanical lock body is opened;
when the mechanical lock body is twisted to be locked in place, the indicator light is turned on to indicate that the mechanical lock body is closed.
A second aspect of the embodiments of the present application provides a method for detecting a stroke of a mechanical lock, where the method is applied to a device for detecting a stroke of a mechanical lock, and the method includes:
the acquisition unit is used for driving the plurality of gears to rotate the mechanical lock body through the motor, rotating to a locked state in a first direction and driving the encoder to encode to obtain a first encoding value;
the acquisition unit is also used for driving the plurality of gears to rotate the mechanical lock body through the motor, rotating to a locked state in a second direction and driving the encoder to encode to obtain a second encoded value, wherein the first direction is opposite to the second direction;
and the processing unit is used for calculating the absolute value of the difference value between the first encoding value and the second encoding value to obtain the calibration stroke of the mechanical lock body, wherein the calibration stroke is the stroke from locking to unlocking of the mechanical lock body.
A third aspect of the embodiments of the present application provides an electronic device, where the electronic device includes an input device, an output device, and a processing chip, and is adapted to implement one or more instructions; and a memory storing one or more computer programs adapted to be loaded by the processing chip and to perform the steps of the method according to the first aspect as described above.
A fourth aspect of embodiments of the present application provides a computer storage medium storing one or more instructions adapted to be loaded by a processing chip and to perform the steps of the method according to the first aspect.
The above scheme of the present application includes at least the following beneficial effects:
in this embodiment, the lock body is coupled to the faceplate using a motor and a plurality of gears and encoders. Firstly, a plurality of gears are driven by a motor to rotate a mechanical lock body, the mechanical lock body rotates to a locked state in two opposite directions, and an encoder is driven to encode, so that a first encoding value and a second encoding value are obtained. And calculating the absolute value of the difference value of the first encoding value and the second encoding value to obtain the calibration stroke of the mechanical lock body. The stroke calibration of the mechanical lock body of the intelligent panel lock is realized by driving a plurality of gears and the encoder through the motor, the problem of incompatibility cannot be generated, and meanwhile, the intelligent mechanical lock can be adapted to most intelligent mechanical locks on the market. Simultaneously, the motor drives the gears and the encoder, so that the stroke can be calibrated, the position change condition of the lock body can be obtained according to the change of the encoding value, and the middle position of the stroke of the lock body can be determined through the encoder.
Drawings
In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the drawings used in the description of the embodiments or the prior art will be briefly described below, it is obvious that the drawings in the following description are only some embodiments of the present application, and for those skilled in the art, other drawings can be obtained according to the drawings without creative efforts.
Fig. 1 is a system architecture diagram of a method for detecting a stroke of a mechanical lock according to an embodiment of the present application;
fig. 2 is a view of a specific application scenario of a method for detecting a stroke of a mechanical lock body according to an embodiment of the present application;
fig. 3 is a schematic flowchart of a method for detecting a stroke of a mechanical lock according to an embodiment of the present disclosure;
FIG. 4 is a schematic diagram of a first calibration provided by an embodiment of the present application;
FIG. 5 is a schematic diagram of a first calibration in a first direction according to an embodiment of the present application;
FIG. 6 is a schematic diagram of an initial electrical signal provided by an embodiment of the present application;
FIG. 7 is a schematic diagram of a first electrical signal provided by an embodiment of the present application;
FIG. 8 is a schematic diagram of a first calibration in a second direction according to an embodiment of the present application;
fig. 9 is a schematic diagram of determining a locked rotor state according to an embodiment of the present application;
FIG. 10 is a diagram illustrating a recalibration after power down according to an embodiment of the present application;
FIG. 11 is a schematic view of an embodiment of the present application illustrating a lock unlocked in place;
FIG. 12 is a schematic view of a lock in place according to an embodiment of the present disclosure;
fig. 13 is a schematic structural diagram of a device for detecting a stroke of a mechanical lock body according to an embodiment of the present application;
fig. 14 is a schematic view of an electronic device according to an embodiment of the present application.
Detailed Description
In order to make the technical solutions of the present application better understood by those skilled in the art, the technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the drawings in the embodiments of the present application, and it is obvious that the described embodiments are only some embodiments of the present application, and not all embodiments. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present application.
The terms "comprising" and "having," and any variations thereof, as appearing in the specification, claims and drawings of this application, are intended to cover non-exclusive inclusions. For example, a process, method, system, article, or apparatus that comprises a list of steps or elements is not limited to only those steps or elements listed, but may alternatively include other steps or elements not listed, or inherent to such process, method, article, or apparatus. In addition, the terms "first", "second", and "third", etc. are used to distinguish different objects, and are not used to describe a particular order.
Referring to fig. 1, fig. 1 is a system architecture diagram of a method for detecting a mechanical lock stroke according to an embodiment of the present invention, where the system architecture diagram includes a lock body 10 and a panel 20.
In the present embodiment, the faceplate 20 is mounted outside the lock hole of the lock body 10. The panel 20 includes a motor 201, a plurality of gears 202, and an encoder 203. Wherein, motor 201 drives a plurality of gears 202, and a plurality of gears 202 drive the key shrink to drive encoder 203 and encode, encoder 203 obtains the code value.
The mechanical lock body formed by the lock body 10 and the panel 20 installed outside the lock hole of the lock body 10 includes, but is not limited to, a fingerprint identification smart mechanical lock and a password input smart mechanical lock.
In this embodiment, first, the motor 201 drives the plurality of gears 202 to drive the key to move, the key moves in a first direction, and the plurality of gears 202 drive the encoder 203 to encode, so as to obtain a first encoded value. Wherein the first direction is any direction. Then, the motor 201 drives the plurality of gears 202 to drive the key to move again, the key moves to the second direction, and the plurality of gears 202 drive the encoder 203 to encode, so as to obtain a second encoded value, wherein the first direction is opposite to the second direction. And finally, after the code values of the mechanical lock bodies in the two directions are obtained, calculating the absolute value of the difference value between the first code value and the second code value. The absolute value is a calibration stroke of the mechanical lock body, wherein the calibration stroke is a stroke from locking and locking to unlocking and locking of the key.
Referring to fig. 2, fig. 2 is a diagram illustrating a specific application scenario of a method for detecting a stroke of a mechanical lock according to an embodiment of the present application, where the scenario is that a user obtains a calibration stroke of the mechanical lock.
The specific scenes are as follows:
first, the user clicks the lock first calibration button on APP. Then, the motor drives a plurality of gears to rotate to any direction and can not rotate any more, namely, the first locked rotor. At this time, the key also moves to the extreme value in any direction. In the mechanical lock body, the motor drives a plurality of gears to rotate to the locked rotor in the first direction at the same time, and drives the key of the mechanical lock body to move and the encoder to encode to obtain a first encoding value.
Then, the motor drives the gears to rotate in the opposite direction of the arbitrary direction until the gears cannot rotate, namely, the gears are locked to rotate for the second time, and a second code value is obtained.
And finally, calculating the absolute value of the difference value between the first coding value and the second coding value to obtain the calibration stroke of the mechanical lock body, wherein the calibration stroke is the whole stroke of the key of the mechanical lock body, namely the stroke from one locked-rotor position of the key of the mechanical lock body to the locked-rotor position in the opposite direction.
Referring to fig. 3, fig. 3 is a schematic flowchart of a method for detecting a stroke of a mechanical lock according to an embodiment of the present application, where the method is applied to an apparatus for detecting a stroke of a mechanical lock, as shown in fig. 3, and includes steps 301 to 303:
301: a plurality of gear rotation mechanical lock bodies are driven through the motor, the mechanical lock bodies rotate to the locked rotor in the first direction, and the encoder is driven to encode to obtain a first encoding value.
In this embodiment, the mechanical lock body composed of the lock body and the panel is different from the conventional mechanical lock, and the mechanical lock body composed of the lock body and the panel can be opened not only by a key but also by a fingerprint or a password. When a user uses a mechanical lock body consisting of a lock body and a panel for the first time, the mechanical lock body does not carry out stroke calibration, so that the mechanical lock body cannot be opened when the user uses fingerprints or passwords to unlock the lock. Thus, a user is required to perform a trip calibration at the time of first use.
Referring to fig. 4, fig. 4 is a schematic diagram of a first calibration provided in the embodiment of the present application. The user can install corresponding APP in the mobile device first, and can also directly carry out calibration on the panel. The present embodiment will be described by taking an example in which a user installs a corresponding APP.
Referring to fig. 5, fig. 5 is a schematic diagram illustrating a first calibration in a first direction according to an embodiment of the present disclosure. The user first clicks the lock first calibration button on the APP. Then, a motor in the panel drives a plurality of gears to rotate; when the gears rotate, the keys in the lock body are driven to move towards a first direction; simultaneously, a plurality of gears also drive the encoder of connecting and encode. When the key can not move to the first direction any more, it means that the lock body has reached the first locked rotation, i.e. the end point of the first direction rotation. At this time, the encoder encodes the first encoded value obtained for subsequent calculation.
Wherein, drive the encoder and encode, obtain first code value, include:
first, please refer to fig. 6, where fig. 6 is a schematic diagram of an initial electrical signal according to an embodiment of the present disclosure. When the encoder is used for encoding, two paths of orthogonal pulses of A and B, namely an A-phase pulse and a B-phase pulse, are emitted, and the phase difference between the A-phase pulse and the B-phase pulse is 90. And acquiring an initial electric signal diagram of the encoder and an initial encoding value thereof when the mechanical lock body calibration is not carried out. Referring to fig. 7, fig. 7 is a schematic diagram of a first electrical signal of an encoder when a mechanical lock body starts to be calibrated and the mechanical lock body rotates from a first direction to a locked state, as shown in fig. 7, which includes an initial electrical signal diagram.
Then, the variation value of the encoder can be obtained according to the variation of the A-phase pulse and the B-phase pulse of the first electric signal diagram and the initial electric signal diagram. Referring to fig. 6 and 7, it can be seen that in the initial electrical signal diagram and the first electrical signal diagram, the upper and lower a-phase pulses and the B-phase pulses are changed. Wherein, a high level and a low level in the a-phase pulse are one pulse, and a high level and a low level in the B-phase pulse are also one pulse. Thus, a four pulse variation number can be obtained from fig. 7. Moreover, the change of one pulse also represents the change of the coding value of one encoder, so that the change value of the coding value of the encoder in the first stalling process can also be obtained to be 4.
Then, acquiring a pulse edge increment value in the first electric signal diagram and a pulse edge increment value of the initial electric signal diagram, and determining the direction of the pulse edge increment value in the first electric signal diagram according to the pulse edge increment value in the first electric signal diagram and the pulse edge increment value of the initial electric signal diagram, wherein the pulse edge increment value is determined by the change of an A-phase pulse and a B-phase pulse in the first electric signal diagram; if the pulse edge increment value in the first electric signal diagram and the pulse edge increment value in the initial electric signal diagram have the same sign, the direction is unchanged; if the pulse edge increment value in the first electric signal diagram and the pulse edge increment value in the initial electric signal diagram have opposite signs, the directions are opposite.
Referring to fig. 7, the increment value of the edge of the pulse is obtained when the pulse of the a phase and the pulse of the B phase change.
As shown in fig. 7, when the level state of the a-phase pulse is a rising edge and the level state of the B-phase pulse is held constant, the pulse edge increment value is determined to be 1; when the level state of the A-phase pulse is a falling edge and the level state of the B-phase pulse is kept unchanged, determining that the increment value of the pulse edge is-1; when the level state of the A-phase pulse is kept unchanged and the level state of the B-phase pulse is a rising edge, determining that the increment value of the pulse edge is 1; when the level state of the A-phase pulse is kept unchanged and the level state of the B-phase pulse is a falling edge, the pulse edge increment value is determined to be-1.
Therefore, the pulse edge increment value in the first electric signal diagram and the pulse edge increment value of the initial electric signal diagram can be obtained, and the direction of the pulse edge increment value in the first electric signal diagram is determined. Referring to fig. 7, if the pulse edge increment value in the initial electrical signal diagram is 4, and the pulse edge increment value in the first electrical signal diagram is 0, the directions of the initial electrical signal diagram and the first electrical signal diagram are the same, i.e. the encoding value is increased by 4.
And finally, obtaining a first coding value according to the initial coding value and the change value of the coder.
302: the motor drives the plurality of gears to rotate the mechanical lock body, the mechanical lock body rotates to the locked rotor in the second direction, and the encoder is driven to encode to obtain a second encoded value, wherein the first direction is opposite to the second direction.
In this embodiment, please refer to fig. 8, and fig. 8 is a schematic diagram illustrating a first calibration in a second direction according to an embodiment of the present disclosure. When the motor can not drive the gears to drive the key to move towards the first direction, the motor drives the gears to drive the key to move towards the opposite direction of the first direction, namely, the second direction. Meanwhile, the plurality of gears drive the encoder to encode. And until the motor can not drive the gears to further drive the key to move towards the second direction, namely the second locked rotor, and a second coding value in the coder is obtained.
303: and calculating the absolute value of the difference value between the first code value and the second code value to obtain the calibration stroke of the mechanical lock body, wherein the calibration stroke is the stroke of the mechanical lock body from locking to unlocking.
In this embodiment, when the first coded value is corresponding to the mechanical lock body rotating in the first direction until the mechanical lock body cannot rotate any more, the first coded value at this time is the first direction rotation blocking value. The second code value corresponds to a second code value of the mechanical lock body, and the second code value is locked in a second direction by the first code value locked in a first direction. The calibration stroke direction of the whole stroke mechanical lock body of the first code value locked in the first direction and the second code value locked in the second direction is opposite. Therefore, the calibration stroke of the mechanical lock body is the absolute value of the difference value between the second code value and the first code value. The mechanical lock body calibration stroke can be obtained through two times of locked rotor detection in opposite directions, so that a user can calibrate as soon as possible to use the mechanical lock body.
In this embodiment, in order to obtain the operating state of the mechanical lock at the time of the first direction lock rotation or the second direction lock rotation, the user uploads the unlocked state or the locked state at the time of the lock rotation to the mechanical lock at the time of calibration.
Please refer to fig. 9, fig. 9 is a schematic diagram of determining a locked rotor state according to an embodiment of the present disclosure. For example, when the mechanical lock body reaches the locking locked rotation, the user confirms that the working state of the mechanical lock body is the locking state at this time in the APP based on whether the mechanical lock body is seen to be open or closed. Then, when the mechanical lock body reaches the unlocking locked rotor, the working state of the mechanical lock body is the unlocking state.
In another embodiment, the mechanical lock body can be a fingerprint intelligent identification lock or a password intelligent identification lock. The mechanical lock body needs to be energized in order to be usable. However, when the mechanical lock body is powered off due to an unstable factor, a user may unlock or lock the mechanical lock body by using a key or a knob on the mechanical lock body. At this time, if the mechanical lock body is powered on again, the mechanical lock body cannot determine the calibration stroke. Because of the manual unblanking or the lock of closing of user, unblanking or close the lock at every turn and probably not reach the stall, when leading to mechanical lock body intelligence to lock or close the lock, can't confirm whether to the stall position, lead to can not unblank or close the lock.
Therefore, when the mechanical lock is powered up again after power failure, the mechanical lock needs to be recalibrated based on the calibration stroke in the initial use.
The method adopted by the recalibration is to obtain the absolute value of the difference of the code values when the mechanical lock body rotates to the locked rotor in two directions and compare the absolute value with the calibration stroke, and accordingly whether the mechanical lock body is successfully recalibrated is determined. Similar to the method described above for obtaining the calibration stroke of the mechanical lock.
Referring to fig. 10, fig. 10 is a schematic diagram of recalibration after power off according to an embodiment of the present application. Firstly, the mechanical lock body is rotated to a code value when in locked rotation in any direction to serve as a third code value, wherein the locked rotation is any one of locked rotation or unlocked rotation.
And then, rotating the mechanical lock body to the code value when in locked rotation in the opposite direction to be used as a fourth code value, and then calculating the absolute value of the difference value between the third code value and the fourth code value.
And finally, when the absolute value of the difference value of the third code value and the fourth code value is equal to the calibration stroke, the mechanical lock body is confirmed to be calibrated again.
In another embodiment, when the mechanical lock has been recalibrated to allow proper operation, a lock in-place threshold and indicator lights are provided in the faceplate to reduce damage to the mechanical lock. Wherein the lock body is locked in place and unlocked in place. Referring to fig. 11, fig. 11 is a schematic view of an unlocking position according to an embodiment of the present application. The unlocking in place refers to the position where the mechanical lock body is just opened, the position is a certain distance away from the unlocking locked rotor, and the distance is a first preset value. Referring to fig. 12, fig. 12 is a schematic view of locking in place according to an embodiment of the present disclosure. The locking position refers to a position where the mechanical lock body is just locked, and the position is a certain distance away from the unlocking locked rotor, and the distance is a second preset value. The first preset value and the second preset value are different according to different requirements of the mechanical lock body.
Wherein the mechanical lock body is already in an open state when the lock is in place. In order to avoid the damage of the lock body, at the moment, the indicator light is turned on to remind a user that the mechanical lock body is opened, and the mechanical lock body does not need to be continuously rotated. On one hand, the indicator light is used for prompting that the user door is opened or closed, and on the other hand, the mechanical lock body is prevented from being damaged due to the fact that the lock is locked or unlocked at every time. The situation of locking in place is the same as above, and is not described here.
It can be seen that the embodiments of the present application are based on the description of the embodiments of the method for detecting the stroke of the mechanical lock body, and the lock body and the faceplate are connected together by using the motor and a plurality of gears and an encoder. Firstly, a plurality of gears are driven by a motor to rotate a mechanical lock body, the mechanical lock body rotates to block rotation in two opposite directions, and an encoder is driven to encode to obtain a first encoding value and a second encoding value. And calculating the absolute value of the difference value of the first encoding value and the second encoding value to obtain the calibration stroke of the mechanical lock body. The stroke calibration of the mechanical lock body of the intelligent panel lock is realized by driving a plurality of gears and the encoder through the motor, the problem of incompatibility cannot be generated, and meanwhile, the intelligent mechanical lock can be adapted to most intelligent mechanical locks on the market. Meanwhile, the motor drives the gears and the encoder, so that the stroke can be calibrated, the position change condition of the lock body can be obtained according to the change of the encoding value, and the middle position of the stroke of the lock body can be determined through the encoder.
Referring to fig. 13, fig. 13 is a schematic structural diagram of a device for detecting a stroke of a mechanical lock according to an embodiment of the present disclosure, as shown in fig. 13, the device for detecting a stroke of a mechanical lock includes an obtaining unit 1301 and a processing unit 1302; wherein:
the acquisition unit is used for driving the plurality of gears to rotate the mechanical lock body through the motor, rotating to a locked state in a first direction and driving the encoder to encode to obtain a first encoding value;
the acquisition unit is also used for driving the plurality of gears to rotate the mechanical lock body through the motor, rotating to a locked state in a second direction and driving the encoder to encode to obtain a second encoded value, wherein the first direction is opposite to the second direction;
and the processing unit is used for calculating the absolute value of the difference value between the first encoding value and the second encoding value to obtain the calibration stroke of the mechanical lock body, wherein the calibration stroke is the stroke from locking to unlocking of the mechanical lock body.
It can be seen that in the device for detecting mechanical lock stroke shown in fig. 13, the lock stroke calibration is performed using the acquisition unit 1301 and the processing unit 1302. The covering condition is complete, and the problem of multi-intelligent mechanical lock adaptation can be realized. The lock body is connected with the panel by the motor, the gears and the encoder under the scene that electronic equipment such as a mobile phone and the like is connected with the mechanical lock body. Firstly, a plurality of gears are driven by a motor to rotate a mechanical lock body, the mechanical lock body rotates to a locked state in two opposite directions, and an encoder is driven to encode, so that a first encoding value and a second encoding value are obtained. And calculating the absolute value of the difference value of the first code value and the second code value to obtain the calibration stroke of the mechanical lock body. The stroke calibration of the mechanical lock body of the intelligent panel lock is realized by driving a plurality of gears and the encoder through the motor, the problem of incompatibility cannot be generated, and meanwhile, the intelligent mechanical lock can be adapted to most intelligent mechanical locks on the market. Simultaneously, the motor drives the gears and the encoder, so that the stroke can be calibrated, the position change condition of the lock body can be obtained according to the change of the encoding value, and the middle position of the stroke of the lock body can be determined through the encoder.
In a possible implementation manner, in terms of encoding by a dynamic encoder to obtain a first encoded value, the processing unit 1302 is specifically configured to:
acquiring a first electrical signal diagram when the encoder finishes encoding, an initial electrical signal diagram when the encoder does not perform encoding and an initial encoding value;
obtaining the change number of pulses according to the first electric signal diagram and the initial electric signal diagram, wherein the pulses comprise a low level and a high level which are adjacent;
obtaining a change value of the encoder according to the change number of the pulses;
determining the change direction of an encoder according to the pulse edge increment values of A-phase pulses and B-phase pulses in the initial electrical signal diagram and the pulse edge increment values of the A-phase pulses and the B-phase pulses in the first electrical signal diagram, wherein the A-phase pulses and the B-phase pulses are orthogonal pulses of the A-phase pulses and the B-phase pulses which are sent by the encoder during encoding, and the pulse edge increment values are determined by the A-phase pulses and the B-phase pulses;
and obtaining a first coding value according to the initial coding value, the change value of the coder and the change direction of the coder.
In a possible implementation, the processing unit 1302 is specifically configured to:
when the mechanical lock body is powered up again, the mechanical lock body is calibrated again based on the calibration stroke.
In a possible embodiment, in terms of recalibrating the mechanical lock based on the calibration stroke, the processing unit 1302 is specifically configured to:
taking a code value when the mechanical lock body is rotated to a first locked rotation as a third code value, wherein the first locked rotation is any one of locked rotation or unlocked rotation;
taking the code value when the mechanical lock body is rotated to the second locked rotation as a fourth code value, wherein the second locked rotation is opposite to the first locked rotation;
and recalibrating the mechanical lock body according to the third code value, the fourth code value and the calibration stroke.
In a possible implementation manner, in terms of recalibrating the mechanical lock body according to the third coded value, the fourth coded value, and the calibration stroke, the processing unit 1302 is specifically configured to:
when the absolute value of the difference value between the third code value and the fourth code value is the same as the calibration stroke, displaying first prompt information, wherein the first prompt information is used for representing that the mechanical lock body is successfully calibrated again;
and when the absolute value of the difference value between the third code value and the fourth code value is different from the calibration stroke, displaying second prompt information, wherein the second prompt information is used for representing that the mechanical lock body fails to be calibrated again.
In a possible embodiment, after obtaining the calibration stroke of the mechanical lock, the processing unit 1302 is specifically configured to:
acquiring the working state of the mechanical lock body;
and determining the first code value as a locking locked-rotor code value or an unlocking locked-rotor code value according to the working state of the mechanical lock body.
In a possible implementation, after recalibrating the mechanical lock, the panel further comprises an indicator light, and the processing unit 1302 is specifically configured to:
turning on an indicator light when the mechanical lock body is turned to be unlocked in place to represent that the mechanical lock body is opened;
when the mechanical lock body is twisted to be locked in place, the indicator light is turned on to indicate that the mechanical lock body is closed. According to an embodiment of the present application, each unit of the cloud server shown in fig. 13 may be respectively or entirely combined into one or several other units to form the cloud server, or some unit(s) may be further split into multiple units with smaller functions to form the cloud server, which may implement the same operation without affecting implementation of technical effects of the embodiment of the present application. The units are divided based on logic functions, and in practical application, the functions of one unit can be realized by a plurality of units, or the functions of a plurality of units can be realized by one unit. In other embodiments of the present application, the cloud server may also include other units, and in practical applications, these functions may also be implemented by assistance of other units, and may be implemented by cooperation of multiple units.
According to another embodiment of the present application, the apparatus for detecting a stroke of a mechanical lock body as shown in fig. 13 may be constructed by running a computer program (including program codes) capable of executing steps involved in the corresponding method as shown in fig. 3 on a general-purpose computing device, such as a computer, including a Central Processing Unit (CPU), a random access storage medium (RAM), a read-only storage medium (ROM) and the like, and a storage element, and the method for detecting a stroke of a mechanical lock body according to an embodiment of the present application may be implemented. The computer program may be recorded on a computer-readable recording medium, for example, and loaded and executed in the above-described computing apparatus via the computer-readable recording medium.
Based on the description of the method embodiment and the device embodiment, the embodiment of the application further provides an electronic device. Referring to fig. 14, the electronic device comprises at least a processor 1401, an input device 1402, an output device 1403, and a memory 1404. Wherein the processor 1401, input device 1402, output device 1403, and memory 1404 within the electronic device may be connected by a bus or other means.
The memory 1404 may be stored in a memory of an electronic device, the memory 1404 being used to store computer programs comprising program instructions, the processor 1401 being used to execute the program instructions stored by the memory 1404. The processor 1401 (or CPU) is a computing core and a control core of the electronic device, and is adapted to implement one or more instructions, and in particular, is adapted to load and execute the one or more instructions so as to implement a corresponding method flow or a corresponding function.
In one embodiment, the processor 1401 of the electronic device provided in the embodiment of the present application may be used to perform a series of processes of the method for detecting the stroke of the mechanical lock body:
the motor drives the gears to rotate the mechanical lock body, the mechanical lock body rotates to a locked position in a first direction, and the encoder is driven to encode to obtain a first encoding value;
the motor drives the gears to rotate the mechanical lock body, the mechanical lock body rotates to a locked position in a second direction, and the encoder is driven to encode to obtain a second encoded value, wherein the first direction is opposite to the second direction;
and calculating the absolute value of the difference value of the first encoding value and the second encoding value to obtain the calibration stroke of the mechanical lock body, wherein the calibration stroke is the stroke of the mechanical lock body from locking locked rotation to unlocking locked rotation.
It can be seen that, in the electronic device shown in fig. 14, it is beneficial to use the motor, the plurality of gears and the encoder to connect the lock body and the panel together in a scenario where the electronic device such as a mobile phone is connected to the mechanical lock body. Firstly, a plurality of gears are driven by a motor to rotate a mechanical lock body, the mechanical lock body rotates to a locked state in two opposite directions, and an encoder is driven to encode, so that a first encoding value and a second encoding value are obtained. And calculating the absolute value of the difference value of the first code value and the second code value to obtain the calibration stroke of the mechanical lock body. Drive the stroke calibration of the mechanical lock body that a plurality of gears and encoder realized intelligent panel lock through the motor, can not produce incompatible problem, again can the adaptation most intelligent mechanical lock on the market simultaneously. Meanwhile, the motor drives the gears and the encoder, so that the stroke can be calibrated, the position change condition of the lock body can be obtained according to the change of the encoding value, and the middle position of the stroke of the lock body can be determined through the encoder.
In another embodiment, the processor 1401 executes the code to drive the encoder to perform the encoding, and obtain the first encoded value, including:
acquiring a first electrical signal diagram when the encoder finishes encoding, an initial electrical signal diagram when the encoder does not perform encoding and an initial encoding value;
obtaining the change number of pulses according to the first electric signal diagram and the initial electric signal diagram, wherein the pulses comprise a low level and a high level which are adjacent;
obtaining a change value of the encoder according to the change number of the pulses;
determining the change direction of an encoder according to the pulse edge increment values of A-phase pulses and B-phase pulses in the initial electrical signal diagram and the pulse edge increment values of the A-phase pulses and the B-phase pulses in the first electrical signal diagram, wherein the A-phase pulses and the B-phase pulses are orthogonal pulses of the A-phase pulses and the B-phase pulses which are sent by the encoder during encoding, and the pulse edge increment values are determined by the A-phase pulses and the B-phase pulses;
and obtaining a first coding value according to the initial coding value, the change value of the coder and the change direction of the coder.
In yet another embodiment, the processor 1401 performs:
when the mechanical lock body is electrified again, the mechanical lock body is calibrated again based on the calibration stroke.
In yet another embodiment, processor 1401 executes a mechanical lock recalibration based on a calibration stroke, comprising:
taking the code value when the mechanical lock body is rotated to the first locked rotor as a third code value, wherein the first locked rotor is any one of locked rotor or unlocked rotor;
taking the code value when the mechanical lock body is rotated to the second locked rotation as a fourth code value, wherein the second locked rotation is opposite to the first locked rotation;
and recalibrating the mechanical lock body according to the third code value, the fourth code value and the calibration stroke.
In yet another embodiment, the processor 1401 performs recalibration of the mechanical lock body according to the third code value, the fourth code value, and the calibration stroke, including:
when the absolute value of the difference value between the third code value and the fourth code value is the same as the calibration stroke, displaying first prompt information, wherein the first prompt information is used for representing that the mechanical lock body is successfully calibrated again;
and when the absolute value of the difference value between the third code value and the fourth code value is different from the calibration stroke, displaying second prompt information, wherein the second prompt information is used for representing that the mechanical lock body fails to be calibrated again. In yet another embodiment, the processor 1401, after obtaining the calibration stroke of the mechanical lock body, performs the method further comprising:
acquiring the working state of the mechanical lock body;
and determining the first code value as a locking locked-rotor code value or an unlocking locked-rotor code value according to the working state of the mechanical lock body.
In yet another embodiment, the processor 1401, after recalibrating the mechanical lock body, the faceplate further comprises an indicator light, and performing further comprises:
turning on an indicator light when the mechanical lock body is turned to be unlocked in place so as to represent that the mechanical lock body is opened;
when the mechanical lock body is twisted to be locked in place, the indicator light is turned on to indicate that the mechanical lock body is closed. By way of example, the electronic devices may be an ultrasound examination device, a computer, etc., including but not limited to a processor 1401, an input device 1402, an output device 1403, and a memory 1404. And the system also comprises a memory, a power supply, an application client module and the like. The input device 1402 may be a scanning device, a keyboard, a touch screen, a radio frequency receiver, etc., and the output device 1403 may be a speaker, a display, a radio frequency transmitter, etc. It will be appreciated by those skilled in the art that the schematic diagrams are merely examples of an electronic device and do not constitute a limitation of an electronic device, and may include more or fewer components than those shown, or some components in combination, or different components.
It should be noted that, since the steps in the method for detecting the stroke of the mechanical lock described above are implemented when the processor 1401 of the electronic device executes the computer program, all the embodiments of the method for detecting the stroke of the mechanical lock described above are applicable to the electronic device, and all the same or similar beneficial effects can be achieved.
An embodiment of the present application further provides a computer storage medium (Memory), which is a Memory device in an electronic device and is used to store programs and data. It is understood that the computer storage medium herein may include a built-in storage medium in the terminal, and may also include an extended storage medium supported by the terminal. The computer storage medium provides a storage space that stores an operating system of the terminal. Also stored in this memory space are one or more instructions, which may be one or more computer programs (including program code), suitable for loading and execution by processor 1401. The computer storage medium may be a high-speed RAM memory, or may be a non-volatile memory (non-volatile memory), such as at least one disk memory; alternatively, at least one computer storage medium may be located remotely from the processor 1401. In one embodiment, one or more instructions stored in a computer storage medium may be loaded and executed by the processor 1401 to implement the corresponding steps described above with respect to the method of detecting mechanical lock body travel.
Illustratively, the computer program of the computer storage medium includes computer program code, which may be in the form of source code, object code, an executable file or some intermediate form, and the like. The computer readable medium may include: any entity or device capable of carrying computer program code, recording medium, U.S. disk, removable hard disk, magnetic disk, optical disk, computer Memory, read-Only Memory (ROM), random Access Memory (RAM), electrical carrier wave signals, telecommunications signals, software distribution media, and the like.
It should be noted that, since the computer program of the computer storage medium is executed by the processor to implement the steps in the method for detecting the stroke of the mechanical lock body, all the embodiments of the method for detecting the stroke of the mechanical lock body are applicable to the computer storage medium, and can achieve the same or similar beneficial effects.
The foregoing detailed description of the embodiments of the present application has been presented to illustrate the principles and implementations of the present application, and the above description of the embodiments is only provided to help understand the method and the core concept of the present application; meanwhile, for a person skilled in the art, according to the idea of the present application, there may be variations in the specific embodiments and application scope, and in summary, the content of the present specification should not be construed as a limitation to the present application.

Claims (10)

1. A method for detecting the stroke of a mechanical lock body is characterized in that the method is applied to the mechanical lock body, wherein the mechanical lock body comprises a lock body and a panel, the panel comprises a motor, a plurality of gears and an encoder, and the method comprises the following steps:
the motor drives the gears to rotate the mechanical lock body, the mechanical lock body rotates to a locked position in a first direction, and the encoder is driven to encode to obtain a first encoding value;
the motor drives the gears to rotate the mechanical lock body, the mechanical lock body rotates to a locked position in a second direction, and drives the encoder to encode to obtain a second encoded value, wherein the first direction is opposite to the second direction;
and calculating an absolute value of a difference value between the first encoding value and the second encoding value to obtain a calibration stroke of the mechanical lock body, wherein the calibration stroke is a stroke of the mechanical lock body from locking to unlocking.
2. The method of claim 1, wherein said driving the encoder to encode to obtain a first encoded value comprises:
acquiring a first electric signal diagram when the encoder finishes encoding, an initial electric signal diagram when the encoder does not perform encoding and an initial encoding value;
obtaining the change number of pulses according to the first electrical signal diagram and the initial electrical signal diagram, wherein the pulses comprise a low level and a high level which are adjacent;
obtaining a change value of the encoder according to the change number of the pulses;
determining the change direction of the encoder according to the pulse edge increment values of the A-phase pulse and the B-phase pulse in the initial electric signal diagram and the pulse edge increment values of the A-phase pulse and the B-phase pulse in the first electric signal diagram, wherein the A-phase pulse and the B-phase pulse are orthogonal pulses of the A-phase pulse and the B-phase pulse which are sent by the encoder during encoding, and the pulse edge increment values are determined by the A-phase pulse and the B-phase pulse;
and obtaining the first coding value according to the initial coding value, the change value of the coder and the change direction of the coder.
3. The method according to claim 1 or 2, characterized in that the method further comprises:
when the mechanical lock body is powered up again, the mechanical lock body recalibrates the mechanical lock body based on the calibration stroke.
4. The method of claim 3, wherein the mechanical lock recalibrates the mechanical lock based on the calibration stroke, comprising:
taking a code value when the mechanical lock body is rotated to a first locked rotation as a third code value, wherein the first locked rotation is any one of locked rotation or unlocked rotation;
taking the code value when the mechanical lock body is rotated to a second locked rotation as a fourth code value, wherein the second locked rotation is opposite to the first locked rotation;
and recalibrating the mechanical lock body according to the third code value, the fourth code value and the calibration stroke.
5. The method of claim 4, wherein said recalibrating the mechanical lock body based on the third code value, the fourth code value, and the calibration stroke comprises:
when the absolute value of the difference value between the third code value and the fourth code value is the same as the calibration stroke, displaying first prompt information, wherein the first prompt information is used for representing that the mechanical lock body is successfully calibrated again;
and when the absolute value of the difference value between the third code value and the fourth code value is different from the calibration stroke, displaying second prompt information, wherein the second prompt information is used for representing that the mechanical lock body fails to be calibrated again.
6. The method of any of claims 1-5, wherein after obtaining the calibrated travel of the mechanical lock body, the method further comprises:
acquiring the working state of the mechanical lock body;
and determining the first code value as a locking locked-rotor code value or an unlocking locked-rotor code value according to the working state of the mechanical lock body.
7. The method of any of claims 1-6, wherein after recalibrating the mechanical lock body, the panel further comprises an indicator light, the method further comprising:
turning on the indicator light when the mechanical lock body is twisted to be unlocked in place so as to represent that the mechanical lock body is opened;
and when the mechanical lock body is twisted to be locked in place, the indicator light is turned on to indicate that the mechanical lock body is closed.
8. The utility model provides a detect device of mechanical lock stroke which characterized in that, detect device of mechanical lock stroke includes:
the acquisition unit is used for driving the gears to rotate the mechanical lock body through the motor, rotating to a locked state in a first direction, and driving the encoder to encode to obtain a first encoding value;
the acquisition unit is further used for driving the gears to rotate the mechanical lock body through the motor, rotating the mechanical lock body to a second direction until the mechanical lock body is locked, and driving the encoder to encode to obtain a second encoded value, wherein the first direction is opposite to the second direction;
and the processing unit is used for calculating the absolute value of the difference value between the first encoding value and the second encoding value to obtain the calibration stroke of the mechanical lock body, wherein the calibration stroke is the stroke from locking to unlocking.
9. An electronic device, comprising: a processor and a memory, the processor being coupled to the memory, the memory for storing a computer program, the processor for executing the computer program stored in the memory to cause the electronic device to perform the method of any of claims 1-7.
10. A computer-readable storage medium, characterized in that the computer-readable storage medium stores a computer program, which is executed by a processor to implement the method according to any one of claims 1-7.
CN202211086921.5A 2022-09-06 2022-09-06 Method and device for detecting stroke of mechanical lock body, electronic equipment and storage medium Pending CN115325980A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202211086921.5A CN115325980A (en) 2022-09-06 2022-09-06 Method and device for detecting stroke of mechanical lock body, electronic equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202211086921.5A CN115325980A (en) 2022-09-06 2022-09-06 Method and device for detecting stroke of mechanical lock body, electronic equipment and storage medium

Publications (1)

Publication Number Publication Date
CN115325980A true CN115325980A (en) 2022-11-11

Family

ID=83929882

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202211086921.5A Pending CN115325980A (en) 2022-09-06 2022-09-06 Method and device for detecting stroke of mechanical lock body, electronic equipment and storage medium

Country Status (1)

Country Link
CN (1) CN115325980A (en)

Similar Documents

Publication Publication Date Title
CN112396613A (en) Image segmentation method and device, computer equipment and storage medium
US20120057291A1 (en) Portable electronic device and unlocking method by electronic compass
CN110059794A (en) Man-machine recognition methods and device, electronic equipment, storage medium
US20080244730A1 (en) Security capability with an input device
CN111512009A (en) Door lock baffle with touch and wireless functions
CN111994176A (en) Charging port cover and charging lock control method, device, equipment and medium
CN109230916A (en) Elevator operation control method, system, controller and encoder
CN111827793A (en) Electronic lock, electronic lock state detection method and storage medium
CN115325980A (en) Method and device for detecting stroke of mechanical lock body, electronic equipment and storage medium
CN105786349A (en) Method for controlling screen picture to rotate and electronic device
CN112820007B (en) Method and system for distinguishing two-dimensional code and IC card signal based on Wiegand protocol
CN110188523A (en) A kind of verification method and mobile terminal
CN111395877B (en) Lockset, lockset control method, control device and readable storage medium
CN110968355A (en) Application program starting method and device and terminal
CN116168040B (en) Component direction detection method and device, electronic equipment and readable storage medium
US20190020988A1 (en) Vehicle communication system and portable device
US20050261804A1 (en) Mechanical lock manipulation device and method
CN110929767B (en) Font processing method, system, device and medium
US11144746B1 (en) Fingerprint sensing apparatus with in-sensor fingerprint enrollment and verification
CN113611048A (en) Battery replacement cabinet capable of taking swallowed batteries online and offline and operation method thereof
CN105677201A (en) Unlocking method and device and mobile terminal
WO2020004450A1 (en) Communication device, communication system, method for controlling information terminal, and information terminal program
CN108090522B (en) Control method of card sender and card sender
CN117875267B (en) Method and system for converting Chinese characters into pinyin
CN113874922B (en) Determining a position of a mobile key device based on a phase difference of samples

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination