Filament sensor

A place to talk about user-made mods and upgrades to their machines
User avatar
jdurand
Printmaster!
Posts: 397
Joined: Mon Dec 01, 2014 12:41 am
Location: Silicon Valley, California
Contact:

Filament sensor

Post by jdurand »

I haven't added this to mine, especially since it's not here yet, but... It would be nice if there was a switch to detect end-of-spool and then execute a non-panic pause with beeper. The filament could then be swapped out and the print continued.

Not that any of us have run out of filament or not used a spool because it looks light...
Standing on the edge of reality... (me)
Quando omni flunkus moritati (Red Green)
Let no man belong to another that can belong to himself. (Paracelsus)
All things are poison and nothing is without poison; only the dose makes a thing not a poison. (Ibid.)
User avatar
Eaglezsoar
ULTIMATE 3D JEDI
Posts: 7185
Joined: Sun Apr 01, 2012 5:26 pm

Re: Filament sensor

Post by Eaglezsoar »

jdurand wrote:I haven't added this to mine, especially since it's not here yet, but... It would be nice if there was a switch to detect end-of-spool and then execute a non-panic pause with beeper. The filament could then be swapped out and the print continued.

Not that any of us have run out of filament or not used a spool because it looks light...
Filibuster.com has a filament winder the uses a sensor to detect the filament and I think it could be converted to your needs.
See this link and expand the pictures, I hope it helps.

http://www.filastruder.com/products/filawinder" onclick="window.open(this.href);return false;
User avatar
jdurand
Printmaster!
Posts: 397
Joined: Mon Dec 01, 2014 12:41 am
Location: Silicon Valley, California
Contact:

Re: Filament sensor

Post by jdurand »

The switch is simple, but it has to connect somehow to request a stop within the next 10" or so of filament.
Standing on the edge of reality... (me)
Quando omni flunkus moritati (Red Green)
Let no man belong to another that can belong to himself. (Paracelsus)
All things are poison and nothing is without poison; only the dose makes a thing not a poison. (Ibid.)
User avatar
Jimustanguitar
ULTIMATE 3D JEDI
Posts: 2631
Joined: Sun Mar 31, 2013 1:35 am
Location: Notre Dame area
Contact:

Re: Filament sensor

Post by Jimustanguitar »

The MakerHive guys were working on measuring filament feed rate with scavenged encoders from a rollerball mouse... Something like that could be adapted to warn you when you reach the end of the filament.

What about passing the filament through a channel with a snapswitch (endstop) in it. You could design it so that the switch is closed when there's filament, and open when there isn't.... Now I might have to draw it :) You could also rig up a way to do this with a photogate.
User avatar
jdurand
Printmaster!
Posts: 397
Joined: Mon Dec 01, 2014 12:41 am
Location: Silicon Valley, California
Contact:

Re: Filament sensor

Post by jdurand »

As I said, the switch is easy. But, it has to ask the software to calmly pause. The switch has to be wired to something.
Standing on the edge of reality... (me)
Quando omni flunkus moritati (Red Green)
Let no man belong to another that can belong to himself. (Paracelsus)
All things are poison and nothing is without poison; only the dose makes a thing not a poison. (Ibid.)
User avatar
Nylocke
ULTIMATE 3D JEDI
Posts: 1421
Joined: Sun Jun 23, 2013 1:43 pm
Location: Iowa

Re: Filament sensor

Post by Nylocke »

They have these... http://www.thingiverse.com/thing:299690" onclick="window.open(this.href);return false; http://www.thingiverse.com/thing:83274" onclick="window.open(this.href);return false;
User avatar
jdurand
Printmaster!
Posts: 397
Joined: Mon Dec 01, 2014 12:41 am
Location: Silicon Valley, California
Contact:

Re: Filament sensor

Post by jdurand »

So, where is the PAUSE input on an RMax to wire the switch to?
Standing on the edge of reality... (me)
Quando omni flunkus moritati (Red Green)
Let no man belong to another that can belong to himself. (Paracelsus)
All things are poison and nothing is without poison; only the dose makes a thing not a poison. (Ibid.)
User avatar
Nylocke
ULTIMATE 3D JEDI
Posts: 1421
Joined: Sun Jun 23, 2013 1:43 pm
Location: Iowa

Re: Filament sensor

Post by Nylocke »

