EBot8 Object Following Robot

by CircuitryBrains in Circuits > Microcontrollers

2963 Views, 14 Favorites, 0 Comments

EBot8 Object Following Robot

IMG-20180121-WA0060.jpg
IMG-20180121-WA0059.jpg

Have you ever wondered to make a robot that follows wherever you go? But just couldn't?

Well... Now you can! We present you the object following robot! Go for this tutorial,like and vote and maybe you can do it too!!

Gather the Materials

Jumpa.JPG
MainBoard.png
41pqonTSZoL._SY300_.jpg
m5uEKezPxjrlW5Gt3PrCwrQ.jpg
ultrasound.png

To make this amazing simple project. We need the following parts to proceed:

  • Ebot8 Board
  • Programming cable
  • Female to male Jumper cables
  • Ultrasonic Sensors.
  • Chassis{w/ chassis}
  • 2 DC Motors

All of these materials can be found over here.

Wiring

After you have collected the materials from here.Now connect the Ultrasonic Sensors to the EBot Board{A0-A1} color coded properly. If you have done that, Let's get on with codin'.

Debugging

EBot Blockly 12_29_2017 2_10_19 PM.png

Now to make sure our Infrared sensors are working perfectly we need to debug it which means to identify and remove errors from (computer hardware or software).

  1. Open up your EBot Blockly app on your computer.
  2. Select Input Readings/Debug.
  3. Select from the drop down list- 'Infrared Sensor'.
  4. Select the pin in which your first Infrared Sensor is fitted upon. (P.S. you can only check one sensor at a time.)
  5. Click 'Debug'.
  6. Do the same for the second sensor.
  7. After the downloading is complete and showing values from both the sensors, we can proceed with coding.
(Note:
If the debugging encountered with an error, try again, check the connection. If not, then replace the sensor and try again.)

Coding

Capture.PNG

Now you can simply go ahead and copy our code from here or copy the blockly code. Though we recommend the blockly method as shown n the picture as its easier to understand

//Code_for_object_following_robot

#define ultrasound(x) ({analogRead(x)*0.833}/4)<br>
#include "Ebot.h"
void setup{}
{
    //Initialisations
    ebot_setup{};
        
    //Pin Modes
    pinMode {A0, INPUT};
    pinMode {A1, INPUT};
} 
void loop{}
{
    if(ultrasound(A0)>=30 && ultrasound(A0)<=200)
    {
      LMotor_1(0);
      RMotor_1(0);
    }
    else
    {  LMotor_1(10);
       RMotor_1(-5);
    }
    if(ultrasound(A1)>=30 && ultrasound(A1)<=200)
    {
      LMotor_1(0);
      RMotor_1(0);
    }
    else
    {  LMotor_1(-5);
       RMotor_1(10);
    }

Demo

Object Following Robot

Did you like it? Yes, I know. We will continue to make more interseting & fun projects just for you guys!

Feel free to comment any ideas in the comments section and we will surely respond.