Advertisement

Responsive Advertisement

Arduino Bluetooth 2WD Robot: A Fun and Easy DIY Project

Have you ever wanted to make your own robot that can be controlled by your smartphone or tablet? If so, this project is for you! In this article, we will show you how to make an Arduino Bluetooth 2WD robot using simple and affordable components. This robot is a two-wheeled vehicle that uses two DC motors to drive its movement and a Bluetooth module to communicate with your device. It also has a 3D printed chassis that gives it a sleek and modern appearance. You can customize the chassis with different colors and shapes to make your own unique robot.

What You Will Need

To make this Arduino Bluetooth 2WD robot, you will need the following components:

  • An Arduino Uno board: This is the brain of the robot. It controls the DC motors and the Bluetooth module. You can use any other Arduino board, but the Uno is the most common and compatible one.
  • A L298N motor driver module: This is the muscle of the robot. It allows the Arduino board to control the speed and direction of the DC motors. It can also provide the necessary voltage and current for the motors.
  • A HC-06 or HC-05 Bluetooth module: This is the voice of the robot. It enables the wireless communication between the robot and your device. It can also be configured to change the name, password, and baud rate of the Bluetooth connection.
  • Two DC motors with wheels: These are the feet of the robot. They provide the motion and traction for the robot. You can use any DC motors with wheels that suit your preference, but make sure they have enough torque and speed for your robot.
  • A 9V battery or any battery ranging from 7V to 12V: This is the power source of the robot. It provides the necessary voltage and current for the Arduino board and the motor driver module.
  • A breadboard and some jumper wires: These are the tools for connecting the components. They make the wiring easy and neat.
  • A 3D printer and some filament: These are the tools for making the chassis of the robot. You can use any 3D printer and any filament that suits your preference. We will provide the STL files for the chassis in the next section.
  • Some screws, nuts, and glue: These are the tools for assembling the robot. They help to secure the components and the chassis together.

How to Make the Arduino Bluetooth 2WD Robot

To make the Arduino Bluetooth 2WD robot, you will need to follow these steps:

  1. Download and print the STL files for the chassis of the robot. You can find them here. There are two parts: the base part that holds the battery, the breadboard, and the motor driver module, and the top part that holds the Arduino board and the Bluetooth module. You can print them with any color and infill that you like. Make sure to print them with enough support and resolution for a good quality.
  2. Connect the components according to the circuit diagram below. You can use the breadboard and the jumper wires to make the connections. Make sure to follow the polarity and the pin numbers correctly. The circuit diagram is as follows:

Circuit diagram

The pin connections are as follows:

  • Arduino Uno pin 5V -> Motor driver module VCC pin
  • Arduino Uno pin GND -> Motor driver module GND pin
  • Arduino Uno pin 2 -> Motor driver module IN1 pin
  • Arduino Uno pin 3 -> Motor driver module IN2 pin
  • Arduino Uno pin 4 -> Motor driver module IN3 pin
  • Arduino Uno pin 5 -> Motor driver module IN4 pin
  • Arduino Uno pin 6 -> Bluetooth module TX pin
  • Arduino Uno pin 7 -> Bluetooth module RX pin
  • Arduino Uno VIN pin -> Battery positive terminal
  • Arduino Uno GND pin -> Battery negative terminal
  • Motor driver module OUT1 pin -> DC motor 1 positive terminal
  • Motor driver module OUT2 pin -> DC motor 1 negative terminal
  • Motor driver module OUT3 pin -> DC motor 2 positive terminal
  • Motor driver module OUT4 pin -> DC motor 2 negative terminal
  • Motor driver module 12V pin -> Battery positive terminal
  • Motor driver module GND pin -> Battery negative terminal

  • Upload the code to the Arduino board. You can use the Arduino IDE or any other software that supports Arduino programming. The code is as follows:

// Include the software serial library
#include <SoftwareSerial.h>

// Define the pins for the Bluetooth module
#define BT_TX 6
#define BT_RX 7

// Define the pins for the motor driver module
#define IN1 2
#define IN2 3
#define IN3 4
#define IN4 5

// Create a software serial object
SoftwareSerial BTSerial(BT_TX, BT_RX);

// Define a variable to store the Bluetooth data
char BTData;

void setup() {
  // Initialize the serial monitor
  Serial.begin(9600);

  // Initialize the software serial
  BTSerial.begin(9600);

  // Initialize the motor driver pins
  pinMode(IN1, OUTPUT);
  pinMode(IN2, OUTPUT);
  pinMode(IN3, OUTPUT);
  pinMode(IN4, OUTPUT);

  // Stop the motors
  stopMotors();
}

void loop() {
  // Check if there is data from the Bluetooth module
  if (BTSerial.available()) {
    // Read the data and store it in the variable
    BTData = BTSerial.read();

    // Print the data to the serial monitor
    Serial.println(BTData);

    // Check the data and execute the corresponding command
    switch (BTData) {
      case 'F': // Move forward
        moveForward();
        break;
      case 'B': // Move backward
        moveBackward();
        break;
      case 'L': // Turn left
        turnLeft();
        break;
      case 'R': // Turn right
        turnRight();
        break;
      case 'S': // Stop
        stopMotors();
        break;
      default: // Do nothing
        break;
    }
  }
}

// A function to move the robot forward
void moveForward() {
  // Set the motor driver pins
  digitalWrite(IN1, HIGH);
  digitalWrite(IN2, LOW);
  digitalWrite(IN3, HIGH);
  digitalWrite(IN4, LOW);
}

// A function to move the robot backward
void moveBackward() {
  // Set the motor driver pins
  digitalWrite(IN1, LOW);
  digitalWrite(IN2, HIGH);
  digitalWrite(IN3, LOW);
  digitalWrite(IN4, HIGH);
}

// A function to turn the robot left
void turnLeft() {
  // Set the motor driver pins
  digitalWrite(IN1, LOW);
  digitalWrite(IN2, HIGH);
  digitalWrite(IN3, HIGH);
  digitalWrite(IN4, LOW);
}

// A function to turn the robot right
void turnRight() {
  // Set the motor driver pins
  digitalWrite(IN1, HIGH);
  digitalWrite(IN2, LOW);
  digitalWrite(IN3, LOW);
  digitalWrite(IN4, HIGH);
}

// A function to stop the robot
void stopMotors() {
  // Set the motor driver pins
  digitalWrite(IN1, LOW);
  digitalWrite(IN2, LOW);
  digitalWrite(IN3, LOW);
  digitalWrite(IN4, LOW);
}
  1. Assemble the robot. You can use the screws, nuts, and glue to attach the components and the chassis together. The assembly steps are as follows:

  2. Attach the DC motors to the base part of the chassis using screws and nuts. Make sure to align the wheels with the holes on the chassis.

  3. Attach the battery and the breadboard to the base part of the chassis using glue or tape. Make sure to leave some space for the wires and the motor driver module.
  4. Attach the motor driver module to the base part of the chassis using glue or tape. Make sure to leave some space for the wires and the Arduino board.
  5. Attach the Arduino board and the Bluetooth module to the top part of the chassis using glue or tape. Make sure to leave some space for the wires and the USB port.
  6. Connect the top and the bottom parts of the chassis using screws and nuts. Make sure to align the holes on the chassis.

  7. Test the robot. You can use the USB cable to connect the Arduino board to your computer and monitor the serial output. You can also use a battery clip to connect the battery to the Arduino board and power the robot. You can download and install a Bluetooth controller app on your device and pair it with the Bluetooth module. You can use the app to send commands to the robot and watch it move. You can also adjust the code and the chassis to change the behavior and the appearance of the robot.

Congratulations! You have successfully made your own Arduino Bluetooth 2WD robot. Have fun and enjoy your creation!

(1) "2wd arduino chassis" 3D Models to Print - yeggi. https://www.yeggi.com/q/2wd+arduino+chassis/. (2) Otto DIY+ Arduino Bluetooth Robot Easy to 3D Print. https://www.instructables.com/Otto-DIY-Arduino-Bluetooth-Robot-Easy-to-3Dprint/. (3) 2WD smart car arduino robot chassis - Cults 3D. https://cults3d.com/en/3d-model/gadget/2wd-smart-car-arduino-robot-chassis. (4) GoodBoy - 3D Printed Arduino Robot Dog - Instructables. https://www.instructables.com/GoodBoy-3D-Printed-Arduino-Robot-Dog/. (5) undefined. https://www.ottodiy.com/%29. (6) undefined. https://wikifactory.com/+OttoDIY/otto-diy-plus.

Post a Comment

0 Comments