My first attempt at building an autonomous RC car with a Raspberry Pi 3.
My wife and I were shopping at our local Big Lots store right after Christmas when I came across some marked down RC cars. I have always wanted to try and build a Rasperry Pi “smart car.” I figured for the price, why not give it a shot. The worse I could do was lose the $20.00 for the car.
When I got it home, I sat out to take the car apart and see what was on the inside. The first thing I noticed was this car had 4 wheel drive and a separate engine that controlled the steering of the car. I needed to come up with a way to control all three engines at once so the car could drive autonomously. I also needed to figure out how to supply power to the car and the engines.
The car originally ran on 5 AA batteries. Which would have been fine to run the motors, however, I wanted something that would be easy to replace. Since the AA batteries are 1.5 volts each (7.5 total volts), I needed to find something that would have been comparable and would also allow me to recharge them. My first thought was to order a battery pack from an RC store, but I wanted to keep the project as cheap as possible. I confiscated some 18650 batteries and decided to use those instead. I ordered a pack of battery holders and soldered two of them together in series.
I read through many great articles here on Hackster.io to figure out the best way to control the engines. I ended up going with two L293D chips. One of the chips control both the front and the back drive engines at the same time. If you are using a car that has 4 wheel drive, connect the front drive and the back drive together, then connect both of those to the output on the L293D chip. You can make them go forward and backwards depending on which pins you set as HIGH on the GPIO board of the Raspberry pi.
Another tricky part that I ran into was the ability to steer the car. I took the same approach as I did with the drive engines and used the input and output on one side of the L293D chip. In doing this, it would only control the car turning in one direction. After many frustrating attempts, I finally figured out that if I utilized both sides of the L293D chip, I would trigger the steering engine to go both Left and Right. The only downfall of this approach is that you have to use a total of 6 pins on your Raspberry GPIO board just to steer the car.
The last thing I wanted to add to the car was crash detection. Again after many hours of research I decided to use the Ultrasonic sensors. I purchased a 5 pack from Amazon and waited for them to arrive. Once they came in, I wired them up and mounted them to the front of the car.
I used the roof that I cut off the car to mount to the front engine housing. I hot glued it so I wouldn’t have to screw into it and possibly mess up the engine. When mounting the senors I used hot glue, but I didn’t glue directly to the sensor, I glued to the 4 wires that are coming off the sensor. I am not sure if it would have hurt it to glue the actual sensor, but I didn’t want to take a chance of messing up the sensor. I did add a few LED’s to the front board so I could make sure that I was getting the pulses that I wanted.
Source: Raspberry Pi Autonomous RC Car
Low cost PCB at PCBWay - only $5 for 10 PCBs and FREE first order for new members
PCB Assembly service starts from $30 with Free shipping all around world + Free stencil
Extra 15% off for flex and rigid-flex PCB
Current Project / Post can also be found using:
- autonomous raspberry pi car
- rasberry pi with RC car
- raspberry pi rc car