🕹️ GSPro ESP8266 Wi-Fi Controller: DIY Gamepad for Your Golf Simulator

ESP8266 GSPro Controller Thumbnail

Are you building a custom gamepad controller for GSPro using an ESP8266? Want to connect physical buttons to send keyboard inputs over Wi-Fi — without serial clutter?

This guide walks you through everything: wiring, code, and server setup for a clean, fully working GSPro controller with expanded keys, URL-safe transmission, and no serial output.

🔧 Hardware Setup

We use an ESP8266 NodeMCU and wire up tactile pushbuttons like this:

Button FunctionGPIO PinESP8266 PinMapped Key
Club DownGPIO5D1i
ResetGPIO4D2r
MulliganGPIO0D3ctrl+m
Club UpGPIO2D4k
PutterGPIO16D0u
Reset AimGPIO14D5a
Tee LeftGPIO1D10c
Tee RightGPIO3D9v
Aim UpGPIO13D7up
Aim DownGPIO15D8down
Aim LeftGPIO12D6left
Aim RightGPIO9D11right

🧠 ESP8266 Firmware Code

Here’s the full Arduino sketch you can upload via the Arduino IDE. It uses ESP8266WiFi and ESP8266HTTPClient to send HTTP GET requests when each button is pressed:

#include <ESP8266WiFi.h>
#include <ESP8266HTTPClient.h>

const char* ssid = "your_ssid";
const char* password = "your_password";
const String server = "http://192.168.1.122:5000/press/";

#define BTN_CLUB_DOWN   5
#define BTN_RESET       4
#define BTN_MULLIGAN    0
#define BTN_CLUB_UP     2
#define BTN_PUTTER      16
#define BTN_RESET_AIM   14
#define BTN_TEE_LEFT    1
#define BTN_TEE_RIGHT   3
#define UP_PIN          13
#define DOWN_PIN        15
#define LEFT_PIN        12
#define RIGHT_PIN       9

void setup() {
  WiFi.begin(ssid, password);
  while (WiFi.status() != WL_CONNECTED) delay(1000);
  sendKey("GSPro Wi-Fi controller is successfully connected!!");
}

String urlEncode(const String& str) {
  String encoded = "";
  char code0, code1, c;
  for (int i = 0; i < str.length(); i++) {
    c = str.charAt(i);
    if (isalnum(c)) encoded += c;
    else {
      code0 = (c >> 4) & 0xF;
      code1 = c & 0xF;
      encoded += '%';
      encoded += "0123456789ABCDEF"[code0];
      encoded += "0123456789ABCDEF"[code1];
    }
  }
  return encoded;
}

void sendKey(String key) {
  HTTPClient http;
  WiFiClient client;
  http.begin(client, server + urlEncode(key));
  http.GET();
  http.end();
}

void loop() {
  if (digitalRead(BTN_CLUB_DOWN) == LOW)  sendKey("i");
  if (digitalRead(BTN_RESET) == LOW)      sendKey("r");
  if (digitalRead(BTN_MULLIGAN) == LOW)   sendKey("ctrl+m");
  if (digitalRead(BTN_CLUB_UP) == LOW)    sendKey("k");
  if (digitalRead(BTN_PUTTER) == LOW)     sendKey("u");
  if (digitalRead(BTN_RESET_AIM) == LOW)  sendKey("a");
  if (digitalRead(BTN_TEE_LEFT) == LOW)   sendKey("c");
  if (digitalRead(BTN_TEE_RIGHT) == LOW)  sendKey("v");
  if (digitalRead(UP_PIN) == LOW)         sendKey("up");
  if (digitalRead(DOWN_PIN) == LOW)       sendKey("down");
  if (digitalRead(LEFT_PIN) == LOW)       sendKey("left");
  if (digitalRead(RIGHT_PIN) == LOW)      sendKey("right");
  delay(100);
}

🌐 Python Flask Server

On your GSPro host PC, run this simple Flask server to capture the GET requests:

from flask import Flask
import pyautogui

app = Flask(__name__)

@app.route("/press/<key>")
def press(key):
    if key == "ctrl+m":
        pyautogui.hotkey("ctrl", "m")
    else:
        pyautogui.press(key)
    return "OK"

if __name__ == "__main__":
    app.run(host="0.0.0.0", port=5000)

Install the required packages:

pip install flask pyautogui

🔌 Wiring Diagram

Each pushbutton is connected between the GPIO and GND. Enable INPUT_PULLUP logic if needed.

✅ Final Notes

  • Remove Serial.begin() to safely use TX/RX as input pins
  • URL encoding ensures keys like ctrl+m are parsed correctly
  • Debounce logic can be added for rapid button presses

🎯 Conclusion

Now you’re ready to use your own custom ESP8266-based gamepad to control GSPro over Wi-Fi! It’s efficient, responsive, and gives you total physical control of your simulation setup.

You may also like...

Leave a Reply

Your email address will not be published. Required fields are marked *