Thomas Sanladerer designed, printed and tested this filament diameter sensor. It could be used on filament making extruders as a control sensor, or in 3d printers to get better printout results. The work on it is in progress, further accuracy improvements are needed but the current results look promising.
Files can be found at:
From project description:
This is a proof-of-concept filament diameter sensor, currently intended for an extruder making filament. The filament centerline is 90mm above the mounting surface.
It picks up the filament's diameter between two bearings, amplifies it via the lever by a factor of 3.6, which moves a magnet in front of the hall sensor.
The hall sensor's depth is adjustable and is locked into place via the M3 bolt. Bend the hall sensor's leads 90° to the back and place the sensor in recessed spot. Lead the wires out to the front.
The 6x2mm magnet goes into the matching hole in the lever. The second hole intended for a ballpen spring, which is not needed in most use cases.
For testing, upload the included sketch to an Arduino, connect the hall sensor to 5V, ground and hook the signal pin up to A1 on the Arduino. Connect via serial at 115200 baud, it will start spitting out two values each line, the first one is the smoothed ADC value, the second one the calculated diameter.
To calibrate, insert a test object with the maximum diameter you want to measure between the bearings and move the hall sensor carriage until the ADC value just reaches a maximum. Lock the carriage in place and use that value along with the diameter of the object as the last entry in the Arduino's lookup table. Insert two (or more, if you increased NUMTEMPS) more objects of varying sizes (for example the shafts of drill bits) and fill out the lookup table. Use the idle position without anything inserted for the zero-diameter position.
Support might be required for the files as they contain 30° overhangs. If you use Slic3r, you're better off with no support material.
Here is a different project which is more heavily developed and has extensive video tutorial: the Filament Width Sensor by flipper for Lyman extruder or stand-alone applications with a voltmeter
Width sensor project description:
The idea is that with a real-time width measurement the 3D printer could compensate the extruded flow for changes in filament width. Also if there is variation between spools of filament, there is no need to calibrate for that when slicing. The g-code is independent of the filament diameter.
For filament extruders, the measured width can be used as feedback in the extrusion process.This version includes a custom designed pc board as well as a housing. A version of Marlin is modified to use the sensor data.
The sensor outputs a voltage in milimeters (3v=3mm) that is shown on the voltmeter.
I made some changes to Marlin to read the filament diameter real-time and compensate the extrusion rate. Code uses a buffer to manage the transit delay between the sensor measurement and the nozzle.
All the files, code and instructions can be found at:
To learn more about the purpose of filament diameter (thickens) sensors, read this Hackaday post:
There is a version of a diameter sensor based on hacked digital calipers developed by Wei-Hsiung Huang. It has several issues related to digital caliper precision and internal workings but it is a good learning project with some usefulness.
You can find all the instructions, code and build guide at: