Computers are ubiquitous in the modern world we live in, and in the automobile there is no exception. Modern cars are controlled by a complex interconnection of microcontrollers, and at the core of this is a communication backbone called Control Area Network (CAN). CAN enables robust and scalable peer to peer communication among microcontrollers.
On UBC Supermileage student team, we build highly efficent ICE, battery electric, and hydrogen electric vehicles. We are using SPI for communication within the vehicles, but we are facing reliability, scalability, and debuggability issues.
SPI is a great protocol for short distance host/peripheral communication, but it is not up to the task of what we are typing to accomplish. Every new node (sensor or actuator) we put into the vehicle means another chip select (SS) wire must be run, and another GPIO slot must be taken up on the host device. One can quickly see the scalability issues here.
In terms of reliability, SPI is susceptible to motor noise which can cause communications to fail. Furthermore, SPI is a wiring and debugging nightmare when there are many long distance peripheral device connections.
As we continue to incorporate more complex sensors, actuators and compute into our cars, it is clear another communication solution is necessary, and moving to CAN is the obvious choice. Furthermore, I am also working on designing a new steering wheel for Supermileage ElectricUrban concept vehicle. Thus, this was a good opportunity to incorporate these projects and implement a CAN node in the steering wheel to send driver input and receive vehicle information which will be displayed on a screen for the driver.
Inside each node on the CAN bus there is a microcontroller, CAN controller and CAN transceiver. The microcontroller talks to the CAN controller which talks to the CAN transceiver which then communicates with the CAN bus sending and receiver data from other nodes. A bit confusing, but luckily the CAN controller is typically built into the microcontroller, which makes our lives easier. We just need to make sure to add a transceiver converting CAN RX (receiver) and CAN TX (transmit) which are exposed on the microcontrollers GPIO to CAN high and CAN low lines of the CAN bus. You may have also noticed that on either end of the CAN bus, there are 120 Ohm resistors bridging CAN high and CAN low. The purpose of these terminal resistors is to impedance match the characteristic impedance of the transmission lines, minimizing reflections which could cause signal interference.
Thus to summarize, to implement the CAN bus we need:The first thing I considered is the steering wheel requirements:
Here is a first draft of button placement and general overview of what the wheel is going to look like. The general idea is a four component mechanical system which consists:
The mechanical and PCB design were done in parallel as they were highly interdependent. The final mechanical CAD can be seen below.
The electrical design was a PCB with included an STM32L432KC MBED enabled microcontroller, as well as a CAN transceiver, a TFT 2.2" display and all appropriate input connections.
The software can be found here, note that I used MBED libraries to implement CAN in C++ as described in the CAN Background section.
Here is the final prototype