Close
0%
0%

Autonomous model car

A self-driving RC car aiming to race around a track

Similar projects worth following
A self-driving model car using custom electronics, IR and IMU.

Summary

This project is all about creating an autonomous model car that can drive around a track totally on its own. It will be my entry in the Folkrace category at the Stockholm Robot Championship in Sweden in November 2016. The cars are not allowed to be remotely controlled, and all sensors and computing needs to be done onboard. Four cars can compete at the same time on the track, and the goal is to complete as many laps as possible in a set amount of time. This video shows the final race at a previous competition.

The car I'm building consists of an off-the-shelf RC car, which I'm going to totally pull apart and just use the base as my platform. All the electronics will be replaced with my custom circuit board, and all the logic will be programmed into an onboard Teensy. The goal of the project is to enter the car into the competition, and have it perform optimally. As few crashes as possible, with as high a speed as I can get it to go. It will use IR sensors and an IMU to detect where it must drive, and a PID controller for smooth steering.

With the recent popularity of self driving cars, like the Tesla and Google Car, there will be an increased need for engineers interested in these kind of challenges. Joining these type of robotic racing competitions, using fairly cheap hardware and self-written software, will hopefully help recruiting new students to the field, and result in safer and better cars in the future.

For myself, I want to increase my mechanical skills, improve on physics and math, and learn to do laser cutting. On the electronics side I've got a real thing for making things neat and compact. I like to use SMD components, and want to become better at making compact designs and better at soldering SMD components. On the software side I want to improve my Arduino-C skills.

Mechanics

I've bought a Losi 1/24 Rally car, and I'm going to rip out all the electronics, and just keep the wheels, gear, driveshaft and chassis. Most of the other parts will be removed or replaced.

Motor

The motor on the original Losi car is replaced by a brushless motor. The one I'm currenly aiming for has a fairly low KV value, about 4000KV, which means that the car is slower but stronger. It is controlled by an electronic speed control from HobbyKing.

Steering Servo

The original Losi comes with a four-pin steering servo. For easier control from Arduino I've bought a replacement servo, (partno LOSB0814) also from Losi, which has the more familiar three-pin connector. This allows me to control the steering using regular PWM signal.

Encoder on driveshaft

In an attempt to monitor the current speed I'm adding a phototransistor on the driveshaft, and use it to detect how many times pr second the wheels are turning, and from that I get the speed of the car.


Electronics

The electronics in the original car is all removed. Absolutely all of it. Instead I'm adding my own custom PCB, and IR sensors for detecting the walls of the racing track.

The PCB has a Teensy 3.2 at the center. It is the brain of the car. Currenly I'm using a stock Teensy which fits into some female headers, but later I'm considering replacing this by incorporating the Teensy components directly into my PCB.

IR-sensors

The IR sensors used to sense the walls are GP2Y0E02B digital sensors, which use I2C. They can sense objects from 4 to 50 cm away. I've put eight connectors on the PCB for the IR sensors. Since the sensors all share the same I2C addrecss I've also included an TCA9548ARGER, which is an I2C multiplexer. From the Arduino code I tell the mux which sensor I want to talk to, and then query the sensor.

Power

Power to the board comes via an Electronic Speed Control, a XC-10A ESC from HobbyKing. A 7.4V LiPo battery is connected to the ESC, and then it supplies my PCB with regulated 5V. The ESC is capable of 1A, which should be more than enough.

Wireless communication for debugging

During the competition the car needs to be totally autonomous. The cars are started with one common startmodule,...

Read more »

  • 1 × Losi 1/24 Rally $150 RC car
  • 1 × Custom PCB
  • 1 × Teensy 3.2 microcontroller $xx
  • 1 × MPU-6050 (MEMS accelerometer)
  • 1 × ESP8266 ESP-12E (Wifi module)

