Sensors

Sensors in EV3 are very important because they help the robot "see" and "feel" its surroundings in order for EV3 to make smart decisions based on what it senses.

There are 5 type of sensors:

Gyro Sensor

gyro

-> The Ultrasonic Sensor in EV3 it help the robot to make accurate turns.

TIt's especially handy for tasks like driving in a straight line, making precise turns, or maintaining balance on two wheels.

Without the Gyro Sensor, the robot might wobble, tip over, or get lost easily.

compass-degree

The Gyro Sensor is like a compass inside the robot's brain. It helps the robot know:

Which way it's facing, just like how you know which way is north when you use a compass.

Add the Gyro sensor to the robot by:

IMG-2014

A way to know how much degrees is:

ev3-connected-gyro

-> This shows the amount of how much the robot have rotate.

-> It can be either positive(to the right) or negative(to the left) numbers.

-> It is shown in degrees

Wait until "90 degrees"

2-Gyro-waituntil

Or

Gyro-waituntil
gyro

1- Move until gyro sensor > 90 degrees

2- Robot stop moving

1-gyro-90-wait-Until

1- Wait [Motors make a right spin turn at speed of 50%] UNTIL [gyro sensor counts "more than 90 degrees"]

2- Stop turning.


"Reset angle" block

gyro-reset-Angle

It's very important to add the reset angle. Because:

-> Gyro sensor does not know where you want the robot to point (the zero degree)

2- Will add extra degrees which make your robot not accurate.

Spin Turn Right:

gyro
2-Reset-Angle

1- Wait [Motors make a RIGHT spin turn at speed of 50%] UNTIL [gyro sensor counts "more than 90 degrees"]

2- Stop turning.

⚠ If it's not accurate, you can add/substract the degrees from "90"

Spin Turn Left:

gyro (1)
5-turn-left-gyro

1- Wait [Motors make a LEFT spin turn at speed of 50%] UNTIL [gyro sensor counts "more than 90 degrees"]

2- Stop turning.

⚠ If it's not accurate, you can add/substract the degrees from "90"


Remember in this challenge in Movement?

I told you that we are going to fix this challenge to make the turns more accurate

movement-gif

Notice that the robot does not turn accurately.

10-4-Square-Challenge1-img

We are going to fix it by using: gyro sensor

gyro (3)

-> Notice that I used the control: "Repeat" block

-> I decided to do it the other way, turning to the right instead of left

-> But you can do it making the robot turning right

3-gyro-90-repeat

-> Fix the turn of your robot. Because it depends on the ground surface where the robot it's in. For example:

- If my robot it's in a slippery ground, I will need less than 92 degrees.

- If my robot it's in a hard ground, I will probably need more than 92 degrees.

I needed 92 degrees to make the robot turn how I wanted it.


Key-Takeaways: Why is Touch sensor important for programming?

Time for a quiz!

Question goes here

Challenge for you

gyro (2)

Hint:

-> Robot stops when gyro sensor sense "180 degrees" (half circle)

-> Use "start moving" to right: 90. The speed is 50%.

4-gyro-180-wait-Until

You might need more or less than 180 degrees. So it's okay if it's not 180 degree to make the robot turn half circle.