Tek Eye Logo

Tek Eye

CAN Bus Wiring Diagram, a Basics Tutorial

The CAN bus is a common digital network used in automotive, industrial, medical and scientific systems for routing sensor data between pieces of equipment. The main advantages are high resilience to noise, reliability, low cost, simple wiring and ease of use. The disadvantages are that the data packet lengths are small, transmission rates are low and the message transmission cycle time can vary.

CAN Network

This article covers the basics of CAN bus wiring, showing a simple CAN bus wiring diagram and how to wire up a CAN bus cable. It covers wiring for the common DB9 plug and socket often used with CAN bus test equipment. The DB9 is also known as 9-pin D-sub, DE-9 (its correct name), DB-9, serial connector, RS232 connector or null modem connector. The CAN bus is used in nearly every form of motorized road transport (even some motorcycles and scooters). On a car it is usually available via the On-Board Diagnostics (OBD) port. Therefore OBD CAN bus wiring is covered. To jump straight to the wiring section then scroll down. Otherwise read the CAN bus background information coming next.

What is the CAN bus?

What is CAN? CAN stands for Controller Area Network. CAN was designed in the 1980s because of limitations of existing serial buses for use in cars. Here is a summary of CAN history taken from the article History of CAN technology:

  • In 1983 the Robert Bosch GmbH company starts development on a new serial bus for vehicles as they had failed to find a suitable serial bus for use in vehicles. A serial bus was required to support new electronic functionality.
  • The Automotive Serial Controller Area Network (CAN) was announced in 1986.
  • Intel delivers the first CAN integrated circuits in 1987.
  • The popularity of CAN saw the original 11 bit message identifier extended to 29 bits in 1991. This new extended CAN works on the same network as standard CAN. The 1991 Bosch CAN Specification 2.0 has a part A for standard messages and a part B for extended messages, hence references to the CAN 2.0B specification in some publications.
  • The increase in data transmission volumes in vehicles (including the time taken when flashing new firmware to vehicles) saw CAN bus utilization design issues. The introduction of CAN with Flexible Data Rate, or simply CAN FD, in 2012 was done to increase data throughput. To do this the data packet size was increased from a maximum of eight bytes to a maximum of 64 bytes. In CAN FD the bit transmission rate is increased during the data byte transmission portion of the packet, hence the name Flexible Data Rate.

CAN Bus Specifications

There is plenty of information available on the CAN bus because it has been around for a while. The International Standardization Organisation (ISO) maintains specifications for CAN in road vehicles in a series of ISO 11898 publications. However, because a fee is required to access the ISO 11898 standards the Bosch original specifications are widely referenced. Listed on the Bosch CAN Literature page is the CAN Specification.

Bosch used to provide a link to their orginal CAN FD specification, however, that link appears to have disappeared. Until it reappears use the ISO 11898 documents, alternatively the orginal Bosch CAN FD Specification is temporarily hosted here. Texas Instruments has a good Introduction to the Controller Area Network. There is the Wikipedia article on the CAN bus. Microchip has an application note AN228, A CAN Physical Discussion providing useful information on CAN signals. Finally CAN in Automation (CiA) produces the CiA 303-1 specification for connector cabling which defines the widely used DB9 (9-pin D-Sub) CAN bus cable connector and the required pinouts.

The CiA specification also provides some information on suitable cabling, which is not covered in most CAN documents. Therefore, it provides a general guideline to CAN bus cable specifications, including CAN bus cable length information. For basic bench testing a single twisted pair 22 AWG cable is suitable (often used for sensor, signal, data or computer signals). These cables are widely available from electronics, electrical and cable suppliers. Cabling for production systems will require designing by an engineer with relevant experience and knowledge.

Those wanting a less technical introduction to CAN may want to look at the CSS Electronics article and video CAN Bus Explained - A Simple Intro.

CAN Bus Protocol

From a software viewpoint the CAN data is straightforward. The physical CAN interfaces and transceiver hardware automatically handle the CAN transmission and receiving protocols at the bit level. This leaves the higher level software just handling the message identifier, data length and data bytes. These are often exposed to programs via the Application Programming Interface (API) of a CAN device plugged into the USB port of a computer. Alternatively a terminal program or custom software reads CAN data from a serial port using a CAN interface device, including Bluetooth and WiFi based CAN interfaces. The CAN message packet consists of:

  • Identifier 0-2047 (11-bit) standard or 0-229-1 (29-bit) extended
  • Data Length Code (DLC) 0 to 8 for the number of data bytes present, or for CAN FD the value 8=8 bytes, 9=12 bytes, 10=16 bytes, 11=20, 12=24, 13=32, 14=48, and 15=64 bytes
  • The data bytes from 0 to 8, or for CAN FD from 0 to 64 (using lengths defined by DLC)

