Hackster is hosting Hackster Holidays, Ep. 6: Livestream & Giveaway Drawing. Watch previous episodes or stream live on Monday!Stream Hackster Holidays, Ep. 6 on Monday!
Jon Mendenhall
Published © MIT

Walabot and Mobile App Controlled 3D-Printed Cars

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

AdvancedFull instructions provided8 hours12,482

Things used in this project

Hardware components

Android device
Android device
This will run the mobile app to steer and drive the cars!
×1
Walabot Developer Pack
Walabot Developer Pack
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
Raspberry Pi 3 Model B
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
Breadboard (generic)
Breadboard (generic)
Will be used with male-female jumper wires for the base station.
×1
Jumper wires (generic)
Jumper wires (generic)
Either 12x male-female, or 6x female-female.
×1
Arduino Nano R3
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 Micro-servo motor
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

Hand tools and fabrication machines

3D Printer (generic)
3D Printer (generic)
Soldering iron (generic)
Soldering iron (generic)

Story

Read more

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.

Wheel

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.

Base Station Wiring Diagram #2

Use this diagram to connect an nRF24L01 module to your Raspberry Pi with male-female jumper wires.

Car Wiring Diagram

Use this diagram to solder wires onto the individual boards of each car.

Code

Car Arduino Sketch

Arduino
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.

Credits

Jon Mendenhall

Jon Mendenhall

4 projects • 62 followers
I've been working with hardware and software for 8 years, and I have 4 years of professional software development.

Comments