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

Add extruder sensor for MMU2 #17886

Merged
merged 12 commits into from
May 17, 2020
Merged

Add extruder sensor for MMU2 #17886

merged 12 commits into from
May 17, 2020

Conversation

BastR
Copy link
Contributor

@BastR BastR commented May 5, 2020

First of all, I'm a beginner in coding, so if there are any errors (there probably will be) please help me to solve them.

Description

History:
The PR #17523 has added the possibility to use the MMU2S with marlin, this had been asked for a long time and I thank the contributor.
BUT this is only possible if the printer is equipped with an MK3S extruder designed for the MMU2S, i.e. with the filament sensor triggered when the filament open the extruder gears away and the door idler moves.
Like this:

This PR adds the possibility to use the MMU2 using a filament sensor located on the extruder inlet and thus improve filament loading. For this to work the filament sensor must be less than 38mm from the extruder gears, if the distance is greater the filament will never be loaded so we must return to the classic version of the MMU2.

In order not to touch in depth the mmu.cpp file, I created some #if ENABLED()/#endif to switch between MMU_EXTRUDER_SENSOR and PRUSA_MMU2_S_MODE, I don't know if it's the best way but it was the easiest for me.

MMU_LOADING_ATTEMPTS_NR and MMU2_C0_RETRY are the same thing, I don't know if we can merge them.

I didn't touch SanityCheck but I think we should check that we use one mode or the other, not both together but also that the filament sensor is activated if we use one of the 2 modes.

Benefits

This improves the loading in case the filament does not reach the extruder for extruders that are not like the MK3S

-The filament is fed to the extruder from the MMU.
-The filament is detected by the sensor and stops the loading.
-A last one C0 command (38mm) pushes the filament while the extruder turns to catch it.
-Print continu

-If the filament is not detected by the sensor, the MMU will perform the number of C0 commands defined in configuration_adv.h.
-If the filament is still not detected, the printer enters runout mode so that the user can solve the problem and avoid missing layers.

@BastR
Copy link
Contributor Author

BastR commented May 8, 2020

I've made some minor changes, the branch is working fine for me. :)
IMG_0923

@Maynardnaze
Copy link

Awesome work!!! I appreciate it. I'll give it a try today or tomorrow

@BastR
Copy link
Contributor Author

BastR commented May 9, 2020

Awesome work!!! I appreciate it. I'll give it a try today or tomorrow

Thanks you @Maynardnaze, I've just make the last commit today, your feedback would be greatly appreciated :)

@0lympu5
Copy link

0lympu5 commented May 11, 2020

Is there a way to get this to work more in the fashion of the mk3 sensor. I have a bondtech bmg with the IR sensor and ball bearing placed just above the gears but not connected to the extruder door in any way.

@BastR
Copy link
Contributor Author

BastR commented May 11, 2020

Yes of course, this PR is made for that, to allow the use of the MMU2 with an extruder equipped with a filament sensor placed before the gears. It works well on my printer but I need testers.

You need to uncomment #define MMU_EXTRUDER_SENSOR to use the sensor for loading filament.

@0lympu5
Copy link

0lympu5 commented May 11, 2020

Okay, thanks for your reply. Is there an option for adjusting loading distance after the sensor?
Currently changed the filament unload position in PrusaSlicer and i would need it to move the filament further than 38mm.

Re designing to add a spring loaded pin that can be moved by the door and invert the sensor output

@BastR
Copy link
Contributor Author

BastR commented May 11, 2020

No we can't, the 38mm are defined in the firmware of the MMU. What extruder do you have? And how far away is the sensor from the gears?

@0lympu5
Copy link

0lympu5 commented May 11, 2020

A bmg direct drive petsfang, my unload distance is 138mm if that give you an idea of the extra distance required

@BastR
Copy link
Contributor Author

BastR commented May 14, 2020

@thinkyhead this is for me the last commit, in the end we left only 2 possibilities for the MMU and both needed a filament sensor, I just restored a part of the code that doesn't need the filament sensor.

@fredmz01
Copy link

@BastR bonjour, j ai une prusa mk3s avec cadre Bear et extrudeuse bondtech , le capteur de filament sur la porte , je viens d installer une carte skr 1.4 et un écran tft35 v3 j utilise le firmware de codiac 2600 sur github, je ne connais rien a marlin , avez vous un firmware compiler prêt à l'emploi suivant ma configuration pour la carte et l'écran avec la fonction mmu2s ? Merci beaucoup

@3DDBPRINT
Copy link

3DDBPRINT commented May 16, 2020

hello,
i confirm the code works ! no problem during print ;)

IMG_3401

@0lympu5
Copy link

0lympu5 commented May 16, 2020

Do both options only work with standard extruder?

@BastR
Copy link
Contributor Author

BastR commented May 16, 2020

Do both options only work with standard extruder?