CAN Bus Wiring Diagram

Most equipment to interface to CAN comes with a 9-pin D-sub plug (the male 9-pin D-sub connector with the pins). Having a plug on the CAN device is opposite to RS232 serial interfaces which often comes with a socket on the equipment. Here is a close up of some equipment with CAN interfaces provided using 9-pin D-sub plugs:

DB9 Plugs

Here is another CAN interface device called PCAN-USB FD. This CAN to USB device is provided by PEAK-System Technik GmbH and supports standard CAN, extended CAN and CAN FD and uses a DB9 plug:

PEAK Systems CAN to USB

The 9-pin D-sub CAN bus cable pinout is defined by CANopn in the CiA 303-1 specification, shown in this table.

CAN Bus 9-pin D-Sub (DB9) Pinout Table

Pin Description
1 Reserved
2 CAN_L bus line dominant low (a.k.a. CAN low or CAN-)
3 Optional CAN ground
4 Reserved
5 Optional CAN shield
6 Optional ground
7 CAN_H bus line dominant high (a.k.a. CAN high or CAN+)
8 Reserved
9 CAN_V+, optional CAN external positive supply

For basic CAN networking this simplifies to:

Pin Description
2 CAN_L bus line dominant low (a.k.a. CAN low or CAN-)
7 CAN_H bus line dominant high (a.k.a. CAN high or CAN+)

Therefore, for devices following the CANopen specification, the basic CAN bus cable is a length of single twisted pair cable with DB9 sockets (the female 9-pin D-sub connectors with the holes):

CAN Device to Device Cable

The simplest wiring is for pins 2 and 7 on the DB9 connectors to connect straight through. Remember that the pinout numbering changes when viewing the connector from the front, or from the rear. The rear view will be used when constructing cables, and the front view when probing for signals:

CAN Bus Cable Wiring

For a more resilient network the CAN ground signals can be connected. When CAN ground is used and one of the CAN high or CAN low wires is damaged the network can still function. See the specifications for use of CAN ground lines.

CAN Bus Wiring Termination

The diagram at the start of the article was derived from the Wikipedia CAN bus page. It shows a CAN bus schematic. At each end of the bus is a resistor. The CAN bus needs to have a termination resistor at each end. The termination resistor has a value of around 120 ohms. The resistor absorbs the CAN signal energy so that it is not reflected from the end of the cables back along the network to cause interference. When using DB9 plug and socket cabling it is possible to source a DB9 adapter with a 120 ohm resistor built in:

CAN Termination

This 120 ohM CAN termination device plugs into the last device on the CAN network, the CAN DB9 cable then plugs into the DB9 terminator.

Many devices will have built in support for CAN termination. Though this may mean that the device has to be opened to enable the internal CAN termination. The CAN termination within devices may be supported by a jumper link, a switch, solder pads or configured via software (see the manufacturers instructions).

When constructing cables the 120 ohm termination resistors may be soldered to back of the DB9 connectors. This diagram illustrates the idea:

CAN Bus Cable Wiring

Here is an example of a 120 ohm termination resistor soldered onto the DB9 connector with the CAN wiring, located in the DB9 shell housing.

CAN Bus Cable Termination

When bench testing short networks only one termination resistor may be sufficient. However, for best performance the CAN bus should be terminated at both ends, especially for the higher bit rates.

The 120 ohm termination can be improved for further noise immunity, see the technical specifications for split termination information (using two 60 ohm resistors and a coupling capacitor connected between them and to ground, e.g. 4.7nF for 1 Mbps).

Networking Multiple Devices

Refer to the specifications for the limits on cable lengths for stub connections to the CAN bus. The CAN bus is a masterless multidrop network, therefore all CAN nodes simply attach to the CAN high and CAN low wires:

CAN Network Wiring

