ZACK DAVENPORT
  • Projects
  • Resume
  • Design Portfolio
  • Music
  • About
  • Contact

QEA: Mini Segways

          This project was the third project in my second semester of Quantitative Engineering Analysis (QEA). The goal of this project was to learn more about both control theory and physics by programming homemade mini-Segways, which are a good analogue to the classic inverted pendulum problem. This project was made exponentially more exciting, however, through the genesis of the first annual Segway Olympics. Pairs of students were to program their Segways to stand up as long as possible for the endurance competition, and also encouraged to compete in other events such as the Segway Salsa event, the Segway Sumo event, or the Ten Foot Dash event.

          My partner and I welcomed John Dough into this world and spent a couple of weeks teaching him to do exciting tricks to amaze peers and professors alike. We entered our Segway in three events: Endurance, Segway Salsa, and Segway Spin. The first step in achieving these lofty goals was to simply get our Segway to stand up in one place at all. To do this, we applied our new knowledge of control theory to implement a PI (proportional-integral) control algorithm on our Segway written in Arduino. This allowed our Segway to stand, but we quickly realized that it would not stand for very long in one place.
Picture

           To fix the problem of our Segway drifting back and forth in increasingly large oscillations, we in an extra integration loop that fed into the desired angle. As the robot moved in one direction, we would integrate its speed to find its new position. If its position was not zero, the desired angle would change so the robot would tilt towards its desired position, which would cause the velocity to kick in and drive the robot back to its origin. Unfortunately this caused the robot to oscillate around its origin and never quite settled down. We fixed this by turning the integral control into another PI control—the proportional aspect settled down the oscillations which meant that the robot now oscillates less and less until it settles down to its origin position. This new code allowed our Segway to stand up in roughly the same place for a long period of time.

          We also wanted our Segway to spin around in one spot in order to compete in the Segway Spin event. Our initial approach was to simply set one of the PWMs—the value that controls the power given to the motors—to be negative and the other to be positive, but we quickly realized that this didn't do quite what we expected. By changing the signs directly in the line of code that sent the PWMs to the motor, the error values for each wheel were calculated improperly because it could not take into account this sign change. Instead, we chose to modify our speed control variable by adding a "spin factor" to the left wheel speed and subtracting this same speed factor from the right wheel speed. Setting this factor as a variable allowed us to easily control it between tests to determine an appropriate value. We also realized that the PWMs that were being outputted were too high to have it spin in a stable manner, so we multiplied both PWMs by a speed factor that we used to scale down the PWM by a factor of 0.4.

          Late in our process of coaching John Dough, he expressed his passion for waltzing to us. He quickly learned how to sing and dance to Strauss's Blue Danube Waltz, a melody he learned using the built-in Pololu Orangutan Buzzer Library. His dance is simple yet elegant: a version of his classic spin but with the positional PI loop removed to allow him to drift across the dance floor.

          This project was an incredibly valuable learning experience for me in that it allowed me to expand my knowledge of both physics and control theory in the same project, and expand my skill set beyond the standard mechanical engineering topics. It also allowed me a surprising amount of creativity; figuring out how to make a Segway dance to an 8-bit version of waltz that it plays from its own speaker was not in the project description, but I had the freedom to take it in that direction. To learn more about the math and concepts used in this project, download the Coach's Report here. Download the Arduino code used for this project here.
Return to Projects
Zack Davenport is a member of the Class of 2020 at Olin College studying Mechanical Engineering with a concentration in Anthropology.
Copyright © 2020
Zack Davenport ​
  • Projects
  • Resume
  • Design Portfolio
  • Music
  • About
  • Contact