You can choose between the 2 new modes or comment both to use MMU has before without filament sensor

@0lympu5
Copy link

0lympu5 commented May 16, 2020

If I used it in mk3 mode as such, will it continue to load as my firmware has stated or the 38mm in the mmu firmware

@BastR
Copy link
Contributor Author

BastR commented May 17, 2020

@BastR bonjour, j ai une prusa mk3s avec cadre Bear et extrudeuse bondtech , le capteur de filament sur la porte , je viens d installer une carte skr 1.4 et un écran tft35 v3 j utilise le firmware de codiac 2600 sur github, je ne connais rien a marlin , avez vous un firmware compiler prêt à l'emploi suivant ma configuration pour la carte et l'écran avec la fonction mmu2s ? Merci beaucoup

@fredmz01 non je n'ai pas de firmware tout prêt pour ta carte et je ne pense pas que tu en trouves, il faut que tu travailles ton marlin pour indiquer tes paramètres machines. À la limite tu vas trouver un marlin pour ta carte mais tu devras quand même y indiquer tes drivers, tes distances, etc...il y'a bcp de tutos sur le net qui peuvent t'aider sinon je t'invite à rejoindre le groupe Anet 3D 🇫🇷 Communauté Française sur Facebook, tu trouveras de l'aide j'en suis certain

@BastR
Copy link
Contributor Author

BastR commented May 17, 2020

If I used it in mk3 mode as such, will it continue to load as my firmware has stated or the 38mm in the mmu firmware

@0lympu5 The load and unload parameters that are in the firmware are only used for the commands coming from the LCD, the management of the load/unload during printing is mostly done from PrusaSlicer.

In a previous PR was introduced the support of the MMU2S and therefore the MK3S extruder with filament sensor on the door. In this PR I introduce the use of the MMU2 with a filament sensor on top of the extruder as it was the case before the MMU2S/MK3S. In these 2 modes, the filament will be stopped when the filament is detected by the sensor then (to simplify) will be pushed by the C0 command of the MMU2 i.e. 38mm.

It doesn't interfere with the operation, it's just necessary to adjust the loading values in the firmware (for load form LCD) and in Prusaslicer (for load during print).

vgadreau pushed a commit to vgadreau/Marlin that referenced this pull request May 29, 2020
@0lympu5
Copy link

0lympu5 commented Jun 26, 2020

How do I access the code, is it in the marlin release or can I manually add the changed files into bugfix?

@BastR
Copy link
Contributor Author

BastR commented Jun 26, 2020

@0lympu5 you can just download the bugfix and update your configurations files

@0lympu5
Copy link

0lympu5 commented Jun 26, 2020

So the bugfix on the website is upto date. Currently use bugfix but downloaded several months ago

@BastR
Copy link
Contributor Author

BastR commented Jun 26, 2020

The code has been merged into the bugfix +/- a month ago

@0lympu5
Copy link

0lympu5 commented Jun 26, 2020

Awesome, just downloaded and will now setup. Any idea if this can work with auto bowden calibration or spool join

@BastR
Copy link
Contributor Author

BastR commented Jun 26, 2020

No, this features are not implemented.

@isanval
Copy link
Contributor

isanval commented Jul 5, 2020

Good work, thanks @BastR !!

Just one question... As I have an extruder filament sensor (on the idler) I compiled the bugfix and enabled MMU2S mode (PRUSA_MMU2_S_MODE). The point is that when I do the Tx command, the filament gets loaded until the gears but the extruder is not spinning, so the filament cannot go through the gears (not enough torque) and the sensor is not triggered.

Souldn't the extruder be spinning until the filament reaches it? I'm missing something?

@BastR
Copy link
Contributor Author

BastR commented Jul 5, 2020

@isanval I've not developed the PRUSA_MMU2_S_MODE but from what I see try M701 Tx to load the filament in the nozzle, Tx command only load filament to filament sensor:

Extract from mmu2.cpp

` /**

  • Handle special T?/Tx/Tc commands
  • T? Gcode to extrude shouldn't have to follow, load to extruder wheels is done automatically
  • Tx Same as T?, except nozzle doesn't have to be preheated. Tc must be placed after extruder nozzle is preheated to finish filament load.*
  • Tc Load to nozzle after filament was prepared by Tx and extruder nozzle is already heated.
    */`

@isanval
Copy link
Contributor

isanval commented Jul 5, 2020

Thanks for your fast answer @BastR , I though you developed the MMU2S mode :-)

I'm gonna take a look to this M701 command

@0lympu5
Copy link

0lympu5 commented Jul 5, 2020

@isanval let me know how it goes. Hoping to set mine up in the next month

@BastR
Copy link
Contributor Author

BastR commented Jul 5, 2020

Let me know if you find any bugs, I regularly print in MMU mode without any problems but I didn't have the opportunity to test everything.

