How To Make An Object Following Robot
How To Make An Object Following Robot
the Stalkerbot
by mindminus in robots
Intro
Speaking of mobile platforms, you might come up with ideas such as line tracking, obstacle
avoidance, anti-dropping, environment monitoring, etc. But what I am making today, is a robot
that follows an object, relentlessly. I call it the stalkerbot, and it is a lot of fun making this robot.
The basic function of this robot is simple: it follows you. It goes forward as you go forward; goes
backward as you go backward; turns left/right as you turn left/right. When you stop moving, it
stops as well.
I used two range sensors to identify the moving direction of object. You can also add more as
well, but the minimum number that will do the job is two. The scenarios are quite
straightforward, and will be explained later.
Material List
Sharp GP2Y0A21 Distance Sensor (10-80cm) with mounting bracket from Ebay
9g micro servo
Tools
screw driver
soldering iron
computer
Then solder the cables onto motor, and expand the lower chassis with standoffs and the upper
deck.
Screw the Romeo controller onto the upper deck (you can also fix it in the middle of two layers),
and connect the motor cables with M1 & M2 on the Romeo controller.
Make sure to leave some place for the lipo battery, you can either insert it between two layers, or
tape it elsewhere from dropping off.
Please note that the infrared sensor switch is a digital sensor and should be connected to digital
ports: green to GND, red to 5V, yellow to digital. While the Sharp distance sensor is an analog
sensor and should be connected to analog ports: black to GND, red to 5V, orange to analog.
Step 3: Programming
There are five scenarios, basically.
#1
If both sensors detect an object at the same time, and the distance is between 5 and 15 cm: object
in range, just stop and check again.
#2
If both sensors detect an object at the same time, and the distance is less than 5 cm: object too
close, retreat to avoid impact.
#3
If the left sensor detects an object while the right sensor does not: object at left, turn left and
move forward.
#4
If the right sensor detects an object while the left sensor does not: object at right, turn right and
move forward.
#5
If neither of the two sensors detects any object: not in sight, stay still and spin.
I've also enclosed the code for download. Below are explanations of some codes.
When digital infrared switch detects an obstacle, it generates low output; If not, generates high
output.
The range of digital infrared sensor switch I used is 3~80cm, and the range can also be adjusted.
Which is cool.
stalkerbot.zip
Step 4: Epilogue
As for now, the tutorial for this object following robot has come to an end. Hope you all made it!
Next steps? Probably I will grab a mp3 module and a speaker, to make this quirky following
robot more annoying - repeating "Penny, Penny" maybe? (I'm a TBBT fan).
Enjoy.