Autonomous RC Car

(Last update on: 09/25/2018)

1. Hardware Components

Since the RC car is built for the purpose of study and research, it is convenient to leave some flexibility for possible extensions when choosing components. I also try to reuse parts I bought for my quadrotors, due to my limited budget. The goal is to set up the platform as fast as possible so that I could start developing software early. I try my best to make a good balance between cost and performance. But the project just hasn’t reached the point for hardware optimization yet.

a. RC Car Chassis and Basic Electronics

Main parts for my car:

Note: 1. Some servos may expect control signals other than PWM, for example SBUS. For simplicity, only PWM servos is planned to be supported by the firmware.
  1. I use FrSky Taranis radio because I own one for my quadrotors. It is used for manual control of the car and emergency brake during autonomous driving. You need at least 2 channels to control a car(steering and throttle). But more than 2 may be used in the firmware for arm/disarm, mode switch etc.
  2. You can optionally upgrade some parts of the chassis. Especially the upgrade of aluminum front C-Hub carriers is highly recommended.

b. Power System

Note: 1. Most FPV quadrotors use 3S, 4S LiPo batteries but for RC cars 2S batteries (with a lot more mAh) are more common.
  1. RC Car batteries mostly come with Deans T plug, while it’s more common to see XT60 connectors on LiPo batteries for multicopters. I add an XT60 adapter on the car because I want to keep the compatibility across all my toys, batteries and the charger for easy maintenance.
  2. A power distribution board (PDB) is used because I need to distribute power from the battery to ESC (which powers motor and servo), microcontroller, single board computer and sensors.
  3. This PDB could support 20A continous current and 30A peak current from each channel. To avoid overheating and board damage, you should use the output pads closest to the input pads for the ESC connection and make solid/complete contact points when soldering.
  4. The PDB could be a bottle neck for the power system, but I didn’t know any better choices designed specifically for RC cars. A custom-designed PDB could be considered in the future. But this off-the-shelf choice works without any problem so far.
  5. The embedded 5V BEC on the PDB is used to power the MCU. A 5V UBEC supporting 6A continuous current is used to power raspberry pi or UP board. An extra 4S battery and 12V BEC may be added if a more powerful single-board computer is used in the future.
  6. The 12V BEC on the PDB should not be used because it would require a 4s battery as input. It will not work properly with a 2S battery (7.4V).
  7. If using multiple battery design (2S + 4S), it might be a good idea to power the MCU and servo/motor from the same power source. By doing so you could still maintain manual control if the battery for SBC and sensors dies first.

d. Control System

Note: 1. Pixracer is a flight controller board for multicopters. I choose it because it is compact while having a rich set of sensors (2 sets of IMU) and hardware interfaces.
  1. Available interfaces on pixracer: serial, I2C, SPI, CAN, 6 channels of PWM output (2 of which can be used for servo/motor control and the rest can be used for input pulse capture).
  2. Raspberry Pi 3 and UP board are used for experiments now. The final choice of single board computer is to be determined.

e. Additional Sensors

  • Intel Realsense D435
  • TBD

2. Assembly Notes

a. Tamiya TA07 Pro Chassis

It is quite straightforward to follow the assembly instructions of the chassis.

Additional information from the Internet:

Note: 1. Don’t forget to buy instant glue, which is required but not included in the package. Other than that you get everything you need to put this chassis together.
  1. A PPM receiver was chosen for its small size. But it’s convenient if you have a receiver that outputs PWM signal. You can test the servo and DC motor conveniently simply with your trasmitter, without an microcontroller or doing any coding.
../../../_images/chassis.jpg

b. Motor and Servo Installation

Follow the instructions.

Note: 1. Don’t tighten servo related parts before you finish adjusting the neutral position of servo. You could adjust the control signal for a neutral position but you probably don’t want to get off the mechanical neutral position too much during installation.

../../../_images/chassis_motor.jpg

c. Wheels and Tires

Note: 1. Make sure you don’t skip using glue on the tires to attach them to the wheels. They’re going to get off during the high-speed driving if you don’t.

../../../_images/wheels_on.jpg

d. Lower Mounting Plate

A mounting plate is very useful for attaching all parts to the chassis nicely. The current design tries to keep the lower plate as close to the chassis as possible but leave enough clearance to moving parts.

Note: 1. Currently the ESC and PDB are connected using a pair of XT60 connectors. In the future this connection point could be removed and the wires from the ESC could be soldered to the PDB directly.
  1. The receiver is attached to the plate from the bottom but the antenna are left above.
  2. The receiver wires and ESC/servo signal wires go below the plate and the connectors could reach the MCU through reserved holes on the plate.
  3. Make sure the wires don’t interfere with the belt/gears below the plate. If organized properly, they shouldn’t move underneath the deck.
  4. See the soldering joints I made in the following picture. The input wires from the battery are almost directly connected to the wires to the ESC. Remember to use a wider soldering tip. A very fine tip will not work.
../../../_images/pdb.jpg

And what the car looks like after installing the mounting plate.

../../../_images/with_deck.jpg

e. More Electronics

In the following image, an Udoo Neo Full, a Pixracer and a racing version of Revolution flight controller are installed. Other boards include the voltage regulation modules and CAN bus tranceiver modules. The final combination will be decided later.

../../../_images/udoo_neo.jpg

3. Software Architecture

a. Firmware

A microcontroller is used to ensure the reliability of the low-level control. It’s desirable that you could still control your RC car with the remote controller even in the extreme situations when the single-board computer running Linux shuts down or your high-level control algorithms go crazy. It’s a lot easier to make a reliable microcontroller system with only low-level functionalities.

I did some experiments to evaluate how I could reuse opensource flight control code so that I don’t have to implement functions like motor control, PWM receiver decoding, IMU data collection etc. for a microcontroller by myself. At first I tried to port dRonin firmware stack to Pixracer, but I counldn’t make it work as reliably as how a stock version would do on a quadrotor. (This process helped me to get a lot more familar with the openpilot flight stack though.) Then I tried to setup Pixracer with PX4 and it didn’t take a lot of efforts to realize basic remote control. But I don’t really like the complexity of PX4 and I feel it would be a pain for the maintenance when I want to do more and more customizations in the long run. Additionally I had to add an additional board for CAN bus and hall sensor output processing to avoid getting significantly involved in the PX4 firmware implementation details. The two-board setup works but I don’t like it either. It requires me to put two MCU boards, which does not only increases hardware and firmware complexity but also decreases system reliability. The best choice seems to be using the Pixracer with custom firmware and only reuse code at module level, compared to adopting the whole system architecture.

The following hardware-related functions need to be implemented:

  • PWM output * 2: one for servo, one for DC motor
  • Input capture: 3-channel hall sensor output, could use the hall sensor interface of STM32
  • PPM/SBUS decoding: remote control signal
  • CAN bus/serial: communication with SBC
  • (IMU data collection)

Additionally a control logic needs to be implemented to coordinate all tasks.