Post by hamidaz on Jul 30, 2024 11:03:11 GMT
ACC speed auto set
I implemented an idea so that the ACC speed is automatically set to 90 km/h every time the car is started.
I have a 2018 Passat 1.8 TSI equipped with ACC.
With almost simple software on a cheap processor connected to the CAN bus, I send some data packets with specific timing that set the cruise control speed to any desired value.
The description of the topic is as follows.
Introduction
Only two settings of the adaptive cruise control (ACC) have memory and do not need to be set every time the car is started. One is whether ACC is on or off and the other is the distance from the car in front. But for me, every day after starting the car I have to set the cruise speed to 90 and then use it (the speed limit in our area is 90 on the highway). For this, I have to press the speed increase key (V+) seven times on the steering wheel and make sure that not more than that by mistake. This daily repetition is a bit annoying.
Of course, I understand that memorizing ACC speed by the car is intentionally not allocated, so that the risk of uncontrolled speed does not arise when using ACC for the first time. The driver has to set the ACC speed on purpose to accept the resulting responsibility.
However, since the cruise control in my car is adaptive, in my opinion, this risk is not significant. So I decided to add this feature to the car.
Findings
The processor inside the steering wheel transmits information through the Convenience CAN bus. In some previously reviewed cases (see here and here) the right side keys, which are mainly used for AID settings and audio, are sent via CAN ID = 5BF. But the processor sends the status of the left side keys, cruise control keys, in a different way and with a different CAN ID. My searches to find its specifications were unsuccessful.
By monitoring the Convenience CAN bus and overcoming many difficulties, I was able to find out that the processor on the steering wheel does the sending with the following rules:
1) The CAN-ID is equal to 12B and the data length is always 8.
2) According to the CAN bus standard, the packet structure is as follows (each number is one byte and is displayed as hex):
4) The yy number in each packet increases by one digit compared to the previous packet. If ACC was on, it would starts from 0x40 and continue until 0x4F, which means 16 different numbers. After that, it starts again from 0x40. The number xx is determined by the rule that is unknown to me but depends on the numbers yy and zz.
5) If all keys were released, the zz number in packets is 80.
6) If the speed increase key (V+) is pressed, the zz number is 82. As long as the V+ key remains pressed, this series of codes will be sent.
7) The rest of the ACC keys also have their zz. For example, for V- it is 84.
The table for "no key", "V+ key" and "V- key" is as follows:
Real sample of packets
This is real packets sent by the steering wheel via CAN bus when I press V+ key for a short time:
. . . . .
00 00 01 2B 08 0D 4F 80 2A 00 00 00 00
00 00 01 2B 08 86 40 80 2A 00 00 00 00
00 00 01 2B 08 F4 41 80 2A 00 00 00 00
00 00 01 2B 08 50 42 80 2A 00 00 00 00
00 00 01 2B 08 CF 43 82 2A 00 00 00 00 // V+ key pressed
00 00 01 2B 08 4F 44 82 2A 00 00 00 00
00 00 01 2B 08 EA 45 82 2A 00 00 00 00
00 00 01 2B 08 F3 46 82 2A 00 00 00 00
00 00 01 2B 08 D6 47 82 2A 00 00 00 00
00 00 01 2B 08 03 48 82 2A 00 00 00 00
00 00 01 2B 08 CC 49 80 2A 00 00 00 00 // V+ key released
00 00 01 2B 08 DC 4A 80 2A 00 00 00 00
00 00 01 2B 08 79 4B 80 2A 00 00 00 00
. . . . .
It can be seen that yy series numbers didn't change but xx and zz numbers changed from "no key" table to "V+" table. It is obvious that the V+ key code started from yy=43 just by chance.
Designing
It is possible to use a cheap simple board like Arduino and a CAN bus interface board like MCP2515. But, for some reason, I used the STM32 processor.
The main idea is to artificially simulate the pressing of the V+ key and send the desired number of appropriate packets on the CAN bus.
While working with the system, I realized that if for any reason the yy numbers are not sent in the order that was said, an ACC error will be declared and ACC will be unusable for now. Of course, this error will be resolved by restarting the car.
Therefore, from a technical point of view, this task is as follows:
16 consecutive packets of V+ table will be sent with a time interval of 1.5 milliseconds. These packets take about 24 milliseconds and fit between the transmissions of the steering wheel processor. So that the overall sequence of yy numbers does not get mixed up and the pressing of the V+ key will be simulated.
Packets on the CAN bus in the time axis will be as follows:
The blue packets are sent by the processor on the steering wheel, and the red packets are sent by our processor.
The final algorithm can be expressed as follows:
1) Start-up and initialize //immediately after ignition-on
2) delay for 6 seconds
3) N = 7; /* 1=30 km/h , 2=40 km/h , ... , 7=90 km/h, … */
4) For N times
5) {
6) Wait and Read-CAN packets to find: xx,yy,zz = 0D,4F,80
7) delay for 3 mili-sec
8) Every 1.5 mili-sec: Send-CAN packets of V+, start from 41,40,82 up to CA,4F,82
9) delay for 300 mili-sec
10) }
11) Set MCP2515 to sleep mode
12) Set the CPU to sleep mode
It is possible to develop the above algorithm in any software language on any processor.
Final result
I implemented the above algorithm in STM32 processor in C language. The MCP2515 function library was very useful. The board power should be connected to Terminal-30.
The system works well, without any errors.
When the car is started, the ACC speed is set to 90 km/h automatically within 10 seconds.
It has brought me a kind of comfort. Besides, it was fun to face this challenge.
See this video:
go.screenpal.com/watch/cZiv6zVPHpy
I implemented an idea so that the ACC speed is automatically set to 90 km/h every time the car is started.
I have a 2018 Passat 1.8 TSI equipped with ACC.
With almost simple software on a cheap processor connected to the CAN bus, I send some data packets with specific timing that set the cruise control speed to any desired value.
The description of the topic is as follows.
Introduction
Only two settings of the adaptive cruise control (ACC) have memory and do not need to be set every time the car is started. One is whether ACC is on or off and the other is the distance from the car in front. But for me, every day after starting the car I have to set the cruise speed to 90 and then use it (the speed limit in our area is 90 on the highway). For this, I have to press the speed increase key (V+) seven times on the steering wheel and make sure that not more than that by mistake. This daily repetition is a bit annoying.
Of course, I understand that memorizing ACC speed by the car is intentionally not allocated, so that the risk of uncontrolled speed does not arise when using ACC for the first time. The driver has to set the ACC speed on purpose to accept the resulting responsibility.
However, since the cruise control in my car is adaptive, in my opinion, this risk is not significant. So I decided to add this feature to the car.
Findings
The processor inside the steering wheel transmits information through the Convenience CAN bus. In some previously reviewed cases (see here and here) the right side keys, which are mainly used for AID settings and audio, are sent via CAN ID = 5BF. But the processor sends the status of the left side keys, cruise control keys, in a different way and with a different CAN ID. My searches to find its specifications were unsuccessful.
By monitoring the Convenience CAN bus and overcoming many difficulties, I was able to find out that the processor on the steering wheel does the sending with the following rules:
1) The CAN-ID is equal to 12B and the data length is always 8.
2) According to the CAN bus standard, the packet structure is as follows (each number is one byte and is displayed as hex):
00 00 01 2B 08 xx yy zz 2A 00 00 00 00
3) This processor sends one data packet approximately every 30 milliseconds to let the system know that it is alive and well. Thus, even if no key is pressed, approximately 32 packets are always sent per second.4) The yy number in each packet increases by one digit compared to the previous packet. If ACC was on, it would starts from 0x40 and continue until 0x4F, which means 16 different numbers. After that, it starts again from 0x40. The number xx is determined by the rule that is unknown to me but depends on the numbers yy and zz.
5) If all keys were released, the zz number in packets is 80.
6) If the speed increase key (V+) is pressed, the zz number is 82. As long as the V+ key remains pressed, this series of codes will be sent.
7) The rest of the ACC keys also have their zz. For example, for V- it is 84.
The table for "no key", "V+ key" and "V- key" is as follows:
Real sample of packets
This is real packets sent by the steering wheel via CAN bus when I press V+ key for a short time:
. . . . .
00 00 01 2B 08 0D 4F 80 2A 00 00 00 00
00 00 01 2B 08 86 40 80 2A 00 00 00 00
00 00 01 2B 08 F4 41 80 2A 00 00 00 00
00 00 01 2B 08 50 42 80 2A 00 00 00 00
00 00 01 2B 08 CF 43 82 2A 00 00 00 00 // V+ key pressed
00 00 01 2B 08 4F 44 82 2A 00 00 00 00
00 00 01 2B 08 EA 45 82 2A 00 00 00 00
00 00 01 2B 08 F3 46 82 2A 00 00 00 00
00 00 01 2B 08 D6 47 82 2A 00 00 00 00
00 00 01 2B 08 03 48 82 2A 00 00 00 00
00 00 01 2B 08 CC 49 80 2A 00 00 00 00 // V+ key released
00 00 01 2B 08 DC 4A 80 2A 00 00 00 00
00 00 01 2B 08 79 4B 80 2A 00 00 00 00
. . . . .
It can be seen that yy series numbers didn't change but xx and zz numbers changed from "no key" table to "V+" table. It is obvious that the V+ key code started from yy=43 just by chance.
Designing
It is possible to use a cheap simple board like Arduino and a CAN bus interface board like MCP2515. But, for some reason, I used the STM32 processor.
The main idea is to artificially simulate the pressing of the V+ key and send the desired number of appropriate packets on the CAN bus.
While working with the system, I realized that if for any reason the yy numbers are not sent in the order that was said, an ACC error will be declared and ACC will be unusable for now. Of course, this error will be resolved by restarting the car.
Therefore, from a technical point of view, this task is as follows:
16 consecutive packets of V+ table will be sent with a time interval of 1.5 milliseconds. These packets take about 24 milliseconds and fit between the transmissions of the steering wheel processor. So that the overall sequence of yy numbers does not get mixed up and the pressing of the V+ key will be simulated.
Packets on the CAN bus in the time axis will be as follows:
The blue packets are sent by the processor on the steering wheel, and the red packets are sent by our processor.
The final algorithm can be expressed as follows:
1) Start-up and initialize //immediately after ignition-on
2) delay for 6 seconds
3) N = 7; /* 1=30 km/h , 2=40 km/h , ... , 7=90 km/h, … */
4) For N times
5) {
6) Wait and Read-CAN packets to find: xx,yy,zz = 0D,4F,80
7) delay for 3 mili-sec
8) Every 1.5 mili-sec: Send-CAN packets of V+, start from 41,40,82 up to CA,4F,82
9) delay for 300 mili-sec
10) }
11) Set MCP2515 to sleep mode
12) Set the CPU to sleep mode
It is possible to develop the above algorithm in any software language on any processor.
Final result
I implemented the above algorithm in STM32 processor in C language. The MCP2515 function library was very useful. The board power should be connected to Terminal-30.
The system works well, without any errors.
When the car is started, the ACC speed is set to 90 km/h automatically within 10 seconds.
It has brought me a kind of comfort. Besides, it was fun to face this challenge.
See this video:
go.screenpal.com/watch/cZiv6zVPHpy