Why do you need a can bus in an alarm. CAN bus: what is it and what is it used for in a car? Deciphering the designation

Why do you need a can bus in an alarm. CAN bus: what is it and what is it used for in a car? Deciphering the designation

03.11.2019

Modern cars are increasingly adapting to the specific needs of people. They have many additional systems and functions that are associated with the need to transfer certain information. If separate wires had to be connected to each such system, as it was before, then the entire interior would turn into a continuous web and it would be difficult for the driver to control the car due to the large number of wires. But the solution to this problem was found - this is the installation of a Can-bus. What role the driver will be able to learn now.

Can bus - does it have anything in common with conventional tires and what is it for

ATTENTION! Found a completely simple way to reduce fuel consumption! Don't believe? An auto mechanic with 15 years of experience also did not believe until he tried it. And now he saves 35,000 rubles a year on gasoline!

Hearing such a definition as "CAN tire", an inexperienced driver will think that this is another type of car rubber. But in fact, this device has nothing to do with ordinary tires. This device was created so that there was no need to install a bunch of wires in the car, because all machine systems should be controlled from one place. Can bus makes it possible to make the car interior comfortable for the driver and passengers, because if it is present, there will not be a large number of wires, it allows you to control all car systems and connect additional equipment in a convenient way - trackers, alarms, beacons, secrets and more. The old-style car does not yet have such a device, which causes a lot of inconvenience. The digital bus does a better job with the tasks assigned to it, and the standard system - with a bunch of wires, is complex and inconvenient.

When was the digital CAN bus developed and what is its purpose

The development of the digital bus began in the twentieth century. Two companies, INTEL and BOSCH, took responsibility for this project.
After some joint efforts, the specialists of these companies developed a network indicator - CAN. It was a new type of wired system through which data is transmitted. This development was called a tire. It consists of two twisted wires of a sufficiently large thickness and all the necessary information for each of the car's systems is transmitted through them. There is also a bus, which is a bundle of wires - it is called parallel.

If you connect a car alarm to the CAN bus, then the capabilities of the security system will increase, and the direct purpose of this car system can be called:

  • simplification of the mechanism for connecting and operating additional vehicle systems;
  • the ability to connect any device to the car system;
  • the ability to simultaneously receive and transmit digital information from several sources;
  • reduces the influence of external electromagnetic fields on the performance of the main and additional vehicle systems;
  • speeds up the process of transferring data to the necessary devices and systems of the machine.

To connect to the CAN bus, you need to find orange in the wire system, it must be thick. It is to it that you need to connect in order to establish interaction with the digital bus. This system works as an analyzer and distributor of information, thanks to which the high-quality and regular operation of all vehicle systems is ensured.

Can bus - speed parameters and data transfer features

The principle of operation on which the CAN bus analyzer operates is that it needs to quickly process the information received and send it back as a signal for a specific system. In each individual case, the data transfer rate for vehicle systems is different. The main speed parameters look like this:

  • total speed of data streams transfer via digital bus –1 Mb/s;
  • the speed of transfer of processed information between the control units of the car - 500 kb / s;
  • the rate at which information is received by the Comfort system is 100 kb/s.

If a car alarm is connected to the digital bus, then information from it will come as quickly as possible, and the commands given by the person, using the key fob, will be executed accurately and on time. The system analyzer works without interruption and therefore the operation of all machine systems will always be in good working order.

A digital bus is a whole network of controllers that have united into one compact device and are able to quickly receive or transmit information, starting or turning off certain systems. The serial mode of data transfer makes the system work more smoothly and correctly. The CAN bus is a mechanism that has the Collision Resolving access type and this fact must be taken into account when installing additional equipment.

Can there be problems in the operation of the bus

Kan bus or digital bus works with many systems at the same time and is constantly engaged in data transfer. But as in every system, failures can occur in the CAN bus mechanism and the information analyzer will work extremely incorrectly from this. Canbus problems can occur due to the following situations:

When a system malfunction is detected, it is necessary to look for the cause of this, given that it may be hiding in the additional equipment that was installed - car alarms, sensors and other external systems. Troubleshooting should be done in the following way:

  • check the operation of the system as a whole and request a fault bank;
  • checking the voltage and resistance of conductors;
  • checking the resistance of the resistor jumpers.

