Arduino Uno Human Following Robot
Dharshan, Bharath, Thanga Dorai
Department of AIML, Sec ‘A’
City Engineering College
Abstract
This project presents the development of a human-following robot utilizing the Arduino Uno
microcontroller. The robot is designed to autonomously detect and follow a human subject
by integrating ultrasonic and infrared (IR) sensors. The ultrasonic sensor measures the
distance between the robot and the human, enabling forward movement when the person is
within a predefined range. IR sensors, positioned on the sides, detect obstacles, allowing the
robot to adjust its path accordingly. The L293D motor driver shield interfaces between the
Arduino Uno and the DC motors, facilitating control over the robot's movement based on
sensor inputs. The Arduino is programmed using the Arduino IDE, continuously reading data
from the sensors to make real-time navigation decisions. This human-following robot has
potential applications in various fields, including healthcare, logistics, and personal
assistance, by aiding in tasks like carrying items or guiding individuals.
Introduction
In today's rapidly advancing technological landscape, the integration of robotics into daily
life has become increasingly prevalent. Among the various innovations, human-following
robots stand out for their potential to assist in tasks ranging from personal assistance to
industrial applications.
Robotics has revolutionized numerous aspects of modern life, from industrial automation to
medical assistance and exploration. Among the diverse applications, represent a particularly
compelling area of research and development. These robots are designed to autonomously
track and follow a designated human, offering a wide range of potential benefits in various
scenarios.
The concept of a robot that can intelligently interact with and adapt to human movement
has long been a subject of scientific inquiry and popular imagination. Recent advancements
in microcontrollers, sensor technology, and artificial intelligence have made the realization
of such robots more feasible and accessible than ever before. Projects involving platforms
like the Arduino Uno have significantly lowered the barrier to entry for aspiring roboticists
and engineers, enabling rapid prototyping and experimentation.
This project delves into the creation of a cost-effective and practical human-following robot
using the readily available and versatile Arduino Uno. Our aim is to develop a system that
can reliably detect and track a human target, demonstrating the fundamental principles of
autonomous navigation and human-robot interaction. By leveraging common sensors and
actuators, we hope to provide a clear and replicable framework for understanding and
building similar robotic systems, ultimately contributing to the broader field of personal
robotics and intelligent automation.
System components
Arduino Uno: The Arduino Uno functions by executing user-
written C++ code, known as a "sketch," which is compiled and
then uploaded via USB to its ATmega328P microcontroller.
Once programmed, this microcontroller continuously runs the
code, interpreting inputs from various sensors (like digital
ON/OFF signals or analog voltage readings converted by its
ADC) to understand its environment. Based on these sensor inputs and the defined program
logic, the Arduino then generates appropriate outputs, controlling actuators such as motors
(often via PWM for speed control) or LEDs, thereby enabling interaction with the physical
world. It draws power from either the USB connection or an external supply, with an
onboard voltage regulator ensuring stable operation.
Motor Driver: A motor driver acts as an intermediary, taking
low-power control signals from a microcontroller and converting
them into the higher-current, higher-voltage signals necessary to
operate a motor. Primarily, it amplifies the current output from
the microcontroller's pins to safely drive the motor, which
typically demands more power. Utilizing an H-bridge circuit for
DC motors, the driver efficiently controls the motor's direction by reversing the polarity of
the voltage supplied. Furthermore, it manages the motor's speed by interpreting Pulse
Width Modulation (PWM) signals from the microcontroller, effectively varying the average
voltage delivered. Many drivers also incorporate protection features to prevent damage
from overcurrent or voltage spikes, safeguarding both the motor and the sensitive control
circuitry, while also providing a degree of electrical isolation to mitigate interference.
Ultrasonic Sensor: An ultrasonic sensor works much like a bat
finds its way around. It first sends out a burst of high-pitched
sound, too high for us to hear. This sound travels until it hits
something. When the sound hits an object, it bounces back to the
sensor like an echo. The sensor then measures exactly how long it
took for the sound to go out and come back. Since we know how
fast sound travels through the air, the sensor can use that time to figure out the distance to
the object. It's like timing how long it takes for a ball to hit a wall and return to calculate how
far away the wall is.
Infrared (IR)Sensor: An infrared (IR) sensor typically works by using both
an infrared emitter (usually an IR LED) and an infrared receiver (often a
photodiode or phototransistor). The emitter sends out a beam of invisible
infrared light. If an object is present in the path of this light, the infrared
rays will reflect off its surface. The receiver then detects this reflected light.
The strength of the reflected signal, or sometimes the presence or absence of a reflection, is
then interpreted by the sensor's internal circuitry or a connected microcontroller to
determine the presence or proximity of an object. This allows for applications like obstacle
detection, line following, and even remote-control communication.
Servo Motor: A servo motor is a specialized motor designed for precise
angular positioning, unlike a continuous-rotation motor. It operates
through a closed-loop system, meaning it constantly receives feedback
about its current position. When a control signal, typically a Pulse Width
Modulation (PWM) signal from a microcontroller, is sent to the servo, it
indicates a desired angle. The servo's internal control circuit compares this desired position
with its actual position, sensed by a built-in potentiometer or encoder. If there's a difference,
the motor rotates until the actual position matches the desired one, then holds that
position. This continuous feedback and adjustment allow for very accurate and repeatable
movements.
Gear Motor: A gear motor combines a regular electric motor
with a gearbox to alter its output characteristics. The motor's
high-speed, low-torque rotation is fed into the gearbox, which
uses a series of meshed gears to reduce the output speed
significantly. Simultaneously, this reduction in speed results in a
substantial increase in torque, making the motor much stronger.
This design allows the gear motor to drive heavier loads or move objects with greater force
than the motor alone could achieve.
System Circuit Diagram and Components
Working Mechanism: The Arduino Uno human-following robot operates on a continuous
feedback loop: it senses the human's position, processes that information, and then actuates
its motors to adjust its movement accordingly.
1. Sensing: The robot uses multiple infrared (IR) sensors, strategically placed (e.g., front,
left, right), to detect the human. These sensors emit IR light, and when it reflects off
the human, the sensor's receiver detects it, signalling the human's presence and
relative direction.
2. Processing: The Arduino Uno microcontroller constantly reads these IR sensor signals.
Its programmed code analysis which sensors are triggered and their intensity to
determine if the human is directly ahead, drifting left, or drifting right, and also
assesses the approximate distance.
3. Decision-Making: Based on this processed data, the Arduino's internal logic decides
the robot's next action. For instance, if the central sensor is active and the distance is
optimal, it commands forward movement. If a side sensor is more active, it instructs a
turn towards that side.
4. Actuation: The Arduino sends control signals (digital for direction, PWM for speed) to a
motor driver. This driver amplifies these signals to provide the necessary power to the
DC geared motors that drive the robot's wheels. The motors then rotate, moving the
robot forward, backward, or turning it to maintain the following behaviour.
This cycle of sensing, processing, and actuating repeats rapidly, allowing the robot to
smoothly and continuously track and follow the human target .
Code used for Arduino Uno
#include<Servo.h>
#include<AFMotor.h>
#define LEFT A0
#define echopin A1 // echo pin
#define trigpin A2 // Trigger pin
#define RIGHT A3
AF_DCMotor Motor1(1, MOTOR12_1KHZ);
AF_DCMotor Motor2(2, MOTOR12_1KHZ);
AF_DCMotor Motor3(3, MOTOR34_1KHZ);
AF_DCMotor Motor4(4, MOTOR34_1KHZ);
Servo myservo;
int pos =0;
long time;
void setup () {
Serial.begin(9600);
myservo.attach(10);
for (pos = 90; pos <= 180; pos += 1) {
myservo.write (pos);
delay (15);
}
For (pos
= 180; pos >= 0; pos-= 1) {
myservo.write (pos);
delay (15);
}
For (pos = 0; pos<=90; pos += 1) {
myservo.write(pos);
delay (15);
}
pinMode (RIGHT, INPUT);
pinMode (LEFT, INPUT);
pinMode (trigpin, OUTPUT);
pinMode (echopin, INPUT);
void loop() {
unsigned int distance = read_cm ();
int Right_Value = digitalRead(RIGHT);
int Left_Value = digitalRead(LEFT);
Serial.print("R=");
Serial.print(Right_Value);
Serial.print(" L= ");
Serial.print(Left_Value);
Serial.print("D=");
Serial.println(distance);
if((Right_Value==1) && (distance>=10
&& distance<=30)&&(Left_Value==1)){forword();}
else if((Right_Value==0) && (Left_Value==1)){turnRight();}
else if((Right_Value==1) && (Left_Value==0)){turnLeft();}
else if((Right_Value==1) && (Left_Value==1)){stop();}
else if(distance > 5 && distance < 10){stop();}
else if(distance < 5){backword();}
delay(50);
}
long read_cm(){
digitalWrite (trigpin, LOW);
delayMicroseconds (2);
digitalWrite (trigpin,
HIGH);
delayMicroseconds (10);
time = pulseIn (echopin, HIGH);
return
time / 29 / 2;
}
void forword(){// turn it on going forward
Motor1.setSpeed(120);
Motor1.run(FORWARD);
Motor2.setSpeed(120);
Motor2.run(FORWARD);
Motor3.setSpeed(120);
Motor3.run(FORWARD);
Motor4.setSpeed(120);
Motor4.run(FORWARD);
}
void
backword(){ // the other way
Motor1.setSpeed(120);
Motor1.run(BACKWARD);
Motor2.setSpeed(120);
Motor2.run(BACKWARD);
Motor3.setSpeed(120);
Motor3.run(BACKWARD);
Motor4.setSpeed(120);
Motor4.run(BACKWARD);
}
void turnRight(){
// the other right
Motor1.setSpeed(200);
Motor1.run(FORWARD);
Motor2.setSpeed(200);
Motor2.run(FORWARD);
Motor3.setSpeed(100);
Motor3.run(BACKWARD);
Motor4.setSpeed(100);
Motor4.run (BACKWARD);
}
void
turnLeft(){ // turn it on going left
Motor1.setSpeed(100);
Motor1.run(BACKWARD);
Motor2.setSpeed(100);
Motor2.run(BACKWARD);
Motor3.setSpeed(200);
Motor3.run(FORWARD);
Motor4.setSpeed(200);
Motor4.run(FORWARD);
}
void
stop(){ // stopped
Motor1.setSpeed(0);
Motor1.run (RELEASE);
Motor2.setSpeed(0);
Motor2.run (RELEASE);
Motor3.setSpeed(0);
Motor3.run (RELEASE);
Motor4.setSpeed(0);
Motor4.run (RELEASE);
}
Results
Different experiments were conducted and the performance of the human following robot
was tested. Test was performed on the ultrasonic and infrared sensor. It was noted that the
sensor was working accurately within a range of 4 meters. Then we performed the test to
check whether the robot maintains a specific distance with the target object. Then we
checked the serial communication between Arduino Uno, motor driver and various motors.
On the basis of results obtained from these tests and experiments, we made the necessary
changes in the processing and control algorithm. After the completion, we observed that the
results produced were very satisfying the robot was perfectly following the person wherever
it goes. Hence the objective of implementing a good Human-Robot interaction was achieved.
Application
Assistive Technology: It can serve as a personal aid for individuals with mobility challenges,
helping them transport items like groceries or medical supplies by autonomously following
them.
Logistics and Material Handling: In environments like warehouses or retail stores, the robot
could follow workers to carry tools, components, or inventory, thereby streamlining
operations.
Education and Research: It acts as an accessible, hands-on platform for teaching fundamental
robotics principles, sensor integration, and basic human-robot interaction concepts.
Retail and Hospitality: Potential uses include assisting shoppers by carrying baskets or helping
hotel guests with their luggage.
Basic Security and Surveillance: The robot can be adapted to follow a guard, carrying
additional equipment or providing a mobile platform for simple monitoring tasks.
Future Work
Future work for an Arduino Uno human-following robot can focus on enhancing its
capabilities and robustness. Firstly, integrating more advanced sensing technologies like
LiDAR, depth cameras, or even GPS could significantly improve its accuracy, range, and
ability to navigate complex, dynamic environments, allowing for more precise tracking and
obstacle avoidance. Secondly, implementing sensor fusion techniques would combine data
from multiple sensor types to create a more comprehensive and reliable understanding of
the surroundings, making the robot less susceptible to individual sensor limitations. Thirdly,
developing more sophisticated control algorithms, potentially incorporating machine
learning or AI for predictive following and adaptive behaviour, would enable smoother, more
intelligent interaction and navigation in unpredictable scenarios. Fourthly, exploring wireless
communication modules could facilitate remote monitoring, control, and data logging,
allowing for greater flexibility and integration into smart environments. Fifthly, improving
power management and battery life would extend the robot's operational duration, making
it more practical for sustained use. Sixthly, enhancing its mechanical design for increased
payload capacity, better stability, and all-terrain mobility would broaden its utility in real-
world applications. Seventhly, incorporating human-robot interface elements such as voice
commands, gesture recognition, or visual feedback would make interaction more intuitive
and user-friendly. Eighthly, developing multi-robot coordination capabilities could allow a
fleet of robots to work together to follow multiple individuals or perform collaborative tasks.
Ninthly, conducting extensive testing in diverse, unstructured environments would be crucial
to identify and address real-world challenges not apparent in controlled settings. Finally,
exploring modularity in design would allow for easy customization and adaptation of the
robot for various specific applications, such as a medical assistant in hospitals or a shopping
cart in malls.
Conclusion
The development of the Arduino Uno human-following robot successfully demonstrated the
feasibility of creating an autonomous system capable of tracking and accompanying a human
target. By effectively integrating infrared (IR) and ultrasonic sensors with the versatile
Arduino Uno microcontroller and a motor driver, the robot reliably detected human
presence and maintained a predetermined following distance. Through rigorous
experimentation and iterative refinement of the control algorithm, the robot achieved
smooth and responsive navigation, adapting its movements to the target's trajectory. This
project not only served as a robust proof-of-concept for basic human-robot interaction but
also underscored the Arduino Uno's immense potential as an accessible and cost-effective
platform for robotics education and rapid prototyping. The satisfactory performance
observed in the final tests confirmed that the core objective of establishing effective human-
robot interaction was met, paving the way for future enhancements in sensor fusion,
advanced AI-driven navigation, and real-world applicability in diverse environments.