Section outline

  • Introduction to Wireless Communication in Robotics

    As robots become more advanced, the ability to communicate without wires becomes essential. Wireless communication allows robots to be controlled remotely, share data, and even work together in teams. In this section, we’ll explore what wireless communication is and how it helps us build smarter and more interactive robots.

    • 🤖 What is Wireless Communication?

      • Wireless communication is the transfer of data between two or more devices without physical connection using radio waves, infrared, or Bluetooth.
      • It allows us to send commands from a remote control, smartphone, or another device to the robot.

      📡 Why Do Robots Need Wireless Communication?

      • To be controlled remotely from a phone, tablet, or computer
      • To operate in places where direct contact is not possible (e.g., search & rescue, drones)
      • To work in groups or swarms, sharing data wirelessly

       

    • 🔌 Types of Wireless Communication in Robotics

      Technology Range Common Uses
      Bluetooth 10–30 meters Mobile app control, short-range data transfer
      Wi-Fi Up to 100 meters Internet-connected robots, home automation
      Infrared (IR) Line of sight, short range Remote controls, TV robots
      RF Modules Up to 500 meters (varies) Long-range remote control, wireless sensors

      📘 What We’ll Focus On

      In this course, we’ll primarily work with Bluetooth communication using modules like HC-05 or HC-06. These are beginner-friendly, affordable, and perfect for controlling your robot using a phone app.

       

      By the end of this section, you should be able to:

      • Understand the need for wireless communication in robotics
      • Identify different wireless technologies and their uses
      • Prepare to use Bluetooth in your own robot projects
  • Getting to Know Bluetooth Modules (HC-05, HC-06)

    Bluetooth modules like HC-05 and HC-06 allow your Arduino-based robots to wirelessly receive commands from a mobile device. Understanding how these modules work is key to building wirelessly controlled robots.

    • 🔷 What is the HC-05/HC-06 Module?

      • Both are popular Bluetooth modules used in hobby electronics.
      • HC-05 can work as both Master and Slave.
      • HC-06 works only in Slave mode (for receiving commands).
    • 📦 Pin Description

      Pin Description
      VCC Connect to 5V (power)
      GND Ground
      TXD Transmit Data (connects to Arduino RX)
      RXD Receive Data (connects to Arduino TX via voltage divider)
      STATE / EN / KEY Used in advanced configuration (not required for basic use)

      🔌 Basic Wiring with Arduino

      • HC-05 VCC → Arduino 5V
      • HC-05 GND → Arduino GND
      • HC-05 TXD → Arduino RX (pin 0)
      • HC-05 RXD → Arduino TX (pin 1) via 1K–2K voltage divider

      ⚠️ Important Note:

      The HC-05 RXD pin is not 5V tolerant, so it's recommended to use a voltage divider when connecting to Arduino TX to avoid damaging the module.

      📶 Pairing the Module

      • Turn on Bluetooth on your phone.
      • Scan for devices — look for “HC-05” or “HC-06”.
      • Default pairing code is usually 1234 or 0000.
      • Once paired, your phone can communicate with the robot using apps like MIT App Inventor or Bluetooth Terminal.

      ✅ What You’ve Learned

      • The difference between HC-05 and HC-06
      • Pin functions and connection to Arduino
      • How to wire and pair your Bluetooth module
  • Setting Up Arduino with Bluetooth

    Now that you’ve learned the basics of Bluetooth and the HC-05 module, it’s time to set up the Arduino to communicate wirelessly. This section covers how to wire the module, switch between modes, and test communication using simple code.

    • 🔌 Connecting HC-05 to Arduino

      • HC-05 VCC → Arduino 5V
      • HC-05 GND → Arduino GND
      • HC-05 TX → Arduino RX (Pin 0)
      • HC-05 RX → Arduino TX (Pin 1) (use a voltage divider to step down 5V to 3.3V)

      📡 Understanding Serial Communication

      Bluetooth modules like HC-05 use UART serial communication. It is important to wire TX of one device to RX of the other and vice versa.

      • TX: Transmit line of Bluetooth
      • RX: Receive line of Bluetooth
      • Make sure baud rate matches in code (default is 9600)

      ⚙️ Upload vs. Communicate Mode

      When the HC-05 is connected to RX/TX pins of the Arduino (pins 0 and 1), the Arduino may face issues uploading code. Here's what to do:

      • During Upload: Disconnect HC-05
      • After Upload: Reconnect HC-05 to use Serial

      This is because the same pins are used for USB upload and Serial communication. If you want to avoid this, consider using SoftwareSerial (we’ll cover that later).

    • 💻 Sample Code – Send and Receive Serial Data

      Upload this code to Arduino to read Bluetooth data and respond via Serial Monitor.

      void setup() {
        Serial.begin(9600);
        Serial.println("Bluetooth ready. Waiting for data...");
      }
      
      void loop() {
        if (Serial.available()) {
          char data = Serial.read();
          Serial.print("Received: ");
          Serial.println(data);
        }
      }
      

      🔍 Testing the Communication

      1. Upload the above code to Arduino
      2. Open the Serial Monitor and set baud to 9600
      3. Connect your phone to HC-05 using a Bluetooth terminal app
      4. Send characters from your phone and see them printed in Serial Monitor

      ✅ What You Learned

      • How to wire and connect HC-05 Bluetooth module to Arduino
      • Difference between upload and communication modes
      • Tested two-way communication using a terminal app

      This setup is the heart of Bluetooth-based projects. In the next section, we’ll build a full robot using this wireless communication.

  • Controlling a Robot via Mobile App (MIT App Inventor)

    Now that your Bluetooth module is connected, it's time to build a simple mobile app that sends commands to your robot. We will use MIT App Inventor, a beginner-friendly, drag-and-drop platform for making Android apps.

    • 📱 What is MIT App Inventor?

      • A free online tool that lets you build apps by dragging and connecting blocks.
      • Great for beginners and works directly from your browser.
      • Apps can be tested live using the MIT AI2 Companion app.
    • 🌐 Getting Started

      1. Go to MIT App Inventor
      2. Sign in with your Google account.
      3. Create a new project and name it something like BluetoothBot.

      📲 Designing the App Interface

      • Add Buttons for robot controls: Forward, Backward, Left, Right, Stop
      • Add a ListPicker to choose the Bluetooth device
      • Use a Label to show connection status

      🔧 App Blocks Logic

      Each button will send a letter or number via Bluetooth to the robot. For example:

      • Forward → Send "F"
      • Backward → Send "B"
      • Left → Send "L"
      • Right → Send "R"
      • Stop → Send "S"

      Use the BluetoothClient block to send these characters when the button is clicked.

    • 🤖 Arduino Code to Receive Commands

      char command;
      
      void setup() {
        Serial.begin(9600);
        pinMode(5, OUTPUT); // Left Motor
        pinMode(6, OUTPUT); // Right Motor
      }
      
      void loop() {
        if (Serial.available()) {
          command = Serial.read();
          if (command == 'F') {
            // Move forward
            digitalWrite(5, HIGH);
            digitalWrite(6, HIGH);
          }
          else if (command == 'S') {
            // Stop
            digitalWrite(5, LOW);
            digitalWrite(6, LOW);
          }
          // Add more conditions for B, L, R
        }
      }
      

      🛠️ Testing and Troubleshooting

      • Make sure your phone is paired with the HC-05 or HC-06.
      • Install the MIT AI2 Companion app to test your interface.
      • Ensure the baud rate in Serial.begin() matches the module (usually 9600).

      ✅ What You’ve Learned

      • How to build a simple Bluetooth control app using MIT App Inventor
      • How to send commands from phone to Arduino
      • How to receive and use Bluetooth commands in Arduino code
  • 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!

  • Project: Wireless Robot in Action

    Time to bring everything together! In this final section, you’ll assemble your full Bluetooth-controlled robot, test it with the app, and troubleshoot any issues that arise during communication or movement.

    • 🔗 Final Circuit Setup and Wiring

      Make sure your connections are secure and complete. Here's a checklist:

      • Motor Driver: L298N module wired to both motors
      • Arduino: Connected to L298N and Bluetooth module
      • Bluetooth Module: HC-05 connected via TX/RX (use voltage divider on RX)
      • Power: External battery pack connected to motor driver (and optionally Arduino)

      Note: Double-check ground connections – all devices should share a common GND.

    • 📱 Testing App Control with Robot

      1. Turn on the robot and connect your phone to the HC-05 module.
      2. Open the Bluetooth control app (e.g., MIT App Inventor app you built).
      3. Test each button: Forward, Backward, Left, Right, and Stop.
      4. Observe how the robot reacts – motors should respond immediately.

      🛠 Debugging Communication Issues

      If the robot doesn’t respond as expected, check the following:

      • Baud Rate Mismatch: Ensure Arduino code uses the correct serial speed (usually 9600).
      • RX/TX Swapped: TX from Bluetooth should go to RX on Arduino, and vice versa.
      • App Command Mismatch: Confirm that the app is sending the correct characters expected by your Arduino code.
      • Power Issues: Motors may not respond if power is low or unstable.

      ✅ What You Achieved

      • Completed a functional wireless robot
      • Tested Bluetooth commands from a mobile app
      • Debugged real-time robot communication

      This project marks a big leap in your robotics journey. You’ve now built and controlled a robot remotely — a skill that opens up tons of creative possibilities ahead!

  • Tips, Safety, and Troubleshooting

    Before wrapping up your wireless robot project, it’s important to follow good practices for safe usage, effective communication, and smooth troubleshooting. This section highlights useful tips that will help you avoid common mistakes and keep your robot running reliably.

    • 🔒 Safe Handling of Bluetooth Modules

      • Voltage Limits: Most Bluetooth modules (like HC-05) operate at 3.3V on RX. If using with a 5V Arduino, use a voltage divider or level shifter.
      • Heat Awareness: Modules may heat up during extended use. Avoid touching them while powered for long periods.
      • Antenna Care: Avoid bending or crushing the onboard antenna to maintain strong signal quality.

       

    • 🛠 Common Errors and How to Fix Them

      • Robot Not Responding: Check Bluetooth pairing, ensure power supply is stable, and verify command strings from the app.
      • Upload Error: Disconnect the Bluetooth module during code upload to Arduino (TX/RX interfere with uploading).
      • App Controls Wrong Action: Review your code to ensure each character sent from the app matches the right function in Arduino logic.
      • Random Movements: This could be caused by poor signal or incorrect command interpretation. Add Serial Monitor print statements for debugging.

      📶 Improving Range and Reliability

      • Line of Sight: Keep your phone in direct line of sight with the robot for best Bluetooth performance.
      • Distance: HC-05 typically works well up to 10 meters in open space. Avoid walls or metal obstacles.
      • Shielding: Place the Bluetooth module away from motor wires and power sources to reduce electrical interference.
      • App Lag: Use lightweight commands (single characters) for faster transmission and less processing delay.

      By following these tips and safety checks, you'll create a more robust and enjoyable robotics experience. You’re now fully ready to build wireless robots with confidence!

  • Congratulations! You have now completed the course on Wireless Communication with Arduino. You've explored the world of Bluetooth modules like HC-05, learned how to pair and communicate with mobile apps, and built your own Bluetooth-controlled robot. These foundational skills are essential for creating interactive and remotely operated robotic systems.

    Now, it's time to test your understanding. Let’s take a quiz to review everything you’ve learned and see how confidently you can apply wireless control in your own projects.