Luckily the Light Control Module (or LCM or LSZ) in the E46 M3 have both backlight level adjustment and an ambient light sensor (ALS), used to control the backlight of the E46 instrument cluster, radio, AirCon etc.
Some challenges had to be solved: understand how to communicate with the LSZ, how to interpret the data from the LSZ and finally how to convert this knowledge into how to automatically control the backlight of the display unit in the airVent Display.
The first challenge was solved by choosing the KBUS to communicate with the LSZ. By transmitting a stausRequest to the LSZ over the KBUS, the LSZ responds with a KBUS message which contains the voltage level of the backlight (dimmer level) and the voltage level of the ALS.
Figure 1: KBUS message LSZ
The second challenge was solved by realizing that 0xFF means lowest dimmer level and 0x00 means highest level. By remapping voltageLevelDimmer = 0xFF-voltageLevelDimmer, a signal is produced that varies logically with the dimmer level seen inside the car.
The signal from the ALS showed to be 0x00 when dark and 0xFF when exposed for strong light. The ALS signal is very non-linear, and after digging into the theory of Adaptive Backlight Control and Adaptive Light Response, I ended up with the DigitalTwin for the relationship between the LUX reported from the photo cell in the ALS and percentage backlight response as shown in Equation 1 below:
brightness=13*log(ambientLight)+13 [%] (1)
Assuming 0x00-0xFF from the LSZs corresponds to 0-1530 LUX, the curve (ALR curve) described by Equation 1 can be visualized as given in Figure 2 below:
Figure 2: ALR curve
The KBUS message request to the LSZ was implemented in the KBUS2CAN module and the data was further embedded in one of the CAN messages and redistributed onto the CAN bus. The CAN2HMI picks up the CAN message and controls the backlight of the airVent Display automatically. The main challenge was actually how to synchronize the dimmer level and ALS intensity level from the LSZ with the main backlight level in the airVent Display monitor, since it required cooperation with four different HW modules. A fun embedded system realtime problem solved.