How to Make a Cute WALL-E Smart Robot With Arduino Step by Step

by Webotricks in Circuits > Arduino

3 Views, 0 Favorites, 0 Comments

How to Make a Cute WALL-E Smart Robot With Arduino Step by Step

Untitled design (55).png

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.

Supplies

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


1 Arduino-Uno - BUY NOW

Jumper-Wires - BUY NOW


Gear motor — BUY NOW


65mm Robot wheel x 2 — BUY NOW


Caster wheel x 1 — BUY NOW


Lithium Battery (3.7V) x 2 - BUY NOW


Lithium Battery Holder x 2 - BUY NOW


Servo Motor (SG90) - BUY NOW


Ultrasonic Sensor - Buy Now


L293D motor driver shield


Foam board

Firstly, identify these components.

Secondly, cut the base part of this robot using the following sizes. 9 cm x 13 cm

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

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

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.

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

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

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.

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

Now, connect these components to the motor driver shield.

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.

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

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

//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);
}

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

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.