Open the wiring loom of almost any modern car and, next to the CAN-Bus, you will find a second, much quieter network: LIN. It runs the wipers, talks to the alternator, reads the battery sensor and listens to switch panels. It does all of that over one single wire, at a fraction of the cost of CAN. In this guide we explain how LIN actually works: what happens on that wire, who is allowed to talk and when, and what to look out for when you put a LIN device in your car. Our reference throughout is LIN 2.x at 19.2 kbit/s (kilobits per second), the version and speed you will meet most often.
LIN stands for Local Interconnect Network. Car manufacturers created it in the late nineties for a very practical reason: CAN is brilliant, but it is too expensive to put in every window switch, seat motor and rain sensor. Those parts do not need speed. They need something cheap and dependable. LIN is exactly that: slow (20 kbit/s at most), simple and cheap. It usually sits underneath CAN as a small local network, with one control unit that speaks both languages and passes information between the two. If you are new to CAN, our Basics of CAN-Bus guide is a good place to start.
|
A LIN-Bus is one single wire that runs past every device, called a node. There is always exactly one master and up to 15 slaves (newer versions of the standard call them commander and responders), on a wire of up to 40 meters. When nobody is talking, the master holds the wire at battery voltage (12 V) through a 1 kOhm pull-up resistor (a resistor that pulls the wire up to 12 V). To send something, a node pulls the wire down to ground. High means 1, low means 0. Because the signal is measured against ground, the ground of the car is the second half of the circuit. |
Inside a node you will find a microcontroller (a small, dedicated computer) and a LIN transceiver. The transceiver is the muscle: it turns the small logic signals of the microcontroller into the 12 V signal on the wire and back again. There is no special communication chip needed, because a LIN message is ordinary serial data (UART, the simple serial port that almost every microcontroller already has). A slave does not even need an accurate clock of its own, as you will see below. That is where LIN saves its money.
This is the heart of LIN. With one wire, only one node can talk at a time, so LIN keeps strict radio discipline. Picture a race engineer doing a radio check: he calls a name, and only that person answers. On LIN the master starts every single message by sending a header, which contains an ID. The data that follows is called the response. Every slave knows which IDs it has to react to, and a slave never starts talking on its own.
That gives three situations. The master asks and a slave answers: “ID 33?” and the battery sensor replies with the battery voltage. The master gives an order: it sends the header for ID 12 and fills in the response itself, telling the wiper motor to run at speed 2. And because everything travels over the same wire, every other node can listen in. The alternator can read the battery voltage without anyone sending it twice.
Put an oscilloscope on a LIN wire and every message shows the same pattern. The header has three parts. First comes the Break: the master pulls the wire low for an unusually long time, which no normal data can do. It is the “attention, new message” signal. Then comes the Sync: a neat pattern of alternating highs and lows. The slaves measure it and set their own clock to the speed of the master, which is why they can get away with a cheap, inaccurate clock. Last comes the ID, the number of the message, with two extra check bits to make sure it was read correctly.
The response holds 1 to 8 bytes of data (a byte is a unit of 8 bits; a bit is a single 0 or 1), followed by a checksum: a control number calculated from the data. The receiver does the same sum, and if the two numbers do not match, the message is thrown away. In the picture the battery sensor answers ID 33 with two bytes that together read 12600. Multiply that by a factor of 0.001 and you have 12.6 Volts. LIN has 64 IDs in total: 0 to 59 for normal signals, 60 and 61 for diagnostics, and 62 and 63 kept in reserve.
The master does not send headers at random. It works through a fixed list called the schedule: ID 12, then ID 33, then ID 47 and so on, each in its own time slot. At the end of the list it starts again. This makes LIN completely predictable. You know to the millisecond when each signal is refreshed, and two messages can never collide.
The price is speed. At 19.2 kbit/s a full message of 8 bytes takes about 6.5 ms, and with the spare time the standard asks for, a slot of 10 ms is typical. Five messages in the schedule means one lap takes 50 ms, so every signal is refreshed 20 times per second. That is plenty for a wiper, a battery voltage or an alternator. It is far too slow for engine speed or a gear shift, and that is why those stay on CAN.
LIN was designed for cars that sit parked for weeks, so it knows how to save power. The master can send a “go to sleep” message, and slaves also doze off by themselves when the wire has been silent for a few seconds. Waking up is the one moment a slave is allowed to take the initiative: any node can pull the wire low for a moment, which tells the master to start the schedule again. Good to know if a LIN device seems to drain your battery, or stays dead after the car has been switched off for a while.
How does anyone know that ID 33 is the battery voltage, that it lives in the first two bytes and that the factor is 0.001? All of that is written down in one file: the LDF (LIN Description File). It lists every node, every ID, every signal and the complete schedule. If you buy a LIN device and want to control it yourself, the LDF, or the same information in a datasheet, is the first thing to ask the supplier for. Without it you are guessing.
| LIN | CAN | |
|---|---|---|
| Wiring | 1 wire, plus ground | Twisted pair with termination |
| Speed | Up to 20 kbit/s | Up to 1 Mbit/s |
| Who may talk | Only when the master asks | Any node, the lowest ID goes first |
| Damaged message | Lost until the next lap | Sent again automatically |
| Cost per node | Low | Higher |
| Typical jobs | Wipers, alternator, battery sensor, switches | Engine, gearbox, dash, ABS |
LIN is forgiving, but it has a few house rules. One master, never two: two masters with two schedules will talk straight through each other. Stay within 16 nodes and 40 meters of wire. A single wire has no twist to protect it, so keep it away from noisy neighbours such as ignition and injector wiring, and give every node a solid ground.
Every node must also run at the same speed and agree on the LIN version. The way the checksum is calculated changed between LIN 1.x and LIN 2.x, so if you mix the two, a perfectly wired node will simply look dead. And remember that LIN does not repeat a damaged message. Never use it for anything that cannot afford to miss a beat.
We have kept this guide deliberately simple and skipped a few special cases that you will only meet deep inside the standard. The fundamentals are what matter: one wire, one master, one schedule.
At KMP Automotive we work with both networks every day, from deciding which signal belongs on CAN and which on LIN, to getting a LIN device talking to the rest of your car. If you would like to discuss a project, our engineering team is ready to help.
Contact our sales team