Build an autonomous car with RPi, NAVIO2 and Tensorflow/Keras, part I: The hardware (parts list)

As explained in my last post some time ago, I recently gained interest in the area of autonomous cars, so I decided to write a series of posts on building a small autonomous car using an RC car chassis, in the hope that they may be helpful for anyone going down this path. This post is the first of the series.



Update: A short version of this post (including a video of the car) has been included in the EMLID Blog. Check it out!

Also a bit longer writeup is available at the EMLID Community Forums.

While the term “autonomous” may bring to mind images of vehicles rigged up with dozens of sensors, rangefinders, complicated control loops and telemetry systems, the premise in the case of this project actually much simpler than that. The goal is to build an autonomous car that can drive around a marked track1 using monocular vision, i.e. a stream of images from a single camera. This definition sets lower expectations than full autonomy2. It is still very exciting and rewarding though once you see the little cars moving about by themselves. Vision-based approaches are naturally software intensive. On the hardware side just a plain camera is usually enough, while at the software side complex algorithms are used to process the image and make driving decisions.

Nevertheless, a good hardware foundation is in order, so this first post will be about hardware, not software. I will share my experience in building a simple, compact autonomous car that is suitable as a research platform in autonomous driving. For my build I’ve used mostly off the shelf parts, and where custom parts were required, I tried to keep processing to the bare essentials. I’ve also placed a list of parts I bought at the end of the post, so for those of you that can’t wait:

To the parts list!

The rest, follow along!

The autonomous car chassis

Let me put it simple: Anything that has three or more wheels, and can move fore, back and steer. You can get a $10 robot chassis, or a $500 RC car, and, at this point in time there will be little difference. This is because as of the time of writing the state of the art in DIY autopilots runs at speeds of approximately a few meters/sec. IF however you’d like to invest in the future where hopefully those speeds will increase, you could get a good quality RC car to handle those corners and bumps.

In my case, I went somewhere in between and bought a 1/16 RC car from Hobbyking, the Turnigy Mini Trooper. You may see the finalized chassis, after modifications, below3.

Hobbyking Mini-Trooper conversion to autonomous car: installed ESC, RC receiver, electronics upper plate, NAVIO2, WiFi adapter and camera with camera rig
Hobbyking Mini-Trooper conversion to autonomous car: installed ESC, RC receiver, electronics upper plate, NAVIO2, WiFi adapter and camera with camera rig
Another view of the finished autonomous car chassis
Another view of the finished autonomous car chassis

The mini trooper is a nice little chassis that has four-wheel drive and independent suspensions with oil-filled shocks. The latter is important if you plan on encountering rough terrain, and overall will help in keeping the camera picture free of vibrations as well4. The suspensions are adjustable, which will come in handy in adjusting your ride height after you’ve added the RPi and other equipment.

The ESC

I went ahead and replaced the stock brushless ESC with a Hobbyking 30A car ESC, because I’ve read that the stock ESC is crap, and can only drive the brushless motor at high speeds and in discrete speed steps. This might be ok for folks bashing the **** out of their cars, but for autonomy it is unacceptable. The new ESC has the added benefit that it includes a 2A max linear BEC. While this is barely enough to run the whole bunch of RPi+NAVIO2+Wifi+Servo (which I’m currently doing), it may help as a power source for the steering servo.

The Upper Deck

I’ve installed a wooden upper deck to house various electronics. This seems to be a common solution among RC autonomous car folks. The main aim of the upper deck is to provide a secure attachment for most electronics, namely the RPi+NAVIO2, Wifi card, and the camera together with the camera “rig”, which is just a fancy name for a raised vertical plate i glued together to fix the camera onto.

I bought some chipboard of around 3mm (anything would be ok really) and cut out a couple rectangular pieces. The biggest one I measured to be a bit longer than the distance between the RC car body posts (holding the original plastic body), and around 10cm wide. I cut the rest to a bit arbitrary dimensions and glued them together with white wood glue for a clean, strong bond. Turned out quite stiff indeed.