If there are problems with the digital bus and the analyzer cannot continue to work correctly, do not try to solve this problem yourself. For competent diagnosis and performance of the necessary actions, the support of a specialist in this field is necessary.

What systems are included in the modern Can bus car

Everyone knows that the can bus is an information analyzer and an accessible device for transmitting commands to the main and additional vehicle systems, additional equipment - car alarms, sensors, trackers. The modern digital bus includes the following systems:

This list does not include external systems that can be connected to the digital bus. In place of such there may be a car alarm or additional equipment of a similar type. You can receive information from the CAN bus and monitor how the analyzer works using a computer. This requires the installation of an additional adapter. If an alarm and an additional beacon are connected to the CAN bus, then you can control some car systems using a mobile phone for this.

Not every alarm has the ability to connect to a digital bus. If the owner of the car wants his car alarm to have additional features, and he could constantly control the systems of his car at a distance, you should think about buying a more expensive and modern version of the security system. Such an alarm is easily connected to the CAN bus wire and works very efficiently.

CAN bus, how a car alarm is connected to a digital bus

The digital bus analyzer copes not only with the internal systems and devices of the car. Connecting external elements - alarms, sensors, other devices - adds more load to the digital device, but at the same time its productivity remains the same. A car alarm that has an adapter for connecting to a digital bus is installed according to a standard scheme, and in order to connect to CAN, you need to go through a few simple steps:

  1. The car alarm is connected to all points of the car according to the standard scheme.
  2. The owner of the vehicle is looking for an orange, thick wire - it leads to a digital bus.
  3. The alarm adapter is connected to the car's digital bus wire.
  4. The necessary fixing actions are carried out - installing the system in a safe place, insulating wires, checking the correctness of the process.
  5. Channels are configured to work with the system, a functional range is set.

The possibilities of a modern digital bus are great, because a coil of two wires combines access to all the main and additional vehicle systems. This helps to avoid the presence of a large number of wires in the cabin and simplifies the operation of the entire system. The digital bus works like a computer, and this is very relevant and convenient in the modern world.

The number of installed sensors on modern car models often allows us to call them "computers on wheels". In order to tidy up the management of numerous electronic systems, a CAN bus was created. What is it and what are the principles of its work, we will consider in this article.

Historical reference

The first products of the automotive industry did without electrical circuits at all. To start the car engine, a special magnetoelectric device was used that generates electricity from kinetic energy.

However, gradually the cars became more and more entangled with wires, and in 1970, in terms of the degree of stuffing with various sensors, they competed with airplanes. And the more devices were placed in the car, the more obvious the need to rationalize the wiring circuits became.

The solution to the problem became possible with the microprocessor revolution and took place in several stages:

  • In 1983, the German concern Bosch began developing a new data transfer protocol for use in the automotive industry;
  • Three years later, at a conference in Detroit, this protocol was officially presented to the general public under the name "Sensor Area Network" (Controller Area Network), or abbreviated in English as CAN;
  • The practical implementation of the German invention was taken up by the companies "Intel" and "Philips". The first prototypes date back to 1987;
  • In 1988, the BMW 8-series became the first car to roll off the assembly line, on which all sensors were organized according to the "CAN" technology;
  • Three years later, Bosch updated the standard and added new features;
  • In 1993, the KAN standard became international and received the ISO classifier;
  • In 2001, every four-wheeled vehicle in Europe became mandatory to be equipped with a CAN bus;
  • In 2012, a new version of the bus was released: the information transfer rate was increased, and compatibility with a number of new devices was also organized.

CAN bus: how it works

The bus includes only a pair of wires connected to a single microchip. Each cable transmits several hundred signals simultaneously to various vehicle controllers. Data transfer speed is comparable to broadband internet. In addition, if necessary, the signal will be amplified to the required level.

The work of technology can be divided into several stages:

  1. Background mode- all nodes of the system are turned off, but the power supply continues to be supplied to the CAN-microchip. The level of energy consumption is extremely small and amounts to tiny fractions of milliamps;
  2. launch- as soon as the driver turns the ignition key (or presses the "Start" button to start the engine - on some car models), the system literally "wakes up". The mode of stabilization of the power supplied to the sensors is turned on;
  3. active work- all controllers exchange the necessary (both diagnostic and current) information. The level of electricity consumption increases at peak loads to a record 85 milliamps;
  4. falling asleep- as soon as the car's engine is turned off, the "KAN" sensors instantly stop working. Each of the nodes of the system is independently disconnected from the electrical network and goes into sleep mode.

