Spring 2016 RoFi: Research and Implementation of the Accelerometer/Gyroscope

Christopher Andelin (Project Manager)

Mario Ramirez (Systems Engineer)

Qui Du (Manufacturing Engineer)

Andrew Laqui (Electronics and Controls Engineer)

Henry Ruff (Electronics and Controls Engineer)

Research and Implementation of the Accelerometer/Gyroscope

By Henry Ruff (Electronics and Controls Engineer)

Note: All files referenced without additional links can be found in the RoFi Spring 2016 Google Drive, https://drive.google.com/drive/folders/0B_v74PMhdCbKSXVPQ285ekZEX28.

RoFi’s movement is somewhat inconsistent, and as such, it is unreliable in being able to perform the same exact frames that it was able to perform from a previous trial; a solution to this inconsistency is the implementation of the MPU-6050 accelerometer/gyroscope, as an ideal albeit very optimistic task. The  MPU-6050 would allow RoFi to be able to balance itself through normal runs, on different surfaces and inclines, all using the same walking code.

In order to be able to start any of these possibilities, research was done on implementation of the MPU-6050. The following Arduino guide is used to obtain raw, readable values with the device.

http://playground.arduino.cc/Main/MPU-6050.

However, this is not a usable format. Instead, Jeff Rowberg had created files for utilization of the readings from the MPU-6050. The tutorial used in being able to work with these files is found here, http://diyhacking.com/arduino-mpu-6050-imu-sensor-tutorial/. Just in case, the necessary Arduino libraries that are used can also be found with the rest of the RoFi files.

Please note, a common complication that can arise in compiling this code is if any Arduino libraries get included before the initial comments in Rowberg’s code. The desired types of values can be toggled by commenting and uncommenting different modes of output.

 

For RoFi’s purposes and to optimize the code as much as possible, I have trimmed down Rowberg’s code to only what might be used, and this version is shown in the “MPU6050Code.txt” file found in the Google Drive. This file is meant to provide the chunks of Rowberg’s code that should be placed into RoFi’s normal walking code generated from Robot Poser, and instructions for which are found within the file itself.

Now that the code has been integrated into RoFi’s walking code, it can theoretically be used to assist in its balancing. The main considerations that we were able to come up with in doing this were as follows:

  • Previous semesters had only utilized the MPU-6050 while RoFi was stationary.
  • As RoFi is walking, the MPU-6050’s data would need to be referenced between each frame of motion.
  • RoFi’s head does not stay parallel to the ground while walking, instead it turns in every direction except rotation about the z-axis. This means the gyroscope is fine for the z-axis, but complex for the other two. If RoFi’s head can be kept parallel, this problem can be circumvented.
  • With the values being read, they can be compared to an expected set of values for RoFi’s normal movement. However, this would need a very large file containing ideal gyroscope values, and the Arduino is not able to reference external files, and there is the concern of limited memory on the Arduino Mega.
  • RoFi’s head movement is too erratic and jerky to use the accelerometer for comparisons with how our current walking code performs. (This can be observed in walking videos.) Similarly, this prevents the gyroscope by comparing values that are being read to each previous value.
  • An acceptable range of variation cannot quite be determined with RoFi’s current movement, to be used in making RoFi balance itself.
  • RoFi’s balance while walking is not as simple as moving one servo a few degrees, rather, most frames of movement utilize several servos, and even one degree on each can overthrow its balance.

With these considerations, the progress we were able to make is simply this suggested code “MPU6050Control.txt”, (in the Google Drive) for future semesters and a guideline for potential ways to use the MPU-6050 to actively balance RoFi during motion.