BEFORE WE START…The EV3 Gyro Sensor is great BUT its performance can need a little bit more ‘managing’ than some of the other sensors. It is prone to things that can frustrate. Obviously, this frustration is overcome when you understand why these things happen and how you can overcome them. For this reason, this resource will focus very specifically on using the Gyro Sensor to measure an angle of rotation (in much the same way that we would use a compass). Using it in this way is a great way of building confidence with the sensor and understanding some of its limitations.
INTRO AND LEARNING GOALSHere is a great framework to get students familiar with the Gyro Sensor:
- Understand how to attach the Gyro Sensor on the correct axis
- Understand the advantages of using ‘Change’ in the Gyro block.
- Create a program to control the rotation of the robot using the Gyro Sensor
- Troubleshooting the Gyro sensor
BASICS OF HOW IT WORKSThe Gyro Sensor detects rotational motion. It does this on a single axis. You need to connect your sensor in the correct orientation – we explain this in the video below: The Gyro Sensor can give us information about the rotation angle in degrees and the rotation rate. We will focus on the rotation angle in degrees.
LET’S ATTACH THE GYRO SENSOR…As we are going to use the Gyro sensor to make the robot turn, we want it to be positioned with the ‘Red Arrows’ facing upwards and the sensor positioned parallel to the ground. You can see where I positioned it at the end of the video below
LET’S GET PROGRAMMING…We are about to create a program to get our robot rotating at a specified angle. In this example, we will get the robot to perform a 180 degree turn using the Gyro Sensor.
SOME TEACHING THOUGHTS… from John
- When you start with sensors, don’t start with the Gyro Sensor! Start with a sensor that will generate fewer frustrations, such as the Colour or Ultrasonic Sensor. When students have more confidence, let them experiment with the Gyro Sensor.
- Use the Gyro Sensor to measure a relative change. So, if you want to rotate 50 degrees, if the starting angle showing on the sensor was 55, it would trigger at 105. This means you don’t have to reset the value of the sensor.
- Keep it simple. Set different angles for your students to perform. Over-learning is a key part of using the Gyro Sensor effectively.
- Use the Port View display in the bottom right corner of your screen. If you are connected to your robot (if you are using the wire to connect you will need to leave it plugged in), you will be able to see the rotation angle that the Gyro Sensor is measuring. It is really useful to see what the Gyro Sensor is actually doing!
HOW CAN I GET THE MOST EFFECTIVE USE OUT OF THE GYRO SENSOR?Here are some key things to try…
- Keep the EV3 and the Gyro Sensor still and steady when connecting up the cable and when starting up the EV3.
- Don’t unplug and then re-plug the Gyro Sensor into the EV3. You won’t damage the EV3, but it will most likely give poor results. If you do though, the next step might help…
- As the angle may “drift” over time and become less accurate, you could look to reset the angle using the Reset mode of the Yellow Gyro Sensor block before every action that you want to measure the angle of. (But you can’t do this on a tablet device – no Yellow blocks!)
- Resetting is different from Recalibrating. Resetting simply resets the value of the Gyro Sensor to zero. A ‘popular’ method to recalibrate the sensor is by switching what it is measuring. This causes the Gyro Sensor to recalibrate. So including this at the start of your program could help:
ROBOT WORKOUT (WHERE NEXT?)
- You can create a simple maze for the robot to move around
- Create different shapes with the robot – you could cover the floor with paper and attach a pen to the robot so that it draws it out! Students could build the pen holder attachment or you could use tape and stick the pen on!