Skip to content

WD24/InFiDEL-Filament-sensor

Repository files navigation

Inline Filament Diameter by Estimation Low-cost InFiDEL

Original work created by Thomas Sanladerer

https://www.prusaprinters.org/prints/57154-infidel-inline-filament-diameter-estimator-lowcost

Further development by Daniel Smullen

https://github.com/drspangle/infidel-sensor/

A cheap, yet precise filament diameter sensor, intended to compensate for filament diameter deviations in real-time. The InFiDEL is a cheap (< $5) filament diameter sensor intended for use with FDM 3d printers. The sensor can be calibrated to provide surprisingly precise filament diameter readings in real-time. The main idea is to use the sensor to correct for filament diameter deviations while printing. Based on this proof-of-concept: https://www.youmagine.com/designs/filament-diameter-sensor Detailed documention for InFiDEL: https://drspangle.github.io/infidel-sensor/

Please refer to Daniel's github page https://github.com/drspangle/infidel-sensor/ or Thomas's Prusaprinters page for original files and more information.

I tried to make the InFiDEL sensor but I was having problems getting reliable results from my build. That's probably more to do with my abilities not anyone else.

Here's my version of the firmware.

Instructions

Build the sensor as per the instructions on https://drspangle.github.io/infidel-sensor/

upload the ATTINY_Calibration sketch to the InFiDEL and the Arduino_Uno_Master_Calibration sketch to an arduino.

Connect the InFiDEL to the arduino via the I2C pins.

Open a serial window in the arduino IDE. The InFiDEL will start outputting smoothed Analog data. Use a selection of measured rods such as the shank of a drill between the sizes of 1.0mm and 2.0mm.

In a spread sheet record the analog output along with the diameter of the drill. I've used open office calc, microsoft excel will do the do the next bit the same.

Create the table with the measured diameters of the drills and the analog reading (ADC)

Diameter ADC 2.00 470 1.60 414 1.55 404

Highlight your data and create a chart, choose a “X-Y Scatter” displaying points only click next. For choose a data range make sure the: “data series in columns” , “First row as label” are both checked then click finish

a new chart will appear. Now right click on one of the data points and choose to “insert trend line”

In the new window under the type tab choose which type of trend line you want. Make sure the “Show Equation” and “Show Coefficient of determination (R2)” check boxes are ticked and then click OK

The “R2 =” number shows how reliable the formula is. The closer to 1.0 the better. At this point I tried both the Logarithmic and linear trend lines and used the one where R2 was closes to 1.0

in this case the Logarithmic.

The formula f(x) = 416.22 ln(x) + 208.47 is for the data set I created yours may be different.

The f(x) is basically the y axis on the chart or the ATTiny's analog output. And the x in the formula is the diameter.

Now open the InFiDEL_ATTiny sketch in the Arduino IDE.

Scroll down to the pre-setup section titled “formula” about line 53.

change the lines

int Smallest_Diameter = 96; // 0.96mm* 100 int Largest_Diameter = 200; // 2.00mm* 100 int Lower_ADC = 183; int Higher_ADC = 470;

from your data set the smallest diameter drill I used was 0.96mm so put that in as 96 for Smallest_Diameter and the corresponding ADC reading for Lower_ADC.

Do the same for the largest diameter drill in your data set. The sketch uses this to decide if the filament is out of range e.g. too thin or not resent.

Next scroll down to the appropriate section depending on if you chose to use a linear graph or a logarithmic graph. About line 67 or line 80

/* A Logarithmic graph may produce better results if you have more data points in the calibration

Logarithmic diameter from Open Office f(x)= 416.2165 In(x)+208.4720

LogarithmicDia = exp((average - 208.472) / 416.2165) LogarithmicDia = exp((average - Logarithmic_RAW_A) / Logarithmic_RAW_B); */ #define Logarithmic_RAW_A 208.472 #define Logarithmic_RAW_B 416.2165

the lines: Logarithmic diameter from Open Office f(x)= 416.2165 In(x)+208.4720

show the formula generated by open office yours might be slightly different. The next two lines show how I adapted it to work on the Arduino IDE all you need to change are the lines:

#define Logarithmic_RAW_A 208.472 #define Logarithmic_RAW_B 416.2165

change the 208.472 and the 416.2165 to the appropriate numbers from your dataset. The same applies for a linear graph.

If you just want to use the InFiDEL as a filament runout sensor and not to measure the diameter then you do not need to calculate either the linear or logarithmic graphs.

Next scroll down to the section in the void loop() commented as “//Calculate diameter”, about line 144. a logarithmic calculation is set by default.

if you wish to use the basic function uncomment the line 151: //Diameter = Dia/100; to read:
Diameter = Dia/100;

and comment out line 157: Diameter = exp((average - Logarithmic_RAW_A) / Logarithmic_RAW_B); to read: //Diameter = exp((average - Logarithmic_RAW_A) / Logarithmic_RAW_B);

for a linear calculation uncomment line 154:

//Diameter = (average + Linear_RAW_A) / Linear_RAW_B; to read: //Diameter = (average + Linear_RAW_A) / Linear_RAW_B;

and comment out line 157: Diameter = exp((average - Logarithmic_RAW_A) / Logarithmic_RAW_B); to read: //Diameter = exp((average - Logarithmic_RAW_A) / Logarithmic_RAW_B);

Now upload the sketch to the InFiDEL and also upload the InFiDEL_Master_Reader sketch to an Arduino, connect each other via the I2C pins and open a serial window and every two seconds it should give a filament reading.

The LED on the InFiDEL should light-up and the FAULT pin should go HIGH if no filament is detected.

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published