Arduino Game Controller Using Bluetooth

by Sabik Irshad in Circuits > Arduino

296 Views, 7 Favorites, 0 Comments

Arduino Game Controller Using Bluetooth

This Project is AWESOME!

This project involves creating a remote control system using an Arduino, an HC-06 (or HC-05) Bluetooth module, and two servo motors. The system can be used to control games like Beach Buggy Racing, providing an easy and intuitive way to play without using traditional buttons.

Supplies

IMG_20240822_111925.jpg
IMG_20240822_112436.jpg
IMG_20240822_112744.jpg
IMG_20240822_113708.jpg
IMG_20240822_112641.jpg
Screenshot 2024-08-24 at 12.35.25.png
FFU5FZVM06Q2SVH.png
Screenshot 2024-08-24 at 12.42.46.png
IMG_20240822_112804.jpg
IMG_20240822_112826.jpg
Screenshot 2024-08-24 at 12.32.37.png

The Main component is the TV Remote

  1. Arduino (Uno or Nano) - 1
  2. Bluetooth Module (HC-05 or HC-06) - 1 *I'm using an HC-06 Bluetooth module
  3. Servo Motors - 2
  4. Power Supply (18650 Battery - 2 or a Power Bank) *I'm using a power bank in this project
  5. Jumper Wires - (Male to Male - 6) and (Male to Female - 4)
  6. Thick wood pieces - 2
  7. Foam Pieces to design the base
  8. An Android phone with Arduino Bluetooth RC Car app for control (*Note: Apple Phones does not support HC-05 and HC-06 Bluetooth Connections)

Wiring the Components

IMG_20240822_135820.jpg
IMG_20240822_134656.jpg
IMG_20240822_134517.jpg

Connect the male to male jumper wires to both the Servo motors

Connect the male to female jumper wires to the HC-05 or HC-06 Bluetooth module

Wiring the Servo Motors:

  1. Connect the signal pin of the first servo motor to Arduino pin 9.
  2. Connect the signal pin of the second servo motor to Arduino pin 10.
  3. Connect the power and ground pins of the servos to the Arduino's 5V and GND pins.

Wiring the HC-05 (or HC-06)

IMG_20240822_135021.jpg
IMG_20240822_140106.jpg
  1. Connect VCC to the 5V pin on the Arduino.
  2. Connect GND to the GND pin on the Arduino.
  3. Connect TXD to the RX pin on the Arduino.
  4. Connect RXD to the TX pin on the Arduino.

Upload the Code

IMG_3576.jpg
IMG_3577.jpg
#include <Servo.h>

Servo leftServo; // Create a Servo object for the left servo
Servo rightServo; // Create a Servo object for the right servo

int leftServoPin = 9; // Pin for the left servo
int rightServoPin = 10; // Pin for the right servo

char command; // Variable to store the incoming command from the HC-05

void setup() {
leftServo.attach(leftServoPin); // Attach the left servo to pin 9
rightServo.attach(rightServoPin); // Attach the right servo to pin 10

leftServo.write(90); // Initialize the left servo to the neutral position (90 degrees)
rightServo.write(90); // Initialize the right servo to the neutral position (90 degrees)

Serial.begin(9600); // Start serial communication at 9600 baud rate
}

void loop() {
if (Serial.available() > 0) {
command = Serial.read(); // Read the incoming command from the HC-05
}

// Continuous checking for the command
if (command == 'R') { // If the left button is pressed
leftServo.write(0); // Move to 0 degrees
} else {
leftServo.write(45); // Return to the neutral position when the button is released
}

if (command == 'L') { // If the right button is pressed
rightServo.write(180); // Move to 180 degrees
} else {
rightServo.write(135); // Return to the neutral position when the button is released
}
}

Check Both Servo Motors

I CAN PLAY Games Using This! #asmr #arduino

The Servo motor movement should work like the above video

Design the Base

Screenshot 2024-08-24 at 17.54.28.png
Screenshot 2024-08-24 at 17.54.46.png

You can design the base of how you'd want it to be as the size of your remote is totally different to mine but the most important part is that both Servo motors have to press the button on the remote

Testing

F9R9OZRM06Q2SOS.png
I'm Ready TO RACE! #asmr #arduino
It WORKS! #asmr #arduino
  1. Power the Arduino Uno
  2. Place the Remote and make sure both Servo motors touches the buttons of the remote
  3. Then Install the app using this link https://play.google.com/store/apps/details?id=omfaer.com.carino&hl=en
  4. Then using the app, connect the HC-06 (or HC-05) Bluetooth module

Then Enjoy your game!!!