For bench testing this can be done using custom made cables, daisy chaining DB9 straight-through splitter cables, or using ribbon cables fitted with 9-pin D-Sub Insulation Displacement Connectors (IDC).

If the wrong plug or socket is on the end of a cable a DB9 gender changer can be used to convert it to the correct connection. They are available to convert plugs (males) to sockets (females), and sockets to plugs. They are useful for connecting two CAN devices together for performing a loop test (sending a message out of the computer on one device and receiving it back on another device):

DB9 Gender Changer

Automotive CAN Bus Cable

The CAN bus is common in cars. How do I know if my car has CAN-bus? The CAN bus is present in nearly all vehicles being made because of the requirement for authorities to access engine emissions (exhaust pollution) data from the engine managment systems. The emissions data is read via the CAN bus. This requirement came into force in America from the late 1990's, in Europe and Japan from the early 2000's, and Australia from late 2000's. Cars are made for a global market, therefore all vehicles tend to have a CAN bus. The CAN bus is accessed via the OBD port:

OBD Port

ODB Pin Usage

Pin Description
1 Manufacturer defined, e.g. VW/Audi/BMW ign. on, low speed GMLAN
2 SAE J1850 PWM Bus+
3 Manufacturer defined, e.g. Ford medium speed CAN- (low), Chrysler CCD bus+
4 Chassis Ground
5 Signal Ground
6 CAN+ (high), ISO 15765-4, SAE J2284
7 K-Line (ISO 9141-2, ISO 14230-4)
8 Manufacturer defined, e.g. BMW second K-Line
9 Manufacturer defined, e.g. BMW engine RPM
10 SAE J1850 PWM Bus-
11 Manufacturer defined, e.g. Ford medium speed CAN+ (high), Chrysler CCD bus-
12 Manufacturer defined
13 Manufacturer defined, e.g Ford PCM programming
14 CAN- (low), ISO 15765-4, SAE J2284
15 L-Line (ISO 9141-2, ISO 14230-4)
16 Vehicle Battery +ve (live 12v or 24v)

CAN Wiring ODB to DB9

For wiring the OBD port to a CAN DB9 device a cable can be purchased or made. To make a cable an OBD plug (male) and a 9-pin D-sub socket (female) is required. When purchasing the OBD to CAN cable ensure that that DB9 socket matches the plug for the CAN device. Some OBD to DB9 cables do not conform to the CANopen standard (i.e. pins 2 and 7 on the DB9 connector). Also be aware that the OBD socket on the vehicle exposes the cars 12 volt electrical system. This means the power pins on the OBD socket could have a voltage range from 10 volts to 18 volts (higher on trucks) and supply a high current. Therefore, precautions against electrical shock must be taken.

Custom OBD to DB9 cable

OBD to DB9 CAN Wiring

CAN Bus Arduino Interfaces

To build a sensor network, interface to a CAN bus, or view the CAN signals from vehicles there are lots of projects available on the Internet. Many microcontrollers have support for the CAN protocol. They are interfaced to CAN using a CAN transceiver chip. Many popular Single Board Computers (SBC) such as Arduino, Raspberry Pi and Texas Instruments Launchpad can interface to CAN via add-ons. Arduino CAN interfaces are popular. There is the SparkFun CAN-BUS Shield and compatibles. The Seeed Studio CAN-BUS Sheild is another option. For a single board Arduino solution look at the Leonardo CAN BUS board.

Note: Some add-on boards with a DB9 plug need correct configuring for CANopen compatibility (pins 2 and 7 on the DB9 socket).

CAN Bus Testing Equipment

Whilst Arduino interfaces provide a reliable method of connecting to and building a CAN bus sometimes professionally supported equipment is required. Especially if no CAN data packets should be dropped when debugging a system. Leading manufactures of CAN test equipment include:

See Also

  • What is an ECU?
  • For a full list of all the articles in Tek Eye see the full site alphabetical Index.

Author:  Published:  Updated:  

ShareSubmit to TwitterSubmit to FacebookSubmit to Google+Submit to LinkedInSubmit to redditPrint Page

markdown CMS Small Logo Icon ↓markdown↓ CMS is fast and simple. Build websites quickly and publish easily. For beginner to expert.

Articles on:

Android, HTML, VPS, Computing, IT, Computer History, ↓markdown↓ CMS

Free Android Projects and Samples:

Android Examples, Android List Examples, Android UI Examples