CxD Archive
Code: Robotics
Code: Robotics
  • Code Introduction
  • TUTORIALS
    • A. Meet Your Robot
      • A-1 Circuit Board
      • A-2 Motors and Wheels
      • A-3 Other Components
    • B. Hello World Test
      • B-1 Arduino Code Editor
      • B-2 New App Template
      • B-3 Global Variable
      • B-4 Setup Function
      • B-5 Loop Function
      • B-6 Upload App to Robot
      • B-7 Add Sound
      • B-8 Use Button
    • C. Driving and Turning
      • C-1 Driving
      • C-2 Turns (Pivoting)
      • C-3 Test Wheel Encoders
      • C-4 Drive for Specific Distance
      • C-5 Pivot By Specific Angle
      • C-6 Drive Straight Continuously
    • D. Detect Objects in Path
      • D-1 Test Mechanical Bumpers
      • D-2 Detect Collisions
      • D-3 Test Ultrasonic Sensor
      • D-4 Avoid Collisions
    • E. Detect Lines on Surface
      • E-1 Test IR Line Sensors
      • E-2 Follow Line
      • E-3 Avoid Line
      • E-4 Count Lines Crossed
      • E-5 Follow and Count Lines
    • F. Detect Other Conditions
      • F-1 Detect Surface Drop-Off
      • F-2 Test Accelerometer
      • F-3 Detect If Upside-Down
      • F-4 Detect If Bumped
  • REFERENCES
    • Arduino Language
    • Arduino Code Editor
      • Create New App
      • Save and Rename App
      • Include RedBot Library
      • Verify App Code
      • Upload App to Robot
      • Download Copy of App
      • Use Serial Monitor to View Data
      • Robot Demo App Template
    • Physical Inputs
      • Push Button (D12)
      • Mechanical Bumpers
      • IR Line Sensors
      • Wheel Encoders
      • Accelerometer
      • Ultrasonic Sensor *
    • Physical Outputs
      • LED Light (D13)
      • Speaker (Buzzer)
      • Motors
    • Robot Behaviors
      • Producing Alerts
      • Driving
      • Turning
      • Detecting Objects
      • Detecting Lines
      • Detecting Other Conditions
    • Navigation Modes
      • Distance Navigation
      • Line Counting Navigation
      • Line Following + Counting Navigation
      • Autonomous Navigation
  • LINKS
    • Robotics Project Guidebook
    • Arduino Create Web Editor
    • Arduino Language Reference
    • RedBot Experiment Guide
  • ELEGOO Experiments
    • Getting the Arduino IDE
    • Starting with the `techCar` Template
    • Template Code for techCar.ino
    • Template Experiments
    • Reinstall the Original Remote App Functionality, If Needed
Powered by GitBook
On this page
  • Tutorial Goals
  • How Mechanical Bumpers Work
  • Check Positions of Whiskers and Bumpers
  • Wire Whiskers
  • Bumper Boards
Export as PDF
  1. TUTORIALS

D. Detect Objects in Path

PreviousC-6 Drive Straight ContinuouslyNextD-1 Test Mechanical Bumpers

Last updated 6 years ago

In this fourth tutorial, you'll learn how to make your robot detect objects in its path by using its mechanical bumpers and (if equipped) ultrasonic sensor.

Tutorial Goals

The goals of this tutorial are to help you:

  • Program a robot app that uses the mechanical bumpers to detect collisions with objects

  • Program a robot app that uses the ultrasonic sensor to avoid collisions with objects

How Mechanical Bumpers Work

The RedBot has left and right mechanical bumpers with "whiskers" to detect collisions with obstacles. Each "whisker" is a flexible metal wire that will bend during a collision. If the wire bends far enough, it will make electrical contact with a metal screw on the bumper board. It is similar to how a switch or button works.

Check Positions of Whiskers and Bumpers

In order for the bumpers to detect collisions accurately, you need to check the positions of the wire whiskers and the bumper boards. Otherwise, it simply may not be physically possible for the wire whiskers to make contact with the metal screw on the bumper boards.

Wire Whiskers

In the normal position (no collision), each wire whisker should be positioned very close to the metal screw on its bumper board. There should only be about ⅛ inch between the wire and the screw. Otherwise, if the wire is too far away, it may not be physically possible for an obstacle to bend the wire far enough to make contact with the screw.

To adjust the position of a wire whisker, you have to loosen the plastic standoff screw on the bottom of the bumper board. In order to physically access this screw on an assembled robot, you may have to remove the entire bumper (by removing the top screw of the plastic standoff, which attaches the bumper to the robot's front end). You also might need to unplug the 3-wire cable that connects to the bumper. After adjusting the wire whisker, correctly reconnect the 3-wire cable, and then reattach the bumper to the robot's front end.

Bumper Boards

Each bumper board should be rotated slightly so the metal screw on the bumper board is positioned slightly in front of the black plastic struts at the front corners of the RedBot chassis. Otherwise, it may not be physically possible for the wire whisker to make contact with the metal screw.

The picture below shows the mechanical bumpers in the correct position. When looking down on the front of the robot, the metal screw of each bumper board (where the wire whisker will make contact) is visible. If you cannot see these metal screws, your bumpers might not be able to work.

To adjust the position of a bumper board, you have to loosen the the top screw of the plastic standoff, which attaches the bumper to the robot's front end. Rotate the bumper board slightly, so the metal screw is further forward than the side strut. Then tighten the top screw of the plastic standoff to secure the bumper.

Mechanical Bumpers (wire whiskers are actually longer)