Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Request] Print pause with input GPIO #1351

Closed
temuccio opened this issue May 21, 2016 · 17 comments
Closed

[Request] Print pause with input GPIO #1351

temuccio opened this issue May 21, 2016 · 17 comments
Labels
plugin idea Idea for a plugin request Feature request

Comments

@temuccio
Copy link

Hello,
it is possible to send pause command at printer when an input of GPIO change status.
With this mode I can control il filament is present or it is finished and, in this case, I don't lose the print.

@GitIssueBot
Copy link

Hi @temuccio,

It looks like there is some information missing from your bug report that will be needed in order to solve the problem. Please take a look at the Contribution Guidelines which will provide you with a template to fill out here so that your bug report is ready to be investigated (I promise I'll go away then too!).

If you did not intend to report a bug, please take special note of the title format to use as described in the Contribution Guidelines.

I'm marking this one now as needing some more information. Please understand that if you do not provide that information within the next two weeks (until 2016-06-04 22:00) I'll close this ticket so it doesn't clutter the bug tracker. This is nothing personal, so please just be considerate and help the maintainers solve this problem quickly by following the guidelines linked above. Remember, the less time the devs have to spend running after information on tickets, the more time they have to actually solve problems and add awesome new features. Thank you!

Best regards,
~ Your friendly GitIssueBot

PS: I'm just an automated script, not a human being, so don't expect any replies from me :) Your ticket is read by humans too, I'm just not one of them.

@GitIssueBot GitIssueBot added the incomplete Issue template has not been fully filled out, no further processing until fixed label May 21, 2016
@temuccio temuccio changed the title Print pause with input GPIO [Request] Print pause with input GPIO May 22, 2016
@GitIssueBot GitIssueBot added request Feature request and removed incomplete Issue template has not been fully filled out, no further processing until fixed request Feature request labels May 22, 2016
@temuccio
Copy link
Author

For this request I think of resolve in this mode:
usage events to trigger the Z change.
Every Z change the system execute a control of input GPIO and if the input say that filament is end, the printer go on pause status.
In this case, if the concept is valid, how I trigger an action if true/false? In this page (http://docs.octoprint.org/en/master/events/index.html) I can't find it.

@FlyByPC
Copy link

FlyByPC commented May 31, 2016

There does appear to be a "ZCHANGE" event on the page listed above. If code could be hooked in here to poll a GPIO and optionally trigger a PAUSE event if it was high (or low), that would do it. You could hook up a filament-end switch with a pull-up or pull-down resistor, and could avoid a failed print.
With an ESP8266 Thing or similar, you could even have the sensor send you a text or email.

@FlyByPC
Copy link

FlyByPC commented May 31, 2016

You'd just need to ensure there's always enough filament between the sensor and extruder to complete any one Z layer, even in the worst case. (Suppose the filament triggers the sensor just after the ZCHANGE event.)

@temuccio
Copy link
Author

Yes FlyByPC, the idea is it this, but I don't understand how put in pause.
For example, if this is the config.yaml, I suppose to write:
events:
enabled: True
subscriptions:
-event: ZChange
command: "check input XX and if == 0 pause"
type: system

How I write a condition in command line?

@FlyByPC
Copy link

FlyByPC commented May 31, 2016

I don't know Python, although it's on my list to learn. It looks like you can "fire" events, which are seen by anything "subscribed" to them. Here's the code in events.py.

Maybe it's as easy as adding a GPIO check and conditional pause event to the ZCHANGE event?

In Arduino C, it would read something like:

void event_ZCHANGE{

//... rest of code here

if (digitalRead(FILAMENTPIN) == LOW){fireEvent(PAUSE);}

}//event_ZCHANGE

@MoonshineSG
Copy link

the best way to do it is via a custom plugin that would get a "nudge" from the GPIO and issue a "pause" and some kind of notification (play a sound?) ...

what kind of filament sensor are we taking about ?

@foosel
Copy link
Member

foosel commented Jun 2, 2016

You have two options here:

  1. Have an external program listen on the GPIO input (e.g. by using RPi.GPIO), in case of a GPIO event have it send a pause command to OctoPrint's REST API.
  2. Basically the same, but built into an OctoPrint plugin which can then utilize the injected self._printer property (also see Injected Properties) to achieve the same thing.

The event hooks are the wrong approach - a GPIO input from a filament sensor won't trigger an event in OctoPrint.

Also keep in mind that this is functionality that will NOT be added to OctoPrint proper, since OctoPrint is platform agnostic and runs on anything under the sun that runs Python 2.7 - that doesn't necessarily have to be a Pi or anything else with GPIO for that matter. So plugin-only (or external) it is.

@foosel foosel added the plugin idea Idea for a plugin label Jun 2, 2016
@MoonshineSG
Copy link

@temuccio: I put together a quick plugin. Change it as you need ...
https://github.com/MoonshineSG/Octoprint-Filament

@FlyByPC
Copy link

FlyByPC commented Jun 2, 2016

Thanks! The API -- and/or the plugin -- is probably just what I'm looking for.

Gina -- would it be possible to add this to the next version of OctoPi, since that's targeted for RPi?

@foosel
Copy link
Member

foosel commented Jun 2, 2016

@FlyByPC Bundling an existing universally applicable plugin might be possible, but then again it would make more sense to have people just install whatever they need through the plugin repository (that's what it's there for). Most people don't connect stuff to GPIO, so having it included by default adds unnecessary ballast.

@FlyByPC
Copy link

FlyByPC commented Jun 2, 2016

That makes sense. I didn't know about the API -- and that alone should make a solution pretty straightforward. Thanks.

@temuccio
Copy link
Author

temuccio commented Jun 5, 2016

@MoonshineSG thanks for the plugin, the next week I cat test it. For the filament sensor , I use a sensor's paper in the common printer (in attach two foto for the idea). It's works at 3.3V ad is it compatible with raspberry.
img_20160605_181200467
img_20160605_181256126

@MoonshineSG
Copy link

a clever approach using an optical sensor (using the sample code above, since then promoted to full fledge plugin): http://www.thingiverse.com/thing:1646220

@foosel
Copy link
Member

foosel commented Jan 27, 2017

Considering that the intent behind this request was a filament sensor and for that there's now a plugin available, I'd say this can be considered resolved.

@foosel foosel closed this as completed Jan 27, 2017
@FlyByPC
Copy link

FlyByPC commented Jan 27, 2017 via email

@jypma
Copy link

jypma commented Apr 13, 2018

I'm using the "pause print at Z layer" plugin for Cura, that allows for e.g. filament change at a certain height. That plugin auto-pauses the print, requiring a "Resume" click in the Octoprint UI to resume the print. My printer (Anet A8 / Marlin) doesn't seem to have a menu option to resume the print, so I have to do if from the web for now.

Does that mean a GPIO pause/resume function makes sense after all? GPIO stop may as well, as a sort of "emergency stop" function.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators May 29, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
plugin idea Idea for a plugin request Feature request
Projects
None yet
Development

No branches or pull requests

6 participants