How to make a cute WALL-E smart robot with Arduino step by step

How to make a cute WALL-E smart robot with Arduino step  by step

Hello and welcome back. In this project, we will learn how to make a cute smart robot with Arduino. For that, I mainly used the Arduino UNO board, ultrasonic sensor, and SG90 servo motor. The L293D motor driver is used for controlling motors. I think that’s a very simple and low-cost project.

Also, I have used a 5mm foam board to make the robot body. You can use other suitable materials for that. I wanted to try building a WALL-E robot and I think it’s a bit similar. I’m not talking about the hardware, just the body shape. Also, I have added a simple program to act as a cute robot. You can also add an obstacle avoidance program to this robot.

Ok, let’s do this project step by step. The required components are given below.

Disclosure: These Amazon links are Affiliate links. As an Amazon Associate, I earn from qualifying purchases.

Step 1

Firstly, identify these components.

Step 2

Secondly, cut the base part of this robot using the following sizes.

Step 3

Thirdly, connect the robot wheels to the gear motors. Then, paste these motors and the caster wheel on the base part.

Step 4

Next, connect the L293D motor driver shield to the Arduino UNO board. Then, install it on the base foam board part.

Step 5

Now, drill two holes and put the motor wires through these holes. Then, connect these motors to the motor driver. For that, I used the M1 and M2 terminals.

Step 6

Next, cut the four foam board pieces for the robot side parts. For that, use the following sizes.

Step 7

Now, cut the top part for this robot. Then, glue the servo motor in front of the top part.

Step 8

Next, install the ultrasonic sensor on the servo horn. Then, paste the battery holder near the servo motor. You can arrange these components as you like.

Step 9

After, drill holes and put the servo wires, battery wires, and four jumper wires through these holes.

Step 10

Now, connect these components to the motor driver shield. For that, use the circuit diagram below.

How to make a cute WALL-E smart robot with Arduino step  by step

Step 11

Now, glue the side parts of this robot that we cut earlier. Also, drill a hole in the front side piece for the USB socket.

Step 12

Next, connect this robot to the computer. Then, copy and paste the following program to the Arduino IDE.

How to make a cute WALL-E smart robot with Arduino step  by step
//include the servo motor library
#include <Servo.h>
//Include the motor driver library
#include <AFMotor.h>

Servo servo;//Servo motor object

int sPoint = 100; // servo start point

//Define the sensor pins
#define Trig A1
#define Echo A0

//Set the speed of the motors
#define Speed 160

//Create objects for the motors
AF_DCMotor motor1(1);
AF_DCMotor motor2(2);

void setup() {
  Serial.begin(9600);
  servo.attach(9);
  servo.write(sPoint);
  //Set the Trig pins as output pins
  pinMode(Trig, OUTPUT);
  //Set the Echo pins as input pins
  pinMode(Echo, INPUT);
  //Set the speed of the motors
  motor1.setSpeed(Speed);
  motor2.setSpeed(Speed);
  delay(1000);
  headMove();
  delay(2000);
  leftSide();
  rightSide();
  left();
  delay(1000);
  Stop();
}

void loop() {
  bool check = true;

  int sValue = ultrasonic();
  if (sValue <= 6) {
    check = false;
    forward();
    delay(300);
    Stop();
    headMove();
  } else if (sValue >= 8 && sValue <= 12) {
    check = false;
    backward();
  } else {
    Stop();
  }
}

//Get the sensor values
int ultrasonic() {
  //pulse output
  digitalWrite(Trig, LOW);
  delayMicroseconds(4);
  digitalWrite(Trig, HIGH);
  delayMicroseconds(10);
  digitalWrite(Trig, LOW);

  long t = pulseIn(Echo, HIGH);//Get the pulse
  int cm = t / 29 / 2; //Convert time to the distance
  return cm; // Return the values from the sensor
}
/*******************Motor functions**********************/

void headMove() {
  for (int a = 0; a <= 5; a++) {
    servo.write(110);
    delay(100);
    servo.write(90);
    delay(100);
  }
}

void leftSide() {
  for (int a = 100; a <= 140; a++) {
    servo.write(a);
    delay(25);
  }
  for (int b = 139; b >= 100; b--) {
    servo.write(b);
    delay(25);
  }
}

void rightSide() {
  for (int a = 100; a >= 40; a--) {
    servo.write(a);
    delay(25);
  }
  for (int b = 39; b <= 100; b++) {
    servo.write(b);
    delay(25);
  }
}

void forward() {
  motor1.run(FORWARD);
  motor2.run(FORWARD);
}
void backward() {
  motor1.run(BACKWARD);
  motor2.run(BACKWARD);
}
void left() {
  motor1.run(BACKWARD);
  motor2.run(FORWARD);
}
void right() {
  motor1.run(FORWARD);
  motor2.run(BACKWARD);
}
void Stop() {
  motor1.run(RELEASE);
  motor2.run(RELEASE);
}

You have to install the AFmotor library file to run this code.

Step 13

Now, select the board and port. After, click the upload button.

Step 14

Finally, glue the top part and put the batteries into the battery holder. Now you can test this robot. The full video guide is below. So, we hope to see you in the next project or tutorial. Have a good day.

Troubleshooting

  • Check all jumper wires.
  • Check components.
  • You must include the library files.
  • Check the program again.

How to make a cute WALL-E smart robot with Arduino step by step

How to make a cute WALL-E smart robot with Arduino step  by step

Similar Posts

Leave a Reply

Your email address will not be published. Required fields are marked *