Bluetooth-Controlled Follow Me Robot With Ultrasonic Sensor and Mecanum Wheels

by muratorkunn in Circuits > Arduino

42 Views, 1 Favorites, 0 Comments

Bluetooth-Controlled Follow Me Robot With Ultrasonic Sensor and Mecanum Wheels

robot.jpeg

4-Mecanum Wheel robotic vehicle controlled via Bluetooth that can follow an object using an ultrasonic sensor. Additionally, the robot uses a servo motor to scan its surroundings for objects and adapt its movement accordingly.

Supplies

1 × Arduino Mega

4 × DC Motors (with Mecanum wheels)

1 × Adafruit Motor Shield

1 × Ultrasonic Sensor (HC-SR04)

1 × Servo Motor

1 × Bluetooth Module (e.g., HC-05)

1 × Battery Pack

1 × Robot chassis with wheel mounts

Screws, nuts, and bolts for assembly

Soldering kit

Screwdrivers

Jumper wires

Hot glue gun or double-sided tape

Assemble the Chasis

Attach the wheels to the motor mounts on the chassis.

Secure the DC motors to the chassis using screws.

Mount the servo motor at the front of the chassis using hot glue or screws.

Wire the Electronics

You can use the pins that you want to use and feel more comfortable according to your project. Here are the connections of our project:


Motor Connections:

Connect the 4 DC motors to the motor shield’s output pins (labeled M1–M4).

Ultrasonic Sensor Connections:

Trig pin → Arduino digital pin 15

Echo pin → Arduino digital pin 14

VCC → 5V

GND → Ground

Servo Connections:

Signal wire → Arduino pin A9

VCC → 5V

GND → Ground

Bluetooth Module Connections:

TX → Arduino RX1

RX → Arduino TX1

VCC → 5V

GND → Ground

Power:

Connect the battery pack to the motor shield’s power input. Ensure the voltage matches your motor specifications.


Coding

If you want the servo to scan slowly, pause at edges, and react to detected objects, modify the followMe() function:

cpp
Copy code
void followMe() {
// Sweep and pause logic
for (servoAngle = 10; servoAngle <= 70; servoAngle += 5) {
scanningServo.write(servoAngle);
delay(100); // Slow down servo movement
long distance = measureDistance();

if (servoAngle == 10 || servoAngle == 70) {
delay(500); // Pause longer at the edges
}

if (distance > 0 && distance < 400) { // Object detected
Serial.print("Object detected at angle: ");
Serial.println(servoAngle);
scanningServo.write(servoAngle); // Point servo at the object
break; // Exit scanning
}
}
}


Pair the Bluetooth Module

Power up the robot.

Use your smartphone to pair with the Bluetooth module (e.g., "HC-05").

Install a Bluetooth terminal app to send commands that you have written to Arduino:

'W' → Forward

'S' → Backward

'A' → Left Crab

'D' → Right Crab

'Q' → Front-Left

'E' → Front-Right

'C' → Back-Right

'Z' → Back-Left

'R' → Turn Right

'T' → Turn Left

'X' → Stop

'F' → Follow-Me mode


Testing

You are done with the Mecanum Robot. Now you can test it.

Place the robot on a flat surface.

Enable Bluetooth mode to control it via your phone.

Test the follow-me functionality by holding an object (your hand, for instance) in front of the ultrasonic sensor.