Jetson RACECAR Part 2 – RACECAR Steering Control

In the first article on the Jetson RACECAR project we described several tasks that need to be completed. The first task on the list that we’ve chosen to work on is building the Jetson RACECAR steering control. Looky here:


In previous articles such as this one, we discussed connecting a servo to a Jetson Development Kit with a PCA9685 Servo Driver. As you might recall, there is an associated repository on Github called JHPWMDriver. This code can be used on both the NVIDIA Jetson TX1 and Jetson TK1 Development Kits. The overall approach is to unplug the steering servo in the Traxxas RALLY from the receiver and plug it into a PCA9685 breakout board which in turn is connected to a Jetson via I2C.

There were two unknowns at the start. First, is the plug on the servo the same as the servo headers supported on the PCA9685? The second unknown is the voltage needed by the steering servo to operate. After removing the steering servo plug from the Traxxas RALLY receiver, it was measured and appeared to have the same IDC type of spacing (2.54mm) as other servos that we have used.

After charging the Traxxas battery, the transmitter was turned on, the battery connected to the car, the ESC powered on, and the voltage was measured as 6 volts on the steering servo header.

Knowing that the PCA9685 breakout board could physically support the servo pins and that through an optional connector the board could supply 6 volts to the servo from an external power supply, it was time to get started. It might just work!


We have covered using I2C with the Jetson TX1 in an earlier article. In this demonstration, we used a Jetson TX1 with the same I2C pins wired as in the previous article; the Jetson TX1 J21 pins 27 (SDA) and 28 (SCL). These are I2C_GP1_DAT and I2C_GP1_CLK respectively, on I2C bus 1. The PCA9685 is wired from these signals, using the 3.3V supply from J21 Pin 1, and GND from J21 Pin 6. Note:The Jetson TK1 can also be used for this application, of course the wiring is a little different. See this article for more details.

The wiring is straightforward with 4 wires. The 3.3V from the Jetson goes to VCC on the PCA9685, GND from the Jetson goes to GND on the PCA9685. SDA from the Jetson goes to SDA on the PCA9685, the same with SCL.

Jetson Traxxas Steering Interface via PCA9685
Jetson Traxxas Steering Interface via PCA9685
Jetson RACECAR Steering

Tools and Supplies

Software Setup and Installation

Once the board is wired up, power up the Jetson.
In order to be able inspect the PCA9685, you may find it useful to install the i2c tools:

$ sudo apt-get install libi2c-dev i2c-tools

After installation, in a Terminal execute:

$ sudo i2cdetect -y -r 1

You should see an entry of 0x40, which is the default address of the PCA9685. If you have soldered the address pins on the PCA9685 (as is the case if you are using multiple boards chained together) you should see the appropriate address.

JHPWMDriver Install

There is a PCA9685 driver available in the JHPWMDriver repository on the JetsonHacks Github account. To install:

$ git clone
$ cd JHPWMDriver
$ cd example

The example is specifically some other servos, but can be used as a guide. In the source file ‘servoExample.cpp’, uncomment the lines:

// int servoMin = 120 ;
// int servoMax = 720 ;

We’ll have to figure out what good values are for this as we start working on the steering code.
Save the file, and make the example:

$ make

To run the example:

$ sudo ./servoExample

The ‘sudo’ is required to gain permission for the I2C bus from user space.
At this point, all sorts of magic happens! Well, to manage expectations, the front wheels should turn from left stop to right stop. You’ll probably hear that the servo value min and max are off from the sound of a little servo whine at the steering stops.


Now that the Jetson can control the steering servo, with a little work we should be able to calculate the correct control settings. There’s some software to be written to control the steering servo from ROS as part of an Ackerman steering robot. Still, it’s nice to have cleared the first hurdle.

Skip to toolbar