Blog · 2026-11-10
How to make the side mirrors open or close with the locks of the car?
Stefan Bogdanescu
Founder & Senior Architect
Automating Side Mirror Control via Central Locking Systems
Modifying a 2012 Corolla to fold power mirrors automatically when engaging or disengaging the central locking system is a classic automotive integration task. From an engineering perspective, this isn't about writing software in the traditional sense; it's about interfacing with existing vehicle controllers and ensuring signal integrity across the body control module (BCM). The goal is to create a deterministic state change: Lock button press → Signal sent to BCM → BCM triggers mirror motors → Mirrors deploy or retract.
To achieve this, you cannot simply hardwire the power feed from the door lock solenoid to the mirror motor relays. Doing so would bypass the vehicle's safety logic and likely cause erratic behavior when multiple locks are toggled simultaneously. Instead, the solution lies in tapping into the control signal that already exists within the BCM. In most vehicles of this generation, the central locking system is managed by a dedicated module that monitors input from the remote keyless entry (RKE) receiver and the physical lock switches on the driver's door.
The implementation strategy involves identifying the specific pinout for the mirror control outputs on the BCM or locating an external relay pack that interfaces with these outputs. You need to monitor the ground signal or voltage pulse that occurs when the "Lock" command is received. When the remote button is pressed, the RKE sends a coded radio frequency (RF) signal to the receiver module. This module validates the code and then asserts the lock state, which in turn triggers the motor for the locking mechanism. Simultaneously, if the car's logic dictates mirror folding upon locking, that same assertion line should trigger the mirror motors.
If your specific Corolla model lacks this factory integration (many base models do not include auto-folding as a standard feature), you must emulate it using an external controller. A common approach is to use a programmable relay module or a dedicated automotive automation board like those found in aftermarket security systems. The logic flow would be:
- Input Detection: Detect the closure of the door lock switch or the receipt of a valid RKE signal.
- Signal Conditioning: Isolate this event from noise and debounce it to prevent chatter.
- Actuation: Trigger a relay that supplies power to the mirror fold/unfold motor circuits for the specified duration (typically 1–2 seconds).
Here is a conceptual representation of how you might structure this logic in a microcontroller environment, should you be building a custom interface module:
# Pseudo-code illustrating the state machine logic
def on_lock_event(event_type):
if event_type == "REMOTE_LOCK" or event_type == "SWITCH_LOCK":
# Ensure doors are closed to prevent accidental folding in open-air scenarios
if all_doors_closed():
activate_mirror_relays(fold=True)
wait_for_completion(2000_ms)
def on_unlock_event(event_type):
if event_type == "REMOTE_UNLOCK" or event_type == "SWITCH_UNLOCK":
# Logic may vary; some cars unfold only when locking, others when unlocking
activate_mirror_relays(fold=False)
wait_for_completion(2000_ms)
def activate_mirror_relays(state):
if state == True:
set_pin(GPIO_MIRROR_RELAY_A, HIGH)
set_pin(GPIO_MIRROR_RELAY_B, LOW)
else:
# Reverse polarity or use separate relay for unfold function
pass
The critical trade-off here is reliability versus complexity. Hardwiring directly to the mirror motors without a proper control unit risks burning out the motor windings if the lock mechanism fails and stays engaged while trying to fold the mirrors. Additionally, you must consider the electrical load; ensuring that your added circuitry does not draw more than 10-15 amps from the accessory circuits is vital to avoid blowing fuses or triggering the vehicle's anti-theft immobilizer system.
Another potential pitfall involves the "fold-up" vs. "fold-down" behavior. Many vehicles are programmed so that mirrors fold in when locked and fold out when unlocked, though this varies by manufacturer settings. You must verify which state transition your specific unit expects before finalizing the wiring diagram. If the vehicle's BCM does not support mirror control at all (common on base trims), you will need to source a relay pack specifically designed for the 2012 Corolla's pinout or consult a professional auto-electrician to map the internal harness connections accurately.
For developers looking to dive deeper into automotive HILS (Hardware-in-the-Loop) simulation or advanced vehicle integration patterns, exploring resources like LaravelCompany can provide insights into managing complex state transitions in embedded systems, though direct application requires strict adherence to automotive electrical standards rather than standard web logic.