Project tutorial
Walabot and Mobile App Controlled 3D-Printed Cars

Walabot and Mobile App Controlled 3D-Printed Cars © MIT

Drive some awesome 3D-printed cars with a Walabot and mobile app!

  • 6,434 views
  • 2 comments
  • 49 respects

Components and supplies

1434509556 android phone color
Android device
This will run the mobile app to steer and drive the cars!
×1
Creator crop 1 zku9vbwoof
Walabot Creator
This will be used as a virtual gas pedal to sense how far you're pressing your foot down for the throttle of the cars.
×1
Pi 3 02
Raspberry Pi 3 Model B
The central part of the project, handling communication with the Web App, and the Walabot, to control each car.
×1
12002 04
Breadboard (generic)
Will be used with male-female jumper wires for the base station.
×1
11026 02
Jumper wires (generic)
Either 12x male-female, or 6x female-female.
×1
Ard nano
Arduino Nano R3
Each car will have an Arduino Nano onboard to control the servo, DC motor, and nRF24L01 module.
×2
DC Motor
You will need DC motors that are geared; I recommend one geared for 300-600 RPM to supply enough torque to move the car.
×2
Sg90 servo motor 180 degrees sg90 micro
SG90 Micro-servo motor
These are just basic servos and will be used on each car for controlling the steering mechanism.
×2
L298N Motor Driver
These are dual H-bridge DC motor drivers which allow the motor to turn in forward and reverse.
×2
LIPO Charge and Protection Module
These will automatically cut power to the car when the LiPo battery voltage drops too low, preventing damage, and allowing you to charge the battery through its USB port.
×2
DC Boost Regulator
This will regulate the voltage of the LiPo battery as it drops over time to stay constant. It can also be adjusted to make the car faster by holding a selectable voltage.
×2
nRF24L01 Module
Each car and the base station will have one of these modules to communicate with each other.
×3
M5x30 Bolt
These will be used as the rear axle for each rear wheel.
×2
M5x16 Bolt
These will be used for connecting the front wheels to the chassis of each car.
×2
M5 Nut
Each front wheel will need an M5 nut to secure it to the chassis.
×2
M5 Washer
Washers will be used used throughout the each car as spacers to make each bearing run smooth for the wheels.
×12
M5 Bearing
The bearings I used have a 13mm diameter, 4mm thickness, and M5 hole in the center. Some V-Slot wheels I have had two of these bearings in each one.
×6
M3 Nut
I used nylon M3 nuts from a hex standoff kit on Amazon.
×3
M5x8 Bolt
These will be used in the differential to hold the two extra bevel gears.
×2
M3 Bolt
You can use any kind of M3 bolt as long as it's about 5mm long. I used two socket head cap bolts, and nylon M3 bolts for the rest.
×14

Necessary tools and machines

3drag
3D Printer (generic)
09507 01
Soldering iron (generic)

About this project

Introduction

Imagine building your own RC cars... that's where this project came from! Ever since I can remember, I've always wanted to build a custom remote controlled vehicle. The original idea for this project was to use a Walabot for positional feedback of such cars and control them via code to follow a designated path. After many days and countless attempts to get the system working, I found that the Walabot is not meant for such applications requiring precise and accurate realtime feedback.

After thinking for a while, I finally thought of using the Walabot to track a person (what it's really good at). Specifically, I would use the Walabot as a "virtual gas pedal," sensing the distance your foot is from the scanner and translating this value into the throttle signal for a remote control car.

You may be thinking "Well that sounds easy... I'll just get some cheap remote control cars from Amazon, open them up, and modify the signals sent to the car. Simple." If you are somewhat observant, you could tell that was exactly what I was thinking, and oh boy was I wrong. The process sounds a lot easier than the reality of it based on a number of things that I would come to find out...

  • Toy manufacturers use different protocols
  • Toy manufacturers use different protocols... per toy
  • It's a nightmare to decode all of the countless protocols

This is why I decided I would just build a remote control car... which is actually quite easy. I spent the next couple days designing parts that would be 3D-printed, and fitting some electronics into them. Yes not every person could do this, but it's a whole lot easier than decoding SPI bus traffic only to have to figure out how to interface with that protocol, and I've already done the heavy lifting for you!

Awesome! It seems my story has not bored you to death so... feel free to follow my structured outline to build your very own (you guessed it) 3D-printed cars remote controlled via some Walabot gas pedal things and a mobile app for steering.

Yes, I know the name could use a little work :)