What is a CAN bus in a car?

CAN in relation to the car can be called the "backbone" to which all electrical devices are connected. The signals are digital and the wires to each controller are connected in parallel. This results in high network performance.

In modern cars, sensors from the following devices are combined into a single network:

  • Motor;
  • Gear box;
  • Airbags (airbags);
  • Anti-lock braking system;
  • Power steering;
  • Ignition;
  • Dashboard;
  • Tires (controllers that determine the level of pressure);
  • "Wipers" on the windshield;
  • multimedia system;
  • Navigation (GLONASS, GPS);
  • On-board computer.

Application in other industries

The lightness and simplicity of CAN technology reveals the possibilities of its application not only for iron horses. The tire is also used in the following areas:

  • Bicycle production. The Japanese brand Shimano announced in 2009 a bicycle with a multi-level control system for the CAN-based gearshift mechanism. The effectiveness of this step was so obvious that other firms, Marants and Bayon X, decided to follow in the footsteps of Shimano. The last manufacturer uses a bus for a direct drive system;
  • Known for the implementation of the so-called "smart home" on the principle of the CAN-bus. Many devices that can solve certain tasks without the participation of people (automatic lawn watering, thermostat, video surveillance system, lighting control, climate control, etc.) are combined into a single data transmission system. True, experts find the use of purely automotive technology in a human dwelling rather doubtful. Among the weaknesses of such a move is the lack of a single international CAS standard for smart homes.

Advantages and disadvantages

"KAN-bus" is valued in mechanical engineering for such positive qualities:

  • Speed: the system is adapted to work in conditions of hard time pressure;
  • Relative ease of embedding in the machine and a low level of installation costs;
  • Increased tolerance to interference;
  • A multi-level control system that allows you to avoid many errors in the process of data entry and exit;
  • The spread of work speeds allows you to adapt to almost any situation;
  • Increased security level: blocking unauthorized access from the outside;
  • A variety of standards, as well as manufacturing companies. The palette of tires available on the market allows you to find an option for even the cheapest car.

Despite the abundance of advantages, CAN technology is not without a number of weaknesses:

  • The amount of information that is available for simultaneous transmission in a "data packet" is quite limited for today's requirements;
  • A significant part of the transmitted data has official and technical purposes. The useful data itself accounts for a tiny fraction of the traffic on the network;
  • The top layer protocol is not standardized at all.

Bosch invented not only the spark plug and fuel filter, but also a kind of “Internet” for car sensors called the CAN bus. What is this standard in the field of linking together all controllers into a single neural network became known about 30 years ago.

Video: how can-bus works in a car

In this video, mechanic Arthur Kamalyan will tell you what the can-bus is used for in a car and how to connect to it:

The appearance of digital tires in cars occurred later than electronic components began to be widely introduced into them. At that time, they only needed a digital “output” to “communicate” with diagnostic equipment - low-speed serial interfaces like ISO 9141-2 (K-Line) were enough for this. However, the apparent complication of on-board electronics with the transition to the CAN architecture has become its simplification.

Indeed, why have a separate speed sensor if the ABS unit already has information about the speed of rotation of each wheel? It is enough to transfer this information to the dashboard and to the engine control unit. For security systems, this is even more important: for example, the airbag controller is already becoming able to independently turn off the engine in a collision by sending the appropriate command to the engine ECU, and de-energize the maximum on-board circuits by sending a command to the power control unit. Previously, for safety, it was necessary to use unreliable measures such as inertial switches and squibs on the battery terminal (BMW owners are already familiar with its “glitches”).

However, on the old principles, it was impossible to implement full-fledged "communication" of control units. The volume of data and their importance have grown by an order of magnitude, that is, a bus was required that is not only capable of operating at high speed and is protected from interference, but also provides minimal transmission delays. For a car moving at high speed, even milliseconds can already play a critical role. A solution that satisfies such requests already existed in the industry - we are talking about CAN BUS (Controller Area Network).

The essence of the CAN bus

The digital CAN bus is not a specific physical protocol. The principle of operation of the CAN bus, developed by Bosch back in the eighties, allows it to be implemented with any type of transmission - even over wires, even over fiber optics, even over a radio channel. The CAN bus works with hardware support for block priorities and the ability for the “more important” to interrupt the transmission of the “less important”.

For this, the concept of dominant and recessive bits has been introduced: to put it simply, the CAN protocol will allow any unit to get in touch at the right time, stopping data transfer from less important systems by simply transmitting a dominant bit while there is a recessive one on the bus. This happens purely physically - for example, if the "plus" on the wire means "one" (dominant bit), and the absence of a signal means "zero" (recessive bit), then the transmission of "one" will unambiguously suppress "zero".

Imagine a class at the beginning of a lesson. Pupils (low priority controllers) calmly talk among themselves. But, as soon as the teacher (high-priority controller) gives the command “Silence in the classroom!” Loudly, blocking the noise in the classroom (the dominant bit suppressed the recessive one), the data transfer between the student controllers stops. Unlike a school class, in the CAN bus this rule works on an ongoing basis.

What is it for? That important data be transferred with a minimum of delays even at the cost of the fact that unimportant data will not be transferred to the bus (this distinguishes the CAN bus from the one familiar to everyone from Ethernet computers). In the event of an accident, the ability of the injection computer to receive information about this from the SRS controller is disproportionately more important than the ability of the instrument panel to receive the next packet of data on the speed of movement.

In modern cars, it has already become the norm to physically distinguish between low and high priorities. They use two or even more physical buses of low and high speed - usually it is a "motor" CAN bus and a "body" bus, the data flows between them do not intersect. Only the CAN-bus controller is connected to all at once, which makes it possible to “communicate” with all the blocks through one connector.

For example, the Volkswagen technical documentation defines three types of CAN buses used:

  • The "fast" bus, operating at 500 kilobits per second, integrates engine, ABS, SRS and transmission control units.
  • "Slow" operates at a speed of 100 kbps and combines the units of the "Comfort" system (central locking, power windows, and so on).
  • The third works at the same speed, but only transmits information between navigation, built-in phone, and so on. On older cars (for example, Golf IV), the information bus and the "comfort" bus were physically combined.

Interesting fact: on the Renault Logan of the second generation and its "co-platformers" there are also physically two buses, but the second one connects exclusively the multimedia system to the CAN controller, on the second one there are both the engine ECU, the ABS controller, and the airbags, and the UCH.

Physically, cars with a CAN bus use it as a twisted differential pair: in it, both wires serve to transmit a single signal, which is defined as the voltage difference on both wires. This is necessary for simple and reliable noise protection. An unshielded wire works like an antenna, that is, the source of radio interference is able to induce an electromotive force in it, sufficient for the interference to be perceived by the controllers as a real transmitted bit of information.

But in a twisted pair, the EMF value of the interference will be the same on both wires, so the voltage difference will remain unchanged. Therefore, to find the CAN bus in the car, look for a twisted pair of wires - the main thing is not to confuse it with the wiring of the ABS sensors, which are also laid inside the car with a twisted pair to protect against interference.

The diagnostic connector of the CAN bus was not re-invented: the wires were brought to the free pins of the already standardized block, in which the CAN bus is located on pins 6 (CAN-H) and 14 (CAN-L).

Since there can be several CAN buses on a car, it is often practiced to use different physical levels of signals at each. Again, for an example, let's turn to the Volkswagen documentation. This is how the data transmission in the motor bus looks like:

When no data is being transmitted on the bus or a recessive bit is being transmitted, the voltmeter will show 2.5 volts to ground on both wires of the twisted pair (signal difference is zero). At the moment of transmitting the dominant bit on the CAN-High wire, the voltage rises to 3.5 V, while on CAN-Low it drops to one and a half. A difference of 2 volts means "one".

On the Comfort bus, everything looks different:

Here, “zero” is, on the contrary, a 5 volt difference, and the voltage on the Low wire is higher than on the High wire. "Unit" is a change in the voltage difference to 2.2 V.

