Section outline

  • Mini Project – Bluetooth Controlled Robot

    Now that you’ve learned to control your Arduino using Bluetooth and an Android app, it’s time to bring everything together into a mini project: a robot that you can steer using your mobile phone!

    • 📦 What You’ll Need

      • Arduino Uno or Nano
      • HC-05 or HC-06 Bluetooth module
      • Motor driver module (like L298N)
      • Two DC motors with wheels
      • Robot chassis
      • Battery pack (7.4V Li-ion or AA x 4)
      • Jumper wires
      • Android phone with MIT AI2 Companion app

      🔗 Wiring the Circuit

      • Connect the motors to the motor driver (IN1, IN2, IN3, IN4)
      • Connect ENA and ENB of the motor driver to PWM pins on Arduino (e.g., 5 and 6)
      • Connect HC-05 TX to Arduino RX, and RX to TX via voltage divider
      • Connect power and GND properly to motor driver and Bluetooth module
    • 🔌 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!