i am going to build a tank robot with obstacle avoidance. Whilst searching across the internet i have come across 3 types of suitable sensor to avoid obstacles they are Ultrasonic, infrared, Microswitch. Which one shall i use and what are the pros and cons of them. Thanks for your help.
you can go with ultrsonic sensor
I'd risk to say that you need to narrow your choices, or make your mind up first.
Microswitch are contact sensors (touch and perceive); ultrasonic sensors are non-contact and work reasonably well from few cm up to approx. 5 m, depending on the target size; infrared sensors are also non-contact sensors used for small range (centi to decimeters).