Explanation

Here is just a quick rundown of how the whole process will work in the end...

The 3D-printed cars will communicate with a Raspberry Pi using nRF24L01 modules. The Raspberry Pi will be running a Python script to connect to the Walabot and read your foot's distance from it, translating that into a throttle value for the car you are controlling. On top of the Python program, the Raspberry Pi will also connect to a mobile app I designed to read your devices accelerometer/gyroscope values and convert that into steering commands for the cars. On top of steering, the app will allow you to shift between Park, Reverse, Neutral, and Drive, and select which car you are controlling.

Now... it's time for the nitty gritty.

Demonstration

How about a video demonstrating the final setup!

Print all necessary parts

Every good hobbyist project uses a 3D printer and this is certainly not an exception! Here's a list of parts you'll need to print for this project.

Note: This is thelist of parts for one car. If you want more cars... print more!

  • (4x) Wheel
  • (2x) Differential Outer
  • (4x) Bevel Gear
  • (1x) Drive Gear
  • (1x) Chassis
  • (1x) Top Plate
  • (1x) Servo Horn
  • (1x) Steering Bracket
  • (1x) Steering Linkage
  • (2x) Front Wheel Mount
  • (2x) Axle Spacer

Note:There could be a lot of printing time required for this project depending on how many cars you want. As an example, I printed two sets of parts to make two cars;each car took about 5 hours of print time.

Assemble each car

Now that all of the parts are printed, we can get on on to actually building the cars. Follow these steps to get on your way!

#1: First, we will be building the front steering mechanism. Start by threading 2 wheels with M5x16 bolts from the outside of the wheel.

#2: Place an M5 washer on each of the 2 front wheel assemblies.

#3: Press an 13mm bearing into each of the FrontWheelMounts. Note which side you are pressing the bearing on, one will be on the left side, the other on the right, making each bearing on the outside of the car. Place this FrontWheelMount on the M5 bolt of the wheel.

#4: Thread and tighten an M5 nut onto each wheel assembly.

#5: Mount the servo at the front of the chassis using one of its mounting screws.

#6: Place the SteeringBracket upside-down on top of the servo and connect it to the chassis with 2 M3 bolts from the underside of the chassis.

#7: Mount the front wheel assemblies to either side of the chassis with an M3 bolt on top through the SteeringBracket, and another through the corresponding hole in the chassis.

#8: Connect the SteeringLinkage to both front wheel assemblies with an M3 bolt going through each FrontWheelMount.

#9: Press the ServoHorn onto the servo and secure it with the small screw provided with the servo. Make sure to also screw the other end of it into the SteeringLinkage with an M3 bolt.

#10: Now onto the rear of the car! Start by threading an M5x30 bolt into the 2 remaining wheels.

#11: Place a washer, bearing, washer, AxleSpace, and finally another washer on the bolt. Push both of these assembly into the rear bearing hole on the chassis.

#12: Time to assemble the differential that the rear wheels will connect to! Press a bearing into both of the DifferentialOuters.

#13: Put an M5x8 bolt and washer through the side hole in each DifferentialOuter.

#14: Thread a BevelGear onto both of the bolts. You should now have 2 halves of the differential.

#15: Put each half together so that the holes in each are opposite to each other. Connect them together with 2 M3 bolts.

#16: This part is a little tedious but you'll need to mount the differential between the two rear wheel axles. Slide both axle bolts through the bearings on either side of the differential. Finally, but most annoyingly, place a washer on each bolt, then thread a BevelGear onto each.

