build details

Show: section status errors & todos local changes recent changes last change in-page changes feedback controls

Part 2: IR Sensor Overview

Modified 2020-10-18 by sageshoyu

Preface

Modified 2020-07-21 by Garrett Warren

At a high level, a sensor is a device that observes something about the world and reports its observations on an electrical wire. For example, a camera can be a sensor.

In contrast, an actuator is a device that does something when provided power via an electrical wire. For example, a motor can be an actuator.

The simplest possible robot is one that has only actuators. However, a robot with any amount of autonomy would also require sensors. This is because such a robot would need observations about its world in order to decide what to do with its actuators.

In this part of the build, you will be adding your first sensor to the drone – the infrared (IR) sensor. The IR sensor is used to measure distance. We’ll provide more details about the hardware used in this portion of the build, explain the circuit you’ll be creating, and then get into the instructions.

Required Materials

Modified 2020-08-05 by Garrett Warren

You will need Build Part 1 completed before you can begin this build part.

Detailed Hardware Descriptions

Modified 2020-08-05 by Garrett Warren

Infrared (IR) Sensor

Modified 2020-08-05 by Garrett Warren

The IR sensor is used to measure distance. On the drone, we use this sensor to measure the height of the drone above the ground. The sensor works by emitting infrared light from one side, and measuring the angle of reflection on other. The sensor outputs a voltage value that varies inversely with distance to an object. After powering up your sensor, you’ll be able to read the voltage output from the sensor using a multimeter.

Infrared Sensor and Wire

Analog to Digital Converter (ADC)

Modified 2020-08-05 by Garrett Warren

The Raspberry Pi GPIO pins can only read digital signals (1’s and 0’s). However, the IR sensor outputs an analog signal (a voltage value). In order for the Pi to read the output of the IR sensor, the analog output must be converted to digital first. This is the purpose of the Analog to Digital Converter, or ADC for short.

Analog to Digital Converter

In order to connect the IR sensor and ADC, you will be creating the following circuit:

ADC Circuit Block Diagram

Build Progress

Modified 2020-08-05 by Garrett Warren

After completing this section, your build will match the diagram below. Compare this diagram to the completed drone diagram and to the Part 1 diagram to see how what you’re building up to the final result.

Diagram for Build Part 2

The IR sensor receives power from the Pi Hat, and the sensor output signal is received by the ADC. The ADC converts the analog signal into a digital signal, and passes this to the Pi using the SCL and SDA inputs, (which is called I2C protocol).