How to make a very durable and reliable bump sensor for your robot.
This thing was on a robot of mine (https://www.instructables.com/id/EDZ6HPOMV5ET9K6IL7/) for several hours and the robot drove around a small pen. The sensors worked flawlessly the whole time, detected every bump and never got bent out of shape.
Step 1: Do It
Make a bump sensor:
buy some papermate mechanical pencils (as in picture #1)
snap the tip off of one.
yank out the spring (picture #2)
Solder an insulated electrical wire to one end.
get some pipette tips (this is what I used but any number of things could be used) as in picture #3
Get a thin (should fit inside the spring) stiff metal rod. I used a thin metal rod from a broken umbrella I found on the street. Solder an insulated electrical wire to one end (picture #4).
Stick the nonsoldered rod end through the pipette so that about half an inch protrudes (picture #5)
Stick the pipette/rod into the spring and bend the metal rod so that its tip touches the spring around it, and glue the pipette/rod base the the base of the spring (picture #6).
Connect the sensor to your microcomputer as seen in the diagram (last picture). The arrow symbol is the bump sensor (a switch).
NOTE: this is a 'normally closed' bump sensor, so your microcontroller program should be waiting for a 0 (logic low) on its IO pin to signify a bump.