#17: Now that the rear axle is ready, slide the MotorGear onto the geared DC motor's shaft, and snap it into the slot in front of the rear axle.

#18: Snap the motor driver, nRF24, Arduino Nano, and boost voltage regulator into their corresponding slots in the chassis. Make sure if any of the boards have pins, to desolder them so they can sit flat in the slots.

#19: Follow the wiring diagram to connect the pins on each board using small flexible wire. This soldering job is rather tedious due to the small space and number of overlapping wires but hang in there!

#20: Now, put an M3 nut into each hole on the TopPlate, and thread an M3x10 hex spacer through the bottom side of it.

#21: Mount the TopPlate to the Chassis using 3 M3 bolts from the bottom, so that the slot in the TopPlate fits around the MotorGear.

#22: Snap the battery protection and charging module into place on the TopPlate, and place a battery into the tray. You do not need to plug the battery in yet.

Build the base station

Congratulations, you've completed half of the project! Soldering all of those tiny wires must have been very tedious... Sadly, this section has wiring but it's much simpler. Follow these easy steps to build your base station!

#1: If you do not have female-female jumper wires, grab a breadboard and 12 male-female jumper wires; if you do, don't worry about the next step; simply connect the Raspberry Pi to the nRF24L01 module as shown in the diagram.

#2: Follow the wiring diagram below and connect jumper wires from the Raspberry Pi to the breadboard, and then another set from the breadboard to the nRF24L01.

#3: Finally, grab a micro-USB cable and connect your Walabot to any of the USB ports on the Raspberry Pi.

Set Up the Raspberry Pi

#1: Plug in the power supply for your Raspberry Pi and wait for it to boot. I recommend using SSH to set up your Pi, but you could use the Pi by itself if it has a keyboard and monitor connected.

#2: In your SSH session or terminal, run the following command to download the GitHub repository for this project.

git clone https://github.com/jonmendenhall/walabotRCCar.git

#3: Run the following commands to set up and install the necessary libraries.

cd walabotRCCar
sudo ./setup

Program the cars

#1: Now that you have your cars and base station complete, you can finally program these speed machines! Download and open the Arduino Sketch that comes with this project.

#2: First, making sure the batteries are unplugged from each car. Then plug a USB cable into the Arduino Nano's USB port. I recommend programming one car at a time so you do not lose track of which car has what settings.

#3: Give the car a unique address on line 7 of the Arduino code, and leave everything else the same. Upload this code. After driving the cars, if you notice that the forward of one car actually goes in reverse, just swap the values of MOTOR_A and MOTOR_B in the code, and re-upload. If you notice that one car tends to veer towards one direction when it should drive straight, modify the CENTER value to be a different degree, then re-upload the code for that car.

Take 'em for a spin

#1: To get the Python code running, use the next command on the Raspberry Pi. This will start the Python code that connects to the Walabot, Android App, and nRF24 module.

python3 walabot.py

Note:You'll need to make sure the addresses in walabot.py match the addresses of the cars when you programmed them. Also, make sure SPI communication is enabled when running:

sudo raspi-config 

Once that part is set up, you'll be able to control your cars by running the provided mobile app on your Android device. This Android app will let you control and steer the cars. To control the throttle, place a box approximately 10cm tall in front of the Walabot laying on the floor. Then, just rest your foot on the box, and step down with the front of your foot above the Walabot.

You can install the APK by opening this link on your Android device and downloading it. The app is named Walabot Drive, and has a purple icon with a car on it.

When you launch the app, make sure the server is running on your Raspberry Pi. The app will say "Searching for Raspberry Pi" until it finds your Pi automatically. Once it finds it, it will hand over controls to you, and you'll be free to drive! The driving can be done as shown in the demonstration video at the beginning of this project.

Code

Car Arduino SketchArduino
This code will run on each car, allowing it to respond to data packets sent via the nRF24, controlling the steering servo, and DC motor.
#include <RF24.h>
#include <Servo.h>

// unique address of the car
// cars with the same address will not work

