Ultrasonic sensor is used to detect the obstacle. The ultrasonic sensor emits and receives ultrasonic waves. The emitted wave will be reflected after hitting the obstacle. The time when waves are emitted and received will be used to calculate the distance between robot and the obstacle.