How to connect
a phone to a car
via Bluetooth?

K-line and CAN protocols

Diana Sadykova
May, 2020

Essentially, a modern car is a computer. They're connected to various servers providing data: from the location of a store to your favourite series. And smartphones can be connected to cars as well. This is hardly surprising in our blissful age of connecting everything to everything. But how exactly does it happen?
First, we need to understand what OBD is, or on-board diagnostics. This is the ability of a vehicle to self-diagnose and report automotive data. As quite a lot of other nice things, OBD systems started to be widely adopted thanks to California. Initially, it was planned to use them for controlling annual emissions, but lack of standardisation hindered the first attempts. Thankfully, this didn't put an end to OBD systems development as manufacturers and repair technicians use them to check vehicle systems. Also, later attempts to control emissions with the help of OBD systems were successful.
On-board diagnostic interface is mandatory for every car model sold in the US since 1996
OBD systems have several standard interfaces, also referred to as high-layer protocols. Most modern vehicles use the OBD-II interface and its equivalents: EOBD in the EU, JOBD in Japan, ADR in Australia. This version of the on-board diagnostic interface is mandatory for every car model sold in the US since 1996 in efforts to control annual emissions. It's only required by law to transmit emission-related data, but most manufacturers also add the capacity to stream real-time data from ECUs, electronic control units of a car. OBD-II is such an advanced system that it can warn about the potential damage of an ECU. For example, it triggers the "engine check" warning well before the actual engine failure. It also allows transferring data back and forth between a vehicle and a device, as well as controlling vehicle systems.
OBD-II can use one of many vehicle buses, internal communications networks, to transfer data from ECUs to a scanner, data logger or even a smartphone via Bluetooth. In this article, I'll describe such means of communication as K-line and CAN since Quality Wolves uses these protocols in projects we develop for automotive and manufacturing verticals.
Nowadays, K-line is mostly used if a vehicle doesn't have the CAN bus
K-line is a low-speed and single-wire system mostly used as a diagnosis network. It can transfer any data limited only by the broadband capacity (10 Kb/s). For example, K-line can tell you if an ECU is turned on or off. The main impediment of the K-line network is that only one ECU at a time to send a message. As a consequence, any device connected to a K-line can see all the messages queued there, even if it's not intended to receive some of them. This poses a security risk if K-line transfers sensitive data. Nowadays, K-line is mostly used if a vehicle doesn't have the CAN bus or it's not vital for a task to use more than a single wire.
CAN bus, or Controller Area Network, is much faster than K-line (up to 1 Mb/s vs 10 Kb/s) and capable of transferring more data in one message. OBD-II mostly runs on CAN nowadays so this vehicle bus standard is essential for cars, trucks, tractors, industrial robots. Unlike K-line that queues messages from all linked ECUs, it unites all electronic control units into a decentralised system and can transfer several messages simultaneously. Though it makes CAN more secure than K-line, some cars are vulnerable to hacking and can surrender control over CAN message systems which, in turn, might be dangerous for an owner.

Here's a simplified scheme of how both protocols work:
New vehicle buses and their extensions are changing the ways we interact with the vehicles and robots
There's a wide range of apps developed with the use of K-line and CAN protocols: from ride height controllers to programs that control robots gathering an EV like Tesla.

New vehicle buses and their extensions (for example, CAN-FD) are changing the ways we interact with the vehicles and robots. It helps to improve drivers' and passengers' experience, makes work easier for factory employees, and opens new possibilities for business automatisation.

If you'd like to create an app that relies on K-line or CAN protocols, just contact us. The Quality Wolves team has experience of working on state-of-the-art solutions for both the largest auto manufacturers and startups.
Did you like this article?
Share it with colleagues to make one little wolf cub smile :)
Subscribe to our blog