
Build a DIY 3-in-1 Transforming Robot: Line Follower, Obstacle Avoider, and Bluetooth-Controlled Rover
Robotics projects often focus on a single behavior — following a line, avoiding obstacles, or responding to remote input. But what if you could build one robot that transforms between all three modes? A single chassis, a single microcontroller, and a smart combination of sensors can give you a multi-functional robot capable of switching behaviors on command.
This DIY project walks you through building a 3-in-1 transforming robot using an Arduino UNO. With the help of IR sensors, an ultrasonic sensor, a Bluetooth communication module, and a motor driver, you can create a compact and powerful bot that is ideal for school STEM projects, competitions, or hands-on learning.
This guide explains the components, setup, logic, and possible upgrades so that you can fully understand and customize your robot.
Introduction: Why Build a Multi-Mode Robot?
Most beginner robots teach only one concept at a time. A line follower teaches feedback control. An obstacle avoidance robot teaches environment sensing. A Bluetooth-controlled robot demonstrates user interaction and remote commands.
But when you combine all three behaviors into a single system, you learn something far more important — mode switching, or making a machine perform different actions based on the selected settings. This is exactly how real-world robots work: they switch between navigation, mapping, and manual override depending on requirements.
Building a multi-mode robot strengthens understanding of:
- Sensor fusion
- Control logic
- Conditional programming
- Input/output handling
- Real-time switching between behaviors
This makes the 3-in-1 robot an excellent learning tool and a great showcase project.
Components Required
To build the transforming robot, gather the following components:
- Arduino UNO
- IR sensors (for line following)
- Ultrasonic sensor (for obstacle detection)
- HC-05 or HC-06 Bluetooth module
- L298N motor driver
- Two DC motors with wheels
- Chassis with battery holder
- Jumper wires
- Optional: Push button for physical mode change
Each component serves a specific purpose. The IR sensors detect black and white contrast for line following. The ultrasonic sensor identifies obstacles by measuring distance. The Bluetooth module allows wireless control through a phone app. The L298N motor driver manages the motors, and the Arduino UNO handles all logic and communication.
How the Robot Works: Three Modes in One System
The robot supports three functional modes:
Mode 1: Line Follower
This mode uses IR sensors pointing downward. When the sensors detect the dark line, the robot adjusts its wheels to stay aligned. If the left IR sensor detects the line, it turns left. If the right sensor detects it, it turns right. If both detect a clear path, it moves forward.
Mode 2: Obstacle Avoider
Here, the ultrasonic sensor mounted in front continuously measures distance. If it detects something too close, the robot stops, turns, or reroutes itself to avoid collision. This requires real-time scanning and simple decision-making logic such as checking left, right, or forward directions.
Mode 3: Bluetooth Manual Control
In this mode, the robot listens to commands sent through a smartphone app. The Bluetooth module receives signals like forward, backward, left, right, or stop. Each command triggers movement through the motor driver. This mode is especially fun because the user can steer the robot like a remote-controlled car.
The best part is that all three modes run on the same hardware. Only the logic changes based on user selection.
Setting Up the System
Wiring the Components
The IR sensors are connected to the analog or digital pins of the Arduino. The ultrasonic sensor requires two pins: trigger and echo. The Bluetooth module uses RX and TX pins for serial communication. The L298N motor driver connects to four digital pins for controlling the motors.
Mode Selection
There are two ways to choose the mode:
- Physical Button
A button cycles through modes. Each press increases the mode value from 1 to 3. - Mobile App
The Bluetooth app sends a command such as “M1”, “M2” or “M3” to switch modes.
Both methods allow quick switching without resetting the robot.
Code Logic Overview
The core of the project lies in how the code manages different modes. Below is a simplified logic structure:
if(mode == 1)
lineFollow();
else if(mode == 2)
avoidObstacles();
else if(mode == 3)
manualControl();
Each mode has its own function containing the specific algorithm.
Line-Following Logic
The IR sensors return HIGH or LOW depending on whether they detect black or white surfaces. The code continuously compares values:
- If left detects black and right detects white: turn left
- If right detects black and left detects white: turn right
- If both detect white: move forward
- If both detect black: stop or adjust, depending on preference
This simple logic enables smooth tracking of the line path.
Obstacle-Avoidance Logic
The robot checks the distance measured by the ultrasonic sensor:
- If distance is greater than a threshold (e.g., 20 cm), move forward
- If distance is below threshold, stop and turn left or right
A more advanced version rotates the ultrasonic sensor to scan left and right directions.
Manual Control Logic
The robot receives characters from the phone app through Bluetooth:
- ‘F’: move forward
- ‘B’: move backward
- ‘L’: turn left
- ‘R’: turn right
- ‘S’: stop
This allows precise steering and real-time control.
Testing the Robot
Testing must be done for each mode separately:
Line Following Test
Use black electrical tape on a white surface. Check if the robot correctly identifies the line and adjusts direction. Fine-tune sensor placement if needed.
Obstacle Avoidance Test
Place objects of different sizes in front of the robot. Test how quickly the ultrasonic sensor responds and whether the robot changes direction effectively.
Bluetooth Control Test
Connect your smartphone through a Bluetooth terminal app or a custom-made controller app. Make sure commands are being received without delay.
Each test ensures the robot functions smoothly across all modes.
Advantages of Building a Transforming Robot
Building a 3-in-1 robot offers several educational benefits:
- Students learn how multiple sensors work together
- They understand how software can modify hardware behavior
- They practice designing modular code with separate functions
- They model real-world robots that operate in different modes
- They gain experience integrating electronics, logic, and mechanics
This makes the robot an excellent project for STEM fairs, college mini-projects, school competitions, and robotics clubs.
Possible Upgrades
Once the basic system is built, you can extend its capabilities:
Add Speed Control
Use PWM signals to control the speed of each motor, improving accuracy.
Add a Display
Use an LCD or OLED to show the current mode or sensor readings.
Add Battery Level Monitoring
Measure voltage and display battery health for longer operation.
Add Autonomous Mapping
Combine obstacle avoidance with mapping algorithms like grid-based exploration.
Add Voice Control
Use a Bluetooth voice command module for a more interactive system.
Conclusion
The DIY 3-in-1 Transforming Robot is a smart, flexible, and rewarding project that brings together three important robotics behaviors: line following, obstacle avoidance, and Bluetooth manual control. With just an Arduino UNO and commonly available sensors, you can build a robot that adapts to multiple situations, teaches valuable engineering skills, and offers hours of experimentation.
Whether you are a student preparing for a robotics competition, a teacher designing STEM activities, or a hobbyist looking for a meaningful challenge, this multi-mode robot is a perfect choice. It demonstrates how software logic transforms simple hardware into a dynamic and intelligent system.












