LogoLogo
  • Introduction
  • Getting Started with Control Hub
    • Connect to the Robot Controller Console
    • Updating Wi-Fi Settings
    • Connecting Driver Station to Control Hub
    • Wiring Diagram
    • Next Steps
  • Getting Started with Driver Hub
  • Adding More Motors
    • SPARKmini Motor Controller
    • Adding an Expansion Hub
  • Troubleshooting the Control System
    • General Troubleshooting
    • Control Hub Troubleshooting
    • Driver Hub Troubleshooting
      • Driver Hub Battery Troubleshooting
    • Expansion Hub Troubleshooting
    • Status LED Blink Codes
  • System Overview
    • Control Hub Specifications
    • Expansion Hub Specifications
    • Driver Hub Specifications
    • Port Pinouts
    • Protection Features
    • Cables and Connectors
      • XT-30 - Power Cable
      • JST VH - Motor Power
      • JST PH - Sensors and RS485
    • Integrated Sensors
    • Dimensions and Important Component Locations
  • Updating and Managing
    • Managing Wi-Fi on the Control Hub
    • REV Hardware Client
    • Updating Firmware
      • Firmware Changelog
    • Updating Operating System
      • Control Hub Operating System Changelog
    • Updating Robot Controller Application
      • Updating Robot Controller Application via Android Studio
    • Updating the Driver Hub
      • Driver Hub OS - Change Log
    • Accessing Log Files
    • Android Studio - Deploying Code Wirelessly
  • Hello Robot - Intro to Blocks Programming
    • Welcome to Hello Robot!
    • Where to Program - Client vs. Browser
      • What is an OpMode?
    • Setting up a Configuration
      • Common Errors in Configuration
    • Using a Gamepad
    • Part 1: Tackling the Basics
      • Tackling the Basics Directory - Blocks
      • Creating an OpMode - Blocks
      • Programming Essentials
      • Programming Servos
        • Programming Servo Basics
        • Using a Gamepad with a Servo
        • Programming Servo Telemetry
      • Programming Motors
        • Programming Motors Basics
        • Programming a Motor with a Gamepad
        • Programming Motor Telemetry
      • Programming Touch Sensors
      • Programming Color Sensors
        • Color Sensor Telemetry
        • Detecting Color
    • Part 2: Robot Control
      • Robot Control Blocks Directory
      • Programming Drivetrain Motors
      • Arcade Style TeleOp - Blocks
        • Establishing Variables in Blocks
        • Motor Power vs. Robot Movement
        • Programming Arcade Drive
      • Arm Control - Blocks
        • Adding a Limit Switch
      • Robot Control Full Program
    • Part 3: Autonomous and Encoders
      • ElapsedTime - Blocks
        • ElapsedTime Setup
        • ElapsedTime Logic
        • ElapsedTime - Multiple Movements
      • Encoder Basics
      • Drivetrain Encoders - Blocks
        • Converting Encoder Ticks to a Distance
        • Moving to a Target Distance
        • Setting Velocity
        • Turning the Drivetrain Using RUN_TO_POSITION
      • Arm Control with Encoders - Blocks
        • Estimating the Position of the Arm
        • Calculating Target Position
        • Using Limits to Control Range of Motion
    • Part 4: Going Beyond!
      • Exploring Functions
      • Programming Mecanum - Simplified
      • Programming Mecanum - Refined
  • Hello Robot - Intro to OnBot Java Programming
    • Welcome to Hello Robot!
    • Where to Program - Client vs. Browser
      • What is an OpMode?
    • Setting up a Configuration
      • Common Errors in Configuration
    • Using a Gamepad
    • Part 1: Tackling the Basics
      • Tackling the Basics Directory - OnBot
      • Creating an OpMode - OnBot
      • Programming Essentials
      • Programming Servos
        • Programming Servo Basics
        • Using a Gamepad with a Servo
        • Programming Servo Telemetry
      • Programming Motors
        • Programming Motor Basics
        • Programming a Motor with a Gamepad
        • Programming Motor Telemetry
      • Programming Touch Sensors
    • Part 2: Robot Control
      • Robot Control OnBot Java Directory
      • Programming Drivetrain Motors
      • Arcade Style TeleOp - OnBot Java
        • Establishing Variables in OnBot Java
        • Motor Power vs. Robot Movement
        • Programming Arcade Drive
      • Arm Control - OnBot Java
        • Adding a Limit Switch
      • Robot Control Full Program
    • Part 3: Autonomous and Encoders
      • ElapsedTime - OnBot Java
        • ElapsedTime Setup
        • ElapsedTime Logic
        • ElapsedTime - Multiple Movements
      • Encoder Basics
      • Drivetrain Encoders - OnBot Java
        • Converting Encoder Ticks to a Distance
        • Moving to a Target Distance
        • Setting Velocity
        • Turning the Drivetrain Using RUN_TO_POSITION
      • Arm Control with Encoders - OnBot Java
        • Estimating the Position of the Arm
        • Calculating Target Position
        • Using Limits to Control Range of Motion
  • Sensors
    • Introduction to Sensors
    • Digital
    • Analog
    • I2C
      • IMU
        • Orientating the IMU
      • Adding an External IMU to your Hub
    • Encoders
      • REV Motor Encoders
      • Through Bore Encoder
    • Using 3rd Party Sensors
      • Sensor Compatibility Chart
  • Useful Links
    • REV DUO Build System
  • Legacy Documentation
    • Configuring Your Android Devices
    • Expansion Hub with Android Device Robot Controller
      • Driver Station and Robot Controller Pairing
      • Wiring Diagram
      • Configuration
    • REV Hub Interface Software
