
As I added functions to the car via CAN, not being able to program
- Transfer

The purpose of this article is to talk about my experience with car modifications and experiments with the CAN bus.
How it all began
First, I decided to add a front camera to my 2017 Chevrolet Cruze. Since the car already has a factory rear-view camera, then at a high level it was necessary to find out two things:
- The way to transfer video from the front camera, which I will add.
- A method of displaying pictures from a rear view camera at any time.
The video part was simple. From previous experience, I knew that you can make a video mixer on a relay.
Starting up on the screen turned out to be more complicated, and after some investigation, I came to the conclusion that the car should send a signal from the rear view camera to the screen through some kind of data bus.
CAN bus
Chevrolet has two different data buses. The first is standard CAN, fast (500 Kbps) and reliable, it is used for critical data. The second is what GM calls LAN (GMLAN), an older and slower bus (33.3 Kbps) that is used for non-security data.
I needed a way to listen for traffic on CAN, that is, a sniffer. The PCAN device is incredibly useful for this purpose.

Peak Can
Peak Can (PCAN) is a USB device capable of intercepting and transmitting messages. Thanks to the Pcan View software, you can get started without much training.
Since the rear view camera is less important for safety than other components, I suggested that the data you are looking for is most likely to be on the GMLAN bus.
The easiest access point is the OBD2 connector. I connected Peak Can to the GMLAN bus, launched the software, and listening to traffic immediately began.
Integration
The goal was to reverse engineer the rear view camera call. To do this, with the sniffer turned on, I reversed the car so that it turned on the display, and then tried to park several times. Throughout this process, I noticed a single ID with messages that sequentially mimicked my actions.
Then I parked and through Pcan View I tried to transmit the same message that I saw when the display turned on and off. In the blink of an eye, I was already interacting with the bus.
Message Transmission via PCAN
However, I did not plan to drive with a laptop all the time. What was needed was a way to automate these functions - and here the Arduino came in handy. The ability to directly receive 12V power in combination with a large number of resources and support on the Internet made this choice obvious.
In addition to Arduino, I needed two components to complete the project: the CAN module and the relay module. In essence, Arduino is the brain that runs and runs code. The CAN module provides the ability to interact with the data bus, and the relay provides power to the front camera, and also acts as a video mixer between it and the rear view camera.

Mcp2515 module (top), Arduino Uno (middle), relay module (bottom)
After adding and configuring the appropriate libraries, Arduino made a connection with the car.
Listening to traffic through Arduino
Since I already knew that I could start the display, I started thinking about HOW to do it. The initial idea was to install a special instant call button on the panel, but I began to think: “What else in the network can be used as a trigger?”
During the experiments, I found that messages with the ID corresponding to the “Cancel cruise control” button are also transmitted via the GMLAN bus. This was ideal because cruise control is activated at speeds above 65 km / h when I use the front camera, and at speeds below 15 km / h the rear view camera will turn on to help with parking, so they will never overlap. After writing some code, I was able to get the Arduino to recognize when the cancel cruise control button is pressed.
Recognizing a single button press
However, I did not want the camera to activate every time I cancel the cruise control, so I decided that the best approach is to turn it (in fact) into a multifunction button. The camera is activated only if the button is “twice pressed”.
After a long weekend exploring the millis function and debugging the code, I successfully programmed double-tap recognition.
Double-tap recognition
And when I tied it to my commands to control the display, I got a pretty cool little utility.
Double tap + commands
Functionality
Now I had the opportunity to turn the display on and off, but there was one problem - what about the rear view camera? I needed them to work together with the front camera, as if they had been set up like that at the factory.
In the flowchart, I depicted how I represent it.

I quickly realized that for such a system you need to know the state of three variables at any time:
- Front camera module: did the driver turn it on or off?
- Camera display: is the image on or off?
- Reverse: car in reverse or not?
Without programming experience, it was very difficult to do, and all my free time I was thinking about different approaches.
In the end, I succeeded!
Active Monitoring
Now I was able to implement the operational logic that controls the relay.
Relay control
Throughout the process, I learned more about the Arduino and noticed that the Nano version is capable of doing everything you need, while it has a smaller size and lower price. It is ideal for permanent installation in a car. I developed a model and printed a case on a 3D printer to place the components as a compact unit for installation.

3D case

Together
Finally the day came when I saw the results. Although you still have to tinker with timing, it was nice to see that the module works correctly.
Turning on / off the parking mode, turning on / off the front camera, automatically switching to the rear view camera and automatically switching back
On the whole, this experience taught me a lot and opened my eyes to the possibility of integration directly with the CAN bus. It is quite surprising what can be achieved by connecting on two wires.
In future
In the future, I plan to write an in-depth tutorial on how to add additional functionality to existing buttons in your car using free software and components.