Table of Contents

DIY Follow Me Robot

Follow_Me Robot
Project Description

Introduction

We will move forward and design our first autonomous robot. This robot will follow any object coming in front of it within a range of 5-10 cm. We will be using two IR sensors (proximity sensors), which will detect objects in front of them and send a signal to the robot. Both sensors will be attached in the front of the robot, one on the left side and one on the right side.

Assembly

The annotated base is shown on right. This is the bottom side. There is the evive logo on the top side for your reference. So be careful while using the base.chassis_base

  • Fix the motor mounting brackets to the chassis using M3 bolts of 8mm length and M3 nuts.motor mounting brackets
evive Alert
The motor wires should be inside, otherwise, they will collide with the wheel. Also, while assembling the robot, be careful about the holes you are using. Also, fasten all the nuts and bolts tightly for smooth functionality.
  • Attach the two motors, one to each bracket, side by side and fasten using M3 bolts of 25mm length and M3 nuts.attaching_motor
  • Now, fit the wheels into the protruding motor shafts.attaching_wheels
  • We’ll attach the Castor wheel now. First, we will mount the M3 standoffs (20 mm) on which the Castor will be attached. Fasten the standoffs to the chassis using M3 bolts of 8mm length.
  • Place the Castor on top of the standoffs in the configuration shown and fasten using M3 bolts of 12 mm length.attaching_castor
evive Notes Icon
Keep in mind, that what we have assembled so far (motors and castor) will be pointing downwards.
  • Flip the assembly and place evive on the top of the chassis.placing_evive
  • Using the holes on the back of evive fasten it to the chassis using M3 bolts of 12mm length.Fastening evive
  • We will now attach 2 IR sensors onto the front of the robot.
  • Screw the sensors onto the top side of the base as shown in the figure above using an M3 bolt of 12mm length and M3 nuts.attaching_IR_Sensor

Circuitry of the Robot

Connect the motors and IR sensor wires as shown in the figure on the next page. Be careful while connecting the IR sensors (Note that VCC  is 5V).

Follow Me Robot Both Senors Circuit Diagram

Calibrating IR Sensor

We are using an IR sensor to detect objects in front of the robot. An IR sensor has two small LED indicators. One is for power, which is ON all the time, the sensor is powered. The other LED is the signal LED which tells whether there is an object in front of it or not. There are two states for the sensor:

  • Signal LED is ON (Active): When the sensor detects the object in front of it.
  • Signal LED is OFF (Inactive): When the sensor does not detect the object.

IR sensorWe have to calibrate both the sensors, such that it can detect the object in front of it.

To calibrate your sensor, switch ON your evive. Keep everything at least 15 cm away from the sensors. If the signal LED is OFF, then your sensor is OK for now, otherwise gently turn the potentiometer knob on the sensor in anti-clockwise direction using a screwdriver, such that the LED turns OFF.

Place an object in front of the sensor at about 5cm. The signal LED should turn ON. If it is not ON, gently turn the potentiometer in a clockwise direction, such that the LED turns ON when the object is in front of it and stays OFF otherwise.

Logic and Flowchart

Our robot can execute four actions:

  • Go Straight
  • Turn Left
  • Turn Right
  • Stop or Brake

Now, we have to decide how to make the robot follow any object. This will depend on the state of both the IR sensors.

If both the sensors are active (object in front), then the robot should move forward to follow the object. If only the left sensor is active (object on the left), then the robot should turn left. If only the right sensor is active (object on the right), then the robot should turn right. If both the sensors are inactive, the robot should be stopped (brake).

follow the enemy flowchart

 

Scratch Script

We are now going to create Scratch Scripts to generate code.

We will be writing the code in PictoBlox.

Let us follow the steps:
  • Create blocks GoStraight, TurnRight, TurnLeft and Brake.Go StraightTurn RightTurn LeftBrake
  • Select the Upload mode from menu bar.  Then, select evive as your Board and load the evive, Actuators, and Display extensions.
  • Drag and drop the evive starts up hat block into the scripting area. Drag and drop the forever block below it.
  • We will use if-else block to define actions depending on the state of both the sensors. Drag and drop an if-else block inside forever block. First, we will check if both sensors are active. We will use the not and and block from the operator palette for the same. Below the if arm, place the Go Straight block. Below the else arm, place another if-else block to check for further conditions.
  • In the second if-else block, we will check if only the left sensor is active. If the condition is true, the robot must turn left. For that, drag and drop the Turn Left block below the if arm. Drag and drop another if-else block below the else arm.
  • Now, we will check if only the right sensor is active. If this condition is true, the robot must turn right. For that, drag and drop the Turn Right block below this if arm. If none of the above conditions is true, the robot must stop. For that, drag and drop Brake block below the else arm.
evive Notes Icon
When the sensor is active, the output received in evive is 0V or LOW otherwise the output is 5V or HIGH. Hence, we will use not block to reverse the state of the sensor i.e. if the sensor is active, then the not block gives HIGH.
 
  • Finally, snap a wait block with 0.05 secs value at the end of forever block to make the robot stable. The script is ready and you can directly upload it to evive.Smartphone-Controlled-Robot script

Your robot is ready to follow you everywhere and anywhere you like!

Debugging the Robot

At times, your robot will refuse to behave the way you are commanding it to. Let’s fix this. If upon pressing forward, your robot starts moving backwards or starts turning, that means at least one motor is rotating in the wrong direction. You can fix this by reversing the direction of that motor.

Your forward-backwards controls shall now work perfectly. If the robot turns left upon pressing left and right upon pressing right, your robot is good to go. If it turns right upon pressing left, you can fix this by exchanging wires of both the motors. Ask an elder for help, if you need.

 

Conclusion

With this, your new age pet is all set to accompany you wherever you go!

Project Downloads - Code and Files

Code LabelCode File
PictoBlox Code for Follow Me Robothttps://ai.thestempedia.com/wp-content/uploads/2023/05/Follow-me-Robot-2.sb3

Circuit Diagram

Circuit Diagram DescriptionCircuit Diagram Fritzing Diagram

Connect the motors and IR sensor wires as shown in the figure on the next page. Be careful while connecting the IR sensors (Note that VCC  is 5V).

Explore Related Projects by STEMpedia

Level up your robot control skills by learning how to control a 2-Wheel Drive Robot with hand gestures using PictoBlox AI's Machine Learning extension. Get ready to channel your inner Jean Grey!
Learn how to make a two-wheel-drive robot and code on the go with PictoBlox's mobile app. Control your robot in real-time with your smartphone!
Learn how to make an automatic chocolate dispenser to delight Santa this Christmas. All components can be found in the evive Starter Kit. Let's begin!

Explore Community Projects