Hardware pendant Start/Stop button / joystick options?

search amazon for ‘numeric keyboard usb’ and it finds a lot of them.

David Lang

you did suggest a keypad (scroll up). the wii remote was sitting on my shelf and a library was available. If you really want a usb tethered pendant, I think that one would be reasonably straight-forward to implement. It would be on the web side getting the key presses mapped to the web control buttons.

Python isn’t truely multithreaded, so when you mentioned running the wii remote in it’s own process rather than its own thread, that could be an option. You could use the wminput library and effectively have the input come in as a joystick or gamepad. This would make it so the web page would need to scan for the input or some other service to put the commands in the webcontrol queue, though I don’t know how to do that. As it is, the pendant has direct access to the data object via self.data.actions.move().

The phone option could be more optimized with some web page adjustments, but I find it functions quite well as it is. I would like to make an optimized web display (no input) for the rpi since I don’t have a touch screen for it any longer. It could show the current position and gcode line. Perhaps that could be its own process and host the wii pendant and update the webcontrol via socketio and REST. This same interface I had considered (above) using a wifi microcontroller. I have an azure IOT board with a display and a couple buttons that might work for that, but I was thinking the wii remotes are really easy to find and are pretty efficient and easy to use plus the pi zero, 3 and 4 all have bluetooth and there was a library for it just waiting to go.

I’m trying to do more cutting, not more coding. I will be very interested to see if this goes anywhere else.

I know. I was being facetious.

I’m surprised anything works these days when we have to get a framework and (someone else’s) library going to register a button press.

Not to mention the latency and the (high) possibility of dropped connections of wireless.

I’m tone deaf… in text. The code for this webcontrol is seriously more intense than I imagined with the web side and the python side and the socket interface. So cool that it works.

but you were right (head down in shame) it probably was an easier solution. Would you really use a USB keypad? I believe you are right it would be “simpler” to implement.

1 Like

As always, the answer is “it depends”. Sure, if you’ve got something working after overcoming all the problems present in a distributed, asynchronous, multi-protocol system then you can present the final result and people will agree it is cool.

However, in our installation we have a touch-screen laptop in a small cupboard next to the machine. The cupboard protects the laptop from most of the dust. We can operate Ground Control using the touch screen, or the touchpad on the laptop keyboard.

I haven’t pressed the cursor keys on the keyboard, to see if they are mapped to Ground Control functions, but a USB numeric keypad is essentially a subset of the keyboard keys. So if there are keyboard shortcuts in Ground Control (haven’t looked, haven’t needed) then those keys could be chosen so that they happen to be the ones on the numeric keypad.

Completely off the top of my head:
Up, down, left, right: Movement
Home: Define home
5: Move to home
Pg Up, Pg Dn: Z-axis up/down
Enter: Play/Pause
End: Stop
/ *: Macro 1 Macro 2

I’m not sure if a pendant like this would be much use to us as the laptop is right next to the machine, plus if I used a pendant I’d prefer to see the screen, which would mean I was close to it.

As I said, by repeating my suggestion I was being a bit facetious, but when the topic first popped up I started thinking how could I do this simply, with something off-the-shelf? A USB numeric keypad seemed like a good idea. Another cheap option is a USB gaming controller. The X-Box or PlayStation type are a bit pricey, but the early Nintendo one is cheap:

I don’t know what the driver for that looks like to the OS, but it could be a case of loading a driver and assigning some keyboard macros to the gamepad buttons.

And there are wireless game controllers too.

I was thinking on this further. The other option for using the wiimote would be the same avenue as using the usb game controller. You load a driver (wminput for the wiimote) and then use the pygame library to read the joystick/gamepad inputs and map them to the sled and z movement functions. This would be a cleaner solution for the wiimote because you can set up a daemon process to attach and detach the wii control via bluetooth and then a separate capture program captures the keystrokes or button presses in the program. Would this solve the issue of lag and connection delays? I can’t answer that, but I looked a few examples of how to do it, so I believe it can be done. Integrating the keypad would be easier than the game pad because it is keystrokes with a generic hid driver. I don’t know how to get a web page to map keys as input. Whatever it is it would need to be in focus and the active program to accept keystrokes.

I got it working!!

push buttons on the controller for start/pause/stop, turn on wii pendant bluetooth, and shutdown.

the wii remote will move the sled, home, set home, move z and zero z, play, pause, stop, disconnect. When the wii remote disconnects, it turns off, the pendant service dies and the button has to be pressed to restart the process for the wiimote to join.

Webcontrol now works with the pendant in operation.
EDIT: The command line display is showing mostly what is wanted and the status LED is working.

2 Likes