Powered by GitBook
On this page
  • Digital Sensor Basics
  • Wiring
  • Configuration
  • Applications

Was this helpful?

Export as PDF
  1. Sensors

Digital

PreviousIntroduction to SensorsNextAnalog

Last updated 1 year ago

Was this helpful?

Digital Sensor Basics

The information from digital sensors comes in two states, also known as binary states. The binary state of a digital sensor is either low or high. This is similar to a light switch being on or off.

Binary information, or states, can be thought of as an "either/or"; a light switch can either be in an 'on' state or an 'off' state. On/off, 0/1, low/high, and FALSE/TRUE are all different ways of presenting binary information. In programming FALSE/TRUE is used most often.

The main difference between a light switch and a digital sensor is that a digital sensor has a default state. The default state is typically its inactive states. Digital sensor datasheets typically will report the sensors active behavior, either active-low or active-high. With an active-high behavior, when the digital sensor is triggered (or activated) you can detect a change in code from a "logic" low state to a "logic" high state.

Logic Level represents the voltage difference between the signal and ground of the Control and Expansion Hub's sensor ports. Both Hubs and REV Sensors operate on a 3.3V logic level. This means the digital sensor needs an operating voltage of 3.3V for use with the Hub. If you are looking to use a 5V digital sensor you will need a Logic Level Converter. See for more information.

This change is from FALSE to TRUE and you can program your robot to act accordingly with this information. Check the datasheet for the sensor you are using to determine its active behavior is and how the behavior is reported in your code.

REV carries the following digital sensors:

  • Touch Sensor ()

  • Magnetic Limit Switch ()

Wiring

Each digital port on the Hub is capable of acting as two separate ports, thanks to the two channels of communication. This is why the ports are marked as 0-1, 2-3, etc. The image above shows which channel of communication corresponds with which port. The n+1 channel operates on odd-numbered ports 1-7 and the n channel operates on the even number ports 0-6.

Two digital sensors may be hosted on the same physical port using the Sensor Splitter Cable. That being said, it is important to check the Pinout Diagram included in the datasheets for each individual sensor, as certain sensors, like the Touch sensor, use only one of the communication channels.

Configuration

Before a sensor can be programmed it must be added to the Robot Configuration. The configuration file stores all configured devices in the Control Hub's "hardwareMap," which can be called to in the code to establish the line of communication between devices.

The steps below show the basic configuration for digital devices. In the example, the Touch Sensor is configured as "REV Touch Sensor" on port 1.

Step 1

While in the configuration select the Digital Devices option. This will open a screen that shows the eight digital ports.

Step 2

In the drop-down menu for Port 1 select "REV Touch Sensor." After it is selected name the sensor. In this example, the Touch Sensor is named "touch," but any naming convention can be used.

Step 3

When you have finished configuring the sensor hit Done. The app will return to the previous screen

For more information on configuring the Touch Sensor or Magnetic Limit Switch go to the sensor datasheets.

Applications

How do digital sensors help a robot navigate the world around it? The REV Touch Sensor and REV Magnetic Limit Switch are most commonly used as limit switches! Limit switches can help detect when a mechanism, like an arm and/or a lift, has reached its physical limits. Installing a limit switch can help keep robot mechanisms from overextending and breaking. They can also be used to zero out the position of motor encoders to further reduce mechanical failure.

For more information on how to use the REV Digital Sensors as limit switches, sensor specifications, coding examples, and more; click one of the links below to head to the sensor datasheets

Digital sensors connect to the Control Hub (), or Expansion Hub (), via a JST PH 4-Pin Sensor Cable and the Digital Ports, shown in the image above. The color-coding of the digital ports in the image corresponds with each wire in the JST PH 4-Pin Sensor Cable. Following convention, the black wire is ground and the red wire is power. The blue (n) and white (n+1) wires are the communication (signal) channels along which the sensor sends feedback to the Hubs.

REV-31-1595
REV-31-1153
Touch Sensor (REV-31-1425)
Magnetic Limit Switch (REV-31-1462)
Digital LED Indicator (REV-31-2010)
Using 5V Sensors
REV-31-1425
REV-31-1462