To mark the spots for drilling the plate post holes I just spread two dabs of regular board marker on the tip of the posts, and pressed the plate on top of them, being careful to hold it parallel to the car. This left four spots on the plate, which I then easily drilled out. The plate was a good fit on the first try. I secured the plate with the included pins5. I did the same trick adding some paint on the screws under the RPi board, to get the positions needed to screw the RPi board on the wooden plate. Later on I drilled a bunch other holes for cable pass-throughs and cable ties.

Electronics

The battery is connected straight to the ESC using an XT60 connector, which I soldered to the ESC cables6. One thing that I enjoyed a lot as a RC car first timer is the presence of a physical switch on the ESC. The switch allows to turn on and off the whole system with a single flick. No such thing on a multi-rotor for sure, as it would be just extra weight. The NAVIO2 board (and Raspberry) is powered by the ESC BEC through connection to the servo rail. The steering servo of the vehicle is powered and gets its signal from the servo rail too. Finally, the RC receiver gets it’s power, as well as the Sbus communication, through the receiver pinout on the NAVIO2.

Front part of the autonomous car chassis, showing connections
Front part of the autonomous car chassis, showing connections

Camera

The Donkey team have been running autonomous cars where the camera is mounted above the electronics platform at an angle. This makes sense as in this way the relatively narrow angle of the RPi camera can capture more of the road ahead. I followed the instructions and mounted the camera facing approximately 15 degrees downwards. I mounted the camera at a total height of around 20 cm (7.87 inches). That’s still a bit lower than the 1/10 vehicles, but I didn’t want to build the camera rig taller. In addition, I’m using a camera lens that increases the viewing angle of the camera. That way I can capture features nearer to the car. The view form the camera looks like below:

View from the autonomous car camera
View from the autonomous car camera

However, if I was to buy a Raspberry camera module now, I’d got for the fish-eye module (Here’s a listing on ebay), and this is what I list below as well.

Autonomous car parts list

Turnigy Mini Trooper 1/16 RC Car
Hobbyking 30A Car ESC 7
Raspberry Pi 3
NAVIO2 HAT
Raspberry Camera, Fish-Eye (here’s a listing on ebay)
TL-W722N WiFi Adapter (here’s a listing on Ebay)
2000mAh Li-Po battery

I’m also listing here an RC Transmitter and Receiver to interface with NAVIO2 and control the autonomous car, although this is optional and the car may as well be controlled via WiFi:

Radiolink AT9S Transmitter with R9D receiver (listing on Ebay)

Conclusion

This post outlined the build process of an autonomous car, focusing on the hardware. Stay tuned for Part II of this post series, where we will dive into setting up the autopilot software for our car.

Have you built an RC autonomous car yourself? Are you planning to? Share your experience in the comments below!

Sign up to Backyard Robotics

Enter your email address to receive updates on exciting new experiments, tutorials and how-to's:

  1. Here we refer to a plainly marked track, i.e. using tape, spraypaint or another visually distinctive means.
  2. also known as L5 autonomy; for a good explanation of levels of autonomy see this article
  3. The car comes with a cover as well, but I really hate those car-looking covers, so I just left it in the box the car came in, and never really plan on using it. If I’ll ever add a cover, for sure it won’t be an immitation of a full scale car with a passenger cabin!
  4. Although it does mean that the car will roll more heavily in tight turns.
  5. Ideally you could add a bit of foam either side of the plate where the posts pass through. This should make the connection more rigid, and help absorb any rough vibrationscoming from the car chassis
  6. This particular ESC comes with bare pre-tinned leads
  7. You’ll also need an XT60 connector, three 3.5mm banana plugs, and soldering equipment for thi ESC, as it comes with bare wires
3 replies on “ Build an autonomous car with RPi, NAVIO2 and Tensorflow/Keras, part I: The hardware (parts list) ”

Leave a Reply