Checking the CAN bus at the physical level is carried out using an oscilloscope, which allows you to see the actual passage of signals over a twisted pair: with an ordinary tester, of course, it is impossible to “see” the alternation of pulses of such a length.

"Decoding" of the CAN-bus of the car is also carried out by a specialized device - analyzer. It allows you to output data packets from the bus as they are transmitted.

You yourself understand that diagnostics of the CAN bus at the "amateur" level without the appropriate equipment and knowledge does not make sense, and it is simply impossible. The maximum that can be done with "improvised" means to check the can-bus is to measure the voltage and resistance on the wires, comparing them with the reference ones for a particular car and a particular tire. This is important - above we specifically gave an example of the fact that even on the same car there can be a serious difference between tires.

Faults

Although the CAN interface is well protected from interference, electrical faults have become a serious problem for him. Combining blocks into a single network made it vulnerable. The CAN interface on cars has become a real nightmare for low-skilled auto electricians already because of one of its features: strong power surges (for example, winter) can not only “hang” a CAN bus error that is detected, but also fill the controller memory with sporadic errors of a random nature.

As a result, a whole “garland” of indicators lights up on the dashboard. And, while the newcomer will be scratching his head in shock: “what is it?”, A competent diagnostician will first of all put a normal battery.

Purely electrical problems are bus wire breaks, their short circuits to ground or plus. The principle of differential transmission when any of the wires is broken or the “wrong” signal on it becomes unrealizable. The worst thing is the short circuit of the wire, because it "paralyzes" the entire bus.

Imagine a simple motor bus in the form of a wire on which several blocks “sit in a row” - an engine controller, an ABS controller, a dashboard and a diagnostic connector. A break at the connector is not terrible for the car - all blocks will continue to transmit information to each other in the normal mode, only diagnostics will become impossible. If we break the wire between the ABS controller and the panel, we will be able to see only it on the bus with a scanner, it will not show either the speed or the engine speed.

But if there is a break between the engine ECU and the ABS, the car, most likely, will no longer start: the unit, without “seeing” the controller it needs (speed information is taken into account when calculating the injection time and ignition timing), will go into emergency mode.

If you do not cut the wires, but simply constantly apply “plus” or “ground” to one of them, the car will “go into a knockout”, since none of the blocks will be able to transmit data to another. Therefore, the golden rule of an auto electrician, translated into Russian censorship, sounds like “don’t get into the bus with crooked hands,” and a number of automakers prohibit connecting non-certified additional third-party devices (for example, alarms) to the CAN bus.

Fortunately, connecting the signaling CAN bus is not a connector to a connector, but crashing directly into the car’s bus, gives the “crooked” installer the opportunity to mix up the wires in places. After that, the car will not only refuse to start - if there is an on-board circuit control controller that distributes power, even the ignition is not a fact that it will turn on.

Changing the temperature of the Ford Fusion air conditioner using commands via the CAN bus.

Ariel Nuñez
Changing the temperature of the Ford Fusion air conditioner using commands via the CAN bus.


Figure 1: How can I use the app to control key vehicle functions?
Recently, I, along with my friends from the company Voyage worked on the implementation of programmatic control of the air conditioning system in the Ford Fusion. At the moment, Voyage is developing budget self-driving cars. The ultimate goal: that everyone can call a car to their front door and travel safely wherever they want. Voyage sees the ability to provide rear-seat access to key vehicle functions as crucial, as the day when the driver's work will be fully automated is not far off.
Why you need a tireCAN
Modern cars use a variety of control systems that in many cases function like micro-services in web development. For example, airbags, braking systems, speed control (cruise control), electric power steering, audio systems, window and door controls, glass adjustment, charging systems for electric cars, etc. These systems must be able to communicate and read each other's parameters. . In 1983, Bosch began developing the CAN bus (Controller Area Network; Local area network of controllers) to solve this complex problem.
We can say that the CAN bus is a simple network where every system in the car can read and send commands. This tire integrates all the complex components in an elegant way, making it possible to implement all the favorite features of the car that we use.


Figure 2: First time tireCAN began to be used in 1988 in the BMW 8 series
Self-driving cars and tiresCAN
As interest in the development of self-driving cars has skyrocketed, the phrase "CAN bus" is also gaining popularity. Why? Most self-driving car companies aren't building from scratch, but trying to learn how to programmatically drive cars after they leave the factory line.
Understanding the internals of the CAN bus used in the vehicle allows the engineer to generate commands using the software. The most needed commands, as you can guess, are related to steering, acceleration and braking.


