As Marlin is now supporting realtime filament diameter sensing and compensation, i’ve been pondering the idea of adding one of those to one of my printers, based on the earlier concept https://www.youmagine.com/designs/filament-diameter-sensor - but in a smaller, lightly spring-loaded package roughly the size of a direct-drive extruder.
Now, the one thing i’m still unsure about is what kind of logic it should have. Marlin expects an analog voltage signal (in V) identical to the measured diameter (in mm), and since the hall sensor in that assembly outputs a non-linear, non-proportional voltage, it would need some extra logic to convert that to something a bit more meaningful. Should that logic be an AtTiny85 plus a couple of passives right with the sensor (adds ~$5 to the BOM) or handled by a modified analog2widthFil() function in Marlin? Would such a specific modification even be accepted into Marlin?
Of course, these assemblies need to, or at least should be calibrated (once), and my idea for that is to add a button to the AtTiny to switch the sensor into a calibration mode and store the lookup table in EEPROM. An implementation in Marlin would require a similar function.
So, any feedback/input?
If this works out and there is some interest from a couple of folks that want to try these out, i’d be up to distributing a handful of kits (less than $20 shipped) with all components (including a preprogrammed AtTiny and PCB), with or without printed parts.
Ya sure i am interested and would love to help.
Im in, but i will source and build localy. Importing stuff to argentina is harder than beating Usain Bolt using flip.flops
@Nicolas_Arias sure thing! Bearings, AtTinys, analog hall sensors and 6x2mm magnets should be available anywhere in the world.
@Thomas_Sanladerer , maybe a nano can be used on an alternative version?
@Nicolas_Arias while it’s overkill, it would certainly be possible to use a Nano or any other Arduino board (o, any other MCU, for that matter). Probably even with the same code.
@Thomas_Sanladerer , yeah, but it will require barely no component soldering…
I’m game - if I had the knowledge I’d of had a go because the repercussions have ruined a few prints lately, but I don’t. Happily you do, so I’ll settle for tester.
AtTiny85 would be much smaller than a nano but still have everything needed, 2 analog pins. I have used these many times for projects.
The AtTiny requires zero external components - running off the internal oscillator and such. It’s just a bit more complicated to program.
If you have two analog channels in the AtTiny it suggests that the design could be expanded to measure diameter in two axes. Which could be justification for using an AtTiny in itself.
Thanks for taking this on. I don’t think I’ll be able to make any meaningful contribution, but I’m sure I’ll be a beneficiary.
@Neil_Darlow good idea! Either the main AtMega or the AtTiny could handle calculating the effective diameter - both have plenty of ADC inputs. Even though you can’t really measure the shape of an ellipse with just two axes, it would still get it in the right ballpark with oval filament.
Tagging @Ian_Johnson , he’s done a lot with this.
@Mark_Rehorst My thoughts exactly. I think the idea is perhaps to keep taking an overall average, then the diameter reading will tend to stay close to some value with slight drift now and then.
@Mark_Rehorst Marlin uses a ring buffer to delay the compensation, so the distance between the sensor and extruder hotend isn’t an issue. Good filament should be round, but then again, good filament shouldn’t need real-time compensation. I’m fairly confident that the cross section of the filament will orient itself in a certain way and stay there, but the possibility of it turning definitely is an issue.
Give me a second, I’ll look into how much of a deviation to expect here.
Numbers!
Assuming the following things:
- The filament has a worst-case profile of a 1.8x1.5mm ellipse with an effective cross section of 2.12mm²
- The single sensors always assumes a perfect circle
- The dual sensor (two sensors at 0 and 90°) always assumes a perfectly oriented ellipse
On-axis at 0 or 90°
Single sensor measures either 1.77mm² or 2.54mm² (worst case)
Dual sensor measures perfectly
Off-axis at 30 or 60°
Single sensor: 1.96mm² or 2.37mm²
Dual sensor: 2.16mm²
Off-axis at 45°
Single and dual both measure 2.16mm²
Less oval filaments will influence the readings to a much lesser extent.
I think @Whosa_whatsis looked into using a single sensor with v-grooves, but wasn’t too happy with the readings that would have produced, either.
Dual sensors are your best bet. A laser or led and a photodiode with a lens or two might be enough to get a good measurement, making the assembly less complicated.
I think we need to look into more compact assemblies and make it as accurate as possible within a low budget.
Nice idea
@Stephanie_A I thought about an optical system but it would be heavily influenced by the material optical properties. You can’t assume that all filament would appear uniformly opaque.