IMG_1088
A21B8A34-51AE-41DC-8048-F78A4CC7DE34

@0lympu5
Copy link

0lympu5 commented Jul 5, 2020

Looking great, hoping to use it more for pva supports and nylon sections in functional parts.

Did you need to change any slicer settings for your repository? I noticed you mentioned having new tool change commands etc

@isanval
Copy link
Contributor

isanval commented Jul 5, 2020

@0lympu5 sure, as soon I test it I will share the results.

@BastR these pictures looks really nice. I assume you are not using the filament sensor on the idler in the extruder. Don't worry about the testing, I'm compiling marlin for supporting M701/M702 gcode commands.

@BastR
Copy link
Contributor Author

BastR commented Jul 5, 2020

@isanval Yes exactly, I use a Prusa filament sensor but it is located above the extruder, like on the MK3.

@isanval
Copy link
Contributor

isanval commented Jul 5, 2020

@BastR no luck. The M701 Tx command is trying to load the filament in the same way than Tx gcode.

The problem is that there is no enough torque to push the filament into the extruder gears if the extruder is not spining.

With M701 command the extruder gears are not spining so the filament isn't loaded an the sensor is never triggered.

@BastR
Copy link
Contributor Author

BastR commented Jul 5, 2020

@isanval Ok I will look tomorrow

@0lympu5
Copy link

0lympu5 commented Jul 5, 2020

I know with orginal operation the mmu2 would load the bowden calibrated length, pause for a second then feed mmu and extruder together to push the filament into the gears.

Would this mean it requires an extra part to script ?

@BastR
Copy link
Contributor Author

BastR commented Jul 5, 2020

Caution, a distinction must be made between operation during printing and off-printing.

During printing the code works in accordance with the slicer, while outside of printing it is the code that does everything.

Personally I don't use the filament loading in the extruder out of print, I launch the print without the loaded filament and it loads automatically at the beginning of the print.

I'm in the middle of printing and I can't test the Tx command or the M701 Tx at the moment, tomorrow I'll see if I can find something.

@isanval
Copy link
Contributor

isanval commented Jul 5, 2020

there is no hurry @BastR , thanks for your help, I really apreciate it

In PRUSA_MMU2_S_MODE it should spin the extruder gears when a Tx command is executed. It should slowly spin the gears until the filament sensor gets triggered.

@0lympu5
Copy link

0lympu5 commented Jul 5, 2020

@BastR are you saying printing via slicer works without issue it just doesnt load completely via lcd?

Are slicer gcode changes required for this?

@BastR
Copy link
Contributor Author

BastR commented Jul 5, 2020

@0lympu5 Exactly, it works without issue while printing. To load correctly filament via LCD Marlin need to be patched

@isanval
Copy link
Contributor

isanval commented Jul 5, 2020

I'm not sure about that in PRUSA_MMU2_S_MODE, as the filament won't be loaded if the extruder is not spining while the Tx/C0 commands are being executed.

I'm not using the LCD commands but I'm simulating the filament change routine through terminal. The Tx command will never be succesful until the extruder gears spins and allow the filament to load and then triggers the sensor.

Look how meanwhile the filament is loading, the extruder is spining: https://www.youtube.com/watch?v=o7ghfPBW_AE#t=2m10s

As soon the filament engages the gears, the sensor is triggered and the C0 command is aborted and "returns the control to the slicer".

@BastR
Copy link
Contributor Author

BastR commented Jul 6, 2020

@isanval I've made some test.

With Tx command, filament reach the extruder and when filament sensor is triggered MMU2 stop loading and there is no move from the extruder, the filament stay above.

With M701 Tx filament reach the extruder, filament sensor is triggered then MMU2 make a last push while extruder rotates to grab the filament to the nozzle, filament is fully loaded.

I've made the test with MMU_EXTRUDER_SENSOR not the PRUSA_MMU2_S_MODE.

@isanval
Copy link
Contributor

isanval commented Jul 6, 2020

Thanks @BastR for your findings

The point is that with PRUSA_MMU2_S_MODE the sensor is on the extruder idler, so it's not trigered until the filament is engaged on the extruder. This engagement never happens if the extruder isn't spining, as the MMU2 don't have enough torque.

For me, the more precise way to do the filament loading is with PRUSA_MMU2_S_MODE, as you are sure the filament is engaged in the extruder gears, but seems it's not fully supported by Marlin yet (or I'm missing something else...)

@thinkyhead
Copy link
Member

thinkyhead commented Jul 16, 2020

With the Prusa Firmware, does the extruder motor basically move always in sync with the MMU2S, both forward and backward, during these procedures?

jmp0x0000 pushed a commit to jmp0x0000/Marlin that referenced this pull request Aug 7, 2020
HairingX pushed a commit to HairingX/Marlin that referenced this pull request Jun 16, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants