Intelligent door lock unlocking method and system based on dynamic light coding
The smart lock unlocking method using dynamic optical coding solves the problem of smart locks being susceptible to environmental interference, and achieves more stable and lower-cost communication.
Patent Information
- Application Number
- CN202511119147.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-08-11
- Publication Date
- 2025-11-21
AI Technical Summary
Existing smart door locks use wireless radio frequency communication, which is easily affected by environmental factors and has high cost and power consumption.
The smart door lock unlocking method based on dynamic optical coding is adopted. The mobile terminal modulates the optical signal, the smart door lock decodes and decrypts it, and unlocks the door after identity authentication, thus avoiding environmental interference under wireless radio frequency communication.
This improves the communication anti-interference stability of smart door locks and reduces costs and power consumption.
Smart Images

Figure CN120997925A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of smart door lock technology, and in particular to a smart door lock unlocking method and system based on dynamic optical coding. Background Technology
[0002] With the development of the Internet of Things and smart homes, smart door locks are gradually replacing traditional mechanical locks and entering thousands of households due to their convenient unlocking methods and high security.
[0003] However, most smart door locks currently communicate with smartphones using wireless radio frequency communication methods, such as Wi-Fi, Bluetooth, Zigbee, and Near Field Communication (NFC). Since wireless radio frequency is susceptible to complex electromagnetic environments, and the above communication methods still have much room for improvement in terms of user convenience, hardware cost, power consumption, and security performance.
[0004] Furthermore, since smartphones communicate with smart locks via Wi-Fi, network configuration is required, which relies on routers and results in high power consumption. Additionally, the built-in NFC chip in smart locks is expensive, and there are issues such as high continuous standby power consumption, the need for antenna installation, susceptibility to electromagnetic and metallic environments, making smart locks susceptible to environmental interference. These issues, along with their high cost and power consumption, are problems that urgently need to be addressed.
[0005] Therefore, existing technologies still need to be improved and developed. Summary of the Invention
[0006] The main objective of this invention is to provide a smart door lock unlocking method, system, terminal, and computer-readable storage medium based on dynamic optical coding, aiming to solve the problems of existing smart door locks using wireless radio frequency communication, which makes them susceptible to interference from environmental factors and result in high costs and power consumption.
[0007] To achieve the above objectives, the present invention provides a smart door lock unlocking method based on dynamic optical coding, the smart door lock unlocking method based on dynamic optical coding comprising the following steps: The mobile terminal acquires encrypted data instructions and modulates the encrypted data instructions according to a preset dynamic optical code to obtain a differentiated pulse width optical signal. If the communication distance and angle between the flash of the mobile terminal and the smart door lock meet the preset requirements, the mobile terminal encodes the differentiated pulse width light signal according to the preset preamble frequency to obtain the target differentiated pulse width light signal, and sends the target differentiated pulse width light signal to the smart door lock through visible light communication. The smart door lock obtains the current ambient light intensity and basic offset through a light sensor, and decodes the target differential pulse width light signal according to the current ambient light intensity and the basic offset to obtain initial communication data; The smart lock decrypts the initial communication data to obtain the decryption result, and performs identity authentication based on the decryption result. The lock unlocks after successful authentication.
[0008] Optionally, the smart door lock unlocking method based on dynamic optical coding, wherein the mobile terminal acquires encrypted data instructions and modulates the encrypted data instructions according to a preset dynamic optical code to obtain a differentiated pulse width optical signal, further includes: The mobile terminal obtains a pre-stored first timestamp, smart lock code, count value, and first salt value, and encodes the first timestamp, smart lock code, count value, and first salt value to obtain a dynamic key; The mobile terminal acquires the data packet and encrypts the data packet according to the dynamic key to obtain an encrypted data instruction.
[0009] Optionally, the smart door lock unlocking method based on dynamic optical coding, wherein the mobile terminal acquires encrypted data instructions and modulates the encrypted data instructions according to a preset dynamic optical code to obtain a differentiated pulse width optical signal, specifically includes: The mobile terminal acquires multiple current ambient light luminance values, calculates the average ambient light value based on the average value of all current ambient light luminance values, and dynamically encodes a preset dynamic light code based on the average ambient light value to obtain a target dynamic light code. The mobile terminal acquires encrypted data instructions and modulates the encrypted data instructions according to the target dynamic optical code to obtain a differentiated pulse width optical signal.
[0010] Optionally, the smart door lock unlocking method based on dynamic optical coding includes pulse width modulation and pulse position modulation. The mobile terminal acquires encrypted data instructions, modulates the encrypted data instructions according to the target dynamic optical code, and obtains a differentiated pulse width optical signal, specifically including: The mobile terminal obtains encrypted data instructions and on / off duration; The on / off duration is modulated according to the fixed period of the pulse position modulation and the time ratio of the pulse width modulation to obtain a logic signal; The encrypted data instruction is modulated according to the logic signal to obtain a differentiated pulse width optical signal; The logic signal is used to control the duration of the flash on / off of the mobile terminal's flash.
[0011] Optionally, the smart door lock unlocking method based on dynamic optical coding, wherein modulating the on / off duration according to the fixed period of the pulse position modulation and the time ratio of the pulse width modulation to obtain a logic signal specifically includes: When the time ratio is a first preset ratio, the on / off duration is modulated according to the fixed period of the pulse position modulation and the first preset ratio to obtain a first logic signal. When the time ratio is the second preset ratio, the on / off duration is modulated according to the fixed period of the pulse position modulation and the second preset ratio to obtain the second logic signal.
[0012] Optionally, in the smart door lock unlocking method based on dynamic optical coding, the preset pre-code frequency includes proportional pulses; If the communication distance and angle between the flash of the mobile terminal and the smart lock meet the preset requirements, the mobile terminal encodes the differentiated pulse width light signal according to the preset preamble frequency to obtain the target differentiated pulse width light signal, and sends the target differentiated pulse width light signal to the smart lock through visible light communication, specifically including: Determine whether the communication distance and angle between the flash of the mobile terminal and the smart door lock meet the preset requirements; If the communication distance and angle between the flash of the mobile terminal and the smart door lock meet the preset requirements, the differentiated pulse width light signal is encoded according to the proportional relationship of the equal pulse to obtain the target differentiated pulse width light signal, and the flash is driven by the flash driver module to send the target differentiated pulse width light signal to the smart door lock. The ratio includes the duration of the lights on and the duration of the lights off.
[0013] Optionally, the smart door lock unlocking method based on dynamic optical coding, wherein the smart door lock acquires the current ambient light intensity and basic offset through a light sensor, and decodes the target differential pulse width optical signal according to the current ambient light intensity and the basic offset to obtain initial communication data, specifically including: The smart door lock collects the current ambient light intensity and basic offset through a light sensor, and calculates a dynamic detection threshold based on the current ambient light intensity, a preset proportional coefficient, and the basic offset. The smart door lock filters the target differentiated pulse width optical signal according to the dynamic detection threshold to obtain the target optical signal, and decrypts the target optical signal multiple times according to the first timestamp to obtain the initial communication data.
[0014] In addition, to achieve the above objectives, the present invention also provides a smart door lock unlocking system based on dynamic optical coding, wherein the smart door lock unlocking system based on dynamic optical coding includes: a smart door lock and a mobile terminal; The mobile terminal user obtains an encrypted data instruction, modulates the encrypted data instruction according to a preset dynamic optical code, and obtains a differentiated pulse width optical signal. If the communication distance between the flash of the mobile terminal and the smart door lock is a preset distance and a preset angle, the mobile terminal encodes the differentiated pulse width optical signal according to a preset preamble frequency to obtain a target differentiated pulse width optical signal. The smart door lock uses a light sensor to obtain the current ambient light intensity and basic offset, decodes the target differential pulse width light signal based on the current ambient light intensity and the basic offset to obtain initial communication data, decrypts the initial communication data to obtain a decryption result, performs identity authentication based on the decryption result, and unlocks the door after successful authentication.
[0015] In this invention, a mobile terminal acquires encrypted data instructions and modulates these instructions according to a preset dynamic optical code to obtain a differentiated pulse width optical signal. If the communication distance and angle between the mobile terminal's flash and the smart lock meet preset requirements, the mobile terminal encodes the differentiated pulse width optical signal according to a preset preamble frequency to obtain a target differentiated pulse width optical signal, and sends this target differentiated pulse width optical signal to the smart lock via visible light communication. The smart lock acquires the current ambient light intensity and a base offset using a light sensor, and decodes the target differentiated pulse width optical signal based on these parameters to obtain initial communication data. The smart lock decrypts the initial communication data to obtain a decryption result, performs identity authentication based on the decryption result, and unlocks the door upon successful authentication. This invention, by sending the target differentiated pulse width optical signal from the mobile terminal to the smart lock for decoding, significantly improves the stability of the smart lock's communication against interference. Attached Figure Description
[0016] Figure 1 This is a flowchart of a preferred embodiment of the intelligent door lock unlocking method based on dynamic optical coding of the present invention; Figure 2 This is a flowchart illustrating the data flow of a preferred embodiment of the smart door lock unlocking method based on dynamic optical coding of the present invention. Figure 3 This is a flowchart of the first logic signal of a preferred embodiment of the smart door lock unlocking method based on dynamic optical coding of the present invention; Figure 4 This is a flowchart of the second logic signal of a preferred embodiment of the smart door lock unlocking method based on dynamic optical coding of the present invention; Figure 5 This is a flowchart of the preamble code for a preferred embodiment of the smart door lock unlocking method based on dynamic optical coding of the present invention; Figure 6 This is a structural diagram of a preferred embodiment of the intelligent door lock unlocking system based on dynamic optical coding of the present invention. Detailed Implementation
[0017] To make the objectives, technical solutions, and advantages of this invention clearer and more explicit, the invention will be further described in detail below with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative of the invention and are not intended to limit the invention.
[0018] Currently, most smart locks communicate with smartphones via wireless radio frequency communication methods, such as Wi-Fi, Bluetooth, Zigbee, and Near Field Communication (NFC). However, wireless radio frequency communication is susceptible to complex electromagnetic environments, and these methods still have significant room for improvement in terms of user convenience, hardware cost, power consumption, and security. Since smartphones communicate with smart locks via Wi-Fi, network configuration is required, leading to high power consumption due to router reliance. Furthermore, the built-in NFC chip in smart locks is expensive, suffers from high standby power consumption, requires antenna placement, and is susceptible to electromagnetic and metallic interference, making smart locks vulnerable to environmental factors and incurring high costs and power consumption. Therefore, a method based on dynamic optical coding is needed for smart lock unlocking. This method involves the mobile terminal modulating and sending an optical signal, which the smart lock receives, decodes, and decrypts. Upon successful authentication, the lock unlocks, avoiding the environmental interference issues inherent in wireless radio frequency communication.
[0019] The preferred embodiment of the smart door lock unlocking method based on dynamic optical coding described in this invention, such as... Figure 1 As shown, the smart door lock unlocking method based on dynamic optical coding includes the following steps: Step S10: The mobile terminal obtains the encrypted data instruction and modulates the encrypted data instruction according to the preset dynamic optical code to obtain a differentiated pulse width optical signal.
[0020] Step S10 includes: Step S11: The mobile terminal acquires multiple current ambient light brightness values, calculates the average value of the ambient light based on all the current ambient light brightness values, and dynamically encodes the preset dynamic light code based on the average ambient light value to obtain the target dynamic light code; Step S12: The mobile terminal acquires the encrypted data instruction and modulates the encrypted data instruction according to the target dynamic optical code to obtain a differentiated pulse width optical signal.
[0021] Specifically, before step S10, the mobile terminal acquires a pre-stored first timestamp, smart lock code, count value, and first salt value; encodes the first timestamp, smart lock code, count value, and first salt value to obtain a dynamic key (AES key (dynamic key) consists of: first timestamp, device SN code (smart lock code), count value, and first salt value); the mobile terminal acquires a data packet, encrypts the data packet according to the dynamic key to obtain an encrypted data instruction; the mobile terminal acquires multiple current ambient light luminance values, calculates the average value of all current ambient light luminance values to obtain an average ambient light value, and dynamically encodes a preset dynamic light code based on the average ambient light value (dynamic threshold refers to...). The optical signal transmitter (mobile APP, i.e., mobile terminal) dynamically adjusts the time period of the current data command modulation transmission optical code according to the current ambient light brightness. When the ambient light is stronger, the interference will be greater, and the time of the two states of the optical code on and off will be correspondingly longer to improve the anti-interference capability of ambient light. When the ambient light is weaker, the time of the two states of the optical code on and off is shorter to improve the transmission rate. The target dynamic optical code is obtained. The mobile terminal obtains the encrypted data command and modulates the encrypted data command according to the target dynamic optical code to obtain a differentiated pulse width optical signal (the encrypted data command is mixed and modulated by (target dynamic optical code) PWM-PPM to distinguish the signal pulse from the ambient light noise in the strong light environment, and the signal-to-noise ratio is improved by combining dynamic threshold adjustment technology).
[0022] Step S12 includes: Step S121: The mobile terminal obtains the encrypted data instruction and the on / off duration; Step S122: Modulate the on / off duration according to the fixed period of the pulse position modulation and the time ratio of the pulse width modulation to obtain a logic signal; Step S123: Modulate the encrypted data instruction according to the logic signal to obtain a differentiated pulse width optical signal.
[0023] In this embodiment, as Figure 2 , Figure 3 and Figure 4As shown, the target dynamic optical encoding includes pulse width modulation (PWM) and pulse position modulation (fixed pulse width, i.e., PWM: the duration (pulse width) of each pulse is constant; variable pulse interval, i.e., pulse position modulation: data is encoded by adjusting the time interval between pulses). The mobile terminal acquires the encrypted data command and the flash duration, and modulates the flash duration according to the fixed period of the pulse position modulation and the time ratio of the PWM to obtain a logic signal (different logic signals 0 and 1 are represented by adjusting the flash duration ratio, wherein the first logic signal (logic signal 0): flash on). The flash is on for 3T / 4 hours and off for 3T / 4 hours (with PWM signal accounting for 25%±5%, without PWM signal accounting for 75%±5%). The second logic signal (logic signal 1) is: flash on for 3T / 4 hours and off for 3T / 4 hours (with PWM signal accounting for 75%±5%, without PWM signal accounting for 25%±5%). The encrypted data instruction is modulated according to the logic signal to obtain a differentiated pulse width optical signal. The logic signal is used to control the on / off duration of the flash of the mobile terminal (the optical signal adopts PWM-PPM hybrid modulation, where PWM is the carrier and is used to control and represent the two states of on and off).
[0024] Step S122 includes: Step S1221: When the time ratio is a first preset ratio, the on / off duration is modulated according to the fixed period of the pulse position modulation and the first preset ratio to obtain a first logic signal; Step S1222: When the time ratio is the second preset ratio, the on / off duration is modulated according to the fixed period of the pulse position modulation and the second preset ratio to obtain the second logic signal.
[0025] In this embodiment, when the time proportion is a first preset proportion, the on / off duration is modulated according to the fixed period of the pulse position modulation and the first preset proportion to obtain a first logic signal; when the time proportion is a second preset proportion, the on / off duration is modulated according to the fixed period of the pulse position modulation and the second preset proportion to obtain a second logic signal.
[0026] In this embodiment, the first logic signal and the second logic signal are represented by optical encoding composed of the time ratio of the on and off states. For example, taking the transmission of logic signals "1" and "0" as an example (assuming period T=4ms): Logic signal 1: On for 3ms (PWM output 3ms, on 75% duty cycle), then off for 1ms (PWM stop 1ms, off 25% duty cycle); Logic signal 0: On for 1ms (PWM output 1ms, on 25% duty cycle), then off for 3ms (PWM stop 3ms, off 75% duty cycle).
[0027] Step S20: If the communication distance and angle between the flash of the mobile terminal and the smart door lock meet the preset requirements, the mobile terminal encodes the differentiated pulse width light signal according to the preset preamble frequency to obtain the target differentiated pulse width light signal, and sends the target differentiated pulse width light signal to the smart door lock through visible light communication.
[0028] Step S20 includes: Step S21: Determine whether the communication distance and angle between the flash of the mobile terminal and the smart door lock meet the preset requirements; Step S22: If the communication distance and angle between the flash of the mobile terminal and the smart door lock meet the preset requirements, the differentiated pulse width light signal is encoded according to the proportional relationship of the equal pulse to obtain the target differentiated pulse width light signal, and the flash is driven by the flash driver module to send the target differentiated pulse width light signal to the smart door lock.
[0029] Specifically, such as Figure 5 As shown, the preset preamble frequency includes proportional pulses (the application layer communication protocol sets the preset preamble frequency; proportional pulses refer to the equal on / off duration of the preamble's optical code. By using optical codes with equal on / off durations, the subsequent communication optical code period can be determined, which facilitates the calculation of logic signals). The system determines whether the communication distance and angle between the mobile terminal's flash and the smart lock meet preset requirements. If the communication distance and angle between the mobile terminal's flash and the smart lock meet the preset requirements (controlling the distance and angle between the flash and the lock sensor, where the angle is less than ±60° in the vertical direction and the distance is less than 50cm in the vertical direction), then the differentiated pulse width is adjusted according to the proportional relationship of the proportional pulses. The light signal is encoded (where the ratio is: light-on duration = light-off duration = T / 2 (PWM pulse signal accounts for 50%±5%, no pulse signal accounts for 50%±5%), where the T value is not fixed and the APP automatically adjusts the T value according to the ambient light intensity) to obtain the target differentiated pulse width light signal (the target differentiated pulse width light signal is the PPM pulse width, not the PWM pulse width, which is the light signal on / off duration from the perspective of the receiving end (smart door lock). For example, the wider the pulse width, the longer the light encoding on / off duration period; the smaller the pulse width, the shorter the time of the two states of light encoding on / off). The flash is then driven by the flash drive module to send the target differentiated pulse width light signal to the smart door lock. The ratio includes the light-on duration and the light-off duration.
[0030] In this embodiment, the optical encoding period is first synchronized by a preset preamble frequency, and a signal with a 5ms on / off duration (on / off duration accounts for 50%, also known as proportional pulse width) is sent. After receiving this signal, the smart door lock terminal considers the subsequent optical signal period to be 10ms. When it receives a 2.5ms on and 7.5ms off signal, it identifies it as logic signal 0. When it receives a 7.5ms on and 2.5ms off signal, it identifies it as logic signal 1.
[0031] Step S30: Obtain the physical parameters of the camera, perform three-dimensional coordinate mapping on the effective area based on the physical parameters to obtain target coordinate parameters, and send the target coordinate parameters to the smart door lock.
[0032] Step S30 includes: Step S31: The smart door lock collects the current ambient light intensity and basic offset through a light sensor, and calculates a dynamic detection threshold based on the current ambient light intensity, a preset proportional coefficient and the basic offset. Step S32: The smart door lock filters the target differentiated pulse width optical signal according to the dynamic detection threshold to obtain the target optical signal, and decrypts the target optical signal multiple times according to the first timestamp to obtain the initial communication data.
[0033] Specifically, the smart door lock collects the current ambient light intensity and basic offset using a light sensor (using a narrow-view sensor with a receiving angle ≤ 60°). Based on the current ambient light intensity, a preset scaling factor, and the basic offset, a dynamic detection threshold is calculated. The smart door lock then filters the target differentiated pulse width light signal according to the dynamic detection threshold to obtain the target light signal. The target light signal is then decrypted multiple times based on the first timestamp to obtain initial communication data.
[0034] In this embodiment, signal amplitude detection is similar to dynamic threshold. Dynamic threshold is for the transmitting end (mobile phone), while signal amplitude refers to the signal receiving end (smart door lock) actively judging the current intensity value of ambient light (average value over a period of time) when it is woken up and in receiving state, and using this value as the base value of light signal receiving intensity. Light signals greater than this value are considered valid signals, and light signals less than or equal to this value are considered invalid signals.
[0035] As an example, the smart door lock dynamically adjusts the signal detection threshold based on the current ambient light intensity. Baseline sampling: The MCU collects the current ambient light intensity during signal gaps (when there are no light pulses). The dynamic detection threshold calculation process: The dynamic detection threshold is equal to the product of a proportional coefficient and the current ambient light intensity, plus a base offset. The proportional coefficient (based on theoretical analysis, a value of 0.8~1.2 is recommended; it is configurable and stored in the door lock MCU), and the base offset (based on theoretical analysis, a value of 50~100 lux is recommended; it is configurable and stored in the door lock MCU). Secondly, through differentiated pulse width design, in strong light environments, the pulse width signal remains higher than the noise baseline. Combined with a clock fault tolerance mechanism (the door lock's internal clock allows for errors), the signal-to-noise ratio is significantly improved. For example, if a mobile terminal sends a 10ms period preamble with a 50% on / off time ratio, the smart door lock may calculate it as a 9.5ms pulse width code with a 50% on / off time ratio. The error is within 5%, which can be considered effective.
[0036] Step S32 includes: Step S321: The smart door lock filters the target differential pulse width light signal according to the dynamic detection threshold to obtain the target light signal; Step S322: Generate a first key based on the current minute coefficient, the smart lock code, the count value and the first salt value; decrypt the target light signal based on the first key to obtain the first initial communication data. Step S323: Generate a second key based on the previous minute coefficient, the smart lock code, the count value and the first salt value; decrypt the target light signal based on the second key to obtain the second initial communication data. Step S324: Generate a third key based on the last minute coefficient, the smart lock code, the count value and the first salt value; decrypt the target light signal based on the third key to obtain the third initial communication data. Step S325: Determine the initial communication data based on the first initial communication data, the second initial communication data, and the third initial communication data.
[0037] Specifically, the smart lock filters the target differential pulse width optical signal according to the dynamic detection threshold to obtain the target optical signal. It generates a first key based on the current minute coefficient, the smart lock code, the count value, and the first salt value. The target optical signal is decrypted using the first key to obtain first initial communication data. A second key is generated based on the previous minute coefficient, the smart lock code, the count value, and the first salt value. The target optical signal is decrypted using the second key to obtain second initial communication data. Finally, the target optical signal is filtered based on the next minute coefficient, the smart lock code, the count value, and the first salt value. The first salt value is used to generate a third key. The target optical signal is decrypted using the third key to obtain third initial communication data. Initial communication data is determined based on the first initial communication data, the second initial communication data, and the third initial communication data (the second-level timestamp is aligned to the minute, the time is obtained from the mobile phone, and after the smart door lock receives it, it uses the three keys generated by the current minute coefficient, the previous minute coefficient, and the next minute coefficient to perform a maximum of three decryptions to prevent the problem of key inconsistency caused by the difference between the mobile phone and device clocks at the minute threshold). The first timestamp includes the current minute coefficient, the previous minute coefficient, and the next minute coefficient.
[0038] Furthermore, after the smart lock successfully executes the instruction, it updates the stored count value. When it receives the instruction again, it checks whether the count value in the data packet is greater than the count value of the last successful decryption (or within the valid time window). If not, it refuses to execute.
[0039] Step S40: The smart door lock decrypts the initial communication data to obtain the decryption result, and performs identity authentication based on the decryption result. After successful authentication, the lock is unlocked.
[0040] Step S40 includes: Step S41: The smart door lock acquires a pre-stored second timestamp and second salt value; Step S42: Re-encode the second timestamp, the smart lock code, the second salt value, and the count value to obtain the decryption key; Step S42: Decrypt the initial communication data according to the decryption key to obtain the decryption result. If the decryption result is correct, control the smart door lock to unlock.
[0041] Specifically, such as Figure 6As shown, the smart lock obtains a pre-stored second timestamp and second salt value, and re-encodes the second timestamp, the smart lock code, the second salt value, and the count value to obtain a decryption key. The lock uses the received count value (combined with the locally stored second timestamp, second salt value, and smart lock code) to regenerate the decryption key for decryption. The decryption module decrypts the initial communication data according to the decryption key to obtain a decryption result. If the decryption result is correct, the smart lock is controlled to unlock (unlocked according to the unlocking command issued by the smart lock).
[0042] Furthermore, such as Figure 6 As shown, the intelligent door lock unlocking system based on dynamic optical coding includes: an intelligent door lock and a mobile terminal; The mobile terminal user obtains an encrypted data instruction, modulates the encrypted data instruction according to a preset dynamic optical code, and obtains a differentiated pulse width optical signal. If the communication distance between the flash of the mobile terminal and the smart door lock is a preset distance and a preset angle, the mobile terminal encodes the differentiated pulse width optical signal according to a preset preamble frequency to obtain a target differentiated pulse width optical signal. The smart door lock uses a light sensor to obtain the current ambient light intensity and basic offset, decodes the target differential pulse width light signal based on the current ambient light intensity and the basic offset to obtain initial communication data, decrypts the initial communication data to obtain a decryption result, performs identity authentication based on the decryption result, and unlocks the door after successful authentication.
[0043] In summary, this invention provides a smart lock unlocking method and system based on dynamic optical coding. The method includes: a mobile terminal acquiring an encrypted data command and modulating the encrypted data command according to a preset dynamic optical coding to obtain a differentiated pulse width optical signal; if the communication distance and angle between the mobile terminal's flash and the smart lock meet preset requirements, the mobile terminal encodes the differentiated pulse width optical signal according to a preset preamble frequency to obtain a target differentiated pulse width optical signal, and sends the target differentiated pulse width optical signal to the smart lock via visible light communication; the smart lock acquires the current ambient light intensity and basic offset through a light sensor, and decodes the target differentiated pulse width optical signal according to the current ambient light intensity and the basic offset to obtain initial communication data; the smart lock decrypts the initial communication data to obtain a decryption result, and performs identity authentication based on the decryption result, unlocking the lock after successful authentication. This invention, by sending the target differentiated pulse width optical signal from the mobile terminal to the smart lock for decoding, greatly improves the stability of the smart lock's communication against interference.
[0044] It should be noted that, in this document, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or system that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or system. Unless otherwise specified, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or system that includes that element.
[0045] It should be understood that the application of the present invention is not limited to the examples above. Those skilled in the art can make improvements or modifications based on the above description, and all such improvements and modifications should fall within the protection scope of the appended claims.
Claims
1. A smart door lock unlocking method based on dynamic optical coding, characterized in that, The smart door lock unlocking method based on dynamic optical coding includes: The mobile terminal acquires encrypted data instructions and modulates the encrypted data instructions according to a preset dynamic optical code to obtain a differentiated pulse width optical signal. If the communication distance and angle between the flash of the mobile terminal and the smart door lock meet the preset requirements, the mobile terminal encodes the differentiated pulse width light signal according to the preset preamble frequency to obtain the target differentiated pulse width light signal, and sends the target differentiated pulse width light signal to the smart door lock through visible light communication. The smart door lock obtains the current ambient light intensity and basic offset through a light sensor, and decodes the target differential pulse width light signal according to the current ambient light intensity and the basic offset to obtain initial communication data; The smart lock decrypts the initial communication data to obtain the decryption result, and performs identity authentication based on the decryption result. The lock unlocks after successful authentication.
2. The smart door lock unlocking method based on dynamic optical coding according to claim 1, characterized in that, The mobile terminal acquires encrypted data instructions and modulates the encrypted data instructions according to a preset dynamic optical code to obtain a differentiated pulse width optical signal. Prior to this, the method also includes: The mobile terminal obtains a pre-stored first timestamp, smart lock code, count value, and first salt value, and encodes the first timestamp, smart lock code, count value, and first salt value to obtain a dynamic key; The mobile terminal acquires the data packet and encrypts the data packet according to the dynamic key to obtain an encrypted data instruction.
3. The smart door lock unlocking method based on dynamic optical coding according to claim 1, characterized in that, The mobile terminal acquires encrypted data instructions and modulates the encrypted data instructions according to a preset dynamic optical code to obtain a differentiated pulse width optical signal, specifically including: The mobile terminal acquires multiple current ambient light luminance values, calculates the average ambient light value based on the average value of all current ambient light luminance values, and dynamically encodes a preset dynamic light code based on the average ambient light value to obtain a target dynamic light code. The mobile terminal acquires encrypted data instructions and modulates the encrypted data instructions according to the target dynamic optical code to obtain a differentiated pulse width optical signal.
4. The smart door lock unlocking method based on dynamic optical coding according to claim 3, characterized in that, The target dynamic optical coding includes pulse width modulation and pulse position modulation; The mobile terminal acquires encrypted data instructions, modulates the encrypted data instructions according to the target dynamic optical code, and obtains a differentiated pulse width optical signal, specifically including: The mobile terminal obtains encrypted data instructions and on / off duration; The on / off duration is modulated according to the fixed period of the pulse position modulation and the time ratio of the pulse width modulation to obtain a logic signal; The encrypted data instruction is modulated according to the logic signal to obtain a differentiated pulse width optical signal; The logic signal is used to control the duration of the flash on / off of the mobile terminal's flash.
5. The smart door lock unlocking method based on dynamic optical coding according to claim 4, characterized in that, The step of modulating the on / off duration based on the fixed period of the pulse position modulation and the time proportion of the pulse width modulation to obtain a logic signal specifically includes: When the time ratio is a first preset ratio, the on / off duration is modulated according to the fixed period of the pulse position modulation and the first preset ratio to obtain a first logic signal. When the time ratio is the second preset ratio, the on / off duration is modulated according to the fixed period of the pulse position modulation and the second preset ratio to obtain the second logic signal.
6. The smart door lock unlocking method based on dynamic optical coding according to claim 1, characterized in that, The preset preamble frequency includes proportional pulses; If the communication distance and angle between the flash of the mobile terminal and the smart lock meet the preset requirements, the mobile terminal encodes the differentiated pulse width light signal according to the preset preamble frequency to obtain the target differentiated pulse width light signal, and sends the target differentiated pulse width light signal to the smart lock through visible light communication, specifically including: Determine whether the communication distance and angle between the flash of the mobile terminal and the smart door lock meet the preset requirements; If the communication distance and angle between the flash of the mobile terminal and the smart door lock meet the preset requirements, the differentiated pulse width light signal is encoded according to the proportional relationship of the equal pulse to obtain the target differentiated pulse width light signal, and the flash is driven by the flash driver module to send the target differentiated pulse width light signal to the smart door lock. The ratio includes the duration of the lights on and the duration of the lights off.
7. The smart door lock unlocking method based on dynamic optical coding according to claim 2, characterized in that, The smart door lock acquires the current ambient light intensity and basic offset through a light sensor, and decodes the target differential pulse width light signal based on the current ambient light intensity and the basic offset to obtain initial communication data, specifically including: The smart door lock collects the current ambient light intensity and basic offset through a light sensor, and calculates a dynamic detection threshold based on the current ambient light intensity, a preset proportional coefficient, and the basic offset. The smart door lock filters the target differentiated pulse width optical signal according to the dynamic detection threshold to obtain the target optical signal, and decrypts the target optical signal multiple times according to the first timestamp to obtain the initial communication data.
8. The smart door lock unlocking method based on dynamic optical coding according to claim 7, characterized in that, The first timestamp includes the current minute coefficient, the previous minute coefficient, and the next minute coefficient; The smart door lock filters the target differential pulse width optical signal according to the dynamic detection threshold to obtain the target optical signal, and decrypts the target optical signal multiple times according to the first timestamp to obtain initial communication data, specifically including: The smart door lock filters the target differential pulse width optical signal according to the dynamic detection threshold to obtain the target optical signal; A first key is generated based on the current minute coefficient, the smart lock code, the count value, and the first salt value. The target optical signal is then decrypted using the first key to obtain the first initial communication data. A second key is generated based on the previous minute coefficient, the smart lock code, the count value, and the first salt value. The target light signal is then decrypted using the second key to obtain the second initial communication data. A third key is generated based on the next minute coefficient, the smart lock code, the count value, and the first salt value. The target light signal is then decrypted using the third key to obtain the third initial communication data. Initial communication data is determined based on the first initial communication data, the second initial communication data, and the third initial communication data.
9. The smart door lock unlocking method based on dynamic optical coding according to claim 2, characterized in that, The smart lock decrypts the initial communication data to obtain a decryption result, performs identity authentication based on the decryption result, and unlocks the door after successful authentication, specifically including: The smart door lock acquires a pre-stored second timestamp and second salt value; The second timestamp, the smart lock code, the second salt value, and the count value are re-encoded to obtain the decryption key; The initial communication data is decrypted using the decryption key to obtain a decryption result. If the decryption result is correct, the smart door lock is controlled to unlock.
10. A smart door lock unlocking system based on dynamic optical coding, characterized in that, The smart door lock unlocking system based on dynamic optical coding includes: a smart door lock and a mobile terminal; The mobile terminal user obtains an encrypted data instruction, modulates the encrypted data instruction according to a preset dynamic optical code, and obtains a differentiated pulse width optical signal. If the communication distance between the flash of the mobile terminal and the smart door lock is a preset distance and a preset angle, the mobile terminal encodes the differentiated pulse width optical signal according to a preset preamble frequency to obtain a target differentiated pulse width optical signal. The smart door lock uses a light sensor to obtain the current ambient light intensity and basic offset, decodes the target differential pulse width light signal based on the current ambient light intensity and the basic offset to obtain initial communication data, decrypts the initial communication data to obtain a decryption result, performs identity authentication based on the decryption result, and unlocks the door after successful authentication.