Technology

09 May 2022

How to connect phones to cars via Bluetooth

Using K-Line and CAN protocols to create awesome driving experiences

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?

HISTORY OF ON-BOARD DIAGNOSTICS

OBD systems, on-board diagnostics, are an important part of modern vehicles. This is the ability of a vehicle to self-diagnose and report data about the vehicle's performance and operation. As quite a lot of other nice things, OBD systems started to be widely adopted thanks to California. Initially, OBD systems were intended to help control annual emissions, but the lack of standardization hindered their effectiveness. Thankfully, this did not halt the development of OBD systems as manufacturers and repair technicians use them to check vehicle systems. Also, later attempts to to use OBD systems to control emissions were successful.

OBD-II, the successor to OBD, is advanced enough to detect potential damage to an ECU and issue a warning. For example, it issues a "check engine" warning well before an engine failure occurs. OBD-II enables the exchange of data between a vehicle and a device, and it can also control various vehicle systems.

OBD-II is the most commonly used interface in modern vehicles, with equivalent systems used in the EU (EOBD), Japan (JOBD), and Australia (ADR). Since 1996, the use of OBD-II has been mandatory for all car models sold in the US as a way to control annual emissions. By law, it is only required to transmit data related to emissions. However, most manufacturers also include the ability to stream real-time data from the car's electronic control units (ECUs).

OBD-II uses various internal communication networks (vehicle buses) to transfer data from the car's electronic control units (ECUs) to a scanner, data logger, or smartphone via Bluetooth. In this article, In this article, I will describe two specific communication protocols - K-line and CAN - that Quality Wolves uses in projects for the automotive and manufacturing industries.

AUTOMOTIVE PROTOCOLS AND THEIR DIFFERENCES

K-line is a low-speed, single-wire communication system primarily used for diagnostic purposes. It can transfer any data, limited only by its broadband capacity of 10 Kb/s. For example, K-line can indicate whether an electronic control unit (ECU) is turned on or off. The main limitation of the K-line network is that only one ECU can send a message at a time. As a result, any device connected to a K-line can see all the queued messages. This poses a security risk if K-line is used to transfer sensitive data. Today, K-line is primarily used in vehicles that don't have a CAN bus, or in situations where it's not essential to use more than a single wire for a task.

CAN bus, or Controller Area Network, is much faster than K-line (up to 1 Mb/s versus 10 Kb/s) and can transfer more data in a single message. OBD-II now mostly runs on CAN, making this vehicle bus standard essential for cars, trucks, tractors, and industrial robots. Unlike K-line that queues messages from all linked ECUs, CAN unites all ECUs into a decentralised system and can transfer multiple messages simultaneously. While CAN is generally more secure than K-line, some cars are vulnerable to hacking and could potentially lose control of their CAN message systems, which could be dangerous for the owner.

TO SUM UP

There's a wide range of apps developed using K-line and CAN protocols, including ride height controllers and programs that control sophisticated car-gathering robots.

New vehicle buses and their extensions, such as CAN-FD, are changing the way we interact with vehicles and robots. These developments improve the experience of drivers and passengers, make work easier for factory employees, and open new possibilities for business automation.

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 in developing state-of-the-art solutions for both large auto manufacturers and startups.

Blog author photo
Diana Sadykova

Head of Marketing at Quality Wolves

I love Belgian beer, future pop, and writing about IT products.

Complete the form
for a quick response

Thank you!

Your message has been received.
Oops! Something went wrong while submitting the form.