#define ADDRESS 0xE0E0E0E0F2

// defines what angle the servo should be at to go straight
// change this if the servo horn was not mounted at 90 degrees

#define CENTER 90

// You can switch MOTOR_A and MOTOR_B values to make the car's forward be the opposite direction

#define MOTOR_A 6
#define MOTOR_B 5

// Connect the nRF24 and Servo

RF24 radio(7, 8);
Servo servo;

// Define the packet structure that will control the car

struct ControlPacket {
	int8_t steering;
	uint8_t throttle;
	uint8_t reverse;
} controlPacket;


void setup() {

	// initialize the nRF24

	radio.begin();
	radio.setPayloadSize(sizeof(controlPacket));
	radio.setChannel(0x60);	
	radio.setDataRate(RF24_1MBPS);	
	radio.setPALevel(RF24_PA_LOW);
	radio.setAutoAck(true);
	radio.openReadingPipe(1, ADDRESS);
	radio.startListening();

	// connect the servo and set it to the center position

	servo.attach(2);
	servo.write(CENTER);

	// setup pins for the motor driver

	pinMode(MOTOR_A, OUTPUT);
	pinMode(MOTOR_B, OUTPUT);
	digitalWrite(MOTOR_A, 0);
	digitalWrite(MOTOR_B, 0);
}

void loop() {

	// wait for and parse the incomding data into a ControlPacket

	while(!radio.available());
	radio.read(&controlPacket, sizeof(controlPacket));

	// control the motor with PWM in forward or reverse depending on the packet

	if(controlPacket.reverse) {
		digitalWrite(MOTOR_B, 0);
		analogWrite(MOTOR_A, controlPacket.throttle);
	} else {
		digitalWrite(MOTOR_A, 0);
		analogWrite(MOTOR_B, controlPacket.throttle);
	}

	// write the steering value to the servo

	servo.write(CENTER + controlPacket.steering);
}
GitHub Repository
This contains the code that will run on your Raspberry Pi.

Custom parts and enclosures

BevelGear
Four of these tiny gears make up the inner workings of the differential.
FrontWheelMount
As the name implies, it is the mount for the front wheels... kind of important.
SteeringBracket
Also very important, without this bracket, there is no stability to the steering mechanism.
SteeringLinkage
If your front wheels don't turn the same way, they're useless! This solves that problem.
ServoHorn
This connects the output shaft of the servo to the rest of the steering mechanism.
TopPlate
This is a boring part, but holds the most valuable part of the car... the battery!
Chassis
This is the main body of the car. Every component will be mounted on this.
Each car of course needs four wheels!
DifferentialOuter
Half of the differential assembly.
MotorGear
The transfers rotational energy from the motor shaft to the differential.

Schematics

Base Station Wiring Diagram #1
Use this diagram to connect an nRF24L01 module to your Raspberry Pi with female-female jumper wires.
Basestationdiagram rk7i1jokkh
Base Station Wiring Diagram #2
Use this diagram to connect an nRF24L01 module to your Raspberry Pi with male-female jumper wires.
Basestationbreadboard y77uczxd16
Car Wiring Diagram
Use this diagram to solder wires onto the individual boards of each car.
Cardiagram itsmukml6v

Comments

Similar projects you might like

WalaBeer Tank

Project tutorial by Balázs Simon

  • 23,650 views
  • 4 comments
  • 159 respects

DIY 3-Axis CNC VMC

Project tutorial by Amit Nandi (BigWiz)

  • 12,163 views
  • 9 comments
  • 46 respects

Create a People Counter Controlled by an Android App

Project tutorial by Kutluhan Aktar

  • 3,067 views
  • 2 comments
  • 7 respects

Make an Enhanced R2-D2 to Be Controlled by an Android App

Project tutorial by Kutluhan Aktar

  • 1,426 views
  • 0 comments
  • 2 respects

RC Rover Controlled by Gest

Project showcase by Salim Khazem

  • 993 views
  • 1 comment
  • 12 respects
Add projectSign up / Login