In this project, we will use several ultrasonic sensors to create a robot car with obstacle detection feature. The sensors will help us estimate the distance of the car from the nearby obstacles. Thus allowing us to create routines that we can execute when the car is about to hit the obstacle while moving. If you want to know more on how an ultrasonic sensor work, please refer to 4Duino Ultrasonic Sensor project documentation.

This project makes a robot car move in a straight line unless it detects an obstacle. If an obstacle have been detected, the robot car will simply try to avoid it by turning left or right. In case, there are obstacle present in the left and right, the robot will instead move back. If it detects an object in all four directions, it will stop.

How it works

              as

Components

  • 4Duino
  • 2 Motors
  • Motor Driver
  • 4 Ultrasonic Sensors
  • µUSB cable
  • 5 Volts Power Supply

Implementation

Step 1: Build

sasa

Build the circuit as shown in the following diagram and table.

Step 2: Program

Workshop 4 – 4Duino Basic Graphics environment is used to program this project.

This project requires the Arduino IDE to be installed as Workshop calls the Arduino IDE for compiling the Arduino sketches. The Arduino IDE however is not required to be opened or modified to program the 4Duino.

Open this file using Workshop 4.

file

Note: Download the code here.

Step 3: Comms Port

Connect the 4Duino to the PC using µUSB cable.

                                     8
Then navigate to the Comms tab and select the Comms port to which the 4Duino connected.

Step 4: Compile and Upload

Go back to “Home” tab. This time, click on the “Comp’nLoad” button.

9
After uploading, 4Duino will start moving as soon as it detects a display touch.

Step 5: Connect Power Supply

Finally, connect a 5 Volts power supply via µUSB.

                             ca

Demonstration

Now, here are the states the robot car will do.

obstacledemo

The chassis for the robot car was made from acrylic using laser cutting technology. However, you can easily make your own with other materials or buy from the market.

FLOW CHART

flow-chart