Xbox 360 controller for OctoPrint

The fun never stops... So I just got my xbox 360 USB receiver in the mail to go with the almost-new controller that I bought at Gamestop days before they closed their stores in California.

So I'd purchased this third controller for safety's sake since I'd purchased a used xbox 360 before lockdown ($45). Staring at it on the table I thought that I should hook this (spare controller) up to my 3D printer.

It's been way too easy.

  • Load driver
  • Adjust udev for rights
  • Reboot
  • Grab a Python module
  • Rock & roll

All I have to do now is to write a plugin to marry this to the G0 commands. I'm thinking...

Maybe...

  • Left joystick (floats) => absolute move X/Y
  • Lpad up/down (bool) => relative move Z (1mm)
  • Lpad left/right (bool) => relative move Z (0.1mm)
  • Right joystick (floats) => relative move X/Y from current position
  • Start (bool) => Home X/Y/Z
  • Left trigger (float) => relative retract
  • Right trigger (float) => relative extrude
  • Left bumper (bool) => unload filament (retract 130mm)
  • Right bumper (bool) => load filament (extrude 130mm)
  • Left joystick push (bool) => center extruder
  • Right joystick push (bool) => ?
  • A (bool) => Resume
  • B (bool) => Pause
  • X (bool) => Cool
  • Y (bool) => Preheat
  • Back (bool) => Cancel

Done

[x] B (Pause)
[x] A (Resume)
[x] Back (Cancel)
[x] Start (Home XYZ)
[x] Left Bumper (unload filament)
[x] Right Bumper (load filament)
[x] Lpad up (1mm up)
[x] Lpad down (1mm down)
[x] Lpad left (0.1mm up)
[x] Lpad right (0.1mm down)
[x] X (cool extruder)
[x] Y (preheat extruder)
[x] Left joystick push (center extruder)
[x] Left joystick (absolute moves X/Y)

3 Likes

Minecraft 3D printer edition?

1 Like

I've been thinking about it, and have decided you must make a game of some type... Something multiplayer or solo, not sure. Game of skill. Maybe reverse jenga or something?

RetroPie supports it, for what it's worth.

At this very moment I'm working on the OctoPrint plugin for controlling it. Given that there's no visual interface, I'm left with things like I've indicated above.

Alright... I've got a fair bit of code and I'll install/test it tomorrow on my 3D printer. :slight_smile:

Looks like I've got something throwing commands. I'll take things slowly and make sure that I don't screw things up.

UPDATE: It's pretty much completed now and working fine on my own printer, for what it's worth.

Hi, i am interested about your project, can you atach the code or maybe the istruction to make it?
Thank you very much.

In the begining i start to think how to atach an analog joystik at the raberry to controll x/y and z, but your project is better.

Here's the repository but I'd suggest that it's only really useful now for another coder. You might want to review the code to see if there's anything you might re-use.

Keep in mind that many analog joysticks would present themselves almost like a mouse to the operating system. You might want to review pygame to see if they have support for this (probably).

I’m just curious, which tasks are so control-intensive so you need a hardware controller?

I've had a TFT control screen on the printer since I bought it. The stock Robo 3D menu interface allowed you to get the printer ready, start/pause/cancel a job and to run some wizards for a few things.

I replaced that menuing interface and it was my intention to prep jobs with it. But having introduced the Xbox 360 controller, those tasks now seem to be much easier with this joystick, essentially. Typical work-saving features include (some) extrusion/retraction or a full amount of something like 130mm for filament changes; pre-warming the hotend or cooling it; homing the axes after a reboot.

1 Like

This is awesome, thank you!

I have an 8BitDo Wireless adapter I use with a spare Nintendo Switch Pro controller, and I'm looking forward to testing out this plugin, to see if the adapter supports xboxdrv

Would you be able to speculate if this will work using any old HID Joystick controller, eg, vanilla joystick/gaming-controller, PlayStation SixAxis, Wii, LIRC remote, etc? (after ruleset, of course)

If so, how?

I'm keen to know if anyone has got this working?
Installed xboxdrv and installed this plugin by OutsourcedGuru but not getting anything going to my printer.
Been mucking around for a couple days now trying to remap axis in xboxdrv and then assign them to gcode movements with the USB keyboard plugin. Have something half working with the [significant] downside that I can only move a set distance and in a single direction at a time (meaning alot of button presses_.
i'm really hoping i could get this to work in any vector direction and to jog with the joystick.
this is for a sandtable (magnet pushes ball through sand to make patterns/pictures) running octoprint on Raspberry Pi 3B+ with ardunio running GRBL. Any help would be super appreciated.

I've been thinking about it, and I've come to the conclusion that you should make a game of some sort... I'm not sure if it'll be multiplayer or solitary. A skill-based game. Maybe a game of reverse jenga?

In my opinion there is no need to include a controller as plugin. It is much easier to write a small stand alone python script and push data via REST to octoprint. It is also pretty difficult to catch all possibilities e.g. what should which button do within the different printer states depending to the needs of any users so I wrote a little script for my std. controller if anybody interrested in.

Curious about your project might be a game-hit project.

it not a game project, this project is all about gaming xbox 360 controller.

yap, you are absolutely right this is definitely a Xbox 360 controller for OctoPrint project instead of just gaming project.