Preview Mode. Sign in to save progress!
You are in preview mode! Progress will not be saved!
Sign in to save your progress!

Detecting Bumps

The Limit Switch

Robots can use Touch Sensors to interact and gain information about its envirment. Touch sensors are most commonly used to detect when a robot has reached a wall, if an object is in the right position, or if a robot's arm has moved to a specific location or limit. There are different types of Touch Sensors with different form factors but they work under the same principle.

limit-switch

Limit Switches are one type of a Touch Sensor, and will be the one that we will use for our project. A Limit switch has a lever that can be used to prevent an arm from moving further than it should. Underneath the arm, you can see a small button that gets pushed when the lever is pushed down far enough.

limit-switch-button

Limit Switches have spring loaded buttons that will "spring open" once the lever arm is released.

Mini Project Control Motor Using A Sensor (Limit Switch)

In this project, you will use a Limit Switch to control when a motor runs. The motor will run when the Limit Switch is pushed in, and will stop when it is released. This project will build on the Motor Control Board Circuit.

limit-switch-circuit
Required items and tools

Find the following components in your kit:

  • Motor Control Board Circuit Motor Control Board Circuit
  • Arduino Uno Arduino Uno
  • USB A-to-B cord USB A-to-B cord
  • Limit Switch Limit Switch
  • 2 Wires (red and black) of 22 AWG 5 pin wire 2 Wires (red and black) of 22 AWG 5 pin wire
  • 22-16 gauge Female Quick Disconnects 22-16 gauge Female Quick Disconnects
  • Insulated Crimper Insulated Crimper
  • Header Pins Header Pins
  • Header Pin Housings Header Pin Housings
  • Header Pin Crimper Header Pin Crimper
Step 1: Prepare the wires
limit-switch-arduino-cable-fit

To connect to the limit switch we will need too create 22 AWG wire with male header pins on one side and a new type of connector, called quick disconnects, on the other end.

22-AWG-split

Start by cutting, separating, and stripping two 22 AWG wire.

Step 2: Attach Header Pins (Male)
red-black-header-pins

Take the red and black wires, and attach male header pins to the end of them.

(Optional) Module: Attaching Header Pins (Male)

For a refresher on how to attach male header pins to your wire, complete the following steps.

Attaching Header Pins Connector: Required items and tools

To begin attaching and crimping spade connectors, you will need the following:

  • 22 AWG Wire 22 AWG Wire
  • Wire Cutter/Stripper Wire Cutter/Stripper
  • Header Pin Crimper Header Pin Crimper
  • Male or Female Header Crimps Male or Female Header Crimps
  • Header pin housings or shells Header pin housings or shells
  • Needle nose pliers or Wire Cutter / Stripper Needle nose pliers or Wire Cutter / Stripper
Note: Extra Components are very Usefull!

You may want to have extra crimps and wires. These crimps are small, require a special crimping tool, precise techniques and practice to create a proper crimp.

Understanding Header Pins

Header pin crimps are made up of three distinct portions: The mating pin zone is the portion of the crimp that interfaces with the component that you are connecting to. The other two portions interface with the wire. There is the conductor crimp zone which is the portion of the cimp that forms around the conductor and makes the electrical connection. The final part is the insulation crimp zone, where this part of the crimp forms around the wire’s insulation. This further securies the wire and creates a strain release. Both male and female header pins are crimped using the same process.

Step 1: Cut wire to length and separate

Cut a piece of the wire to the needed length and separate the number of wire you need from the .

Step 2: Strip the individual wires

Strip the ends of the wire so that 0.10 in or 2.5 mm of wire is exposed. It may be easier to strip the wires longer and trim the exposed wires to 0.10 in or 2.5 mm.

Step 3: Cut off a male or female connector

Cut off the male or female pin off of their connector strips. Keep the metal tab connected to the crimp, it will be used to align the crimp into the header pin crimper.

Step 4: Insert the wire into crimp

Place the wire into the crimp. Make sure the exposed wire is not in the mating pin zone.

Step 5: Fold over the Insulation-crimp

To give your crimp a better chance to be successful use your wire cutters or needle nose pliers to start to fold over the tabs on the insulation crimp zone.

Understanding the Crimper

The recommended crimper has 2 different crimping areas the larger anvil crimps the insulation zone while the smaller anvil crimps the conductor zone. Make sure to line up the zones correctly or the crimp will not crimp properly.

Step 6: Crimp the connector

Use the crimping tool to crimp the conductor crimp zone and the insulation crimp zone. Make sure the Mating pin zone is extended completely out of the crimping tool. If you crimp this part it will deform and will not function

After crimping, if you inspect the connection and see that the crimped parts are not fully compressed onto the wire you may want to crimp the connection a second time.

Step 7: Remove the metal carrier strip

Once the crimp is successfully attached to the wire you can remove the metal carrier strip by bending or cutting it off. After removing that, the crimp is ready to be placed into the plastic housing.

Step 8: Adding the housing

