Here’s the next milestone of my filament profiler. I haven’t done the full code yet, but it’s reading both axis just fine. The geometry should provide 0.05mm measurement accuracy without subpixel interpolation for objects between 0.5mm and 4.5mm in diameter. Interpolation should more than double the resolution.
Next step is to add code to locate the filament exactly within the hole, then use a little trigonometry to get the diameter, knowing its location within the two cones of light.
If it’s not obvious, I’m not using any optical lenses. This is projecting light onto the sensor, and the filament blocks the light, leaving a shadow.
One sensor isn’t enough, though, since the shadow grows the closer the filament is to the light source. Mechanical means could hold the filament in place, but filament is stiff, and it would add significant drag.
With two sensors you can find out where the filament is exactly, then correct for the placement of the filament inside the cone of light.
Further by measuring along two axis you gain a little more information about the filament profile, such as roundness. This isn’t perfect, but it’s better than a single measurement.
I also did some speed measurements and the digital writes and analog reads are consuming way too much time, allowing only 8 measurements per second. I expected it to be slow, but not this bad. I’ll work on the math first, though, and leave the speed issue for another day.
That’s for a later milestone, probably using a typical mouse sensor. But yes, that is planned to be part of this project. Using both the profile and movement, I expect to be able to output volume information for the printer in real time.
You mentioned aligning the filament should cause too much drag but how about letting the sensor float in the x/y directions and lock it to the filament? You could then keep the sensors a known distance from the filament but reduce drag.
@Eric_Moy eventually I’ll have to do that. For now I’ll be sending the data to the computer and doing the heavy lifting in processing until I figure out what the calculations involved are going to be, and what calibration looks like. This will speed development significantly. Once that’s done I’ll move it to the processor and do some performance evaluations. I don’t think it’ll be difficult for the processor to do, but we’ll see. @Tom_Haynes that’s an excellent idea!
@Thomas_Sanladerer Is that for the atmega parts the uno and mega are based on, or is that for the arm processor the due is based on? The speed up routines may be different.
@Adam_Davis that’s for the Atmega-based Arduinos. You’re right, the ones for the Due will be different, but in the long run, an Atmega-based device (i use the 4$ Pro Mini clones) would be the better choice anyways - not everyone wants to use a 40€ Arduino for such a simple task.
Mechanical drag from guiding the filament isn’t really that great. Bowden extruders push through a long guide tube, and I pull through one on my MG Prusa. Furthermore, I added a printed guide tube at the end of the Bowden tube that turns the filament (1.75 mm) through 90° of a ~35 mm radius as it comes off the spool. Granted, I couldn’t get away with that tight a bend on 3 mm filament, but my point is that it is possible to guide filament without putting too much drag on it. Placing the sensor right at either opening of a Bowden tube (or similar) should constrain it within about 0.5 mm of the desired location without adding all that much drag.
Spitballing other ideas: To constrain the position further, 3 bearings spaced 120° around the filament may yield a position more consistent than your rig can currently measure. (The OpenRC crowd may have some size suggestions for cheap bearings of an appropriate size.) The bearings couldn’t all be at the same point along the length of the filament, of course, unless one of them was on a complaint mount of some kind. Some other arrangement of bearings could allow the filament itself to provide the force that keeps it against all the bearings, but that might require more bearings. I’m imagining some all-printed scenarios too. Just please don’t give up on guiding the filament for fear of drag. It’s quite manageable. And @Tom_Haynes 's idea is certainly a viable option too.