CE432 Robotics II Fall 2022
Final Presentation - Tumbller Bot Final Progress
Name: Ryan Jeanes
Email: rejeanes@fortlewis.edu
Final Presentation - Tumbller Bot Final Progress
Introduction
For this project we are modifying code of the Elegoo Tumbller bot to allow us to control its movement with a joystick. The first step we took to achieve this is to simply remove all of the excess code from the source code provided on Elegoo's website. Then, I designed two small Finite State Machines (FSM), one for the mode controlling the behavior and the other for the motor speeds.

Design
I was hoping to have the Tumbller bot working with just the ESP32 controlling the onboard modules. After a bit of searching, I realized that Tumbller's board was solely using the Nano's 5V and 3.3V voltage regulating circuits to power the other modules on the board. I had a bag of 7805 Voltag Regulators, and the ESP32 has plenty of GPIO pins. However, I have never used ESP32's MCPWM functionality to drive the DC motors, and was uncertain I'd have it finished in time. So, I opted to get the setup I have been working on fully functional.
The bot is making use of two ESP32s to send the joystick commands to the nano. The ESP32 on the bot has its TX2 pin connected to the Nano's RX pin to allow for Serial communication. The ESP32's 3.3V output is high enough to be recognized by the Nano, however the serial connection's baud rate is significantly lower than I was originally hoping to get it to. A lot of the problems last week is that it seems that due to timing error of the devices, they were having problems communicating at the previous 4806000 baudrate. This was hard to debug since any debugging prinouts severely interferes with the car's ability to balance, due to Serial communication being interrupt driven. The fastest working baudrate for communicating between the devices is 115200bps. To accomodate this slower speed, I changed the original plan of having the ESP32 receiver send the actual speed and turn values to the Nano to having it send single character commands and have the Nano make use of the motion FSM to set its motion directions.


Figure 1 - Setting the registers to enable the carBalance() function to be called approx. every 5ms and PC/External interrupts for the encoder pins.





Figure 2 - The main control function that decodes received characters to set the relevant motion state.


Figure 3 - Tumbller bot with ESP32 connected to allow wireless communication.


Figure 4 - PID and Gyro calibration parameters.

Test Results
After fixing the issue I was having with the Serial communication not syncing between the microcontrollers, the car is able to be controlled with a joystick over wireless relatively well. There is still a small issue where the right wheel occasionally starts rocking back and forth. Adjusting PID settings helped mitigate this somewhat, but one thing I noticed is that with the wheel tightly secured there is still a decent amount of play with the axle itself. The amount of play in the right motor's axle is definitely more than the left motor's axle, so I believe it is moving just enough to trigger a pulse from the encoder.

Appendix
TumbllerBot.ino
ESP32 joystick controller code
ESP32 Receiver code
CarControl.h
CarControl.cpp
Sensors.h
Sensors.cpp
KalmanFilter.h
KalmanFilter.cpp