Our project focuses on building a versatile robot car controlled by an Xbox controller. It is divided into two key parts: ensuring smooth communication between the Xbox controller and the robot car, and implementing multiple control modes through code development in Code Composer Studio.
The overall system architecture operates as follows: the Xbox or phone connects to the ESP32 board, and the ESP32 transmits the corresponding data via UART or GPIO. For the Xbox control, we flash a Bluetooth extension called Bluepad32, which enables real-time reading of Xbox button inputs. The data stream is classified into two categories: continuous data, such as joystick inputs, is encapsulated into UART packets and transmitted at a baud rate of 115200; discrete data, such as the Y, X, A, and B buttons, is sent as digital outputs. A Texas Instruments board continuously polls the states of the corresponding pins to read this data.
For phone control, we develop a frontend and backend application for the ESP32 using Arduino. The user connects to the ESP32 through a personal hotspot, with the connection initiated using the ESP32’s IP address. The frontend application contains four control buttons and a log text box. When the user clicks a button on the website, an HTTPS request sends the state change to the ESP32. A callback function on the ESP32 detects this change and transmits the data to the Redboard via UART. The reverse communication is also supported, where the ESP32 continuously sends its state back to the frontend application for display on the website.
We used Code Composer Studio to develop the robot car's four distinct functional modes and implement control for a soft robotic arm. The Xbox controller buttons are mapped as follows:
- X Button: Manual Control Mode
- Y Button: Racing Game Mode
- A Button: Automatic Follow Mode
- B Button: Mobile Remote Control Mode
We integrated an LED display on the PCB board that shows the corresponding letter pattern for the active mode. This real-time LED feedback ensures users can quickly identify the active mode through a clear, visual letter display.
In this mode, the Xbox controller provides full manual control. The left joystick is used to control the car’s forward, backward, and turning motions, while the right joystick controls the soft robotic arm’s gripping and releasing actions.
Currently, due to the weight of the robotic arm, the car may experience slippage while in motion. We are actively working on improving the connection structure to resolve this issue and ensure smoother operation.
This mode simulates a racing video game experience. The RT button controls the throttle for acceleration, while the LT button controls the brakes. The left joystick is used for steering.
To enhance realism and better simulate the braking behavior of racing games, the car does not stop immediately when the brake is applied. Instead, it gradually decelerates and comes to a stop through a smooth sliding motion.
In automatic follow mode, the car uses a front-mounted distance sensor to continuously measure the distance to an object in front. The car automatically follows the object while maintaining a fixed distance. If the object moves closer to the car, the car will reverse to restore the preset distance. When no object is detected in front, the car will automatically stop.
In mobile control mode, the control authority of the car is transferred to a smartphone connected via hotspot. Using a mobile app, the user can control the car’s forward, backward, and steering motions.
During this mode, the Xbox controller remains active for switching between modes and triggering the emergency braking function if needed.
For better function demonstration, we have temporarily removed the soft robotic arm. Additionally, we have implemented an emergency function. When both the LT and RT buttons are pressed simultaneously, the car will perform an emergency stop and return to its initial mode.
Comments