There isn't a dedicated one defined, but I know the feature is in the firmware. Hook the sensor into one of the spare endstop pins. Find out which pin that is. Then theres a UI_ACTION_PAUSE pin you can define I think. Talked about in this thread. Sounds more like a "you need to be connected to a host software to use this" kind of feature. http://forums.reprap.org/read.php?267,209755" onclick="window.open(this.href);return false;

Another option is seeing if you can get some G-code to be ran when an input is detected. You can pause, save position, move to a park position, set beeps and stuff, etc. Then maybe another button or LCD interface option to resume the print and have it (maybe extrude some filament) move back to save position and resume.
User avatar
jdurand
Printmaster!
Posts: 397
Joined: Mon Dec 01, 2014 12:41 am
Location: Silicon Valley, California
Contact:

Re: Filament sensor

Post by jdurand »

Ok, looks like I have to figure out how to implement that. My current printer is closed source so there's nothing I can touch but the software does have a pause function for changing filament.
Standing on the edge of reality... (me)
Quando omni flunkus moritati (Red Green)
Let no man belong to another that can belong to himself. (Paracelsus)
All things are poison and nothing is without poison; only the dose makes a thing not a poison. (Ibid.)
User avatar
Nylocke
ULTIMATE 3D JEDI
Posts: 1421
Joined: Sun Jun 23, 2013 1:43 pm
Location: Iowa

Re: Filament sensor

Post by Nylocke »

Its meant for the Marlin and Teacup firmwares from what I've seen the support is much less primeval. I'm pretty sure the LCD works by sending Gcode commands to the controller, if you modify the Repetier firmware a bit to use similar code to do the pause routine g-code (its a bit more complicated than that, you need some timeout disable code and a few other things too) it should work pretty well. This post pertains more to the RMAX users who want this functionality, sorry jdurand.

I could probably figure out the necessary extra code for this function and write it, I just don't have time at the moment..
User avatar
jdurand
Printmaster!
Posts: 397
Joined: Mon Dec 01, 2014 12:41 am
Location: Silicon Valley, California
Contact:

Re: Filament sensor

Post by jdurand »

Not a panic, just have to add it to my long list of ToDo items.

AND...I just ran out of filament on my Afinia last night. Maybe I shouldn't have mentioned it. :)
Standing on the edge of reality... (me)
Quando omni flunkus moritati (Red Green)
Let no man belong to another that can belong to himself. (Paracelsus)
All things are poison and nothing is without poison; only the dose makes a thing not a poison. (Ibid.)
jesse
Printmaster!
Posts: 426
Joined: Tue Jan 01, 2013 8:38 pm
Contact:

Re: Filament sensor

Post by jesse »

You could use something like this: http://www.soliforum.com/topic/3256/fil ... ng-device/" onclick="window.open(this.href);return false;

An arduino could be used to detect when the filament diameter reaches 0. A Java program could connect to the Arduino via aerial port and trigger a macro to pause the gcode host.
User avatar
Nylocke
ULTIMATE 3D JEDI
Posts: 1421
Joined: Sun Jun 23, 2013 1:43 pm
Location: Iowa

Re: Filament sensor

Post by Nylocke »

Thats way more complicated than it needs to be really, unless you're thinking of workarounds to closed source.

I don't have a RAMBo running the SeeMe branch of Repetier, if someone does want this "end of the line" feature and they don't mind waiting for me to have some time, and they would mind being a test subject could you let me know. I can get to writing the code for the pause feature by tomorrow and then send you the code and tell you where to put it. I'd just need to know what to change, if anything.
User avatar
jdurand
Printmaster!
Posts: 397
Joined: Mon Dec 01, 2014 12:41 am
Location: Silicon Valley, California
Contact:

Re: Filament sensor

Post by jdurand »

I could be the test subject but my RMax isn't here yet, so...nothing to test it on. We could address this after I get the printer assembled and running. Actually, my wife will do most of the assembly as I'm booked with customers.
Standing on the edge of reality... (me)
Quando omni flunkus moritati (Red Green)
Let no man belong to another that can belong to himself. (Paracelsus)
All things are poison and nothing is without poison; only the dose makes a thing not a poison. (Ibid.)
User avatar
Eaglezsoar
ULTIMATE 3D JEDI
Posts: 7185
Joined: Sun Apr 01, 2012 5:26 pm

Re: Filament sensor

Post by Eaglezsoar »

Nylocke wrote:Thats way more complicated than it needs to be really, unless you're thinking of workarounds to closed source.