Figure 3: Introduction to LIDAR (key sensor for self-driving car)
With the help of sensors like LIDAR (light detecting and ranging; optical location system), the machine is able to look at the world like a superman. Then the computer inside the car makes decisions based on the information received and sends commands to the CAN bus for steering, acceleration and braking.
Not every car is capable of becoming self-driving. And for some reason, Voyage chose the Ford Fusion model (you can read more about the reasons in this article).
Tire researchCAN inFordFusion
Before I started researching the air conditioning systems in the Ford Fusion, I opened my favorite book, The Car Hacker's Handbook. Before diving into the heart of the matter, let's take a look at Chapter 2, which describes three important concepts: bus protocols, the CAN bus, and CAN frames.
TireCAN
The CAN bus has been used in American cars and light trucks since 1994 and has been mandatory since 2008 (in European cars since 2001). This bus has two wires: CAN high (CANH) and CAN low (CANL). The CAN bus uses differential signaling, the essence of which is that when a signal is received on one wire, the voltage rises, and on the other it decreases by the same amount. Differential signaling is used in environments that need to be insensitive to noise, such as automotive systems or manufacturing.


Figure 4: Raw bus signalCAN displayed on an oscilloscope
On the other hand, packets sent over the busCAN, not standardized. Each package contains 4 key elements:

  • arbitrationID (ArbitrationID) is a broadcast message identifying the device that is trying to start communication. Any device can send multiple arbitration IDs. If two CAN packets are sent over the bus per unit time, the one with the lower arbitration ID is skipped.
  • ID extension(Identifierextension; IDE) - in the case of a standard configuration CAN bus, this bit is always 0.
  • Data length code (Datalengthcode; DLC) specifies the size of the data, which ranges from 0 to 8 bytes.
  • Data. The maximum data size carried by the standard CAN bus can be up to 8 bytes. Some systems force the packet to be padded to 8 bytes.


Figure 5: Format of standardCAN packages
CAN frames
In order to turn on / off the climate system, we must find the desired CAN bus (there are several such buses in the car). Ford Fusion has at least 4 documented tires. 3 buses operate at high speed 500 kbps (High Speed ​​CAN; HS) and 1 bus at medium speed 125 kbps (Medium Speed ​​CAN; MS).
Two high-speed buses HS1 and HS2 are connected to the OBD-II port, but there is a protection there that does not allow forging commands. Together with Alan from Voyage, we removed the OBD-II port and found the connections to all tires (HS1, HS2, HS3 and MS). On the rear wall of the OBD-II, all buses were connected to the Gateway Module.


Figure 6:Homer – the first self-driving taxi from the companyVoyage
Since the climate system is controlled via the media interface (SYNC), we will have to send commands via the medium speed bus (MS).
Reading and writing CAN packets is done using the SocketCAN driver and network stack, created by the Volkswagen R&D department for the Linux kernel.
We will connect three wires from the machine (GND, MSCANH, MSCANL) to the Kvaser Leaf Light HSv2 adapter (available for $300 on Amazon) or CANable (sold for $25 on Tindie) and boot the bus on a computer with a fresh Linux kernel CAN as a network device.

Modprobe can
modprobe kvaser_usb
ip link set can0 type can bitrate 1250000
ifconfig can0 up

After loading, we run the candump can0 command and start monitoring traffic:

