1. Got a question or need help troubleshooting? Post to the troubleshooting forum or Search the forums!

Filament Runout Sensor (FRS) upgrade to Robo R1/R1+

Discussion in 'Mods and Upgrades' started by danzca6, Nov 19, 2016.

  1. danzca6

    danzca6 Well-Known Member

    Joined:
    Jul 27, 2015
    Messages:
    2,161
    Likes Received:
    1,077
    Have you ever returned to a print to find that it didn't print the last layers do to the filament running out or it snapped? Maybe you know you don't have enough on the end of a roll, but don't want to waste it. Well adding a filament runout sensor to your Robo will allow you to print without worrying about ruining your print because you didn't have enough filament. This technique uses an already available command called M600 used for changing filament using an LCD. M600 is also a great way to change colors of filament between layers. You might have used it on your LCD controller with the standard Robo flavored versions of Marlin. Looking to the future, and the use of Marlin 1.1.0, we now have logic for a filament runout sensor. Not only does it work, but it works remarkable well. The printer will just wait for you (beeping) until you change the filament out and resume the print. How it handles the change of filament is all defined around the M600 settings that are in your control in the firmware. I'll explain how to set it all up for you here. Sorry in advance being long, but it really is easy as pie. Also understand I didn't magically come up with all of this. I just saw the code in the firmware, did some research, designed an enclosure, and put it all together here for anyone to benefit from the slick upgrade to their Robo printer.

    Things you will need:
    • The latest Marlin 1.1.0 for the Robo3d - see downloads in this thread
    • 1 Optical endstop sensor - I bought a 3pk but here is a single
    • 2 #4x1/2" phillips pan head self tapping screws or equivalent
    • LCD Controller - either the XXL or Full Graphics to enable M600
    • Optionally you may need some 22 awg stranded wire to extend what comes with the sensor
    • Holder for sensor - Mine is available on Thingiverse found here

    Firmware Changes Needed:

    The option for the FRS is not available in the current firmware offerings that Robo has posted on their site. The latest firmware from Marlin that
    @WheresWaldo has been maintaining for the community is needed for this to work. See my link above and choose your correct version and if you want to stay with the ABL or the new MESH leveling version. Just 3 easy changes in the firmware. Please always make sure to have a backup of the firmware you are currently running to revert back if needed.

    First thing is to make sure you have the Filament Change routines enabled. @WheresWaldo recently uncommented the definition to enable this on the latest versions of his files. I will post the code here as well. Please note my changes to lines indicated with ROBO-DANZ-FC. The stock settings are more suited for Bowden setups on Deltas. Feel free to tweak to your liking, but I found these settings to work best for me. You also need to have an LCD controller for this to be seen.

    Configuration_adv.h - Enabling Filament Change Feature
    Code:
    // Add support for experimental filament exchange support M600; requires display
    #if ENABLED(ULTIPANEL)
      #define FILAMENT_CHANGE_FEATURE               //--ROBO-DANZ-FC Enable filament exchange menu and M600 g-code (used for runout sensor too)
      #if ENABLED(FILAMENT_CHANGE_FEATURE)
        #define FILAMENT_CHANGE_X_POS 114           //--ROBO-DANZ-FC X position of hotend
        #define FILAMENT_CHANGE_Y_POS 10            //--ROBO-DANZ-FC Y position of hotend
        #define FILAMENT_CHANGE_Z_ADD 10            // Z addition of hotend (lift)
        #define FILAMENT_CHANGE_XY_FEEDRATE 100     // X and Y axes feedrate in mm/s (also used for delta printers Z axis)
        #define FILAMENT_CHANGE_Z_FEEDRATE 5        // Z axis feedrate in mm/s (not used for delta printers)
        #define FILAMENT_CHANGE_RETRACT_LENGTH 2    // Initial retract in mm
                                                    // It is a short retract used immediately after print interrupt before move to filament exchange position
        #define FILAMENT_CHANGE_RETRACT_FEEDRATE 60 // Initial retract feedrate in mm/s
        #define FILAMENT_CHANGE_UNLOAD_LENGTH 50    //--ROBO-DANZ-FC Unload filament length from hotend in mm
                                                    // Longer length for bowden printers to unload filament from whole bowden tube,
                                                    // shorter lenght for printers without bowden to unload filament from extruder only,
                                                    // 0 to disable unloading for manual unloading
        #define FILAMENT_CHANGE_UNLOAD_FEEDRATE 10  // Unload filament feedrate in mm/s - filament unloading can be fast
        #define FILAMENT_CHANGE_LOAD_LENGTH 0       // Load filament length over hotend in mm
                                                    // Longer length for bowden printers to fast load filament into whole bowden tube over the hotend,
                                                    // Short or zero length for printers without bowden where loading is not used
        #define FILAMENT_CHANGE_LOAD_FEEDRATE 10    // Load filament feedrate in mm/s - filament loading into the bowden tube can be fast
        #define FILAMENT_CHANGE_EXTRUDE_LENGTH 35   //--ROBO-DANZ-FC Extrude filament length in mm after filament is load over the hotend,
                                                    // 0 to disable for manual extrusion
                                                    // Filament can be extruded repeatedly from the filament exchange menu to fill the hotend,
                                                    // or until outcoming filament color is not clear for filament color change
        #define FILAMENT_CHANGE_EXTRUDE_FEEDRATE 3  // Extrude filament feedrate in mm/s - must be slower than load feedrate
      #endif
    #endif
    
    Second we need to enable the filament runout sensor routines. Here you just need to remove the // in front of the definition line as indicated with ROBO-DANZ-FRS. The rest stays the same. You can see the script it calls when triggered is the M600 command that we now have enabled by defining the FILAMENT_CHANGE_FEATURE above.

    Configuration.h - Filament Runout Sensor
    Code:
    //===========================================================================
    //========================= Filament Runout Sensor ==========================
    //===========================================================================
    #define FILAMENT_RUNOUT_SENSOR   // ROBO-DANZ-FRS Uncomment for defining a filament runout sensor such as a mechanical or opto endstop to check the existence of filament
                                     // RAMPS-based boards use SERVO3_PIN. For other boards you may need to define FIL_RUNOUT_PIN.
                                     // It is assumed that when logic high = filament available
                                     //                    when logic  low = filament ran out
    #if ENABLED(FILAMENT_RUNOUT_SENSOR)
      const bool FIL_RUNOUT_INVERTING = false; // set to true to invert the logic of the sensor.
      #define ENDSTOPPULLUP_FIL_RUNOUT // Uncomment to use internal pullup for filament runout pins if the sensor is defined.
      #define FILAMENT_RUNOUT_SCRIPT "M600"
    #endif
    
    The third and final change is to assign the pin on the RAMPS we are using for the optical sensor. We are using pin 20 with this setup. I am not using pin 4 because that is being used for my RRD Fan Extender mod found here. Also, using Servo pin D4 being analog is not ideal for this setup and I find D20 a better setup for a digital setup.

    pins_RAMPS.h
    Code:
    // define digital pin 4 for the filament runout sensor. Use the RAMPS 1.4 digital input 4 on the servos connector
    #define FIL_RUNOUT_PIN      20 // ROBO-DANZ-FRS Default is D4, but needed this digital input
    
    An optional change is to enable PINS_DEBUGGING in Configuration_adv.h by removing the // in front. This makes the command M43 available for debugging and testing the FRS using M43 P20 to return the state of the endstop with a 0 or 1. Can also be useful for debugging other pins.

    Configuration_adv.h
    Code:
    /**
    * Add M43 command for pins info and testing
    */
    #define PINS_DEBUGGING //--ROBO-DANZ
    
    Hooking Things Up:

    Hooking things up is very straight forward. However, if you own the R1+ with the slightly customized RAMPS configuration, Robo decided to not have any headers soldered in that are not used. We will be using D20 pins for this setup and you would need to solder in a 1x3 pin header for this to work.

    The optical endstop has 3 connections. VCC or V or + that is the 5V lead (red), SIG or S for the signal (yellow), and GND or G or - that is the ground (black). Below is a section of the RAMPS schematic depicting the upper right area where the X, Y, and Z endstops are plugged in. You will see where D20 pin has the red, black, and yellow dots indicating where the leads need to run from the optical sensor. As I have noted already, you may need to replace or lengthen the leads with 22 AWG stranded wire to reach you selected mounting point. More about where to mount this later.

    800px-Arduinomega1-4connectors.png

    Assembly:

    Using my enclosure for the optical sensor you just need to assemble the pieces needed and decide if you want to put the sensor inline prior to going into the top slot of the Robo case or to sit on top of the Greg's Wade extruder. Either option works fine. I designed this to be fairly generic and can be used on any printer really and it also is short enough not to interfere with Z height. A few pics here for reference. The model files can be pulled off of my Thingiverse page found here. I've included the source files as well if you want to make any modifications like adding a filament cleaner/oiler so that it is all one assembly.

    FRS_needed_parts.jpg

    FRS_assembled.jpg

    FRS_triggered.jpg

    FRS_with_filament.jpg

    Note Worthy Items:




      • When making changes to the RAMPS, please always unplug power and USB to be safe.
      • Make sure routing of the new wires are properly secured and out of the way from normal operation.
      • This can also be easily done with a mechanical endstop, but I wanted something that had no contact with the filament for the least amount of resistance. It is also far less bulky. Designs for an enclosure for this can be found on Thingiverse.
      • Debugging and testing is fairly easy when you enable PINS_DEBUGGING in the firmware explained above and using M43 P20 to get a 0 or 1 returned telling if the sensor is triggered or not.
      • You also don't always have to have the FRS in place. You can run the filament as usual and just put a small piece of filament in the enclosure to make the printer think it has filament.
      • This may not work the best with transparent types of filament. A mechanical endstop would be more suited for those types of filament if you use them often.
      • You are not required to print via SD card for this to work. You can still print via USB. The LCD is still required for response to the filament change routine.
      • There is also a filament width sensor feature available in the new Marlin versions. It is not the same as this. I can look into implementing if anyone is interested.
    I hope you find this modification useful. Happy printing and Cheers!
     
    #1 danzca6, Nov 19, 2016
    Last edited: Nov 30, 2016
  2. Pergo

    Pergo Member

    Joined:
    Aug 26, 2015
    Messages:
    31
    Likes Received:
    4
    Very nicely documented! You did a wonderful job of taking a pseudo complicated add on and making it easy to implement.
     
  3. danzca6

    danzca6 Well-Known Member

    Joined:
    Jul 27, 2015
    Messages:
    2,161
    Likes Received:
    1,077
    Thank you. Like I said in the post, it isn't anything new that I came up with, but I wanted to have a documented way for the Robo community to implement. I first started researching what was needed when @Toro1966 had an issue of filament running out during one of his prints. Thanks again for the feedback and looking forward to others implementing this feature.
     
  4. Doug Meek

    Doug Meek Member

    Joined:
    Sep 14, 2016
    Messages:
    54
    Likes Received:
    24
    I added this to my R1 today but I ran into an issue with the sensor I ordered from Amazon. The optical sensor part was not soldered very well and thus it was false triggering all the time. So I redesigned DANZA6's mount so that the center portion has some adjustment to it. This allowed me to fine tune the sensor position to make it rock solid. My mount is listed here: http://www.thingiverse.com/thing:1990763

    Thanks for the write up on an excellent add on!
     
  5. danzca6

    danzca6 Well-Known Member

    Joined:
    Jul 27, 2015
    Messages:
    2,161
    Likes Received:
    1,077
    I really like that idea. I shouldn't have bet on the tolerances with these optical sensors being close to the same. Very clever design. Well done.
     
  6. Shane

    Shane New Member

    Joined:
    Mar 21, 2017
    Messages:
    20
    Likes Received:
    0
    Hello first off great write up and excellent instructions. My question is when I use the M23 P20 command i get between 64 and 79 with no filament and 98 to 111 with filament. Is this correct? In your post you stated i should be seeing a 0 or 1.
     
  7. Shane

    Shane New Member

    Joined:
    Mar 21, 2017
    Messages:
    20
    Likes Received:
    0
    Yes, and sorry should of caught that before I posted the question.
     
  8. danzca6

    danzca6 Well-Known Member

    Joined:
    Jul 27, 2015
    Messages:
    2,161
    Likes Received:
    1,077
    Interesting. Yes you should get a 0 or 1 when hooked up using the pins I did. I may need to get the latest firmware update and see if something changed. I'll post back if there was a difference that I found or not, but in the meantime, could you post a pic of where you have this hooked up on the RAMPS board?
     
  9. Shane

    Shane New Member

    Joined:
    Mar 21, 2017
    Messages:
    20
    Likes Received:
    0
    I wont be home much today but i will take a picture tonight. I followed the steps in your post using pin 20 and also changed the code to pin 20. I will verify all this tonight.
     
  10. Shane

    Shane New Member

    Joined:
    Mar 21, 2017
    Messages:
    20
    Likes Received:
    0
    Sorry i took so long. Here are some pictures of my board.
     

    Attached Files:

    • 1.jpg
      1.jpg
      File size:
      692.8 KB
      Views:
      53
    • 2.jpg
      2.jpg
      File size:
      765.5 KB
      Views:
      51
  11. WheresWaldo

    WheresWaldo Volunteer ( ͠° ͟ʖ ͡°)
    Staff Member

    Joined:
    Feb 18, 2015
    Messages:
    5,905
    Likes Received:
    3,593
    Your wiring looks off I think the wiring should be +, - and 20 only, one of them appears to be in the wrong spot.
     
  12. Shane

    Shane New Member

    Joined:
    Mar 21, 2017
    Messages:
    20
    Likes Received:
    0
    Might just be the picture but that is how i have it + - and pin 20 pin 21 has nothing pluged into it. The sensor works as advertised the light is on with filament and off with no filament. I have not tried it while printing as i was hopping to figure out the 0 and 1 issue first.
     
  13. danzca6

    danzca6 Well-Known Member

    Joined:
    Jul 27, 2015
    Messages:
    2,161
    Likes Received:
    1,077
    I think you're fine. Mine is working differently with the newer firmware version as well. Simple test is to take about an extra 2 inch piece of filament and put into the sensor to represent a normal filament path. Start a print and as it is printing the first layer just pull that 2 inch piece out. It should then execute the M600 and go through the filament change routine on your LCD.
     
    Geof likes this.
  14. danzca6

    danzca6 Well-Known Member

    Joined:
    Jul 27, 2015
    Messages:
    2,161
    Likes Received:
    1,077
    One thing I will caution those using this, you will need to know your filament roll and how the end of the filament is attached to it. If it is taped, loose, or maybe bent and stuck into a hole. You don't want to just leave it printing and have the printer hang up extruding on the end not releasing from the spool. Mine are sometimes loose or bent into a hole that I have been able to cut off so that it will release and pass through the sensor correctly. So if you are getting close to the end, just be cautious of this. This works great on loose sample filament rolls as well. Just my 2 cents for the day.
     
  15. mark tomlinson

    mark tomlinson ༼ つ ◕_ ◕ ༽つ
    Staff Member

    Joined:
    Feb 21, 2013
    Messages:
    23,912
    Likes Received:
    7,338
    For what it is worth most will spin free and come off of the roll ok (at least mine have) but it is certainly something to bear in mind.
    I would not (as @danzca6 suggested) trust it :)
     
    Geof likes this.
  16. Mike Toole

    Mike Toole Member

    Joined:
    May 18, 2017
    Messages:
    52
    Likes Received:
    10
    During the filament change routine, does the print head have to go to the home position? I would like to make these additions to my R1+. However, the parts I print are large and will not allow clearance for the head to reach home, if that is a requirement. please advise. Thank you.
     
  17. Geof

    Geof Volunteer Moderator
    Staff Member

    Joined:
    Nov 9, 2015
    Messages:
    6,757
    Likes Received:
    2,339
    You can change the filament change position in the firmware
     
  18. danzca6

    danzca6 Well-Known Member

    Joined:
    Jul 27, 2015
    Messages:
    2,161
    Likes Received:
    1,077
    @Geof is totally right. You can search for one of these variables in Configuration.h file and set whatever X/Y you want it to happen at. Also, you can adjust how much Z goes up to clear parts. Good luck man. These changes also change when you have an LCD controller and select the change filament option in the menu.

     
    Mike Toole likes this.
  19. Mike Toole

    Mike Toole Member

    Joined:
    May 18, 2017
    Messages:
    52
    Likes Received:
    10
    Awesome! Thanks all. I just put the lcd screen on last night so I am not eager just yet to start messing with firmware. :) however, I will probably order all required items, build the sensor holder and then work up some courage, and then ask you guys for the firmware details. ;D I appreciate it.
     

Share This Page