A Compact Solution to Modern Traffic Congestion

About: The BCAMRL is a Mechatronics Research Lab, founded in 2014 on the campus of Bergen County Academies, a magnet high school within the Bergen County Technical School District. Students create innovations base...

Traffic congestion is a major problem in many first world countries today, and the fact that modern cars pollute a lot is not good for the planet anyway. By introducing a more compact and cleaner method of transportation, both the environmental problem and congestion problems can both be solved at the same time. By removing two wheels from a traditional car and placing the remaining wheels side by side, personal transportation can be made smaller and more maneuverable. This prototype uses a robot base with two 12v DC motors that drive a pair of foam wheels mounted parallel to each other. Using feedback from the MPU6050 6 axis inertial measurement unit, it is possible to use a PID controller to maintain balance. The rider would simply lean forwards to move forwards, backwards to move backwards, and stand straight to stop moving. An Arduino Uno with an Adafruit Motor Shield controls the motors and everything is powered by a pack of AA batteries.

Teacher Notes

Teachers! Did you use this instructable in your classroom?
Add a Teacher Note to share how you incorporated it into your lesson.

Step 1: Get the Parts

This project will need:

  • 1x Arduino Uno

  • 1x Robot base

  • 1x Adafruit Motor Shield

  • 2x 12v DC geared motors

  • 10 AA batteries

  • 12v AA battery holder

  • 2x foam wheels

  • 1x MPU6050 6 axis gyroscope

  • Wires

  • Computer for programming

Step 2: Assemble the Robot Test Base

The robot base was originally designed for three wheels, two driven wheels and one caster. Since the robot is only going to be balancing on two wheels, we do not need the caster, so we can remove that. Screw on the motors on and attach the wheels.

Step 3: Electronics

Attach the motor shield on top of the Arduino and wire up the MPU6050.

MPU6050 → Arduino Pin

Vcc → 5v


SCL → A5

SDA → A4

The arduino will be placed in between the two plates of the robot.
Finally, secure the battery pack to the top of the robot and screw the power wires to the Adafruit Motor Shield.

Step 4: Code

The bulk of the project is the code and it’s not a walk in the park. In a nutshell, the code takes the raw values of the gyroscope and converts it into an angle measure using trigonometry. The data gets processed by an Arduino which then drives the motors accordingly, trying to keep the angle at 0 degrees at all times.

Step 5: Testing

In the code, there are three values, kp, ki, and kd. Tuning those to fit the robot is an essential part to making the robot work. The kp value tunes how much power the motors should be given when there is a small error, so if the robot is not reacting fast enough, increase this value. The ki value tunes how much compensation is needed for the robot to return to exactly zero, so if you see that the robot is not exactly returning to center at all times, increase this value by a little bit (like 0.001). The kd value is responsible for "catching" the robot when there is a violent change. If the robot is oscillating back and forth around the center point, then increase this value to dampen them. A bit of trial and error should get you a working solution.

Step 6: Final Remarks

This robot can now balance on its own. If this project were to be scaled up, it would work with the same code as for the rider to move forwards, all he/she needs to do is to lean forwards and the control algorithm will compensate by moving forwards. To reverse direction, he/she simply needs to lean backwards. Steering can also be implemented with a small remote control. By scaling down the size of our transportation vehicles, there will be less mass on the roads and the task of navigation will be much simpler.



    • Indoor Lighting Contest

      Indoor Lighting Contest
    • Make It Fly Challenge

      Make It Fly Challenge
    • Growing Beyond Earth Maker Contest

      Growing Beyond Earth Maker Contest