Arduino project 57- Obstacle avoiding robot using Arduino

How many times have we wished to have a robot that goes around the house avoiding obstacles? Creating this project with Arduino Uno, an HC-SR04 module and two wheels will take us to be a child.

The robot is able to avoid obstacles, thanks to the ultrasonic range finder sensor that senses obstacle coming on its way. The robot is equipped with two motors. As soon as it perceives an obstacle in its path, it blocks one of the two wheels, thus allowing to turn around and avoid bumping.

There are several robot chassis available on Ebay. You can buy something similar to shown below:
First, we mount the circuit like the following diagram, if you do not use the BC547B transistors and want to use other types of transistors I suggest you take a look at the datasheet of the component you are going to use. You should compare the details and use a suitable one.
The wiring diagram:
After having assembled the components on the breadboard and connected everything, all that remains is to insert the sketch on Arduino through the IDE updated to the latest version. The code is as follows: