Chapter 4. Sensors and Control

In this chapter, we will have the robot respond to the environment using the sensors available in your kit. You will also take a reading from the sensor to display on both the EV3 brick and the computer screen. I will try to focus on information that is not already readily available in the EV3 help menus.

In this chapter, I will introduce:

  • Programming blocks for sensors
  • Official LEGO sensors such as:
    • Touch Sensors
    • Color Sensors
    • Motor rotation sensors
    • Gyro Sensors
    • Ultrasonic motion sensors
    • Infrared Sensors
  • Third-party sensors such as:
    • Dexter industries
    • Mindsensors
    • HiTechnic
    • Tetrix
    • Matrix
    • Vernier

Using sensors

What is great about the official LEGO EV3 (and some NXT) sensors is that the software on the EV3 brick will Auto-ID the sensors as soon as they are plugged in. This makes it easy to use the sensors because you do not need to tell the brick what you plugged in. If you are using older LEGO sensors or sensors from other manufacturers, you will have to download and import sensor blocks that will control those sensors. The sensor blocks have the code to control the sensor and convert the signals from the sensor into readable values. You can download these .ev3b files from the manufacturer's website. These third-party companies include HiTechnic, Dexter, and Vernier to name a few. The Retail Home Edition and the Educational Edition of the EV3 kit come with different sensors. The Educational Edition of the software is ready to use all of the EV3 sensors. The Retail Home Edition of the software is not ready to use the gyro or the Ultrasonic motion sensor. To use the gyro or the Ultrasonic motion sensor, you will have to download the sensors blocks from LEGO. Later in this chapter, we will download and import these sensor blocks. But first we are going to learn how to use the sensors in your kit. We can use sensors to collect data or we can use them to allow the robot to react to the environment. In the Educational Edition of the software, we can collect large data sets from the sensors using the Data Logging features that we will explore in Chapter 9, Experiment Software and Data Logging.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.223.172.224