Wireless Model Vehicle

Introduction
This project was completed in teams of three people as part of a graduate level course entitled Design of Mechatronic Systems. The goal of this project was to create a small vehicle that could be wirelessly controlled using the wifi UDP protocol. The vehicle was then raced through a small course, in a time trial competition against the other twenty-five teams in the class. We were provided NodeMCU boards with ESP8266 wifi modules along with basic electronic components, motors, and servos. As a team, we did all programming, circuit design and fabrication, and mechanical design and fabrication. This page will explain all aspects of this. Click here to skip this and read the results.
Mechanical Design
The vehicle design was aimed at keeping the car small and compact without being restrictive. The team opted for a three wheel design with two motor drive in the back of the vehicle. A servo was used to control the front wheel for ease of steering. The team decided to use this more difficult method of steering rather than differential steering because it had the potential to be faster while offering the same level of control. A number of different gearing approaches were tested. Initially, the team believed that a high gear ratio was necessary, but this turned out to be the result of an issue with the H-bridge that was used to drive the motors. The H-bridge could not handle the current required to power both motors. Consequently the team switched to MOSFET control, sacrificing the ability to move backwards (which was not necessary for this project) for added speed and control. With the motor issues resolved, the team settled on a gear ratio of roughly 1:5, adding torque to the high RPM motors in order to increase acceleration. The main body of the vehicle was fabricated from laser cut eight inch MDF and metal standoffs of various lengths. Lego gears and wheels were used, since they are precisely manufactured and served well for this purpose. Laser cut gears were attempted, but the lack of precision of the laser cutters, along with the laser angle, caused high friction at the interfaces.



Electronics
Four AA batteries created a 6V power supply, which was used to power the MCU unit. The MCU unit used 3.3V logic, thus a level shifter was used to change this to 6V logic in order to command the servo pulse single and MOSFET used to drive the motors. Flyback diodes were put on the motors to ensure that the MCU unit was protected. A switch was added as a digital input to specify which of the two wireless networks to which the vehicle should connect.
Software
The wifi UDP protocol was used to send commands to the vehicle. The MCU needed to connect to a specified wifi network and then wait for commands on a certain UDP port. Before any commands were processed, a "go" command needed to be received, which would be sent to all vehicles at once so that a fair race could occur.
Teams were allowed to create their own method of getting controller inputs. We opted to take on the challenge of figuring out how to read inputs from a USB Xbox One controller, and relay these over UDP using the laptop, instead of another MCU unit. The Xbox controller offered very precise and easy control. SlimDX, a wrapper for the DirectX libraries was used in C# to read in values from the controller (note that the actual controller reading pieces of the code were drawn from online examples). We designed a basic GUI to display the controller values and relay them over UDP. The GUI shows the main joystick positions, along with what buttons are currently being pressed. We also added the ability to send an artificial go command for testing purposes.

Results
Our vehicle was the fastest out of all the vehicles in the final race. It was able to complete the course in 8 seconds, six times faster than the next fastest car. It is worth noting that this is not just because of the vehicle’s design and control, but largely because of the fact that the wifi network being used for the race was clogged with UDP messages, because some teams were sending them too rapidly. Our team navigated this by switching to a different wifi network for racing. The videos show an example of the vehicle’s motion and the winning race run about the track, respectively.