Can0 33A 00 00 00 00 00 00 00 00 415 00 00 C4 FB 0F FE 0F FE can0 346 00 00 00 03 03 00 C0 00 can0 348 00 00 00 00 00 00 00 00 can0 167 72 7F FF 10 00 19 F8 00 can0 3E0 00 00 00 00 80 00 00 00 can0 167 72 7F FF 10 00 19 F7 00 can0 34E 00 00 00 00 00 00 00 00 can0 358 00 00 00 00 00 00 00 00 can0 3 A4 00 00 00 00 00 00 00 00 can0 216 00 00 00 00 82 00 00 00 can0 3AC FF FF FF FF FF FF FF FF can0 415 00 00 C8 FA 0F FE 0F FE can0 083 00 00 00 00 00 01 7E F4 can0 2FD D4 00 E3 C1 0 8 52 00 00 can0 3BC 0C 00 08 96 01 BB 27 00 can0 167 72 7F FF 10 00 19 F7 00 can0 3BE 00 20 AE EC D2 03 54 00 can0 333 00 00 00 00 00 00 00 00 can0 42A D6 5 B 70 E0 00 00 00 00 can0 42C 05 51 54 00 90 46 A4 00 can0 33B 00 00 00 00 00 00 00 00 can0 42E 93 00 00 E1 78 03 CD 40 can0 42F 7D 04 00 2E 66 04 01 77 can0 167 72 7F FF 10 00 19 F7 00 can0 3E7 00 00 00 00 00 00 00 00 can0 216 00 00 00 00 82 00 00 00 can0 415 00 00 CC F9 0F FE 0F FE can0 3A5 00 00 00 00 00 00 00 00 can0 3AD FF FF FF FF FF FF FF FF can0 50B 1E 12 00 00 00 00 00 00

Even though the above information is equivalent to the amplitude of the audio signal, it is quite difficult to understand what is going on and detect any patterns. We need something similar to a frequency analyzer, and the equivalent is in the form of the cansniffer utility. Cansniffer shows a list of identifiers and allows you to track changes in the data section within a CAN frame. As we explore certain IDs, we can set up a filter for the IDs that are relevant to our task.
The figure below shows an example of information taken with the help of cansniffer from the MS bus. We have filtered out everything related to identifiers 355, 356 and 358. After pressing and releasing the buttons related to temperature adjustment, the value 001C00000000 appears at the very end.


Figure 7: Information from the busMS captured with cansniffer
Next, you need to combine the functionality for controlling the climate system with a computer running inside the car. The computer runs on the ROS (Robot Operating System; Operating System for Robots) operating system. Since we are using SocketCAN, the socketcan_bridge module greatly simplifies the task of converting a CAN frame into an information block understood by the ROS operating system.
The following is an example of the decoding algorithm:

If frame.id == 0x356:
raw_data = unpack("BBBBBBBB", frame.data)
fan_speed=raw_data/4
driver_temp = parse_temperature(raw_data)
passenger_temp = parse_temperature(raw_data)

The received data is stored in CelsiusReport.msg:

bool auto
bool system_on
bool unit_on
bool dual
bool max_cool
bool max_defrost
bool recirculation
bool head_fan
bool feet_fan
bool front_defrost
bool rear_defrost string driver_temp
string passenger_temp

After pressing all the necessary buttons in the car, we have the following list:

CONTROL_CODES = (
"ac_toggle": 0x5C,
"ac_unit_toggle": 0x14,
"max_ac_toggle": 0x38,
"recirculation_toggle": 0x3C,
"dual_temperature_toggle": 0x18,
"passenger_temp_up": 0x24,
"passenger_temp_down": 0x28,
"driver_temp_up": 0x1C,
"driver_temp_down": 0x20,
"auto": 0x34,
"wheel_heat_toggle": 0x78,
"defrost_max_toggle": 0x64,
"defrost_toggle": 0x4C,
"rear_defrost_toggle": 0x58,
"body_fan_toggle": 0x04,
"feet_fan_toggle": 0x0C,
"fan_up": 0x2C,
"fan_down": 0x30,
}

Then these strings are sent to the node running the ROS operating system and then the translation into codes understood by the car takes place:

Rostopic pub /celsius_control celsius/CelsiusControl ac_toggle

Conclusion
Now we can create and send the same codes to the CAN bus that are generated when pressing the physical buttons associated with the increase and decrease in temperature, which makes it possible to remotely change the temperature of the car using the application when we are in the back seat of the car.


Figure 8: Remote control of the car climate system
This is just a small step in creating a self-driving taxi with Voyage specialists. I got a lot of positive emotions while working on this project. If you are also interested in this topic, you can check out the list of vacancies at Voyage.

The CAN bus is an electronic device built into the vehicle's electronic system to monitor performance and driving performance. It is a mandatory element for equipping a car with an anti-theft system, but this is only a small part of its capabilities.