I don't have a RAMBo running the SeeMe branch of Repetier, if someone does want this "end of the line" feature and they don't mind waiting for me to have some time, and they would mind being a test subject could you let me know. I can get to writing the code for the pause feature by tomorrow and then send you the code and tell you where to put it. I'd just need to know what to change, if anything.
If you guys get this to work, I believe it should be documented and placed on this forum in case someone would want to do something
like this in the future. The concept is cool and should be part of this Forum!
shapeshifter
Prints-a-lot
Posts: 27
Joined: Tue Oct 14, 2014 11:08 pm
Location: Somewhere out there.

Re: Filament sensor

Post by shapeshifter »

I can test this if you like, I'm running SeeMeCNC repetier 0.91 and have spare endstops, wire etc, just let me know if you want me to do it.
User avatar
jdurand
Printmaster!
Posts: 397
Joined: Mon Dec 01, 2014 12:41 am
Location: Silicon Valley, California
Contact:

Re: Filament sensor

Post by jdurand »

There was mention of combining it with a jammed filament sensor. It would be very easy to design a filament motion detector that put very little load on the filament but would reliably send pulses to the input port while the filament moved. We could do both functions in one if the firmware could have a timeout that counted down whenever the system is running and is reset when it's paused. On timeout, the PAUSE function is called.
Standing on the edge of reality... (me)
Quando omni flunkus moritati (Red Green)
Let no man belong to another that can belong to himself. (Paracelsus)
All things are poison and nothing is without poison; only the dose makes a thing not a poison. (Ibid.)
User avatar
Nylocke
ULTIMATE 3D JEDI
Posts: 1421
Joined: Sun Jun 23, 2013 1:43 pm
Location: Iowa

Re: Filament sensor

Post by Nylocke »

I started writing the code late last night, but I fell asleep looking things up. Repetier is a bit more advanced than what I've worked with before, but I've figured the hard part out (I think). All I need to do is find how to call come G-code functions into the queue and set up an LCD menu for filament pauses and an M command for resuming via host software.
User avatar
Eaglezsoar
ULTIMATE 3D JEDI
Posts: 7185
Joined: Sun Apr 01, 2012 5:26 pm

Re: Filament sensor

Post by Eaglezsoar »

Nylocke wrote:I started writing the code late last night, but I fell asleep looking things up. Repetier is a bit more advanced than what I've worked with before, but I've figured the hard part out (I think). All I need to do is find how to call come G-code functions into the queue and set up an LCD menu for filament pauses and an M command for resuming via host software.
You have to take the time to get a good night sleep! I bet you average 4-5 hours. Not enough to recharge that great brain you have!
User avatar
jdurand
Printmaster!
Posts: 397
Joined: Mon Dec 01, 2014 12:41 am
Location: Silicon Valley, California
Contact:

Re: Filament sensor

Post by jdurand »

Here's another option for a future version of the code, suggested by my wife (blame her). On dual head machines, when head one runs out of filament switch to head two.
Standing on the edge of reality... (me)
Quando omni flunkus moritati (Red Green)
Let no man belong to another that can belong to himself. (Paracelsus)
All things are poison and nothing is without poison; only the dose makes a thing not a poison. (Ibid.)
User avatar
Eaglezsoar
ULTIMATE 3D JEDI
Posts: 7185
Joined: Sun Apr 01, 2012 5:26 pm

Re: Filament sensor

Post by Eaglezsoar »

jdurand wrote:Here's another option for a future version of the code, suggested by my wife (blame her). On dual head machines, when head one runs out of filament switch to head two.
Actually that is not a bad idea. Again informing the firmware that the filament is gone and switch to the other is the problem.
But as an idea, I think that it is a good one.
User avatar
Nylocke
ULTIMATE 3D JEDI
Posts: 1421
Joined: Sun Jun 23, 2013 1:43 pm
Location: Iowa

Re: Filament sensor

Post by Nylocke »

You aren't far off on the sleep thing eagle. I have no recollection of how I ended up going to bed last night, probably not the best...

I'll probably get the firmware changes done tonight, I'll upload what and where needs to be changed. Should just be a change to configuration.h, commands.cpp and its header file, and some small LCD code changes.
User avatar
Eaglezsoar
ULTIMATE 3D JEDI
Posts: 7185
Joined: Sun Apr 01, 2012 5:26 pm

Re: Filament sensor

Post by Eaglezsoar »

Nylocke wrote:You aren't far off on the sleep thing eagle. I have no recollection of how I ended up going to bed last night, probably not the best...

