A panda and a cabana: How to get started car hacking with comma.ai

A quick link for those who’d just like to buy a panda, otherwise read on.


When I started on this journey 2 years ago, first trying to hack my ILX to drive itself, getting your car to talk to your computer was hard. I vaguely knew cars had a CAN bus, and I also knew they had an OBDII port. So I purchased a USB to OBDII interface off Amazon.

ELM327 Based USB Interface

When I plugged it in to my MacBook, it showed up as a serial interface. And it used AT commands. I found some Python code to speak this protocol, and I thought I could now talk to the car.

When the code worked (which was about 50% of the time!), the information it gave me was very limited, mostly just about the engine. Surely there had to be more…

So I dove deeper, and looked into what’s actually on the OBDII port. Sure enough, there is a CAN bus! Many of the USB to CAN transceivers were thousands of dollars, but I found a moderately priced one that gave me full access. We were in business, and I could read all the CAN messages on the bus.

At first, it was just random noise. But after a few weeks of reverse engineering, it started to make sense. I found the message broadcasting the speed. Then I found the message broadcasting the steering angle. Then, I found the message that would actually let me turn the steering wheel via software!

A few weeks later, I had a very basic self driving car. And the rest is history.


panda: the nicest universal car interface ever

In order to get the reliability and throughput we needed to make cars self driving, we started building our own interface hardware.

When we gave away the plans for our first self driving hardware, we included a custom car interface board. It interfaced two CANs with USB. But some cars needed more. So we built panda.

Panda OBDII pinouts

panda is the nicest universal car interface ever.

It supports 3 CAN, 2 LIN, and 1 GMLAN. It also charges a phone. On the computer side, it has both USB and Wi-Fi.

The software is 100% open. And it plugs into the OBDII port on every car made in 1996 or later.

Software Compatibility

chffr: chffr is our cloud dashcam app. It allows you to record and review your drives, in addition to helping to train self driving cars. Now if you have a panda paired with chffr, you can record all the sensors from your car. From any part of your drive, assuming your car has the sensors, you’ll be able to see how many RPM your engine was going, how much gas was in your tank, your MPG, if you had a door open, how hard you hit the brake, and much much more.

chffr when in use

pandacan: pandacan is a user space library for talking to your car over USB or Wi-Fi from Python. It allows full read/write access to all the CAN and LIN buses. “pip install pandacan”

SocketCAN: SocketCAN is the Linux standard for CAN interfaces. The included driver allows panda to work with all SocketCAN tools, including can-utils and Wireshark.

openpilot: openpilot, our open source driving agent, can use panda to communicate with your car and control the gas, brake, and steering on supported vehicles.

Support for J2534 on Windows and ELM327 emulation coming shortly. This will enable it to work with most manufacturer diagnostics tools and apps like Torque.

And one more piece of software is supported…

cabana: comma.ai CAN analysis tool

CAN bus analysis is what allows you to make sense of all the sensors and signals in your car. Aside from CANalyzer, which is a $10,000 proprietary Windows only tool, there is no good software for CAN analysis.

Today, with the launch of comma cabana, this changes. We’ve set our app team loose on building the best CAN analysis tool to ever exist to complement our panda hardware. And I think they’ve succeeded.

On the left, you’ll find all the signals from your car. In the middle, the signal you are currently editing. And on the right, your driving video and graphs of the signals.

cabana is already live to all panda and NEO users, who can access it by clicking the purple checkmark on the driving explorer. Everyone else can try it out on an Acura ILX demo route.

Here is a livestream of me reverse engineering the signals on my Prius using a panda and cabana (skip to near the end for the good stuff). What took weeks before now only takes hours. We’ll also be doing a livestream Friday @ noon PST. Follow us on Twitter @comma_ai for details.

opendbc

Even if you have a high quality CAN interface and great CAN analysis software, it’s still some work to figure out what the messages in your car mean. But it’s work that should only be done once in the world per car.

https://github.com/commaai/opendbc

cabana integrates with our DBC repository, opendbc. DBC is the industry standard “decoder ring” for your car, and cabana makes it easy for you to create, save, and share DBC files with the world. From cabana: you can fork the opendbc repo to your github account, make edits as you discover new things about your car, then submit a pull request to the main repo when you are ready.

Our goal is to build a repository with a DBC file for every car ever manufactured and democratize access to the decoder ring for your car.

Getting a panda

We have given away over 50 panda to developers and people with many comma points. If you are an active member of the comma.ai community (join our slack!), you may find yourself with a free panda.

But for everyone else, for the first time in history, comma.ai is selling a product. You can order a panda for $88 shipped anywhere in the world. Your card will not be charged until your panda is ready to ship, which should be in around 4 weeks for the first to order and up to 12 weeks if you are late.

How to get started

  1. Order a panda!
  2. Download our dashcam app chffr.
  3. On arrival, pair your panda with chffr.
  4. Go for a drive.
  5. Use cabana to explore your car.