I have a PIC16F917 microcontroller that is used to operate a robot. I would like to add a sensor to it that will allow me to detect obstacles. How can I determine what sensor I should be using for this? Are there any special protocols I should be looking for to work with my PIC?
There are so many sensors which can be used to detect objects in front of your vehicle.
These work as you might expect. One transducer sends out a 'blip' that's too high pitched for a human to hear, and measures how long it takes for the sound to reflect back from surfaces. These aren't perfect, however, and rely on there being a good reflecting surface. You may find that they just don't detect long-haired dogs, table legs, or hard flat surfaces at an angle.
Sharp optical distance sensor:
These work by shining out a beam of infrared light, and basically looking at the spot it makes on a surface with a tiny 1D camera inside. The output is an analogue voltage which can be directly connected to one of your PIC's analogue input pins.
A really simple way to detect objects is to make some whiskers. Think of these simply as switches with a very long lever attached to them. You can either buy some cheap microswitches and attach sticks to them, or make your own using metal wire.