Implementing a Low Speed, Low Cost
Communications Protocol
by Fred Eady
(that you’ve probably never heard of)
The LIN (Local Interconnect Network) framework was originally conceived for the
automobile industry. LIN nodes are typically small standardized electronic modules
that enable low cost networks for low end automotive functions. In today’s automobile,
major automobile computing nodes are usually interconnected using high bandwidth
CAN (Controller Area Network) technology. LIN nodes command less bandwidth than CAN
nodes and are normally found in smaller satellite networks that oversee the automobile’s
door locks, windows, lighting, and air handling. If you really get down to it, a modern
automobile is made up of a number of networked embedded computing nodes that are
tasked to support the automobile’s mechanical parts and electrical functions. Thus, a car
is no more than a sophisticated, computerized four-wheeled cargo robot.
LIN is a relatively young network topology. It is a
standardized protocol based on hardware and
firmware normally used for RS-232 communications.
Initially released in 1999, the latest spec is revision 2.0 and
dated September 23, 2003. As LIN became more of a
complicated liability for American automakers, North
American automakers dived into the LIN mix. A task force
was assembled and published the SAE (Society of
Automotive Engineers) J2602 Recommended Practice for
LIN Networks document, which is aimed at the ambiguities
of the LIN 2.0 specification. As of late 2008, a LIN 2.1 test
specification is in the works. If LIN can be applied to the
control of automobile mechatronics, it stands to reason that
we can adapt LIN to our robotic needs, as well. Let’s begin
our smells-more-like-a-robot-than-a-car LIN discussion by
PHOTO 1. The LIN node electronics are mounted on an
inexpensive two-layer ExpressPCB printed circuit board.
All of the components are readily available from Mouser or
Digi-Key. There’s plenty of breadboard area for mounting relays,
LEDs, an LCD, or motor drivers.
36 SERVO 06.2009
designing and building a pair of regulation LIN nodes.
Scratching Out A Robotic LIN Node
From the looks of Photo 1, we’ve got some assembly
work to do. The actual LIN circuitry takes up about half of
the printed circuit board’s component area. The rest of the
component area is populated by a textbook PIC18F2620
microcontroller implementation. I’ve reserved plenty of
breadboard area for additional monitor and control
electronics as the automotive and robotic purpose of a LIN
node is to perform or control a mechatronic task.
The Microchip LIN transceiver doesn’t need much support from the PIC18F2620. So, most of the PIC’s I/O pins
are available at the I/O header. If you need to commandeer
some of the I/O pins that are already spoken for, you can
free up RC0 and RB2 by removing resistors R9 and R8,
respectively. By activating the PIC’s internal oscillator, you
can also recover I/O pins RA6 and RA7 while eliminating
crystal Y1 and supporting capacitors C8 and C9. The LIN
founders intended for the slave nodes to be hosted by
devices that require very little support circuitry, such as
crystals and voltage regulators. So, you may want to keep
the crystal and its supporting capacitors in your master
node and trim the slave nodes down to the bare essentials.
There are two things that turn our PIC18F2620 circuit
into a LIN node: the firmware driver and a Microchip
MCP2021 LIN transceiver. Since we’re in the hardware build
mode, let’s talk about the MCP2021.
Microchip’s MCP2021
LIN nodes operate on a bidirectional, half-duplex communications link. The term half-duplex tells us that network nodes