Before you start experimenting with the sensors you should have a basic background information about how the sensors work. We will be looking at two basic sensors: the touch sensor and the ultrasonic sensor.
The touch sensor has a button at the front that can be pressed. When the button is pressed the sensor sends a signal to the EV3 brick, the EV3 brick can then use this signal to make decisions about what it wants to do next.
You can think of the touch sensor as a light switch, when the switch is on (button is pressed) the light is on (signal to the brick). When the switch is off (button is not pressed) the light is off (no signal to the brick).
When you use the sensor in the Mindstorms program you will see there are three options for the touch sensor:
- 0 (Released) – The button is not being pushed
- 1 (Pressed) – The button is being pushed
- 2 (Bumped) – The button has to be pushed first and then released
The ultrasonic sensor looks like it has eyes and it can use these eyes to “see” what’s in front of it. The ultrasonic sensor can’t really see but it there is an obstacle in front of it the sensor can measure how far away the obstacle is.
The ultrasonic uses the same principle bats use to sense their environment: echolocation. The sensor sends out sound that we can’t hear (ultrasonic) and measures how long it takes for that sound to bounce of an obstacle and come back to the sensor. It then uses that time to calculate a distance.
There are different settings for using the ultrasonic sensor in the Mindstorms software, for this class you will always measure distance in centimeters (cm).