Under Hood Module

Goal
Develop a single under-hood module that meets a variety of modern forced-induction performance needs such as water-meth injection control and FlexFuel sensor value broadcasting.
The primary reason is to reduce the assortment of single-purpose standalone modules under the hood of my car, each with their own clutter, harnesses, fuse taps, and firewall passthroughs.
Development
Requirements
- CAN
- 12v supply power
- Water-meth injection
- 12v pump output
- 12v solenoid output
- Flow sensor input
- FlexFuel sensor input
- 5v frequency/pulse-width read input
- Sensor power
Hardware
I slightly overcomplicated the design in an effort to make the hardware more general purpose so that it can be used for other projects. I also used a variety of new high-side chips that I was interested in trying.
- ESP32S3 uC: Fantastic value for a microcontroller when we don't need a ton of IO
- 15A high-side outputs: Current monitoring, hardware short circuit faults, and low-frequency PWM capabilities
- 5v/12v analog inputs: FlexFuel sensors, flow sensors, etc, one dedicated to 12v supply voltage
- Low-side FET output: These aren't great, but are easy for toggling something like a 12v LED when we don't care about current monitoring or anything
- 2x CAN-FD interfaces: for connecting to vehicle networks, with MITM capabilities
- 1x CAN interface: private CAN for bench diagnostics/flashing without opening the case for USB
- Board edge connector: easy access to USB and UART for programming and debug
Enclosure
I really wanted to try the Cinch MOD-ICE enclosures. This consists of a PCB-mounted sealed enclosure which snaps into a housing. It comes in various sizes, connector families, and pin counts. I went with Molex MX150 connectors in a sealed 2 connector setup.
It also means I do not have to CAD a housing.
Software
Bootloader
This module is buried inside my engine bay, and it is not intuitive to remove, open, flash, reassemble, and reinstall on each new software change. I started developing my own Rust-based bootloader (now VGBL), because I needed a robust programming routine which never resulted in an inability to recover without physical access.
The bootloader is UDS-based, and was initially only able to be written entirely over CAN. This was slow however, so I actually enter the bootloader via CAN and then execute a routine to turn on the Wi-fi radio and flash with that.
Application Software
This is a pretty straightforward program
General
- UDS diagnostic stack (CAN, Wi-fi)
- IO abstractions for the high-side outputs
- Power & sleep control (wake via CAN)
Water-methanol injection strategy
My system uses the windshield washer fluid tank as the methanol tank. Boost and windshield fluid low status are obtained via CAN and fed into the WMI strategy. This strategy uses lookup tables to determine pump duty cycle and solenoid engagement. Functionality is monitored via pump/solenoid current consumption and the flow switch. If these readings fall out of the safe parameters for a short period of time, an error lamp is commanded on the cluster.
FlexFuel
The 5v input is configured with the TC to give us readings of frequency and pulse width. These two readings are filtered and decoded into fuel temperature and ethanol content. These values (along with error states) are forwarded to the CAN bus for custom code to make adjustments on the ECM.