Skip to main content

Sensor Guide

Sensors

What are sensors?

Sensors are devices that respond to an input and produce an output. They convert external data to something we can interpret, analyze, and possibly input to another system. There are many examples of sensors in everyday life:

  • Thermometer in a thermostat
  • Tire pressure sensors
  • Photoreceptor in a camera
  • Humidity sensor for a greenhouse
  • Motion infrared sensors in security devices
  • Accelerometer in a video game controller.

CoDrone EDU Sensors

The CoDrone EDU drone has multiple sensors:

  • Motion sensor, which is an Inertial Motion Unit and contains multiple sensors in itself:
    • Accelerometer, responsible for acceleration readings.
    • Gyroscope, responsible for stabilizing the drone and reading angular velocities and orientation.
    • Temperature sensor, responsible for reading internal temperature.
  • 2 range sensors:
    • Bottom range sensor, responsible for height detection above a surface.
    • Front range sensor, responsible for reading distances from obstacles.
  • Pressure Sensor, which is utilized in height detection as well.
  • Optical flow sensor, which is responsible for estimating position of the drone.
  • 2 color sensors, which are responsible for color detection.

Read through the rest of this page to learn more about each sensor!

Motion Sensor

Purpose

The CoDrone EDU drone's motion sensor is an IMU (Inertial Motion Unit) that consists of an accelerometer, gyroscope, and a temperature sensor and is responsible for measuring the drone's acceleration, angular velocity, orientation, and internal temperature.

Location

It is located inside the drone on the PCB (Printed Circuit Board).

Data Collected

DataSensorRangeUnits
X-AccelerationAccelerometer-1568 – 1568meters per second, squared x10
Y-AccelerationAccelerometer-1568 – 1568meters per second, squared x10
Z-AccelerationAccelerometer-1568 – 1568meters per second, squared x10
X-Angle (Roll)Gyroscope-180 – 180degrees
Y-Angle (Pitch)Gyroscope-180 – 180degrees
Z-Angle (Yaw)Gyroscope-180 – 180degrees
X-Angular VeloctiyGyroscope-2000 – 2000degrees per second
Y-Angular VeloctiyGyroscope-2000 – 2000degrees per second
Z-Angular VeloctiyGyroscope-2000 – 2000degrees per second
Internal TemperatureTemperatureCelsius

Interpreting Data

Accelerometer:

  1. The units for the acceleration data is multiplied by 10. To convert these values into meters per second, squared, you must divide the data by 10. For example, at rest, the accelerometer will read a z-acceleration of 98, meaning you would have to multiply this by 10 to get 9.8m/s2.

Gyroscope:

  1. Turning the drone to the left will display positive z-angular velocity or yaw velocity readings. Tilting the drone forward will display positive y-angular velocity or pitch velocity readings. Tilting the drone right will display positive x-angular velocity or roll velocity readings.
  2. Angle data goes from -180 degrees to 180 degrees, not 0 degrees to 360 degrees.
  3. Taking off or inserting the battery into the drone resets the gyroscope (resetting the initial orientation).

Tempertature Sensor:

  1. The temperature readings represent the drone's internal temperature, not external (environmental) temperature.

Programming Applications — Python Functions

Accelerometer

get_accel_x()
get_accel_y()
get_accel_z()

Gyroscope

get_angle_x()
get_angle_y()
get_angle_z()
get_angle_x()
get_angle_y()
get_angle_z()
reset_gyro()
turn_degree()
turn_left()
turn_right()

Temperature

get_drone_temperature()

Programming Applications — Blockly blocks

Accelerometer

Gyroscope





Temperature


Range Sensor

Purpose

The range sensor relies on an infrared sensor chip, which consists of an IR (infrared radiation) emitter and IR receiver and is responsible for detecting distances from surfaces or objects. The IR emitter shoots out infrared light, and the IR receiver receives the infrared light that is reflected from the surface. The chip calculates the distance based on the time it took for the infrared light to come back to the receiver.

There are two range sensors on the CoDrone EDU drone: one in the front and one in the bottom, commonly known as the front and bottom range sensor. The front range sensor is commonly used for obstacle avoidance and bottom range sensor is used for height detection.

The range sensors have a range of 1.5m or 1500mm until they start returning a 10.00m (10000mm) due to range sensors timing out.

Location

Front Range Sensor

Bottom Range Sensor

Data Collected

DataSensorRangeUnits
Front RangeFront Range Sensor0 – 200centimeters
Bottom RangeBottom Range Sensor0 – 200centimeters

Interpreting Data

Front Range Sensor:

  1. The front range sensor will not be able to get an exact reading of 0 due to light scattering and interference. The lowest value you may see is approximately 0.9cm (9 mm) by covering the sensor.
  2. The front range sensor will start returning (10.00 meters) 1000 centimeters if the object or surface in front is too far.

