0% found this document useful (0 votes)
4 views7 pages

WALLE Robot Guide

The document provides a connection and code guide for a WALL-E inspired multipurpose robot using an Arduino UNO. It includes a connection table for various components, Arduino code for controlling the robot's movements and sensors, and Python code for voice control and radar visualization. The robot can respond to commands via Bluetooth and voice, and it includes safety features like flame detection and obstacle avoidance.

Uploaded by

robomindx2010
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
4 views7 pages

WALLE Robot Guide

The document provides a connection and code guide for a WALL-E inspired multipurpose robot using an Arduino UNO. It includes a connection table for various components, Arduino code for controlling the robot's movements and sensors, and Python code for voice control and radar visualization. The robot can respond to commands via Bluetooth and voice, and it includes safety features like flame detection and obstacle avoidance.

Uploaded by

robomindx2010
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 7

WALL-E Inspired Multipurpose Robot - Connection and Code Guide

1. Connection Table

Component | Arduino Pin / Connection

------------------|------------------------

Ultrasonic Sensor | Trig -> D12, Echo -> D13

IR Sensor | A0

Flame Sensor | A1

Servo Motor | D9

Low RPM Motor | Connected via L298N motor driver

L298N Motor Driver| IN1 -> D2, IN2 -> D3, IN3 -> D4, IN4 -> D5, ENA & ENB -> 5V (or PWM pins D6/D7)

Bluetooth Module | TX -> D10, RX -> D11 (SoftwareSerial)

Emergency LED | D8

Power | 14V battery connected to VIN and L298N 12V input

2. Arduino UNO Code

#include <Servo.h>
#include <SoftwareSerial.h>

// Pins
#define TRIG_PIN 12
#define ECHO_PIN 13
#define IR_PIN A0
#define FLAME_PIN A1
#define EMERGENCY_LED 8
#define SERVO_PIN 9

// Motor driver pins


#define IN1 2
#define IN2 3
#define IN3 4
#define IN4 5
Servo armServo;
SoftwareSerial bluetooth(10, 11); // RX, TX

// Variables
long duration;
int distance;
int flameVal;
int irVal;

void setup() {
Serial.begin(9600);
bluetooth.begin(9600);
pinMode(TRIG_PIN, OUTPUT);
pinMode(ECHO_PIN, INPUT);
pinMode(EMERGENCY_LED, OUTPUT);

pinMode(IN1, OUTPUT);
pinMode(IN2, OUTPUT);
pinMode(IN3, OUTPUT);
pinMode(IN4, OUTPUT);

armServo.attach(SERVO_PIN);
armServo.write(90); // Start position

Serial.println("Robot Initialized");
bluetooth.println("Robot Ready");
}

int getDistance() {
digitalWrite(TRIG_PIN, LOW);
delayMicroseconds(2);
digitalWrite(TRIG_PIN, HIGH);
delayMicroseconds(10);
digitalWrite(TRIG_PIN, LOW);

duration = pulseIn(ECHO_PIN, HIGH);


distance = duration * 0.034 / 2;
return distance;
}

void moveForward() {
digitalWrite(IN1, HIGH);
digitalWrite(IN2, LOW);
digitalWrite(IN3, HIGH);
digitalWrite(IN4, LOW);
}

void moveBackward() {
digitalWrite(IN1, LOW);
digitalWrite(IN2, HIGH);
digitalWrite(IN3, LOW);
digitalWrite(IN4, HIGH);
}

void turnLeft() {
digitalWrite(IN1, LOW);
digitalWrite(IN2, HIGH);
digitalWrite(IN3, HIGH);
digitalWrite(IN4, LOW);
}

void turnRight() {
digitalWrite(IN1, HIGH);
digitalWrite(IN2, LOW);
digitalWrite(IN3, LOW);
digitalWrite(IN4, HIGH);
}

void stopMotors() {
digitalWrite(IN1, LOW);
digitalWrite(IN2, LOW);
digitalWrite(IN3, LOW);
digitalWrite(IN4, LOW);
}

void setupEmergencyLight(bool state) {


digitalWrite(EMERGENCY_LED, state ? HIGH : LOW);
}

void loop() {
// Read sensors
distance = getDistance();
flameVal = analogRead(FLAME_PIN);
irVal = analogRead(IR_PIN);

// Check flame sensor (assuming threshold)


if (flameVal < 300) {
setupEmergencyLight(true);
bluetooth.println("FIRE ALERT");
stopMotors();
armServo.write(0); // Move arm as alert
} else if (distance < 20) {
// Obstacle detected
setupEmergencyLight(true);
bluetooth.println("OBSTACLE ALERT");
stopMotors();
} else {
setupEmergencyLight(false);
}

// Bluetooth command processing


if (bluetooth.available()) {
char cmd = bluetooth.read();
switch (cmd) {
case 'F': moveForward(); bluetooth.println("Moving Forward"); break;
case 'B': moveBackward(); bluetooth.println("Moving Backward"); break;
case 'L': turnLeft(); bluetooth.println("Turning Left"); break;
case 'R': turnRight(); bluetooth.println("Turning Right"); break;
case 'S': stopMotors(); bluetooth.println("Stopped"); break;
case 'A': armServo.write(45); bluetooth.println("Arm Raised"); break;
case 'D': armServo.write(90); bluetooth.println("Arm Lowered"); break;
case 'E': setupEmergencyLight(true); bluetooth.println("Emergency Light ON"); break;
case 'e': setupEmergencyLight(false); bluetooth.println("Emergency Light OFF"); break;
}
}
}

3. Python Code for Voice Control and Radar Visualization

import speech_recognition as sr
import pyttsx3
import serial
import time

# Initialize speech engine


engine = pyttsx3.init()
recognizer = sr.Recognizer()
mic = sr.Microphone()

# Setup serial communication (change COM port as per your system)


arduino = serial.Serial('COM3', 9600, timeout=1)
time.sleep(2) # Wait for connection
def speak(text):
engine.say(text)
engine.runAndWait()

def listen():
with mic as source:
print("Listening...")
audio = recognizer.listen(source)
try:
command = recognizer.recognize_google(audio).lower()
print(f"Recognized: {command}")
return command
except sr.UnknownValueError:
return ""
except sr.RequestError:
return ""

def send_command(cmd):
arduino.write(cmd.encode())

while True:
command = listen()
if command:
if "forward" in command:
send_command('F')
speak("Moving forward")
elif "backward" in command:
send_command('B')
speak("Moving backward")
elif "left" in command:
send_command('L')
speak("Turning left")
elif "right" in command:
send_command('R')
speak("Turning right")
elif "stop" in command:
send_command('S')
speak("Stopping")
elif "arm up" in command or "raise arm" in command:
send_command('A')
speak("Arm raised")
elif "arm down" in command or "lower arm" in command:
send_command('D')
speak("Arm lowered")
elif "emergency light on" in command:
send_command('E')
speak("Emergency light on")
elif "emergency light off" in command:
send_command('e')
speak("Emergency light off")
elif "exit" in command or "quit" in command:
speak("Goodbye!")
break

You might also like