Project by Andrew Hellrigel and Ryan Chen
A swerve drive is a 4 wheeled robot where each wheel can be independently driven and steered. This allows the robot to be able to translate in any direction while also being able to rotate at the same time. We built a simple swerve drive robot using stepper motors as the steering motors and 550 DC motors as the drive motors for each module. Via wifi with an ESP8266, it connects to a computer that is running a python script to read an XBOX controller input and then send the commands.
View a video of the swerve drive
View the CAD Model on OnShape
For the mechanical assembly, most of the parts can be 3D printed from the files located in the OnShape CAD model. However, there are a few extra parts that are needed as shown below.
- Delrin for laser cutting gears
- Deep grove ball bearings
- 8mm ball bearings
- Aluminum square tube (20mm x 20mm x 200mm with 2mm wall)
- GT2 synchronous timing pulleys (20t and 60t)
- 8mm x 300mm linear motion rods
- 3.175mm to 5mm pinion reducer sleeve
- 20t bevel gears
Additionally, some metric and standard hardware is needed for assembly (mostly M3, M4, and 6-32 screws and nuts are used)
The electrical design works with an MBED LPC1768 microcontroller as the main controller for the drivetrain. The MBED connects to 4 motor controllers, 4 stepper motor controllers, and a bluetooth module. For power, a 3S lipo battery and a 5V buck converter are used. To simplify the wiring to the motor controller, a hex inverter is used. All of these parts can be found below. An XBOX controller is used to be able to drive the robot.
Below is a wiring diagram of how to make all of the connections needed for this project to work.
The software to control the swerve drive robot is made up of two parts. First, there is a python script that takes controller inputs from the XBOX controller and converts the data to be sent over Wi-Fi to the ESP8266 connected to the MBED. Secondly, the MBED reads the incoming data over a serial port and does the math to convert joystick inputs into wheel positions and speeds. The inverse kinematics math that needs to be performed can be found from this whitepaper. Once the appropriate wheel positions and speeds are calculated, those commands can be sent out to the appropriate motor drivers and stepper motor drivers. Custom libraries for these motor drivers were designed to be able to accept these specific inputs.
All of the ESP8266 software used for this project can be found at the link below.
The ESP8266 should be flashed using Arduino IDE. Follow these instructions to download the library to use ESP8266 through the Arduino IDE.
In the esp8266_setup.ino file, replace the network name/password strings with the network that your computer will be connected to.
All of the mbed software used for this project can be found at the link below.
All of the python software used for this project can be found at the link below.
In the python code, replace the existing IP address for ESP8266 with the IP address outputted by the ESP8266 on the Arduino Serial Monitor.