View all 7 components

  • Disassembling Losi Rally 1:24 car

    Frode Lillerud08/20/2016 at 20:47 0 comments

    Today I started on disassembling the stock Losi 1/24 Rally car. One of the nice things when picking this car as the base for my robot is that it is designed to be hackable. RC people like to (or are perhaps forced to) work on their cars. Replacing broken parts and upgrading to better parts is part of the experience for RC-people. So that is good news for me, since it makes modifying the car so much easier.

    Here is a picture of the stock car, where just the body has been removed.

    Removing the protective insider cover as well makes the electronics visible as well.

    I'm replacing all the electronics, the motor, steering servo and parts of the frame. The electronics will be replaced with my own custom Teensy-based PCB, the motor will be changed to one which is slower and with more torque. The stock servo for steering uses five wires, so that will be replaced with one that has three pins.

    Gutting out all the parts I don't need I end up with this;

    I've bought a new base plate, made from delrin, from a spanish seller (jamachucka) on Ebay. It gives me plenty of room to work with, and with delrin it is easy to drill new mountingholes.

    Here is the new baseplate mounted. I've bough a replacement servo from Losi (LOSB0814) which has three-wire setup, and a servo-saver.

    Lastly I've connected it up to my custom PCB. You can see it running the test-program for the steering in this video.

  • PCB, revision 1

    Frode Lillerud08/18/2016 at 19:57 0 comments

    As mentioned the PCB is where I've put most of my time so far. Doing an iteration of schematics in KiCad, pcb layout in KiCad, order from China, wait, solder and test, takes so much time that I don't want to put it off until it's too late. The first revision was designed and soldered a few weeks ago, and I've tested most of the features.

    In this first version I've got a fairly big PCB. It's about 90mmx63mm, and just barely fits under the body of the car.


    It has a Teensy 3.2 mounted on female headers in the center of the board. Surrounding is a WiFi module, a Bluetooth module, various headers for motor, steering servo, driveshaft encoder and IR-sensors. Additionally I've put on a few components for monitoring power consumption, and a gyro/accelerometer/compass combo.

    Why both Bluetooth and WiFi? Well, because I haven't tried either the ESP8266 (WiFi) or HM-11 (Bluetooth) modules before, and I wanted to give both a go. In the next revision I'll probably keep just one of them. Haven't decided on which one yet, though. The ESP8266 would allow me to host a webserver on the car, which would be cool. On the downside it is really powerhungry, and will probably need to be flashed with a custom firmware. HM-11 on the other hand would give me just a simple wireless serial connection, which is easier to work with and is more in line with what I really need. So for now I'm leaning towards keeping the BT module, but I'll have to do a bit more testing before I make up my mind.

    The IR sensors I use (GP2Y0E02B) are really small, and use I2C. Since they all use the same I2C address I have to use a multiplexer for flipping between each of them when querying for distance. That is done by a TCA9548APWR I2C mux. I used it on the car I built last year, and haven't had any problems with it. For the next revision I plan on changing it to a TCA9548ARGER, which is basically the same chip, but in a package which is about half the size.

    For my IMU (Inertial Motion Unit) I've got a combo of the MPU-6050 and a HMC5883. Most likely I'll use the sourcecode from FreeIMU. I've done a brief test of the MPU-6050, and it seems to work just fine.

  • Status so far

    Frode Lillerud08/06/2016 at 21:18 0 comments

    Let's see, what is the current status...

    On the mechanical side I've bought a Losi 1/24 Micro Rally car. It'll serve as the base platform for which I'll build the car. I'll have to disassemble most of the car, remove all the electronics and replace a great deal of the hardware, like motor and servo. I want to make the end-result still look neat and sexy, and not like a hacked together piece of cr*p, so if I can, i want to hide all my modifications under the original chassis of the car.

    On the electronics side is where I've put all my effort so far. Since attending the previous competition in May 2016, I've been doing research and worked on the custom circuitboard for this next car.

    As the "brain" of my car I'm using a Teensy. It fits into a socket on my custom PCB. I use IR sensors for detecting the walls on the racing track. The previous car had three. This one has potientially eight.

    Propulsion will be done by a brushless motor, powered by a 7.4V LiPo and an Electronic Speed Control from HobbyKing. Steering will be handled by a small servo.

    In addition to sensors and actuators for motion, I'm also including a few extra features on my PCB for future use. I've added an onboard IMU for motion detection, a current sensor for monitoring power consumption, bluetooth / wifi for debugging and configuration changes, and a few other minor things.

    But, right, I was talking about the current status.

    The first revision of the custom PCB has been drawn in KiCad, and created in China. I've soldered almost all of it, and am in the process of verifying that all the features work as intended. Most do, but some minor problems have been identified. I'll come back to the PCB in a later post.

    Lastly, there is the software side. The code for the car will be written in Arduino-C. I've got some code from the previous cars, but will probably rewrite most of it this time around. One new key feature to implement is a PID-controller for improved navigation.

    From here on out I've got about three months to get the car ready. I'll focus on the electronics in the beginning (since it takes a while to receive and test new boards), then move over to doing the mechanics, and lastly focus on the software.

  • Initial commit

    Frode Lillerud08/06/2016 at 20:57 0 comments

    Ok, so, this is a project I've been working on for a little while already, but there still remains a ton of work. I want to document the project from here on out, and hopefully it'll be interresting to follow along, maybe it'll spark some discussions, and force me to be more structured.

    The project is an autonomous model car which will race around a racetrack on its own, using only onboard sensors and computing power. The end goal is to compete in a competition for autonomous racing cars in Sweden in November (2016), and in Estonia in December.

    I've attended a few competitons in Sweden already, but with other robots (we call the cars for robots) than this one. Those entries have been so-so. Last year my car died in the second heat. This time around I want to put a lot more effort into the robot, and hopefully learn a lot along the way.

    There are a few rules for the competition which I need to adhere to. Though not a complete list, here are the most important ones.

    • The car needs to be totatlly autonomous during the race. No remote control allowed.
    • It can be max 20cm x 15cm x 15cm
    • It has to have standard IR sensor used to start the car (www.startmodule.com)
    • It cannot harm or jam the other racing cars
    • Complete the most laps in a certain amount of time to win.

    The project requires some mechanical skills (which is probably my weakest part), some electronic skills (which is what I find most fun to work with), and some programming skills (I'm a developer by day, so that should cover that part).

    Hopefully you'll find the project interrestng to follow1

View all 4 project logs

  • 1
    Step 1

    MECHANICS - Disassemble stock Losi car

  • 2
    Step 2

    MECHANICS - Add new baseplate, motor and servo

  • 3
    Step 3

    ELECTRONICS - Solder the PCB

View all 5 instructions

Enjoy this project?

Share

Discussions

Similar Projects

Does this project spark your interest?

Become a member to follow this project and never miss any updates