I'll probably get the firmware changes done tonight, I'll upload what and where needs to be changed. Should just be a change to configuration.h, commands.cpp and its header file, and some small LCD code changes.
It is none of my business but the lack of sleep will catch up with you. Please try to get more sleep, I don't want to start worrying about you! :(
User avatar
Nylocke
ULTIMATE 3D JEDI
Posts: 1421
Joined: Sun Jun 23, 2013 1:43 pm
Location: Iowa

Re: Filament sensor

Post by Nylocke »

This task has proven to be more daunting than I first though. Didn't know that Repetier was so complicated, or that programming could be this complicated, though my C++ knowledge comes from computers, and my experience with pointers is pretty minimal (2 years ago there was 1 chapter in the C++ book we used on pointers. I haven't touched C++ since that class). I am pretty confused, I have a spot for the new M command (Not sure what number I should have taken, but I used 601 and 602 for pausing and resuming via the filament sensor), but I can't figure out how to one specific M code command from inside the program. Maybe I'm not supposed to do that, but I was trying to keep it modular? Most everything is set up to be called over serial it seems. Also the other issue is having it work via SD and Host. Theres a specific command for SD pausing, but theres another one for host, and I don't think I should call both at once?

Looking around again, there is this
For end of spool there is a nice solution if used with the host. Put the microswitch on the UI_ACTION_PAUSE action. That will send a pause request to the host and then it will go into pause mode. You can then even move the extruder around, reheat extrude until you get flow etc.. All this is not possible with a stupid pause/continue but needed if you switch the spool.
Until I can expand my C++ and Repetier knowledge (or someone else does all this) that should work for those who only do printing over host. Pretty much plug in another endstop into the X min (thats how I have it set by default) and add some code into different files.

In Commands.cpp you'll need to add

Code: Select all

void Commands::CheckFilament()
{
  if (FILAMENT_SENSOR_PIN > 0) {
    if (!Printer::isXMinEndstopHit) {
      UIDisplay::executeAction(1099);
    }
  }
  
}
in this position

Code: Select all

#include "Repetier.h"

const int sensitive_pins[] PROGMEM = SENSITIVE_PINS; // Sensitive pin list for M42
int Commands::lowestRAMValue=MAX_RAM;
int Commands::lowestRAMValueSend=MAX_RAM;

void Commands::CheckFilament()
{
  if (FILAMENT_SENSOR_PIN > 0) {
    if (!Printer::isXMinEndstopHit) {
      UIDisplay::executeAction(1099);
    }
  }
  
}
In Commands.h you'll need

Code: Select all

static void CheckFilament();
In this spot:

Code: Select all

class Commands
{
public:
    static void CheckFilament();
    static void commandLoop();
In Configuration.h you'll need these lines

Code: Select all

//Pin for filament sensor (set to X min on RAMBo) set to -1 to disable
#define FILAMENT_SENSOR_PIN X_MIN_PIN
Just put them near the top, I have them under the ###### IMPORTANT ##### box


And finally you'll need to put this into Printer.cpp

Code: Select all

Commands::CheckFilament();
right in the defaultLoopActions() function

Code: Select all

void Printer::defaultLoopActions()
{
    //check heater every n milliseconds
    Commands::checkForPeriodicalActions();
    UI_MEDIUM; // do check encoder
    millis_t curtime = HAL::timeInMilliseconds();
    if(PrintLine::hasLines()) {
        previousMillisCmd = curtime;
        Commands::CheckFilament();
    }
Keep in mind this is all untested. If your filament is in the sensor and it keeps on pausing then you'll need to invert the X min endstop logic. Its all set up to use existing code. If you have any questions or any issues let me know.
gschora
Plasticator
Posts: 12
Joined: Tue Sep 10, 2013 2:28 pm

Re: Filament sensor

Post by gschora »

I'm also interested in such a sensor.
How about a different approach than changing the firmware:

Hooking up a e.g. teensy board between the rambo and the computer.
This board is forwarding all serial communication from the computer to the rambo and back.
The switch is also hooked to the teensy board. If the teensy detects the end of the filament it sends the necessary GCode commands to the printer to pause and park the printhead. Then you change the filament and resume the printjob.

I don't know if this is doable or not, but advantages would be:
x no change to the firmware
x just hook the teensy in between computer and rambo and everything should work
x you can hook up all kinds of sensors on the teensy and program them to do things according to GCode sent from the computer to the printer (servos, fire sensors, bluetooth...)
x easily program whatever you want

any thoughts?
Post Reply

Return to “Mods and Upgrades”