Instrument Cluster Spoofing
Because I plan to make the 320i a restored car as much as possible I am not planning to add any electronic gauges or meters, at least none that are usually visible in the dashboard. My plan is to use the analog gauges in the instrument cluster like the fuel gauge, tachometer and temperature gauge to give information like battery capacity, voltage, current and battery temperature. The tachometer will also be used to show the motor speed. All of the signals that drive these analog gauges will have be generated by some other circuit or processor that gets the battery information from other sensors. My first test of the instrument cluster was the fuel gauge, because I had access to the input wires from the fuel level sensor. Those wires were underneath the area I cut out of the back seat for the battery boxes. Many old cars used a bi-metallic strip that the fuel sensor would regulate current through, based on the level of the fuel. The heating of the bi-metallic strip would move the gauge. That type of fuel gauge is very slow and very non-repeatable. To my surprise I found the fuel gauge in the 320i to not be a bi-metallic but rather a true galvanometric gauge. I found it only took 10mA at 400mV to get a full displacement of the gauge. Setting up a MOSFET with a voltage divider circuit I was able to drive the gauge from 0 to full by varying the duty cycle of a PWM gate signal into the MOSFET. I used a Microchip PIC processor to generate the PWM signal at 1k Hz. To access the other gauges I needed to remove the instrument cluster. It took a couple of tries but I finally was able to remove the complete instrument cluster from the dashboard. I took note of all the wire colors and positions on the connectors because I have a wiring diagram for the 320i that has the wire color coding. I removed the tachometer first. In BMWs the tachometer was driven by the coil signal to the distributor cap. I did not want to make a high voltage signal to drive the tach so I took the tachometer circuit apart. Again to my surprise the circuit driving the tachometer was more advanced. There was an integrated circuit called a "pulse shaper for revolution counters". It is a frequency to current converter. That meant this gauge is also a galvanometric gauge and it should take a PMW signal to move it. Connecting directly to the gauge, I was able to move the tachometer meter over the full range by varying the duty cycle of a PWM signal, using the MOSFET/Microchip PIC driving circuit and a voltage divider to give 5V. I found that if I took the PMW signal directly from the PIC I could also move the tachometer, because the PIC is running at 5V.
The temperature gauge proved to be the most difficult to spoof. The gauge is a three terminal device, where one connection was ground, one was +12V and one was the temperature sensor in the engine. The schematic for the temperature sensor circuit showed the other side of the temp sensor was grounded. I found that by using resistors from 22 to 100 ohms I could get the temperature gauge to move the full range. Because this gauge was also galvanometric, the resistors were varying the amount of current to move the gauge. Programming a resistance is possible but I wanted a simpler method and one that would be continuously variable. I found that if I varied the voltage on +12V input side of the gauge I could move the gauge. The gauge moved from low to high by adjusting the voltage from 0.6 to 3.8V with a 10 ohm resistor on the sensor leg. The voltage adjustment changed the current from 6ma to 30ma. By controlling the +12V voltage with PMW on the MOSFET I could control the gauge movement.
Having all the gauges move by varying the duty cycle of a PWM signal is a great result as the GEVCU or the BMS could be programmed to have these gauges display battery info, once the movement vs PWM duty cycle is calibrated. The 320i instrument cluster has one more gauge. In the bottom center of the tachometer there is a 4-digit red LED display which was a clock. I plan to replace this 4-digit display with another 4-digit display that is the same size that will be programmable through a serial interface. The display will be programmed to show the time as well as all the battery info - the only visible digital readout. I plan to use some other digital gauges, but those will be hidden from normal view. For instance I plan to put a JLD 404 amp-hour meter in the area behind where the ashtray is on the center console. With the ashtray closed, no meter visible.
Video of the instrument spoofing is here.
Images of the calibration curves for the PWM are here.