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

Support for a filament diameter sensor #1037

Merged
merged 7 commits into from
Oct 11, 2014

Conversation

filipmu
Copy link

@filipmu filipmu commented Aug 16, 2014

This pull request supports the feature request in issue #1010 to provide an input for a real time filament diameter sensor that controls the volume of extrusion for one selected extruder. Implements a delay buffer to handle the transit delay between where the filament is measured and when it gets to the extruder. Gcode can be created once, and can be made independent of the filament diameter. See discussion for that issue.

For examples of these sensors, see: http://www.thingiverse.com/thing:89044, https://www.youmagine.com/designs/filament-diameter-sensor, http://diy3dprinting.blogspot.com/2014/01/diy-filament-diameter-sensor.html. Any sensor which produces a voltage equivalent to the diameter in mm (i.e. 1v = 1mm) can be used. This provides a very simple interface and may encourage more innovation in this area.

4 new Mcodes are defined to set relevant parameters.

Majority of this code (except for some code in the ISR) can be bypassed by undeclaring a #define. So it behaves nicely for the majority of users who don't have a sensor.

Pins defined for Rambo, Ramps 1.4, Printrboard.

I reverted a commit (1d0fe03 Change pinMode to SET_INPUT or SET_OUTPUT) since it was not really germane, but this is still an issue for printrboards and probably anything Teensylu.

One to-do is to display the filament diameter and relevant control info.

Filip Mulier added 5 commits August 4, 2014 21:44
Original code is using WRITE from fastio, but original used pinMode to
set pin direction and did not use the fastio SET_INPUT or SET_OUTPUT.
This caused an issue with the rotary encoder interface to  boards based
on teensyduino, since for teensyduino pin numbers for fastio and the
usual Arduino IO are different.
This feature allows the printer to read the filament diameter
automatically and adjust the printer in real time.  Added code to read
an analog voltage that represents a filament diameter measurement.  This
measurement is delayed in a ring buffer to compensate for sensors that
are a distance away from the extruder.  The measurement is used to
adjust the volumetric_multiplier for the extruder.  Some additional g
codes (M404, M405, M406, M407) are used to set parameters and turn
on/off the control. g code M221 is updated.  Pins for RAMPS1.4, RAMBO,
and Printrboard are identified for analog input.  The configuration file
is updated with relevant user parameters.
… code

Improvement to avoid reinitializing delay buffer with every print. Fixed
issues in buffer indexing and memory out of bounds due to floating point
imprecision.  Simplified the code by avoiding conversion to standard
diameter and 1cu mm extrusion, which caused complications in determining
mm extruded.
Update the config file for improvements and clarifying what diameter to
use in the slicer software.
@nicolas-rambaud
Copy link
Contributor

It’s very interesting !

Do you know if there are any youtube video on how to set this up?

De : filipmu [mailto:notifications@github.com]
Envoyé : samedi 16 août 2014 20:58
À : ErikZalm/Marlin
Objet : [Marlin] Support for a filament diameter sensor (#1037)

This pull request supports the feature request in issue #1010
https://github.com/ErikZalm/Marlin/issues/1010 to provide an input for a
real time filament diameter sensor that controls the volume of extrusion
for one selected extruder. Implements a delay buffer to handle the transit
delay between where the filament is measured and when it gets to the
extruder. Gcode can be created once, and can be made independent of the
filament diameter. See discussion for that issue.

For examples of these sensors, see: http://www.thingiverse.com/thing:89044,
https://www.youmagine.com/designs/filament-diameter-sensor,
http://diy3dprinting.blogspot.com/2014/01/diy-filament-diameter-sensor.html.
Any sensor which produces a voltage equivalent to the diameter in mm (i.e.
1v = 1mm) can be used.

4 new Mcodes are defined to set relevant parameters.

Majority of this code (except for some code in the ISR) can be bypassed by
undeclaring a #define. So it behaves nicely for the majority of users who
don't have a sensor.

Pins defined for Rambo, Ramps 1.4, Printrboard.

I reverted a commit (1d0fe03
ErikZalm@1d0fe03
Change pinMode to SET_INPUT or SET_OUTPUT) since it was not really germane,

but this is still an issue for printrboards and probably anything Teensylu.

You can merge this Pull Request by running

git pull https://github.com/filipmu/Marlin Filament-Sensor

Or view, comment on, or merge it at:

https://github.com/ErikZalm/Marlin/pull/1037
Commit Summary

  • Change pinMode to SET_INPUT or SET_OUTPUT
  • Real-time filament diameter measurement and control
  • Improvements and bug fixes in sensor delay buffer for filament sensor
    code
  • Filament sensor changes to config file
  • Revert "Change pinMode to SET_INPUT or SET_OUTPUT"

File Changes

Patch Links:


Reply to this email directly or view it on GitHub
https://github.com/ErikZalm/Marlin/pull/1037.[image: Image supprimée par
l'expéditeur.]

@filipmu
Copy link
Author

filipmu commented Aug 28, 2014

As far as I know there is no youtube video on how to set this up, but it would be a good idea. I'll try to put something together.

@ErikZalm
Copy link
Contributor

Can you also correct the PID_dT in configuration.h?
This patch changes the analog sampling time.

Adjusted the  #define PID_dT to reflect 10 A to D sample steps, vs
original 8.
@filipmu
Copy link
Author

filipmu commented Sep 1, 2014

I made the change to the PID-dT definition.

Added the new m-codes to this document.
@boelle
Copy link
Contributor

boelle commented Sep 26, 2014

So has this been merged in the code yet?

@boelle
Copy link
Contributor

boelle commented Oct 11, 2014

or will that never happen? a shame as i have to add the code for it every time there is an update here...

ErikZalm added a commit that referenced this pull request Oct 11, 2014
Support for a filament diameter sensor
@ErikZalm ErikZalm merged commit 058e446 into MarlinFirmware:Marlin_v1 Oct 11, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants