HUMAN FOLLOWER ROBOT
The robot utilizes an HC-SR04 Ultrasonic Sensor to maintain a specific distance from a target (a human). By calculating the "Time of Flight" of sound waves, the Arduino Nano adjusts the motor speeds and directions via the L298N Dual H-Bridge driver. The mechanical configuration uses a Differential Drive system with two powered wheels and one passive castor wheel for 360-degree mobility.
Supplies
1.Ultrasonic sensor
2.L298N motor driver
3.jumper cables
4. 2 X BO Motors
5.SG90 Servo motor
6.Castor wheel
7.Arduino nano
Chassis Assembly
The balance of the robot is really important for it to move smoothly.
Mount the Motors: Put your two DC gear motors at the back or middle of the chassis. Make sure they are perfectly parallel to each other.
Install the Castor Wheel: Put the castor wheel at the front. This will help form a tripod.
Sensor Placement: Put the HC-SR04 sensor right at the front facing forward. It should be, at a height where it can easily detect a persons legs. Avoid putting it too low where it might detect the floor.
Wiring
Motor Connections: Connect the left motor to the Out1/Out2 terminals and the right motor to Out3/Out4.
L298N motor driver connection
IN1-D5
IN2-D4
IN3-D3
IN4-D2
ENA-D6
ENB-D7
Servo motor connection
VCC-5V
GND-GND
Signal-D8
Ultrasonic sensor connection
VCC-5V
GND-GND
TRIG-D10
ECHO-D11
Wiring & Power Management
Drive Power: Connect a 7.4V or 9V battery to the L298N 12V and GND terminals.
The Common Ground Rule: Connect the GND of the L298N to the GND pin of the Arduino Nano.
Note: If the servo jitter causes the Nano to reset, use a dedicated 5V regulator for the servo.
Coding
Uploading the code: Open the Arduino IDE and type the code and Upload it
CODE
Conclusion
The Human Follower Robot operates as a closed-loop feedback system where the Arduino Nano acts as the central processor, constantly polling an HC-SR04 ultrasonic sensor mounted on a servo to map the distance to a target. By triggering a sonic pulse and measuring its return time, the Nano calculates the real-time proximity of a human; if the target moves beyond a set threshold, the Nano sends PWM signals to the L298N motor driver (via pins D2-D7) to engage the dual DC motors and close the gap. The mechanical stability is maintained by a differential drive system and a front castor wheel, allowing the robot to pivot smoothly and adjust its heading based on the sensor's wide-angle scan, ensuring it maintains a consistent "sweet spot" distance without physical collision.