Skip to content

A convoluted solution involving an Arduino Uno, USB host controller v1.3 and an ESP32

Notifications You must be signed in to change notification settings

targetarchitecture/ESP32-Xbox360-Controller-MQTT-client

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

46 Commits
 
 
 
 
 
 
 
 

Repository files navigation

XBOX360 Wireless MQTT Controller

Failsafe Film

Two years on after I started learning about robotics and electronic engineering. I decided to revisit a problem that I couldn't find a solution for when building Zebra (Ada's first robot). I wanted to use my old Xbox 360 controllers and their wireless receiver to operate robots directly.

It sounds like a relatively simple problem, however the XBOX360 wireless receiver is very picky about the host controller it's plugged into, and the host controller can also be very picky about the device that it's plugged into. After weeks of failing to get this to work, I packed the XBOX360 controllers away.

It's 2020 and everything is an IoT MQTT device - even your 15 year old XBOX360 controllers. I still had the original Ardiuno Uno and a USB host shield from Keyestudio that I had purchased to build Zebra. The Uno and the USB shield had always been a stable combination when using the XBOX360 wireless controller - however at the time I lacked the knowledge to turn this into a working robot controller.

The simplest solution was to connect the Arduino Uno to the ESP32 via the arduinos serial pins and to the second serial (UART) on the ESP32. The ESP32 is much easier to use in this respect as it has multiple UARTs compared to the ESP8266.

The ESP8266, it claims to have to two UARTs howevers both of them are basically in use - one for programming and the other for the flash memory access.

The ESP32 and the Arduino have differant logic levels (5v & 3.3v), the hardware incorporates a logic level shifter for both the transmit and recieve lines.

I added a small SSD1306 OLED display to show some stats and the XBOX360 logo. To house the project I used circular USB panel mount sockets for the first time, these are much easier to install as it just requires a hole drilled and not my usual butchery with a dremmel.

Failsafe Film

Actions

Serial Command Serial Value MQTT Topic MQTT Value
STOP
START
XRC:True
XCC:1
Battery:0-3XBOX360/Battery0/3
L2:0-255XBOX360/Trigger/Left0/100
R2:0-255XBOX360/Trigger/Right0/100
LHX:-32768/32767XBOX360/Stick/Left/X-100/100
LHY:-32768/32767XBOX360/Stick/Left/Y-100/100
L3:CXBOX360/Stick/LeftClick
RHX:-32768/32767XBOX360/Stick/Right/X-100/100
RHY:-32768/32767XBOX360/Stick/Right/Y-100/100
R3:CXBOX360/Stick/RightClick
U:CXBOX360/D-Pad/UpClick
U:PXBOX360/D-Pad/UpPress
D:CXBOX360/D-Pad/DownClick
D:PXBOX360/D-Pad/DownPress
L:CXBOX360/D-Pad/LeftClick
L:pXBOX360/D-Pad/LeftPress
R:CXBOX360/D-Pad/RightClick
R:PXBOX360/D-Pad/RightPress
START:CXBOX360/Button/StartClick
BACK:CXBOX360/Button/BackClick
XBOX:CXBOX360/Button/XBOXClick
SYNC:CXBOX360/Button/SYNCClick
A:CXBOX360/Button/AClick
B:CXBOX360/Button/BClick
X:CXBOX360/Button/XClick
Y:CXBOX360/Button/YClick
A:PXBOX360/Button/APress
B:PXBOX360/Button/BPress
X:PXBOX360/Button/XPress
Y:PXBOX360/Button/YPress
L1:CXBOX360/Bumper/LeftClick
L1:PXBOX360/Bumper/LeftPress
R1:CXBOX360/Bumper/RightClick
R1:PXBOX360/Bumper/RightPress

Commands

MQTT Topic MQTT Value Serial Command Serial Value
setBigRumbleOn:0-3XBOX360/1/Battery0/3

setBigRumbleOn: 0-255 setSmallRumbleOn: 0-255 setBothRumbleOn: 0-255 setRumbleOff setLedOn: 1 setLedOn: 2 setLedOn: 3 setLedOn: 4 setLedMode: All setLedMode: Alternating setLedMode: Rotating setLedMode: FastBlink setLedMode: SlowBlink setLedMode: Off setLedOff

About

A convoluted solution involving an Arduino Uno, USB host controller v1.3 and an ESP32

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published