🔌 Suggested Pin Connections
Component |
Connected To |
Motor IN1 |
Pin 7 (Arduino) |
Motor IN2 |
Pin 8 |
Motor IN3 |
Pin 9 |
Motor IN4 |
Pin 10 |
ENA |
Pin 5 (PWM) |
ENB |
Pin 6 (PWM) |
HC-05 TX |
Pin 0 (RX) |
HC-05 RX |
Pin 1 (TX via 1k-2k voltage divider) |
💻 Sample Arduino Code
char command;
void setup() {
Serial.begin(9600);
pinMode(5, OUTPUT); // ENA
pinMode(6, OUTPUT); // ENB
pinMode(7, OUTPUT); // IN1
pinMode(8, OUTPUT); // IN2
pinMode(9, OUTPUT); // IN3
pinMode(10, OUTPUT); // IN4
}
void loop() {
if (Serial.available()) {
command = Serial.read();
if (command == 'F') {
digitalWrite(7, HIGH); digitalWrite(8, LOW); // Left motor forward
digitalWrite(9, HIGH); digitalWrite(10, LOW); // Right motor forward
} else if (command == 'B') {
digitalWrite(7, LOW); digitalWrite(8, HIGH);
digitalWrite(9, LOW); digitalWrite(10, HIGH);
} else if (command == 'L') {
digitalWrite(7, LOW); digitalWrite(8, HIGH);
digitalWrite(9, HIGH); digitalWrite(10, LOW);
} else if (command == 'R') {
digitalWrite(7, HIGH); digitalWrite(8, LOW);
digitalWrite(9, LOW); digitalWrite(10, HIGH);
} else if (command == 'S') {
digitalWrite(7, LOW); digitalWrite(8, LOW);
digitalWrite(9, LOW); digitalWrite(10, LOW);
}
}
}
🎮 Using the Mobile App
- Connect to the Bluetooth module via the ListPicker
- Tap the direction buttons to control your robot
- Observe how your robot responds to your commands
🚧 Debugging Tips
- Check Bluetooth pairing and serial baud rate
- Ensure motors are connected correctly (swap IN1/IN2 or IN3/IN4 if needed)
- Test commands via Serial Monitor first
🏁 What You Achieved
- Assembled a basic robot using Arduino and Bluetooth
- Built a mobile app to send directional commands
- Tested and debugged a working wireless control system
This mini project is a huge step toward building more advanced wireless robots and automation systems. You’ve now combined hardware, software, and mobile interaction into one seamless project!