Inspiring Mindstorms EV3 Programming for FLL Part 5: Reusable EV3 Gyro Calibration My Block

In the previous post, we outlined the process for turning a robot by a certain degree using a Gyro sensor as a guide. In another post, we also discussed using a Gyro sensor to maintain straight movement for our robot. However, it’s important to note that Gyro sensors can experience drift, which can make them challenging to work with. In this post, we’ll delve into what causes drift in Gyro sensors and provide solutions to address this issue.

So what is gyro drifting? Gyro drifting is a phenomenon where a Gyro sensor connected to the EV3 brick displays fluctuating values even when it’s not in motion. In other words, the sensor produces uncontrollable and erratic measurements, which is referred to as “drifting.” To illustrate this problem, we have captured a video from Mindstorms’ port view, which shows the values on port 4 (where a Gyro sensor is connected) changing constantly even when the robot is stationary. This drifting issue can make it challenging to use the sensor for accurately turning to specific angles.

How to Solve the Gyro Drifting Problem

When a gyro is drifting, it needs calibration. There are two calibration methods – manual solution and automatic solution. Manual solution is keeping the robot motionless, unplug the wire of the Gyro sensor and plugin again. Automatic solution is writing a program using the Gyro Sensor Block without unplug/plug the wire. Manual solution requires that the robot is standstill while plugging in the wire again which is not very easy to do. So we prefer the automatic solution using the Gyro Sensor Calibration program.

EV3 Gyro Calibration Program

We found the calibration strategy 5 of the tutorial is reliable for our 15N8 model gyro sensor. We use this technic to customize the code for Gyro Sensor Calibration as shown in the following screenshot.

EV3 Gyro Calibration
EV3 Gyro Calibration

Reusable EV3 Gyro Calibration My Block

Gyro Sensor Calibration program we created in the above section can be turned in a reusable My Block. The following screenshot shows how to turn the program into EV3 Gyro Calibration My Block.

EV3 Gyro Calibration My Block
EV3 Gyro Calibration My Block

With our newly created reusable Gyro Calibration My Block, we can easily calibrate the Gyro sensor before running any programs that use it. The screenshot below provides an example.

To ensure that the robot remains motionless during calibration, our team raises their hands while performing the Gyro Calibration.

Using EV3 Gyro Calibration My Block
Using EV3 Gyro Calibration My Block