AVR Ultrasonic Obstacle Avoider

This is the program of “simple obstacle avoider robot using ultrasonic sensor“. This program is designed for ATMega16 microcontroller.

Hardware setup

Before burning this program directly into your robot ATMega16 microcontroller, understand the hardware requirements and connection details of your robot.

The ultrasonic sensor used is HC-SR04 type. The connection details of this sensor are given below:

Connection details and internal structure of Ultrasonic sensor used in ATMega16 robotic kit

The trigger pin of this sensor is connected to PA1 and echo pin is connected to PA2 of ATMega16 microcontroller.

The motors of your robot must be connected to PB3-PB0 i.e. the left motor is connected across PB3 & PB2 such that +ve terminal of the motor is connected to PB3. Similarly the right motor is connected across PB1 & PB0 such that its +ve terminal is connected to PB0.

Now once the hardware connections are setup properly you can download the complete editable file of the program as well as the .hex file, below.

All the best…!