Bottom Range Sensor:

  1. The bottom range sensor will be able to get an exact reading of 0 if the drone is sitting on a surface. If the drone is sitting on a surface, the bottom range sensor turns off (causing a reading of 0), so that the color sensor can turn on and detect color without any interference. It is safe to assume that if the drone is sitting on a surface, the bottom range or height is 0.
  2. The front range sensor will start returning (10.00 meters) 1000 centimeters if the object or surface in front is too far.

Programming Applications — Python Functions

Front Range Sensor

avoid_wall()
keep_distance()
detect_wall()
get_front_range()

Bottom Range Sensor

get_bottom_range()
get_height()
get_pos_z()

Programming Applications — Blockly Blocks

Front Range Sensor



Bottom Range Sensor




Pressure Sensor

Purpose

The pressure sensor, commonly known as the barometer, is used to measure the pressure that the drone is experiencing. With the pressure data, it can calculate the drone's altitude, which is the elevation above sea level.

Location

It is located inside the drone on the PCB (Printed Circuit Board).

Data Collected

DataSensorRangeUnits
PressureBarometerPascals
Altitude/ElevationBarometer-1568 – 1568meters

Interpreting Data

  1. By collecting pressure data, you can calculate the height from the ground.

Programming Applications — Python Functions

get_pressure()
get_elevation()
get_pos_z()

Programming Applications — Blockly Blocks



Optical Flow Sensor

Purpose

The optical flow sensor is used to track the X-Y position of the CoDrone EDU drone. The optical flow sensor works is essentially a camera that captures frames of the ground, calculates the drone's velocity based on the differences between each frame, and from there, calculates its position.

Since the optical flow sensor is not able to retrieve height data, the optical flow sensor utilizes the bottom range and pressure sensor data to compute the Z-position (similar to height but Z-position can be negative if the drone takes off at an elevated surface, not the floor). This utilization of the bottom range and pressure sensor data provides more information for the optical flow sensor to accurately compute the X-Y position.

Location

The optical flow sensor is located on the bottom of the drone.

Data Collected

DataSensorRangeUnits
X-PositionOptical Flow Sensor-1000 – 1000centimeters
Y-PositionOptical Flow Sensor-1000 – 1000centimeters
Z-PositionBottom Range Sensor and Pressure Sensor-1000 – 1000centimeters

Interpreting Data

  1. The drone's coordinate system (the X-Y-Z axes) and position data is reset at takeoff or when the battery is inserted into the drone. It does not reset when the drone lands.
  2. The x-axis of the drone points forward from the drone, and the Y-axis of the drone points left from the drone.
    1. If the drone moves left, the y-position increases, and if the drone moves forward, the x-position increases.
    2. However, if the drone rotates or deviates from its initial heading or z-angle (defined by heading at takeoff), the drone's coordinate system will not rotate with the drone. This means, if the drone's heading or z-angle is not 0, left/right movement no longer solely changes y-position and forward/backward no longer solely changes x-position.

Programming Applications — Python Functions

get_position_data()
get_pos_x()
get_pos_y()
get_pos_z()
move_forward()
move_backward()
move_right()
move_left()
move_distance()
send_absolute_position()

Programming Applications — Blockly Blocks


Color Sensor

Purpose

The color sensor is a sensor that projects bright lights onto a surface to help detect how much red, green, and blue light are being reflected. From this, the CoDrone EDU drone calculates the Hue, Saturation, and Value (and Lightness) values. From these values, the CoDrone EDU drone outputs the name of the color, based off of the preset colors that came with the drone. For the CoDrone EDU (JROTC ed.), fresh out-the-box, needs to perform color calibration before it is able to accurately output the color name.

Additionally, both CoDrone EDU and CoDrone EDU (JROTC ed.) drones have 2 color sensors on the bottom of the drones.

Location

The two color sensors are located on the bottom of the drone. This is an image of one of them.

Data Collected

DataSensorRangeUnits
HueColor Sensor0 – 360degrees
SaturationColor Sensor0 – 100
ValueColor Sensor0 – 100
LightnessColor Sensor0 – 100

Interpreting Data

  1. Hue represents the color from the color spectrum (red, orange, yellow, green, blue, purple, etc.) from 0-360.
  2. Saturation represents the color's intensity from 0-100.
  3. Value represents the lightness or darkness of the color from 0-100. Used in the HSV color space only.
  4. Lightness also represent the lightness or darkness of the color from 0-100. Used in the HSL color space only. Value and Lightness represent lightness and darkness but are calculated a different way and used for different purposes/applications.

Programming Applications — Python Functions

get_colors()
get_front_color()
get_back_color()
load_color_data()
predict_colors()

Programming Applications — Blockly Blocks