Skip to content

TugrulSTE/SimulationBox

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

3 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

Wireless Button Box for ETS2 (ESP32 + UDP)

This project is a DIY Button Box controller for Euro Truck Simulator 2, built using an ESP32 microcontroller. Unlike standard controllers that act as USB HID devices, this project uses WiFi and UDP Sockets to communicate with the PC.

It consists of two parts:

  1. Transmitter (ESP32): Reads physical buttons/switches and sends state data via UDP.
  2. Receiver (Windows PC): A C++ console application that listens for UDP packets and simulates keystrokes using the Win32 API.

πŸš€ Features

  • Wireless: Completely air-gapped data transmission over local WiFi.
  • Low Latency: Uses UDP protocol for minimal delay.
  • No Drivers Needed: The receiver app runs as a standalone user-mode application.
  • Custom PCB/Wiring: Simple GPIO pull-up logic.

πŸ›  Hardware & Wiring

  • Microcontroller: ESP32 (DOIT DEVKIT V1 or similar)
  • Connection: Buttons connected between GPIO and GND (Internal Pull-ups used).
Component ESP32 GPIO Pin ETS2 Function Keyboard Key
Ignition (Switch) GPIO 18 Start/Stop Engine E
Horn (Button) GPIO 15 Air Horn H
Parking Brake (Switch) GPIO 21 Toggle Handbrake SPACE
Lights (Switch) GPIO 5 Hazard Lights F

πŸ’» Software Setup

1. ESP32 (Firmware)

The firmware is written in C using ESP-IDF and FreeRTOS Task Management.

  • Open main.c.
  • Update wifi_config with your WiFi SSID and Password.
  • Update SERVER_IP with your PC's local IP address (e.g., 192.168.1.X).
  • Flash to ESP32.

2. Windows Receiver (App)

The receiver is a standard C++ Console Application using winsock2.

  • Open receiver.cpp (or main.cpp).
  • Update the server.sin_addr.s_addr line with your PC's IP address.
  • Compile using Visual Studio or MinGW (Link with ws2_32.lib).
  • Run the executable before starting the game.

⚠️ Disclaimer

This is a hobby project created for educational purposes to learn about Socket Programming and Embedded Systems. The code is in a "prototype" state.

πŸ“ License

Feel free to use and modify!

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors