The Gyro sensor can be positioned horizontally, vertically or at a random angle. Have you ever wonder what does the gyro detect when it is positioned vertically. This is the subject of this video tutorial for the LEGO Mindstorms EV3 Gyro Sensor.
- 01 Jan 2017
Previous video tutorials:
Instructions for building the EasyBot are available at:
Previously we did a program that turns the robot to 90 degrees and then returns back the robot. Now an interesting question here is what will happen if we remove the sensor from here and place the sensor like this. It's not horizontal, but vertical. Would the program work, what would be the value returned from the gyro sensor? Let's check out the program.
Same program as before only this time the sensor is positioned vertically. I'll run the program.
The robot does not stop, I'll stop the program and we see that there is a completely different value returned from the sensor. It returns 19 degrees. Although the whole motor is turning the gyro sensor detects that it's turning on 19 degrees. Why does this happen with the sensor? Let's run the program again.
The motor turns, make a few rotations but the sensor is detecting an angle that's increasing very slowly.
This time only to 40 degrees angle. Let's see the construction. What actually happens here is that when the sensor detects an angle of turning in a plane. There's quite some mathematics here in the sensor going on. Without entering into much detail. When we have the sensor perfectly aligned horizontally and we turn it, it will give us the degree of turning. But if we have the sensor perfectly vertically, like this and we just turn the sensor there's is no turning in the direction of the sensor. So we are turning vertically, but we are not turning in this direction and that's why we are returning 0. We have no turning and that's very tricky with this sensor. When you want to work with this sensor you must have 2 conditions. First, you must either place this sensor perfectly horizontally or perfectly vertically. In our case you see that while we are turning the robot, the sensor returns some values of 14, 40, so it's a slightly increasing value. That's because our whole construction is not perfectly horizontal and the sensor is not perfectly vertical. We must lift the construction like this for about a millimeter or something so that we have the sensor perfectly vertical and if you have it that way it won't detect any turning in the direction the sensor detects turning. So it detects turning in this plane not in this one. That's very tricky for the sensor. Have this in mind when you are using you sensor on you robots. If you want to have some precise turning with the gyro sensor.