Smart Lock Ignores First Code Until Emergency Rail Stabilises
A smart lock that stays shut after the external 9 V contacts are touched and the first sequence of digits is entered is commonly blamed on a defective keypad or a depleted internal cell. The same code is typed a second time, often more deliberately. The bolt still does not retract. The microcontroller supply has not yet risen above the level that releases the processor from reset, so the keypad matrix scan has not begun and no comparison has been performed.
The external battery only supplies the lock long enough for the internal rail to charge and the actuator to be driven. Until the boot sequence completes, keystrokes are neither buffered nor evaluated. Any digits entered while the rail is still rising therefore leave the lock state unchanged.
- External contact path and capacitor charge
- Brown-out release and processor initialisation
- Actuator stall current and rail collapse
- Conditions that mimic an unread code
- Sequence that begins with a full wait
- Comparison occurs only after the rail has held
External contact path and capacitor charge
The external terminals on most smart locks route the 9 V battery onto the internal supply rail through a series protection diode or similar isolation element. That diode introduces a forward voltage drop of roughly 0.3 V to 0.7 V depending on its chemistry and the current flowing through it. Consequently the voltage that actually reaches the bulk capacitor is already lower than the nominal 9 V measured at the battery terminals. On a fresh battery the loss is modest; on a partially depleted cell whose open-circuit voltage has already fallen toward 7 V or 8 V the drop becomes proportionally more significant and can leave the capacitor charging from a source that is only marginally above the microcontroller’s minimum operating voltage.
The rail charges a bulk capacitor sized to store the energy needed by the microcontroller and the actuator. Voltage on the capacitor does not appear instantly. The rise follows an RC time constant set by the capacitor value and the total series resistance in the path. An aged 9 V battery exhibits elevated internal resistance, often rising from a few ohms when new to tens of ohms after prolonged storage or partial discharge. That added resistance multiplies the effective R in the RC product, stretching the time required for the capacitor voltage to climb through the brown-out threshold. The downstream logic therefore remains inactive for a longer interval, and the window during which keypad entries are ignored grows accordingly.
While the rail is still ascending, the microcontroller’s brown-out detector holds the processor in reset. The detector compares the supply voltage against a fixed threshold voltage. Below that threshold the detector asserts reset so that the processor cannot execute code from an unstable rail. This prevents logic corruption of registers or flash reads that would otherwise occur if the clock started while the voltage was still climbing. Only after the rail has remained above the threshold for a short qualifying interval does the detector release reset and allow the boot sequence to begin.
The interval is typically a few hundred milliseconds to a couple of seconds depending on capacitor size, battery condition, diode drop, and the exact threshold. During that entire interval the keypad matrix is not scanned, so any digits entered are simply never registered by the controller.
Brown-out release and processor initialisation
Once the brown-out detector releases reset, the microcontroller begins its clock and memory initialisation. The on-chip oscillator is first multiplied by a Phase-Locked Loop to produce the system clock. The PLL requires a finite lock time during which the output frequency is still settling; until lock is declared the core cannot reliably fetch instructions or sample the keypad matrix. Concurrently the controller clears and initialises its SRAM. Every location that will later hold keystroke buffers, comparison flags, or actuator state must be written to a known value before the scan routine is enabled.
Firmware-level steps add further delay. The boot code loads the interrupt vectors into the vector table so that subsequent events (keypad column drives, timer overflows, or actuator-fault flags) can be directed to the correct handlers. It then configures the GPIO pins that form the keypad matrix: selected pins are set as outputs to drive the columns, others as inputs with appropriate pull-ups or pull-downs to read the rows. Only after these pin directions, pull resistors, and interrupt enables have been written does the scan routine become active. Both the vector-table setup and the GPIO configuration are sequential memory writes that cannot be overlapped with the earlier PLL lock or SRAM clear; they therefore extend the silent interval after reset release.
If the supply rail sags again during this window—because the external battery is weak or the bulk capacitor is still only partially charged—the processor may attempt a write to non-volatile flash memory while the voltage is below the manufacturer’s guaranteed programming level. An incomplete write can leave a partially programmed page whose checksum later fails, forcing the controller into a recovery loop or a permanent lock-out until the flash is re-initialised. The brown-out detector’s purpose is precisely to keep the core in reset until the rail is high enough that such incomplete writes cannot occur. Any digits typed before the PLL has locked, the SRAM has been cleared, the interrupt vectors have been loaded, and the GPIO pins have been configured never enter the comparison buffer; the lock therefore behaves as if the keypad were dead.
Some locks flash an LED or sound a tone when the rail is stable and the scanner is live. Others give no external indication. In either case the safe interval is to wait until any visible or audible ready signal appears, or for a few seconds after the 9 V battery is applied, before the first digit is pressed.
Safety: Do not leave a 9 V battery connected longer than the maker’s stated limit. Do not short the external contacts. A lock that fails to retract after a full boot and a confirmed code is a mechanical or motor fault, not a timing issue. This page does not cover internal battery replacement or firmware updates.
Actuator stall current and rail collapse
Even after the rail is stable and a valid code has been accepted, the solenoid or gear motor that retracts the bolt draws a large inrush current at the moment it is energised. At the instant of switch-on the motor has not yet developed Back EMF, so the current is limited only by the winding resistance and equals the stall current. That stall current is typically several times the steady running current and is supplied primarily by the bulk capacitor. The capacitor’s equivalent series resistance converts the sudden current pulse into an immediate voltage drop across the rail. The resulting voltage sag can dip below the brown-out detector’s threshold voltage. The detector then reasserts reset, the processor restarts, and the partially completed unlock is aborted. The bolt never fully retracts and the user sees another ignored or failed attempt.
The same voltage collapse can occur if the external 9 V battery is weak or if the contacts are dirty, because the battery then cannot replenish the capacitor fast enough during the stall-current pulse. The lock may accept the code, start the actuator, and then reboot mid-stroke. Waiting for a full, stable boot before the first entry, and confirming that the external battery is fresh, avoids this second failure mode.
| Pattern | Likely fault | First move |
|---|---|---|
| First code after 9 V contact is ignored | Keypad scan not yet running | Wait for ready indication or several seconds before entry |
| Code accepted then lock reboots | Inrush current drops rail below threshold | Allow full capacitor charge; use a fresh 9 V battery |
| No response even after long wait | Open contacts or failed internal rail | Clean external terminals; check internal battery separately |
| Lock opens only on the second or third try | Partial charge on first attempt | Wait longer after applying the 9 V battery |
Conditions that mimic an unread code
A corroded external contact can prevent the bulk capacitor from charging at all, so the lock never leaves reset. An exhausted internal battery can leave the lock dependent on the external 9 V source even for normal operation; in that case the same boot delay appears every time. A jammed bolt or a failed actuator motor produces a different symptom: the lock accepts the code and attempts to move, but the bolt does not retract. Those cases are mechanical and are not solved by waiting longer before entry.
Sequence that begins with a full wait
- Apply the 9 V battery firmly to the external contacts and wait for any ready LED or tone, or for at least three seconds.
- Enter the code only after that interval.
- If the lock still ignores the code, remove and reapply the battery and repeat the wait.
- Confirm the external contacts are clean and the 9 V battery is fresh.
- If a valid code is accepted yet the bolt does not move, the fault is no longer the boot timing.
Comparison occurs only after the rail has held
- Digits entered while the bulk capacitor is still charging never reach the comparison routine.
- The brown-out detector holds the processor in reset until the supply rail exceeds the threshold voltage.
- Actuator stall current can pull a partially charged rail back below the threshold and force a reboot.
- Waiting for a stable boot before the first entry avoids both the ignored-code and the mid-stroke reset failures.
Comments
Post a Comment