Introduction: Follow Me... Petbot

Picture of Follow Me... Petbot

Do you ever had felt lazy to pull your pet along the street when you take it for a walk. Now don't worry. I got a perfect solution for it .Thinking of making robots, you might come up with ideas such as line tracking, obstacle avoider, anti-drop Robot, environment monitoring Robots, etc. But what we are going to make today, is a robot(or a pet) that follows an object, relentlessly. The basic function of this robot is simple: it follows you. It goes forward as you go forward; when you stop moving, it stops as well.

I used an Ultrasonic range sensor to identify the moving direction of the object. You can also add more number. The minimum number that will do the job is one. Here by measuring the pulse width of the echo pulse from ultrasonic sensor we can get the range of the object in front of the robot. Here we created an algorithm which will move the robot forward when the object is moving forward within the programmed range and backwards in the same manner. Here we will implement Software Pulse Width Modulation which can convert normal digital outputs to the PWM output pins of the Arduino.

Step 1: Video

Watch the video...It's my friend and mine project at

Step 2: Prerequisites & Equipment:

You are going to need the following:

1. An Arduino Board or Arduino clone (Here is a guide to identify a cloned Arduino)

2. Two DC Motors or (Hobby DC motors with L298N Drive) , An Ultrasonic Sensor.

3. Robot chassis and wheels which suit your chassis size and motor size.

4. Arduino IDE for the programming.

5. You may add LEDs as your wish.

Step 3: Block and Circuit Diagram

Picture of Block and Circuit Diagram

Hardware assembly:

Make the circuit as is given by the circuit diagram. Make the robot assembly with your selected parts and connect the motors to the circuit.(You may use this project guide) Optocouplers are used to safeguard the Arduino from High voltage risks.

Step 4:

Picture of

(This circuit is for professional... For beginner please refer Project Guide for more information and hints)

Step 5: ​Installing the SoftPWM Library:

Download this zipped file and unzip it under the library directory of the Arduino IDE folder.

For example, for my computer's setup, the directory is


After copying files across,

the directory XXX\arduino-1.0.1\libraries\SoftPWM

Load the program code.ino after you save it onto your computer and open it in the Arduino IDE. (Link for code.ino is available at the bottom)

Step 6: ​Coding Description:

Setup and initializations:


SoftPWMSet(pin, 0);

SoftPWMSetFadeTime(pin, rt, ft);

These are the functions used to initialize Software PWM in the Arduino. “pin” can be replaced with any pin number available on the Arduino board you are using. “rt” refers to the rising time of the starting of pulse which is represented in milliseconds and “ft” which refers to the falling time of the end of a pulse which is also represented in milliseconds. Here, I used SoftPWM to reduce the speed of the Motor, as my motor RPM is high. If you have a less RPM motor you can use the normal digital output of the pins which is given as the comment in the code.

Step 7: Algorithm:

Distance of the object is measured in centimeters.

if (cm < 25 && cm > 14) { This condition is to move forward the robot when the object is in the range of 14 to 25 centimeters. }

if (cm < 14 && cm > 12){ This condition is to make the robot stable when the object is in the range of 12 to 14 centimeters. }

if (cm < 12 && cm > 2) { This condition is to move backward the robot when the object is in the range of 2 to 12 centimeters. }

if (cm > 25){ This condition is to stop the robot when the object is in the out of range i.e greater than 25 centimeters. } .

Step 8: Vote Me

Picture of Vote Me

That's all for now.....

As my request, pls vote me in Make It Move Contest 2017 and DO NOT copy this instructable because it's full of my effort and money.


odinnido12 (author)2017-09-26

You left a watermark on "your" youtube video. You are poisoning the community by copying people's work and then asking others not to do it to you. It's the same thing with your other posts. This platform is for people who want to express their creativity and ideas, not cheat others so that they can win prizes.

TamilHagilan (author)odinnido122017-09-29

It says that (Watch the video...It's my friend and mine project at below the Video section. It's name is not cheating.

And checkout every of my posts i had my copied my other posts in other websites like this and giave a link for my profile in it.... Next time watch carefully before judging others.....

About This Instructable




Bio: Im just 13 years old and im interested in robotics and arduinos. But don't ever underestimate me!!!
More by TamilHagilan:WaiterB0TSurveillance Droid Storage Bug
Add instructable to: