Maslow Home Maslow Community Garden Newsletter

Hardware pendant Start/Stop button / joystick options?

So I’m still really new to this and I’ve searched the forum, but I didn’t see anything about a physical start or stop button other than the STOP NOW discussion. I have been using layered Gcode files, but I found that the home position between them changed a bit, so I had to start the job and hurry and stop the job and reset, so each time I would run to the laptop to stop the job. In ground control, there is a start / stop, but to use it I need to carry my laptop around all the time, so lifting the sled to save the work piece, shutting off the router, then running to the laptop to stop it is the most clumsy arrangement. Plus my space is a bit tight. I wired in my own E-stops and included some romex to home light switches for ease in controlling things on the maslow.


The steppers are the switch on the left, the router is on the right. I don’t have a high enough amperage rating e-stop to run the vacuum off of it as well, which would be in the middle until the contactor arrives. I had planned to plug in the raspberry pi on the same connection with the Arduino, so an E-stop will kill it all as will the power switch,

I’m wondering why we couldn’t have physical buttons on the system like a green START and a red STOP button similar to the pendant idea. With the understanding that the Arduino has only 2 or 3 inputs left and that scanning them for direct input would be a taxing issue on it makes sense, so anything to do this would most likely be connected to a groundcontrol (laptop) input or a webcontrol (web based laptop or raspberry pi web or gpio or USB) input.

My (somewhat incompletely considered) ideas:

  1. Since web control can serve multiple pages to different viewers simultaneously, can it serve a modified page /form so a pizero wireless pendant (running on a USB battery pack - nice flat package) could get and put information from GPIO start / pause / stop buttons? I have like 5 of these available and could mock it up and test it, but I don’t have much experience with flask or the web side of this system, so whether or not this makes sense or could be constructed reliably is an unknown to me. My experience would be best used in making the pendant or configuring data from the pendant to the webcontrol, not the webcontrol side.

  2. If I’m using raspberry pi to serve webcontrol, would it make sense to add the desktop to autoload a simplified localhost web page with just the control buttons on a local 5" touch screen on the raspberry pi that could be mounted 6 inches above the middle of the work space? It could be reached to tap it while standing in front of the home position. The web control would also be loaded on my laptop where I would be able to view the layout and follow the cut in process and set all the greater details. The 5" touch screen would not be fully functioning as web control, just button input. This could also be accomplished from an 8" kindle fire with a limited web page.

  3. The 2017 joystick idea was interesting. I 3D printed a joystick a couple years ago off of thingiverse (link: https://www.thingiverse.com/make:413769). The microcontroller and VID and PID I chose work in windows, but retropie never recognized it, so it sits idle. It would need to be USB powered from a computer, but my laptop only has 1 usb port and the maslow is connected to it. If it were connected to webcontrol raspberry pi, how could we read joystick input for control button movement? It could be on #1 or #2.

Perhaps the question shouldn’t be could it work, but would it make any sense to pursue any of these options and would anyone else be willing to guide me through the webcontrol incorporation of it? I can get the hardware and USB working, but the web side of it will be slower. My goal here is the fastest route to function and I want it to be fairly easy to use. I have a couple days before going back to work, so knocking this out would be awesome and a good use of time.

I just read more about webcontrol on the github page and read the downloadable documentation. Much of what I was discussing is covered in the phone page, but I would still like physical push buttons to make it start and pause and stop.

look at web control and the GPIO options that it has.

with web control, you can have your phonr on screen that gives you quick
controls.

a lot of the fancier options will need enhancements to the firmware (we really
should look at the grbl fork more and see if we can transition to it)

David Lang

I am interested to see where this might go as well.

The “Arduino MEGA” has 16 analog input pins that can measure a variable voltage input (or used as extra digital pins). I do not know if this would require a firmware update or if it is simply a tweak of the interface through groundcontrol (or webcontrol).

I do know that my Maker-Made shield only connects to analog pins 0-7. Pins 8-15 are vacant and not connected to the shield board. I would assume these pins on the shield just pass through to the GPIO pins (i have not verified). If the pins can be used within groundcontrol, it should not be too hard to create a script that will assign specific voltages to trigger other actions (based on 1 input pin).

You could make a simple hardware “wultiplexer” solution that would use simple resistors and switches. You could wire a button to send 4v to the pin when pressed and then assign 4v input to “UP”. 3v would be assigned “RIGHT”, 2v could be “DOWN”. This would give you a crude form of a “joystick” based on a single input pin. :joystick:

Depending on how much functionality you need, if you target a 0.1v resolution and leave 0.1v gap between discreet triggers, you could possibly trigger 5 different actions per volt of input.

The main limitation of a system like this is the potential of pressing 2 buttons at once and sending a different signal than what was intended to the system. It would be FUN to learn when pressing the “UP” and “RIGHT” buttons at the same time, you end up sending the “START” command :zap: :zap:… LOL!

wiring to the arduino is not going to work well to get things into
GroundControl. The protocol for CNC machines is that the management software
tells the firmware what to do, not that the firmware starts doing things and
tells the management software what it’s doing.

With WebControl running on a Pi you cand use teh GPIOs to communicate with the
management software easily

If you really need lots of inputs, use a keyboard (it doesn’t have to look like
a normal keyboard to the user, but it should look like one to the software),
doing lots of different voltages per pin is a nightmare to get right and
reliable.

David Lang

Thank you for the brilliant and insightful feedback! It makes complete sense.

It is awesome to have a community like this to bounce ideas around with!

Can we handle the inputs within the Arduino? This way we would never have to worry about sending an input signal to groundcontrol for processing and then sending commands back to the Arduino.

Example: my 3d printer is running an Arduino “Mega 2560” based control board. It has a filament sensor. When it runs out of filament, a switch opens. It will pause the print, move the head to home (in “X” and “Y” axis only) unload the remaining filament by backing up the motor a set number of steps. Then it will wait for you to reload and clear the error. This entire process is all handled in the Arduino code. I didnt know if it would be possible to configure something similar on Maslow. When you trigger a specific input, move the sled a certain number of steps in a specific direction.

There are a LOT of unused inputs on the Arduino board. I have started playing around on my end to see if this is possible and how to best execute something like this. I am still learning and it might be a while but I will report back if I make progress.

do you know of any 3d printers that send commands/info from the firmware to the
controllers like you propose? I can’t. At best, you can jog around the bed and
the upstream controller doesn’t know that you moved.

to use your example of the filiment sensor, any movement that it does is
transparent to the controller as it moves back before doing anything else.

the Pi has more GPIOs available than the arduino does.

If you want to go down this road, you will need to invent the protocol for the
arduino to tell GroundControl what it’s doing. We will also need to permanently
abandon efforts at grbl compatibility (as neither the g-code sender control
softare, or the firmware will understand the new protocol)

It’s FAR simpler to just do this on a Pi with WebControl.

David Lang

I agree the input would be simplest from the pi, though my 3D printer has a button on the front that allows me to pause, change temp, speed up or slow down the print on the fly. I think most running marlin do.
I’m thinking the pi could read the input via GPIO, USB (ps2 or xbox controller) or even bluetooth (wiimote?) and then programmatically send the pause or stop command to the controller. I’m pulling my retropie apart to put this thing together so I have a few controllers now in addition to the one I made.

WebControl already implements several GPOI functions, and it shouldn’t be that
hard to expand it to includ others.

David Lang

With most 3d printers, The Arduino IS the controller. You do not need Octoprint to use your printer. It is an optional software that makes using it more convenient.

I assumed giving the controller (Arduino) an additional input wouldn’t be too much of an issue. Most printers do not have this “2 part system” where you have one part doing some of the work and another part doing the rest. In a Printer, the Arduino is the only thing taking the gcode from an SD card or octoprint and figuring out what to do from there.

I didn’t know how Maslow was setup that is why I am asking these questions.

Thanks again for the awesome insight!

The 3d printers act like stand-alone tools, whereas the maslow acts like a USB printer requiring the PC to be there to operate. What needs to happened to make it stand-alone?

If you want to go down this road, you will need to invent the protocol for the
arduino to tell GroundControl what it’s doing. We will also need to permanently
abandon efforts at grbl compatibility (as neither the g-code sender control
software, or the firmware will understand the new protocol)

I was thinking about this a bit. Right now I believe ground control sends gcode to the arduino and the arduino responds back to ground control after the play button is pressed as the cut progresses. I need to look into how it actually works. Is the pc acting as the gcode buffer, feeding only one line at a time and so the Arduino only parses one at a time? 3D printers use similar hardware and they read the gcode from an attached sd card and can go crazy fast. It seems plausible that there is much more untapped horsepower in the controllers on maslow since it only uses 2 motors on an x-y plane instead of 3 motors that my delta 3d printer uses.

The 3d printers act like stand-alone tools, whereas the maslow acts like a USB printer requiring the PC to be there to operate. What needs to happened to make it stand-alone?

If you want to go down this road, you will need to invent the protocol for the
arduino to tell GroundControl what it’s doing. We will also need to permanently
abandon efforts at grbl compatibility (as neither the g-code sender control
software, or the firmware will understand the new protocol)

I was thinking about this a bit. Right now I believe ground control sends
gcode to the arduino and the arduino responds back to ground control after the
play button is pressed as the cut progresses. I need to look into how it
actually works. Is the pc acting as the gcode buffer, feeding only one line
at a time and so the Arduino only parses one at a time?

Yes, this is pretty much the way all CNC mills work.
Part of this is that the heritage is machines like
https://www.google.com/imgres?imgurl=https%3A%2F%2Fwww.normanmachinetool.com%2Fwp-content%2Fuploads%2F2019%2F03%2F8441-HAAS-VF-2D-CNC-3-AXIS-VERTICAL-MILLING-MACHINE-1.jpg&imgrefurl=https%3A%2F%2Fwww.normanmachinetool.com%2Fproduct%2Fhaas-vf-2d-3-axis-cnc-vertical-machining-center%2F&docid=3YqUUn0vob2USM&tbnid=_osNNj4ONxD7oM%3A&vet=10ahUKEwiUrYbdodXmAhXTJzQIHfvhA94QMwjqAigBMAE..i&w=1740&h=1744&client=ubuntu&bih=967&biw=1970&q=haas%20CNC&ved=0ahUKEwiUrYbdodXmAhXTJzQIHfvhA94QMwjqAigBMAE&iact=mrc&uact=8

but part of it is that there are just more things you have to worry about
(starting position, tool changes, etc), part of it is that CNC mills tend to be
more dangerous (spinning bits, large masses moving, etc) and up until very
recently you did not have embedded controllers that didn’t suffer horrible
stalls at times when also trying to run a UI and/or network

3D printers use similar hardware and they read the gcode from an attached sd
card and can go crazy fast. It seems plausible that there is much more
untapped horsepower in the controllers on maslow since it only uses 2 motors
on an x-y plane instead of 3 motors that my delta 3d printer uses.

the maslow does use 3 motors, and the math required is far more complex than a
3d printer (even a delta printer) as we do not have a way to go both from
desired position to chain lengths and from chain lengths to actual position with
just calculations, we have to guess and iterate (up to about 5000 times IIRC)
for one of the directions

This is part of the reason why the arduino is short on resources for running the
maslow (the arduino is short on resoources for a 3d printer, that’s why the new
32 bit boards are showing up)

there is not a drastic amount of unused processing power on the arduino when
running the maslow.

We have been thinking about new controller designs, including some that won’t
require two parts, but a Pi is so cheap that it’s a really easy way out to use
WebControl on the Pi and talk to a simpler controller board for the time
critical work.

1 Like

Thanks for taking time to discuss.

It is surprising with the micros that are available now that 8 bit is still in use if the calculations are that intensive. Flight controllers for the quadcopters are quite amazing controlling the 4 brushless motors in flight and communicating telemetry via serial bus to the osd and the controller. Those are cheap at $40, 32 bit, and could likely be repurposed for this, but running brushless vs steppers takes fewer pins, so it probably won’t just drop in. I wonder what the cost difference is if each motor had its own stepper driver that was bus controlled leaving the controller to just do math?

The pi zero is 64 bit, but would require a real time OS to work, so that may be a bit more challenging.

There is computational “horsepower” out there, but that is out of scope for this discussion, but it helps me get the proper perspective on where things are.

Im out of town on vacation, so I won’t be very responsive for a bit and might not be able to read everything posted… with that said…

The idea of a hardware pendant using a rpizero is interesting… there’s a couple of ways it can be done, but I think it would have to be a separate app written for the zero. I know it’s possible to run a headless webbrowser (webbrowser without a display) but that could get complicated to build for. Webcontrol can take in websocket requests or HTML requests. I think a separate app that uses HTML might be the simplest path. if an app is written to send a HTML request to webcontrol when something happens on a gpio, webcontrol can readily process it.

option 2: webcontrol raspberry pi also serving a desktop with 5" waveshare touch screen for hard mounted touch screen control… I have not yet gotten the web browser to open automatically to the correct web page and have it go to full screen without intervention, but a pic of it there is below:


how do we get the rpi to load the mobile web page?
add the user-agent switcher chromium app and tell it you are on android kit-kat
then change the screen rotation of the touch screen and reboot

but after doing this, if I have to manually load the web page each time, I’ll just use my phone.

Honestly, for me the deal breaker is the dist to move text that is editable with a keyboard only. the up/down arrows only go 0.01 up or down and I have fat fingers. In Android this would not be a problem because the on-screen keyboard would pop up. If it had a popup like ground control that can be selected, that would be ideal.

I’m thinking a logitech gamepad might do the trick for me.

I don’t think it would be too hard to make a pop-up keyboard like ground control for both dist to move and gcode index. It’s probably be a special page created… so something like http:xxx.xxx.xxx.xxx:5000/touchPage.html and would automatically be a mobilized layout

That part I don’t know much about but I think the odds are high someone has already developed a script or something to start chromium on boot and go to a webpage.

ok so that makes it try to load the page, but when the desktop first comes up, the page isn’t always ready… so how to get it to reload… press the reload button and it comes up. Or if you don’t get to it soon enough, it automatically reloads and comes up. Not in full screen, but with the display rotated 90 degrees, it is probably ok.

Try:

https://www.raspberrypi.org/forums/viewtopic.php?t=122143

How do “we” add in a pop up to change the movement text?

I was looking over the webcontrol code. In there is a section with GPIO. Is that for the arduino inputs?

How would we interface the web interface control with the raspberry pi GPIO? I know how to do it in python locally with a script or cron job, but not how to have a web-served page do it. It seems likely that the same route to have a web served page send a serial command would work. I’m showcasing my ignorance here, but I’d really like to learn how this works. - this is based on an incomplete understanding of flask, which appears to be a web display for a local program, not serving multiple instances. I noticed when i use my phone, the rpi screen follows the phone screens, so it is more of a vlc connection. I had conjured up some insane complexity based on multiple users and it isn’t so, but I must admit the fact that it works like this is very very cool.

An rpi shutdown button would be very very useful as well because my touch screen covers the IO typically used to initate shutdown from a button.