What Does Code B1791 Mean?
The diagnostic trouble code (DTC) B1791 indicates an Autolamp Sensor Input Circuit Open. This is typically a manufacturer-specific code, commonly encountered in Ford, Lincoln, Mercury, and some Mazda vehicles. It signifies that the Body Control Module (BCM), or in some architectures, the Smart Junction Box (SJB), has detected an open circuit condition within the electrical pathway of the ambient light sensor responsible for the automatic headlamp system. The autolamp sensor, often a photodiode or photoresistor, converts ambient light intensity into an electrical signal (voltage or resistance). The BCM/SJB monitors this input to determine whether to activate or deactivate the vehicle’s headlamps and potentially adjust instrument panel illumination. An “open circuit” implies a complete break in the electrical path, preventing the sensor’s signal from reaching the control module, or indicating a failure within the sensor itself that mimics such a break. This results in the BCM/SJB receiving an anomalous or absent signal, exceeding its calibrated thresholds for a valid sensor input.
Common Symptoms
- Automatic headlamps fail to activate or deactivate: The primary symptom is a complete loss of automatic headlamp function. The headlights may remain off when they should be on, or stay on constantly regardless of ambient light conditions.
- Manual headlamp operation unaffected: The headlamps will usually still function correctly when manually turned on via the headlight switch.
- Instrument cluster illumination anomalies: The dashboard lights may not dim or brighten appropriately in response to changing light conditions.
- Lack of “Auto” indicator functionality: The specific indicator lamp for the automatic headlight mode on the instrument cluster may not illuminate or function as expected.
- Warning messages: Some vehicles may display a message on the instrument cluster, such as “Check Auto Lamps” or “Service Headlamps.”
What Causes the Code B1791?
- Faulty Autolamp Sensor: An internal failure within the ambient light sensor, causing it to fail to produce a signal or exhibit an infinite resistance, thereby mimicking an open circuit.
- Damaged Wiring Harness: A physical break, fray, cut, or severe corrosion in the wiring connecting the autolamp sensor to the BCM/SJB. This includes the signal wire, power supply wire (e.g., 5V reference), or ground wire.
- Loose or Corroded Connectors: Poor electrical contact at the autolamp sensor’s connector, the BCM/SJB connector, or any intermediate connectors within the circuit due to bent pins, corrosion, or improper seating.
- Incorrectly Installed Aftermarket Accessories: Improper installation of dash covers, window tint, or other accessories that obstruct the sensor or interfere with its wiring.
- Faulty Body Control Module (BCM) / Smart Junction Box (SJB): While less common, an internal fault within the BCM’s input monitoring circuit for the autolamp sensor could lead to a false detection of an open circuit.
How to Diagnose and Troubleshoot
Diagnosis of B1791 requires a systematic approach, often involving a digital multimeter (DMM) and an advanced diagnostic scan tool capable of reading BCM/SJB live data.
- Visual Inspection:
- Locate the autolamp sensor, typically found on the top of the dashboard near the windshield or integrated into a defroster vent. Inspect for physical damage, obstructions, or debris.
- Carefully trace the wiring harness from the sensor back to the BCM/SJB. Look for visible signs of chafing, cuts, pinch points, or corrosion along the entire length.
- Inspect the electrical connectors at the sensor and the BCM/SJB for bent pins, corrosion, pushed-out terminals, or improper seating. Unplug and re-plug connectors to ensure good contact.
- Scan Tool Data Analysis:
- Connect an OBD-II scan tool capable of accessing BCM/SJB live data.
- Navigate to the live data stream for the ambient light sensor. Monitor its reported voltage, resistance, or lux value. An open circuit will likely show a static, incorrect, or absent reading (e.g., 0V or maximum voltage if using a pull-up resistor to detect an open).
- Actuate the headlamp switch between OFF, AUTO, and ON positions while monitoring the sensor data to see if any change occurs.
- Digital Multimeter (DMM) Testing:
- Power and Ground Verification: With the ignition ON and the sensor connector disconnected, backprobe the power supply pin (e.g., 5V reference) and the ground pin at the sensor connector. Verify appropriate voltage and a solid ground connection (less than 0.1V to chassis ground). If either is missing, trace the circuit back to the BCM/SJB, checking for open wires or faulty internal BCM output.
- Sensor Resistance/Output Test: If the sensor is a simple photoresistor, disconnect it and measure its resistance directly. The resistance should change significantly when light is applied or blocked. If it’s an active sensor with voltage output, apply the correct power/ground and measure its output voltage in varying light conditions. An open circuit will show infinite resistance or no voltage output.
- Circuit Continuity Test: With the battery disconnected and both the sensor and BCM/SJB connectors disconnected, perform a continuity test on each wire (signal, power, ground) from the sensor connector to its corresponding pin at the BCM/SJB connector. Look for very low resistance (typically less than 5 ohms). An open circuit will show infinite resistance (OL or “Open Loop” on most DMMs). Simultaneously check for short to ground (continuity between circuit wire and chassis ground) or short to power (continuity between circuit wire and any power source).
- Wiggle Test: While monitoring live data or DMM readings (if safe and practical), gently wiggle the wiring harness and connectors associated with the autolamp circuit. A momentary flicker or change in readings indicates an intermittent connection that needs further investigation.
Recommended Repairs and Solutions
Once the root cause of the B1791 code has been accurately diagnosed, implement the following repairs:
- Repair or Replace Damaged Wiring: If an open circuit is identified in the wiring harness, repair the damaged section. Use appropriate automotive-grade wiring, solder connections (preferred method for reliability) with heat-shrink tubing, or high-quality crimp connectors. Ensure the repair is weather-sealed and properly secured to prevent future damage.
- Clean or Replace Corroded Connectors: If corrosion is found at either the sensor or BCM/SJB connector, carefully clean the terminals using a specialized electrical contact cleaner and a small wire brush or pick. If the corrosion is extensive or terminals are severely damaged, replace the entire connector assembly. Always ensure terminals are properly seated and locked.
- Replace Faulty Autolamp Sensor: If the autolamp sensor itself tests as open or fails to provide the correct output, replace it with a new OEM (Original Equipment Manufacturer) or a high-quality aftermarket equivalent part. Ensure proper fitment and reassembly of any dashboard trim pieces.
- Address Aftermarket Obstructions: If an aftermarket dash cover or window tint is obstructing the sensor, remove or modify it to ensure the sensor has a clear line of sight to ambient light.
- Body Control Module (BCM) / Smart Junction Box (SJB) Replacement: Only consider BCM/SJB replacement as a last resort, after thoroughly ruling out all other possibilities. BCM replacement typically requires specialized programming and calibration using a factory-level scan tool, which should be performed by a qualified technician.
- Clear DTCs and Verify Function: After completing any repairs, clear the B1791 DTC using an OBD-II scanner. Perform a functional test of the automatic headlamp system by operating the vehicle in varying light conditions (e.g., driving into a dark garage, covering the sensor). Confirm that the headlamps activate and deactivate as expected and that no further codes are set.

