Overview
I’m Justin and this summer I designed and built a self-balancing robot. It currently balances on two wheels and can move in any direction by connecting to either a Wii remote or smartphone app.

For my third milestone, I was able to make my robot fully balance on its own and be controlled via bluetooth. Completing this milestone was especially difficult for me because it required me to understand and use some calculus in my code. Specifically, I learned how to use Proportional, Integral, and Derivative Control (PID) to calculate how much my motors needed to move in order to keep the robot balanced on two wheels. In short, PID control is a “smart” algorithm used in anything from space shuttles to thermostats that learns from the accumulation of past errors to predict future errors. In my robot, the PID control algorithm senses an error in the robot’s pitch and corrects for that by turning the wheels in the right speed and direction.
Tuning the PID turned out to be very tedious, mostly because it involved recompiling and reuploading the main code every time I needed to make a small tuning adjustment. To bypass this problem, I first tried to use an advanced autotune software that could do the tuning for me. It should have worked in theory, but in reality it did not work because it my Arduino processor was not fast enough and started lagging. Then, I decided to add potentiometers to the robot to tune the pid values in real time. Ultimately, this addition allowed me to fully tune the PID in a just a matter of days, unlike many others who have spent weeks on the tuning process.
Next, I wanted my robot to be able to move forwards, backwards, left, and right, so I switched out my Arduino Uno to an Arduino Mega ADK so that I could use a bluetooth dongle. Changing the board was much easier than I originally imagined, and connecting a Wii remote to the Arduino was pretty simple for me because I already had some experience coding from using the PID control. Using a joystick to control the robot involved some guess-and-check balancing, and even though it currently isn’t fully tuned, it was a good accomplishment.

For my second milestone, I’ve connected an Inertial Measurement Unit (IMU) containing an accelerometer and gyroscope that can each individually tell me the pitch, yaw, and roll of the IMU. Unfortunately, these angle measurements were not accurate enough for my robot, so I decided to implement a sensor fusion algorithm that combines the two measurements and give me a more accurate measurement. Although it was difficult to understand the fusion algorithm fully due to very little documentation, eventually I was able to dig out the information I needed in online forums. I also used a 3D simulation program to display the angle measurements onto my computer monitor.

I’ve reached the first milestone of my project, which is the self-balancing robot. For the past week, I have been mainly learning how to program in Python and Arduino Code, both of which I had no exposure to prior to this program. I was able to use, understand, and customize various simple example sketches for the Arduino, and afterwards I moved on to installing the motor shield onto my Arduino. I learned how to read the motor shield example code and was able to fully control the speed and direction of two independent DC motors. The motors are controlled by pulse-width modulation, which switches the motor current on and off quickly at a high frequency to change the speed of the motors. The proportion of periods of time with current turned on to the periods of time the current is turned off determines the speed of the motor. A 9V battery pack connected to the Arduino enabled it to work without being plugging in to my computer. Check out the video below for more details about what I accomplished.

MiniPOV 3
My starter project for was the MiniPOV 3, a toy that can display a floating message in midair. The concept that this toy shows is persistence of vision, which is a phenomenon that creates afterimages in the retina of the human eye.
By waving the MiniPOV quickly through the air, 8 LEDs flashing at different speeds create an afterimage in the viewer’s retina, allowing him/her to see the custom message.
The main components of my MiniPOV are resistors, zener diodes, LEDs, a serial port, an integrated circuit, and a microprocessor. Take a look at the video below for a demo and review of my my MiniPOV 3.