The CAN bus is one of the devices in the electronic automation of a car, which is tasked with combining various sensors and processors into a common synchronized system. It provides the collection and exchange of data, whereby the necessary adjustments are made to the operation of various systems and machine components.

The abbreviation CAN stands for Controller Area Network, that is, a network of controllers. Accordingly, the CAN bus is a device that receives information from devices and transmits between them. This standard was developed and implemented over 30 years ago by Robert Bosch GmbH. Now it is used in the automotive industry, industrial automation and the design of objects designated as “smart”, such as houses.

How the CAN bus works

In fact, the bus is a compact device with many inputs for connecting cables or a connector to which cables are connected. The principle of its operation is to transfer messages between different components of the electronic system.

Identifiers are included in messages to convey various information. They are unique and report, for example, that at a particular moment in time a car is traveling at a speed of 60 km/h. A series of messages is sent to all devices, but thanks to individual identifiers, they only process those that are intended specifically for them. CAN bus identifiers can be 11 to 29 bits long.

Depending on the purpose of CAN tires are divided into several categories:

  • Power. They are designed for synchronization and data exchange between the engine electronic unit and the anti-lock braking system, gearbox, ignition, and other working units of the car.
  • Comfort. These tires provide digital interfaces that are not connected to the chassis of the machine, but are responsible for comfort. This is a seat heating system, climate control, mirror adjustment, etc.
  • Information and command. These models are designed for the rapid exchange of information between the nodes responsible for car maintenance. For example, a navigation system, a smartphone and an ECU.

Why CAN bus in a car

The distribution of the CAN interface in the automotive sector is due to the fact that it performs a number of important functions:

  • simplifies the algorithm for connecting and operating additional systems and devices;
  • reduces the influence of external interference on the operation of electronics;
  • provides simultaneous receipt, analysis and transmission of information to devices;
  • accelerates the transmission of signals to mechanisms, running units and other devices;
  • reduces the number of wires needed;

In a modern car, the digital bus provides the following components and systems:

  • central mounting block and ignition lock;
  • anti-lock system;
  • engine and gearbox;
  • airbags;
  • steering gear;
  • steering wheel sensor;
  • power unit;
  • electronic blocks for parking and blocking doors;
  • tire pressure sensor;
  • wiper control unit;
  • high pressure fuel pump;
  • sound system;
  • information and navigation modules.

This list is not exhaustive as it does not include compatible external devices that can also be connected to the bus. Often, a car alarm is connected in this way. A CAN bus is also available for connecting external devices for performance monitoring and diagnostics on a PC. And when you connect a car alarm together with a beacon, you can control individual systems from the outside, for example, from a smartphone.

Pros and cons of CAN bus

Experts in automotive electronics, speaking in favor of using the CAN interface, note the following advantages:

  • simple data exchange channel;
  • information transfer rate;
  • wide compatibility with working and diagnostic devices;
  • a simpler scheme for installing car alarms;
  • multi-level monitoring and control of interfaces;
  • automatic transmission rate distribution with priority in favor of the main systems and nodes.

But the CAN bus also has functional disadvantages:

  • with increased information load on the channel, the response time increases, which is especially typical for the operation of cars “stuffed” with electronic devices;
  • due to the use of a higher level protocol, standardization problems are encountered.

Possible problems with the CAN bus

Due to the inclusion in many functional processes, malfunctions in the CAN bus appear very quickly. The most common signs of impairment are:

  • question mark indication on the dashboard;
  • simultaneous glow of several bulbs, for example, CHECK ENGINE and ABS;
  • disappearance of indicators of fuel level, engine speed, speed on the dashboard.

Such problems arise for various reasons related to power supply or electrical circuit failure. This may be a short to ground or battery, an open circuit, damaged jumpers, a voltage drop due to problems with the generator, or a dead battery.

The first measure to check the tire is computer diagnostics of all systems. If it shows a bus, you need to measure the voltage at the H and L pins (should be ~4V) and examine the waveform on the oscilloscope under the ignition. If there is no signal or it corresponds to the mains voltage, there is a short circuit or open circuit.

Due to the complexity of the system and the large number of connections, computer diagnostics and troubleshooting should be placed in the hands of specialists with high-quality equipment.



© 2023 globusks.ru - Car repair and maintenance for beginners