Making comma.ai's Openpilot work on Classic Tesla Model S
The following instructions describe how to get comma.ai's Openpilot working on a "Classic" Tesla Model S. The classic Model S does not have autopilot hardware but does have the same steering control system and servo as the autopilot Model S and therefore can be controlled through electrical signaling (specifically one of the car's CAN buses).
These instructions would also work on an autopilot Model S, but the controls for engaging openpilot vs. the car's autopilot could be confused so caution is advised. To get openpilot working on an autopilot Tesla Model S, omit the section on Bypassing the EPAS kill signal.
Please read the instructions in their entirety before starting as the sections aren't necessarily written in chronological order.
EPAS: Electric Power Assisted Steering
CAN bus: Controller Area Network
DISCLAIMER: The author of this document takes no responsiblity for the content of these instructions and anyone following these instructions does so at their own risk and is responsible for complying with any applicable local laws and regulations.
There are basically two steps to interfacing comma.ai's hardware to the car:
Establishing a connection to the car's chassis CAN bus
The car has 5 CAN buses. A connection to only one -- the chassis bus (also known as CAN bus 5)-- is necessary to get openpilot to work. CAN bus 5 will be connected to the "Car CAN" pins of the Neo board (pins 3 and 6 of the RJ45 connector).
The car has a diagnostic connector located behind the "cubby" which is underneath the center console. You will need to build an interface to that diagnostic connector in order to tap in to the chassis CAN. This page has a good explanation of how that is done and what parts are necessary. You will need to have wires going to pins 4, 9, 10 and 11 of the diagnostic connector (+/- power and a connection to the chassis can -- called "CAN 6 chassis" on that page)
The AMP connector that plugs into the diagnostic port can be ordered from Digikey.
Connect the pins as follows:
|Signal name||Pin on diagnostic connector||Pin on Neo RJ45 connector|
|Chassis CAN low||11||3|
|Chassis CAN high||4||6|
Bypassing the EPAS kill signal
The control systems on a classic Model S periodically send a "kill" signal to the EPAS control module which is located on the EPAS servo which is connected directly to the steering rack. This kill signal is only sent on non autopilot cars.
To bypass this kill signal, all communication with the EPAS module needs to be proxied through the Neo board. The Neo firmware will be programmed to proxy all CAN messages to and from the EPAS control module with one exception. It will rewrite the message that disables control of the EPAS servo with one that enables it. This is absolutely necessary and steering control will not work without doing this.
The connector you need to unplug from the EPAS is located as show in the above picture and looks like the following:
The wiring specifications for connector X164 are:
You will unplug connector X164 and plug it into a connector/harness that you'll need to build.
The harness has two functions.
- It maintains the ignition on line from the stock X164 and feeds it into the EPAS so that the EPAS knows when the car is "on".
- It brings the proxied chassis CAN lines from the Neo board to the EPAS.
To make the harness, you will need:
- 1 x AMP connector model 967616-1
- 1 x AMP connector model 967587-3
- 3 x AMP connector pin model 962885-1
- 1 x AMP connector pin model 928918-1
- 3 x AMP connector cavity plug model 967067-1
- 1 x AMP connector cavity plug model 967056-1
- 10ft of shielded 2 or 4-conductor twisted pair wire such as this
Cut a small 10" piece of wire and strip only one of the conductors. Connect pins 6 on the two AMP connectors with that wire.
With the rest of the wire, using one of the twisted pairs, connect one end to pins 2 and 5 of the 967616 connector, leave the other end free for now.
Close up the AMP connectors following the manufacturer's instructions and put some silicone into each of the pin holes that are unused.
The harness you've made will look like this when finished:
You'll need to run the other end of the harness into the cabin to where you've created the connections for the Neo board. The twisted pair you've used to plug into the EPAS will connect to the Neo through the RJ45 as follows:
|Signal name||Pin on EPAS connector||Pin on Neo RJ45 connector|
|EPAS Chassis CAN low||2||8|
|EPAS Chassis CAN high||5||7|
You will need to make a hole in the firewall at the back of the "frunk" once you've removed all of the frunk pieces. This picture shows a hole but it is 1-inch TOO LOW, so make the hole where the red circle is:
When finished, your overall wiring will look like this:
Here's a good reference for the diagnostic connector to make sure you get the rights pins