Re: Wire up filament sensor to MK2, use thermister circuit?
Hi Stepen,
Hi Waldemar,
I have a question regarding to you filament sensor code. I am currently running 3.0.11, and I am pretty happy about it.
If you want to stay with an stable version you should consider version 3.0.12, there were quite a lot of fixes and features added to 3.0.12.
However, I am planning to install a filament runout sensor and I decided to compile my own for my liking. I was wondering can you briefly tell me which file did you do the modification. Basically, I just want to add the sensor on, so whenever the filament run out, the print pause and wait for my input from the LCD. I know you add a sensor menu on the latest firmware, and I want to add it to my current firmware as well. Would you mind if you can tell me which file did you touch and modified? Thanks and have a great day.
So If I just want to add the filament sensor to RamBo using the y-max end stop. Do I just change the FR_SENS to 24 under pins.h and Uncomment the #define FILAMENT RUNOUT SUPPORT under Configuration_prusa.h? Is that it? or I have something else to do?
Yes that's it for the basic function, BUT depending on the sensor you are using you may need also use a pullup function to get reliable readings.
Useful is also to #define DISABLE_MAX_ENDSTOPS in the Configuration.h
For more information you also can compare
https://github.com/3d-gussner/Prusa-Firmware/releases/tag/v3.0.12-FRSens_v1 https://github.com/3d-gussner/Prusa-Firmware/archive/v3.0.12-FRSens_v1.zip
with https://github.com/prusa3d/Prusa-Firmware/releases/tag/v3.0.12 https://github.com/prusa3d/Prusa-Firmware/archive/v3.0.12.zip
Is it hard to implement the menu like you did on 3.1.0-RC1 firmware? Thanks.
That was bit more work to implement just check my github and commits i have.
Had to mod 'Configuration.h', 'Marlin_main.cpp', 'ultralcd.cpp', 'language_en.h',... files generate 'language_all.h/cpp' files. And it took days of testing.
At the moment i am reorganizing my github, so not all branches are up to date.
But you can get an idea if you look in the ALL_IN_ONE branch and search for 'RUNOUT'.
Hope that helps,
Waldemar aka 3d-gussner
Re: Wire up filament sensor to MK2, use thermister circuit?
Thanks.
Re: Wire up filament sensor to MK2, use thermister circuit?
Re: Wire up filament sensor to MK2, use thermister circuit?
Hi,
got finally the new 3.1.0-RC2 firmware for Prusa i3 MK2/S/MMU with Hyperfine Bed Tuning and Filament Runout Sensor tested and released.
Check my github https://github.com/3d-gussner/Prusa-Firmware/releases for the latest version.
Re: Wire up filament sensor to MK2, use thermister circuit?
Hi,
3.1.0 firmware for Prusa i3 MK2/S/MMU with Hyperfine Bed Tuning and Filament Runout Sensor is ready
You can choose between tree hex files depending which languages you want/need to use.
https://github.com/3d-gussner/Prusa-Firmware/releases
Please let me know if there are any issues.
Waldemar aka 3d-gussner
Re: Wire up filament sensor to MK2, use thermister circuit?
I would like to have a when "out of filament" go to pause mode and beep or whatever (configurable) as well.
Otherwise it's hard to catch the good point in time to replace the filament and one risks to throw away the product so far.
I'm all for doing it cleanly with firmware support (official).
Aynway, this work of yours looks good.
Re: Wire up filament sensor to MK2, use thermister circuit?
I would like to have a when "out of filament" go to pause mode and beep or whatever (configurable) as well.
Otherwise it's hard to catch the good point in time to replace the filament and one risks to throw away the product so far.
Hi,
what do you mean with 'got to pause and beep or whatever (configurable) as well' ?
The filament runout sensor triggers g-code M600, which is kind of 'pause and beep' with removing the filament and waiting for the user to change the filament.
The difference, beside remove filament - and waiting for user interaction, i can see is, that during M600 gcode the hotend and bed temps stay and with pause the hotend temp is set to 0 while bed temp stays.
Never waited with pause or M600 g-code for a long time, so cannot say if there is any timer that will switch hotend and/or bed off.
Do you mean that the FRS could behave different
1. when you are close to the printer and awake (M600 filament change)
2. and on the other side it does something else when you are away or sleep? But what should it do then and how?
I'm all for doing it cleanly with firmware support (official).
I tried to get the Hyperfine Bed Leveling and other things pulled in the official Prusa firmware, but it takes time and sometimes it doesn't make it.
So i started to publish the modified firmware releases, for users who like to have these features but don't want to code them self.
I am also happy that ~40% of users downloaded my firmware release had chosen for the modified language versions (EN,ES,FR,PT,NL and EN,DE,NL,FR), so all the effort done by two other people to help translating is not for nothing.
Aynway, this work of yours looks good.
Thanks
Re: Wire up filament sensor to MK2, use thermister circuit?
Hi. Can you help set up filament run-out sensor so it works with normally closed type when filament is not present? I have this idea connecting one wire to motor casing and the other to filament idler bearing. Its stealth and requires no switches and it works only reversed.
I am not that great wit arduino.
The const bool Y_MAX setting to false does not work probably cause #define DISABLE_MAX_ENDSTOPS
Help would be greatly appreciated.
Agnius
Re: Wire up filament sensor to MK2, use thermister circuit?
Hi. Can you help set up filament run-out sensor so it works with normally closed type when filament is not present? I have this idea connecting one wire to motor casing and the other to filament idler bearing. Its stealth and requires no switches and it works only reversed.
I am not that great wit arduino.
The const bool Y_MAX setting to false does not work probably cause #define DISABLE_MAX_ENDSTOPS
Help would be greatly appreciated.
Agnius
Hi Agnius,
Hi saw your issue on my Github here the same answer, maybe somebody else can give some thoughts and ideas.
Yes it is possible to have NC FRS switch defined.
I defined the Y_MAX_PIN 24 as 'FIL_RUNOUT_PIN 24' in the pins.h file. As i don't use any other max endstops and to prevent issues i disabled the 'DISABLE_MAX_ENDSTOPS' so there are double assignments to ONE PIN!
I am not sure if i understand you correctly:
- You want to make FRS switch by using the E-motor and the E-idler by connecting cables to theses?
- Doing this you have to make sure that the voltage and current aren't too high for the miniRambo ATmega pin, you could destroy your board. I don't know if the motor shaft generates any voltage/current in operation or manual movement. So be careful and analyse that really good. If you have a cheap Arduino board (which you can miss in worst case) you should try that there.
I implemented the FRS for two sensors.
- One for mechanical switches Signal to GND
- One for optical switches Signal to VCC
So depending if you plan to set the pin to GND or VCC you should be able to read the status.
As said i am not sure what you are planning to do, I don't own a oscilloscope and proper tools to measure if this could harm the controller board.
Re: Wire up filament sensor to MK2, use thermister circuit?
Hi, can you post a picture ?
And how you wired it.
Re: Wire up filament sensor to MK2, use thermister circuit?
Dirty schematics, You need to trim filament entry neck so idler bearing touches extruder gear when there is no filament:
I went through firmware changing stuff from 1 to 0 and from true to false without any luck. Having next to none experience with coding and marlin makes it impossible. I cant grasp the concept guys made it to work. On original marlin all is clear, Y_MAX inverting true or false but here MAX_ENDSTOPS are disabled and there i am lost what is meant for display and what is meant for function.
I hope someone will help me out
Re: Wire up filament sensor to MK2, use thermister circuit?
Configuration_prusa.h:
// Define Prusa filament runout sensor
//#define FILAMENT_RUNOUT_SUPPORT
#ifdef FILAMENT_RUNOUT_SUPPORT
#define FILAMENT_RUNOUT_SENSOR 1
#endif
Not sure if that defines the pin; if not you will have to look in pins.h to set the pin number. You could use the pinset from the Max X/Y/Z endstops which also have a 5V output and are otherwise unused.
Peter
Here my way to find the right pin or know what, how, where to change to another pin.
I was looking for 'FILAMENT_RUNOUT_SUPPORT' in all firmware files (clone from github) and found it in 'Marlin_main.cpp'.
Here some lines...
' #ifdef FILAMENT_RUNOUT_SUPPORT
if(READ(FR_SENS)){
'
Looking for 'FR_SENS' in the all other files you will get some lines in 'pins.h' file
Here some lines...
'#if MOTHERBOARD == 302
#define MINI_RAMBO
#endif
#if MOTHERBOARD == 301 || MOTHERBOARD == 302
#define KNOWN_BOARD
#ifndef __AVR_ATmega2560__
#error Oops! Make sure you have 'Arduino Mega 2560' selected from the 'Tools -> Boards' menu.
#endif
#define FR_SENS 21
#define X_STEP_PIN 37
'
It makes sense to double check if ' 21' is used somewhere else and you will find in the 'pins.h' file another line.
' #define BEEPER 78
#define BTN_EN1 80
#define BTN_EN2 73
#define BTN_ENC 21
'
But this is not an issue because that part is for a motherboard '==102' or 'RAMBo10a' and not '==302'/'MINI_RAMBO'
So it is PIN 21 by default. But where can you find PIN 21 on the board?
Check the schematics https://github.com/ultimachine/Mini-Rambo/blob/1.3a/board/Project%20Outputs%20for%20Mini-Rambo/Mini-Rambo.PDF
and search for '21'.
'21' is on page 1 but that is just the USB2Serial
Next '21's are on page 2 and you find a few.
So which one is it?
Knowing some used pins from the 'pins.h' file, i searched for 'X-STEP' in the schematic pdf and there you can compare the 'pins.h' value with the schematic value. Here you will see that 'pins.h' values are not the physical Atmega2560 CPU pins!
!!! You have to look for the 'Arduino Pin#' and not 'Part Pin#' numbers!!!
'X_STEP_PIN 37' in 'pins.h' == 'X-STEP' in the schematic 'Arduino Pin#' 37 and 'Part Pin#' 53.
Knowing that...'FR_SENS' == 'Arduino Pin#' is 21 == 'SCL', search for 'SCL' and you get on the second page 4 hits:
1. (SCL/INT0) PDO in the CPU
2. CPU pin 43 ____ SCL ____ 21
3. Extruder Extension section / SD-SS ______ __SCL____ __Reset__
4. Bottom part P3 6 | _6_SCL___
Long story short:
By default the 'FILAMENT_RUNOUT_SUPPORT' aka 'FR_SENS' PIN 21 can be found on the board on pin 6 of the connector P3.
Also changing the 'pins.h' 'FR_SENS' value is an option to one of the unused MaxStops.
Hi,
I install a optical sensor (like this: ) in my MK2S printer. The sensor works great after uncomment the line: //#define FILAMENT_RUNOUT_SUPPORT in Configuration_prusa.h the problem is need to be invert the logic. The printer stop when put filament ( optical sensor led off) and print when the filament is out ( optical sensor led on), Could you help me invert the logic in the firmware? Thank you in advance.
Best regards.
Re: Wire up filament sensor to MK2, use thermister circuit?
Configuration_prusa.h:
// Define Prusa filament runout sensor
//#define FILAMENT_RUNOUT_SUPPORT
#ifdef FILAMENT_RUNOUT_SUPPORT
#define FILAMENT_RUNOUT_SENSOR 1
#endif
Not sure if that defines the pin; if not you will have to look in pins.h to set the pin number. You could use the pinset from the Max X/Y/Z endstops which also have a 5V output and are otherwise unused.
Peter
Here my way to find the right pin or know what, how, where to change to another pin.
I was looking for 'FILAMENT_RUNOUT_SUPPORT' in all firmware files (clone from github) and found it in 'Marlin_main.cpp'.
Here some lines...
' #ifdef FILAMENT_RUNOUT_SUPPORT
if(READ(FR_SENS)){
'
Looking for 'FR_SENS' in the all other files you will get some lines in 'pins.h' file
Here some lines...
'#if MOTHERBOARD == 302
#define MINI_RAMBO
#endif
#if MOTHERBOARD == 301 || MOTHERBOARD == 302
#define KNOWN_BOARD
#ifndef __AVR_ATmega2560__
#error Oops! Make sure you have 'Arduino Mega 2560' selected from the 'Tools -> Boards' menu.
#endif
#define FR_SENS 21
#define X_STEP_PIN 37
'
It makes sense to double check if ' 21' is used somewhere else and you will find in the 'pins.h' file another line.
' #define BEEPER 78
#define BTN_EN1 80
#define BTN_EN2 73
#define BTN_ENC 21
'
But this is not an issue because that part is for a motherboard '==102' or 'RAMBo10a' and not '==302'/'MINI_RAMBO'
So it is PIN 21 by default. But where can you find PIN 21 on the board?
Check the schematics https://github.com/ultimachine/Mini-Rambo/blob/1.3a/board/Project%20Outputs%20for%20Mini-Rambo/Mini-Rambo.PDF
and search for '21'.
'21' is on page 1 but that is just the USB2Serial
Next '21's are on page 2 and you find a few.
So which one is it?
Knowing some used pins from the 'pins.h' file, i searched for 'X-STEP' in the schematic pdf and there you can compare the 'pins.h' value with the schematic value. Here you will see that 'pins.h' values are not the physical Atmega2560 CPU pins!
!!! You have to look for the 'Arduino Pin#' and not 'Part Pin#' numbers!!!
'X_STEP_PIN 37' in 'pins.h' == 'X-STEP' in the schematic 'Arduino Pin#' 37 and 'Part Pin#' 53.
Knowing that...'FR_SENS' == 'Arduino Pin#' is 21 == 'SCL', search for 'SCL' and you get on the second page 4 hits:
1. (SCL/INT0) PDO in the CPU
2. CPU pin 43 ____ SCL ____ 21
3. Extruder Extension section / SD-SS ______ __SCL____ __Reset__
4. Bottom part P3 6 | _6_SCL___
Long story short:
By default the 'FILAMENT_RUNOUT_SUPPORT' aka 'FR_SENS' PIN 21 can be found on the board on pin 6 of the connector P3.
Also changing the 'pins.h' 'FR_SENS' value is an option to one of the unused MaxStops.
Hi,
I install a optical sensor (like this: ) in my MK2S printer. The sensor works great after uncomment the line: //#define FILAMENT_RUNOUT_SUPPORT in Configuration_prusa.h the problem is need to be invert the logic. The printer stop when put filament ( optical sensor led off) and print when the filament is out ( optical sensor led on), Could you help me invert the logic in the firmware? Thank you in advance.
Best regards.
Hi Mark,
We made a firmware forum the MK2/s quiet time ago, here the link https://github.com/3d-gussner/Prusa-Firmware/releases/tag/v3.1.1-HP . If you want to build yourself just compare my github source code vs Prusa MK2 branch source code to see the made changes. Hope that helps.
Best regards,
Waldemar aka 3D-gussner
Re: Wire up filament sensor to MK2, use thermister circuit?
Here my way to find the right pin or know what, how, where to change to another pin.
I was looking for 'FILAMENT_RUNOUT_SUPPORT' in all firmware files (clone from github) and found it in 'Marlin_main.cpp'.
Here some lines...
' #ifdef FILAMENT_RUNOUT_SUPPORT
if(READ(FR_SENS)){
'
Looking for 'FR_SENS' in the all other files you will get some lines in 'pins.h' file
Here some lines...
'#if MOTHERBOARD == 302
#define MINI_RAMBO
#endif
#if MOTHERBOARD == 301 || MOTHERBOARD == 302
#define KNOWN_BOARD
#ifndef __AVR_ATmega2560__
#error Oops! Make sure you have 'Arduino Mega 2560' selected from the 'Tools -> Boards' menu.
#endif
#define FR_SENS 21
#define X_STEP_PIN 37
'
It makes sense to double check if ' 21' is used somewhere else and you will find in the 'pins.h' file another line.
' #define BEEPER 78
#define BTN_EN1 80
#define BTN_EN2 73
#define BTN_ENC 21
'
But this is not an issue because that part is for a motherboard '==102' or 'RAMBo10a' and not '==302'/'MINI_RAMBO'
So it is PIN 21 by default. But where can you find PIN 21 on the board?
Check the schematics https://github.com/ultimachine/Mini-Rambo/blob/1.3a/board/Project%20Outputs%20for%20Mini-Rambo/Mini-Rambo.PDF
and search for '21'.
'21' is on page 1 but that is just the USB2Serial
Next '21's are on page 2 and you find a few.
So which one is it?
Knowing some used pins from the 'pins.h' file, i searched for 'X-STEP' in the schematic pdf and there you can compare the 'pins.h' value with the schematic value. Here you will see that 'pins.h' values are not the physical Atmega2560 CPU pins!
!!! You have to look for the 'Arduino Pin#' and not 'Part Pin#' numbers!!!
'X_STEP_PIN 37' in 'pins.h' == 'X-STEP' in the schematic 'Arduino Pin#' 37 and 'Part Pin#' 53.
Knowing that...'FR_SENS' == 'Arduino Pin#' is 21 == 'SCL', search for 'SCL' and you get on the second page 4 hits:
1. (SCL/INT0) PDO in the CPU
2. CPU pin 43 ____ SCL ____ 21
3. Extruder Extension section / SD-SS ______ __SCL____ __Reset__
4. Bottom part P3 6 | _6_SCL___
Long story short:
By default the 'FILAMENT_RUNOUT_SUPPORT' aka 'FR_SENS' PIN 21 can be found on the board on pin 6 of the connector P3.
Also changing the 'pins.h' 'FR_SENS' value is an option to one of the unused MaxStops.
Hi,
I install a optical sensor (like this: ) in my MK2S printer. The sensor works great after uncomment the line: //#define FILAMENT_RUNOUT_SUPPORT in Configuration_prusa.h the problem is need to be invert the logic. The printer stop when put filament ( optical sensor led off) and print when the filament is out ( optical sensor led on), Could you help me invert the logic in the firmware? Thank you in advance.
Best regards.
Hi Mark,
We made a firmware forum the MK2/s quiet time ago, here the link https://github.com/3d-gussner/Prusa-Firmware/releases/tag/v3.1.1-HP . If you want to build yourself just compare my github source code vs Prusa MK2 branch source code to see the made changes. Hope that helps.
Best regards,
Waldemar aka 3D-gussner
Thank you for your fast response. Could you detailed me the changes in the firmware to use opto optical sensor please? The reason is I using a Ramps with the Prusa firmware, I would like know how invert the logic of the optical sensor in the firmware.
Thank you in advance for your time,
Re: Wire up filament sensor to MK2, use thermister circuit?
Thank you for your fast response. Could you detailed me the changes in the firmware to use opto optical sensor please? The reason is I using a Ramps with the Prusa firmware, I would like know how invert the logic of the optical sensor in the firmware.
Thank you in advance for your time,
Hi Mark,
as said just compare the your ramps Prusa MK2 source code with my source code. I use http://winmerge.org/?lang=en to compare codes.
You will find in several files comments like
// Define Prusa filament runout sensor
// FILAMENT_RUNOUT_SENSOR
or code like
#ifdef FILAMENT_RUNOUT_SENSOR
Maybe the easiest way is to make github pull request from https://github.com/3d-gussner/Prusa-Firmware/tree/MK2-Private_build to your github branch. Don't know if you use a github fork.
Hope that helps.