Vex 1.0 © 2005 Carnegie Mellon Robotics Academy Inc. Touch Sensor This lesson will explain how to hook a standard micro switch into the Vex system to function as a custom digital sensor -Vex offers a limited selection of sensors that are optimized to work with the system -Don’t let this limit your creativity -Off-the-shelf sensors and electrical components can be adapted to work with the Vex system -Adapting off-the-shelf components is different in every case; you should take all the necessary precautions and be sure to understand the electrical behavior and requirements of each device before attempting to use it
Vex 1.0 © 2005 Carnegie Mellon Robotics Academy Inc. Materials Needed Basic components –Limit switch –3-wire cable (12") OR two single wires –Wire stripper Soldering –Soldering pen –Solder –Vice Crimping –Male Molex pins (3) –Molex connector (1) –Crimping tool
Vex 1.0 © 2005 Carnegie Mellon Robotics Academy Inc. The Limit Switch as an Electrical Switch The Limit Switch either connects or disconnects two terminals electrically –The switch has 3 terminals, but only uses two here –COM (sometimes marked GND or ) establishes the electrical ground voltage –The NO ("Normally Open") terminal is electrically disconnected from the COM terminal when the switch is open, and connected when the switch is closed
Vex 1.0 © 2005 Carnegie Mellon Robotics Academy Inc. Limit Switch as a Digital Sensor The voltage at the NO terminal can be used as a digital signal to determine whether the switch is closed or not –NO terminal voltage will default to HIGH (+5V) if the switch is not closed –Closing the switch changes the NO terminal voltage to LOW (0V = ground) –HIGH is a digital 1, LOW is a digital 0
Vex 1.0 © 2005 Carnegie Mellon Robotics Academy Inc. Solder Limit Switch Terminals Set LOW voltage: Black wire to COM terminal Set output voltage: White wire to NO terminal NC terminal and Red wire are unused
Vex 1.0 © 2005 Carnegie Mellon Robotics Academy Inc. Crimp 3-Wire Connector This end of the cable will be plugged into the Micro Controller Create a standard 3- pin Molex connector –Wire order must be Black-(Red)-White –Red cable may be omitted because it is not used
Vex 1.0 © 2005 Carnegie Mellon Robotics Academy Inc. Plug In to Micro Controller Plug the crimped connector into the Micro Controller –Analog/Digital port bank in an Digital Sensor Port –Port 5 is set this way by default –Black wire must go on the same side as black wire on regular Vex connectors
Vex 1.0 © 2005 Carnegie Mellon Robotics Academy Inc. Load Online Code to Test Connect the micro controller to the PC and turn it on In easyC: –Build & Download menu –On-Line Window –Download On-Line Code Push the switch arm and watch “Digital Input 5” change