Many smart locks use additional mechanical or electrical components to determine whether a deadbolt is open or closed. It might be simple switches, or hall sensors with magnets, or an encoder. The design in this project doesn’t require any such additional components. The motor driver turns off the motor when deadbolt reaches open or closed state by motor current sensing.
Many smart locks use four AA batteries for power supply. In this case, the power supply voltage decreases from 6.5 V (charged batteries, 1.63 V each) to 3.6 V (discharged batteries, 0.9 V each) and the motor rotates with different speeds at 6 V and 3.6 V. Also, higher voltage might burn out the motor.
In this project, voltage regulation is used. The motor is controlled by PWM. When batteries are fully charged, the PWM duty cycle is approximately 50%, and increases while battery is discharging, so the regulated voltage stays unchanged.
Below we described steps needed to understand how the smart lock motor driver has been programmed. However, if you just want to get the result of programming, download GreenPAK software to view the already completed GreenPAK Design File. Plug the GreenPAK Development Kit to your computer and hit the program to design the driver.
Construction and Operation Principle
This typical Application circuit requires only one external component – a current sense resistor.
The design has one input for driver control and another one for fault monitor:
PIN#2 – a Button for close/open the smart lock deadbolt.
PIN#14 – Error output. When the closing time is less than 1 Second (can’t close smart lock), this output goes HIGH.
The general block diagram is shown in Figure 4.
The smart lock is opened by a falling edge on PIN2 and is closed by a rising edge.
During the first 150ms, an internal circuit ignores the CCMP0 signal because during this time the starting current of the motor is higher than at normal operation. After that, during normal operation, if the motor current increases to 290 mA, the motor turns off.
A rising edge at PIN2 turns on the motor. The PWM duty cycle is changing depending on the power supply voltage. For example, at 6V the duty cycle value is at 50%. When batteries discharge to 3.6 V, the PWM duty cycle increases to approximately 83%. This behavior provides a constant level of the motor supply voltage at 3 V (regulated value), see Figure 6.
In addition, this design permits changing deadbolt direction during the opening or closing process. This can be useful in the case when the user changes his mind and wants to open the door after pressing the close button, see Figure 7.
The Error Output can be used to detect an event when the door can’t be closed. In our case, the closing time is equal to 1 second and can be changed in a wide range.
When the closing time is less than 1 second, the Error Output goes HIGH. It will be reset after the next falling edge at PIN2.
Motor Parameters Measurement
Two parameters need to be measured to adjust the timings and control the circuit used in our design: motor starting time and motor current consumption.
Motor starting time is approximately 100 ms.
There is a lot of noise and our circuit will provide filtration where needed. The maximum value of the motor current consumption is 310 mA at 3 V power supply. RMS current is approximately 208 mA.
Voltage regulation is done by using PWM and Diff.Amp&Integrator blocks. Diff.Amp&Integrator Vref has an internal divide by 4:
Vref = Vdesired*Gain = 3 V * 0.25 = 0.75 V
Vdesired – desired constant voltage for motor power supply;
Gain – internal Diff.Amp&Integrator gain is constant - 0.25.
Then the closest value from Vreg list is 0.768 V.
The Diff.Amp&Integrator outputs are...Read more »