Build your own Wireless Controller for pc and android with arduino

Build your own Wireless Controller

You can build a basic wireless game controller using the ATmega32u4 Pro Micro development board by combining it with a wireless module (like Bluetooth or RF) and connecting input components like buttons, joysticks, etc.

Here's a step-by-step overview to build a DIY wireless controller using the ATmega32u4 + HC-05 Bluetooth module, targeting use with PC or Android, not Xbox.


What You’ll Build

A Bluetooth HID game controller that can wirelessly connect to:

  • PCs (Windows/Linux)

  • Android phones/tablets

  • Raspberry Pi

This setup does not work on Xbox, but it’s great for emulators, custom game rigs, or robotics control.


Components Needed

Component Description
ATmega32u4 Pro Micro Microcontroller with native USB HID support
HC-05 Bluetooth Module For serial Bluetooth communication
Buttons & Joysticks For input
Battery Pack (3.7V Li-ion or AA) For portable power
Level Shifter / Resistors For 3.3V ↔ 5V communication (optional)
Wires, Breadboard, or Custom PCB For connections

High-Level Steps

1. Design the Inputs

Decide on your control scheme:

  • 4 or more buttons

  • 1 or 2 analog joysticks (using potentiometers or thumbsticks)

  • Optional: D-pad, triggers, etc.

Connect buttons to digital pins, and joysticks to analog pins (A0–A5).


2. Connect the HC-05 Module

The HC-05 is a serial Bluetooth module that communicates with the ATmega32u4 using UART (TX/RX).

Wiring:

HC-05 Pin Connect To
VCC 5V (or 3.3V if it's a 3.3V module)
GND GND
TX RX (pin 0 on Pro Micro)
RX TX (pin 1 on Pro Micro) (use a voltage divider! HC-05 is 3.3V)

Use a resistor divider on the TX line from Pro Micro → HC-05 RX (5V → 3.3V).


3. Program the ATmega32u4

You’ll be sending input data over Bluetooth serial. Here’s a basic sketch:

cpp
#define BUTTON_PIN 2
#define JOYSTICK_X A0
#define JOYSTICK_Y A1
void setup() {
pinMode(BUTTON_PIN, INPUT_PULLUP);
Serial1.begin(9600); // HC-05 on Serial1 (TX1/RX1)
}
void loop() {
int buttonState = digitalRead(BUTTON_PIN);
int joyX = analogRead(JOYSTICK_X);
int joyY = analogRead(JOYSTICK_Y);
Serial1.print("BTN:");
Serial1.print(buttonState);
Serial1.print(",X:");
Serial1.print(joyX);
Serial1.print(",Y:");
Serial1.println(joyY);
delay(50); // 20 Hz update
}

You can read multiple buttons, map analog ranges to 0–255, and format output as JSON or CSV for easy parsing.


4. Pair the HC-05 with a PC or Android

  1. Power the controller.

  2. Go to your Bluetooth settings.

  3. Pair with the HC-05 (default PIN: 1234 or 0000).

  4. Open a serial terminal (like PuTTY or an emulator input handler) to receive data.

On Android, use apps like Bluetooth Serial Controller or Gamepad Tester.


5. Turn Into a Real Gamepad (Optional Advanced Step)

To emulate a Bluetooth HID gamepad, you cannot use HC-05 directly, as it only supports Serial Port Profile (SPP).

For real HID gamepad emulation, you’d need:

  • Bluetooth module with HID support, like Bluefruit EZ-Key or RN-42 HID firmware

  • Or switch to a board like ESP32, which supports Bluetooth HID natively.

But for PC games that support remapping or for robot control, Serial over Bluetooth is usually enough.


Powering the Controller

You can use:

  • 3.7V Li-ion/LiPo battery + boost converter (to get 5V)

  • 2x AA batteries (3V total, may work directly with Pro Micro + HC-05)

  • Rechargeable USB pack (if size isn’t a constraint)

Back to blog

Leave a comment

Please note, comments need to be approved before they are published.