The plastic housing, or shields as they are sometimes called, add structure and support to make the crimp more durable. The plastic housings come in various sizes that can hold multiple connections in one block. Some projects will have all the connections next to each other which make the multi-connection block very convenient to use. Using single pin housing is easier to learn on and creates wires that have more flexibility in how they can be connected.

Both the male and female header pins have a small square or rectangle of metal in the pin mating zone. This metal “tab” will lock itself into the square opening or “slot” in the housing. Make sure the tab and the slot are facing the same direction and push the crimp into the larger opening in the housing. If done successfully the crimp will lock itself in the housing.

If the crimp is having trouble fitting into the housing you may want to use your wire cutters or needle nose pliers to compress the insulation crimp.

Step 9: Test the connection

Perform a pull test to confirm that the crimp will not slip out of the housing. If the housing does not easly slip off you have successfully made a crimp!

Step 3: Attach Quick Disconnects
red-black-quick-disconnects

Follow along with this module to learn how to use quick disconnect crimps.

Quick Disconnect Connector: Required items and tools

To begin crimping both male and female quick disconnects, you will need the following:

  • Male or Female Quick Disconnects Crimps Male or Female Quick Disconnects Crimps
  • 22 AWG Wire 22 AWG Wire
  •  Insulated Crimper Insulated Crimper
  • Wire Stripper Wire Stripper
What are Quick Disconnect Crimp

Quick Disconnect connectors are that can be connected and disconnected with out addtional tools. These crimps always work in pairs, a male connector fits into a female connector. Male connectors can be found built into different electrial components as well as being crimped to wires.

/m-f-disconnects
Step 1: Prepare wire for a Quick Disconnect Crimp
22AWG-stripped

Take the end of the wire, and make sure there is enough conductor exposed to attach the connector -- about 0.5 cm, or a quater (1/4) of an inch is good for this type of clip.

Step 2: Insert exposed wire into the Crimp

Insert the the stripped wire into a male or female crimp. Make sure the wire does not extend past the crimping tube.

Step 3: Insert crimp and wire into crimper slot
crimping-barrel-2.jpg

Insert the crimp and wire into the slot on your crimper that matches the size of the wire.

Step 4: Crimp the connection

Firmly squeeze the handle of the crimper to press the tube around the exposed wire. Many crimper designs will not open back up until you have squeezed far enough -- if the crimper won't open, keep squeezing until it does.

Step 5: Crimp the connection
crimping

Line up the wire and crimp in the jaws and squeeze the crimper until the crimper snaps open.

Step 6: Testing the connection
pulling-quick-disconnect

Give the crimp and the wire a soft pull. If the crimp is secure the wire will not come out of the crimp

Step 4: Attach Wires To Limit Switch
limit-switch-disconnects

Attach the newly created wires to the Limit Switch.

You will need to attach the Quick Disconnect of the black wire to the common "COM" port of the Limit Switch, and the Quick Disconnect of the red wire to the Normaly Open "NO" port of the Limit Switch.

limit-switch-closeup

COM, NC, and NO describe the roles of each terminal:

  • COM or Common is the "common" terminal that connects to either the NC or NO terminal depending on whether the switch is pressed in or not.
  • NC or Normally Closed is the terminal that is the default connection of the switch. When the switch is not pressed down the NC terminal is connected to the COM terminal, creating a "closed" circuit.
  • NO or Normally Open is the terminal that is NOT connected to COM when the switch is released. This creates a gap or "open" circuit between the COM terminal and the NO terminal. When the switch is pressed in the NO terminal is connected to the COM terminal.
Step 5: Connect the Limit Switch
limit-switch-arduino
  • Take you circuit from your Motor Control Board. Make sure the blue and green wires are plugged into ports 13 and 12 respectively. The red and black wires, from the Motor Control Board, should be connected to 5V and GND respectively.
  • To start to connect the Limit Switch connect the male header pin end of the black wire to a GND pin of the Arduino.
  • Connect the male header pin end of the red wire to digital pin 8 on the Arduino.
  • Connecting the limit switch this way will allow the arduino to monitor when port 8 is connected to GND.
Step 6: Power the Arduino
arduino-powered

Connect the Arduino to your computer using the USB A-to-B cable.

Step 7: Open LimitSwitch Program
arduino-open

Download the following program: LimitSwitch.ino

Open the Arduino software and open the LimitSwitch” program.

Step 8: Upload the Program
limit-switch-upload

Click on the Upload button to upload the program to the Arduino Uno. The program should immediately run after it is done uploading.

What happens?

limitSwitchToArduinoToRelayToMotor

The motor should move only when the Limit Switch is pressed in, and stop when it is released!

Explanation

The Limit Switch is connected to the Arduino from a GND to a Digital pin. If you look in the program, you will see that in the setup, it is being set as an "INPUT_PULLUP". What this means is that we are setting up Digital Pin 8 to be an INPUT that is in a special "PULLUP" mode.

limit-switch-pullup

This INPUT_PULLUP mode tells the Arduino to invert the input so that instead of “HIGH” being what we’re used to (on), it inverts it so that it is off. So for the Limit Switch, it allows us to use the pin so that if it is not pushed in, it is not giving the Arduino a HIGH signal.

Limitswitch-Arduino
Contact Us