creating an OpenPilot car port for Hyundai Elantra Hybrid 2021

I got a Comma Two sometime late 2020, during one of their rare sales. Even though I didn’t have a car with LKAS or SCC at the time, knowing that the price of COTS devices that can provide self driving can only go up with time I had to get in on the deal.

It wasn’t up until now, during OpenPilot 0.8.6 development cycle, when I got a supported car. 👌


I heard during one of geohot’s live stream that Hyundai Hybrid cars aren’t quite supported yet, mainly because the gas signal differed a bit from Hyundai’s gas car variants. What that means?–I was going to attempt to find out, but someone already figured it out, saving me quite some time!

A DIY Connector

The only thing left was fingerprinting the car and then driving! And surprisingly, it was really that easy. Except for the connector that I needed to replace the LKAS camera.

The connector was keyed a bit differently from the harness I bought from Comma. However, judging from the connector guide from the OpenPilot wiki, the wiring hasn’t changed, so all I needed to do was shave down some plastic on the harness’s Male plug.

Once I plugged it in, the Comma Two powered on, didn’t recognize the device, and I was ready to go.

Fingerprinting (2.0)

OpenPilot’s codebase really is something else: easy to comprehend and minimal bloat. Their Wiki guide is fairly straight-forward:

  1. drive around in dashcam mode
  2. upload the results
  3. go to useradmin site
  4. extract the firmware, and Copy & Paste it into selfdive/car/<car_make>/
  5. “Rebuild” the codebase on-device and see if the car gets recognized

After some snooping around the car’s upload logs and toggling the Enable Community Features on the device I was good to go!

Adding this small snippet of code into OpenPilot is all it needed to get it to work.

    (Ecu.fwdCamera, 0x7c4, None) : [
      b'\xf1\000CN7HMFC  AT USA LHD 1.00 1.03 99210-AA000 200819'
    (Ecu.fwdRadar, 0x7d0, None) : [
      b'\xf1\000CNhe SCC FHCUP      1.00 1.01 99110-BY000         '
    (Ecu.eps, 0x7d4, None) :[
      b'\xf1\x8756310/BY050\xf1\000CN7 MDPS C 1.00 1.02 56310/BY050 4CNHC102\xf1\xa01.02'
    (Ecu.transmission, 0x7e1, None) :[
    (Ecu.engine, 0x7e0, None) : [


I submited a PR to be upstream for other Elantra Hybrid 2021 owners to try out, and it was quickly merged and acccepted. The people at work fast.

The near out-of-the-box experience is something else–absolutely blows the stock system out of the water. Unfortunately all Hyundais currently use latitudinal-only control (left-right); the logitudinal control said to come soon, so the experience I’m having is only a small part of what OpenPilot is capable of.

Definitely looking forward to using this day-to-day. 😄

comments powered by Disqus