A prototype sensor that can measure filament diameter in real time for your 3D printer or Filament extruder.
What it Is
This is a prototype for an... optical sensor that measures the width of plastic filament in real time as it goes into a 3D printer or a filament extruder. It is prototype #3 (other 2 are on Thingiverse ).
What it Does
The idea is that with a real-time width measurement the 3D printer (or filament extruder) 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.
For 3D Printers
A version of Marlin is modified to use the sensor data.
The sensor outputs a voltage in millimeters (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.
Could use stand-alone with a voltmeter or an LED panel display and 5v supply (think USB charger). To show filament width without interfacing to printer or extruder. Can also hook up to a data logger to track filament diameter.
Can measure width or diameter of any object in this size range (wire, plant stems, etc)
Sensor Specs (my Estimates)
1. Accuracy: Practical usage: 0.02- 0.05mm in ratiometric mode for 3mm filament. Theoretical: The sensor has .06mm wide pixels, and with the subpixel edge detection, my guess is that it is 5-10 times better, so .01mm.
2. Sampling Speed: Internal sampling of image is 100Hz, output is averaged to update roughly once every second.
3. Limitations: May not work with clear or translucent filament. Not fully tested for 1.75mm filament but should work.
How it works: see attached doc.
First step - decide if you want a sensor for 3D printing or Filament extrusion.
1. Get the PC board made.
See Seeedstudio_order_v2.0.zip for files needed to order a board from Seeedstudio. The specs are on the PC_board_BOM.pdf.
Alternatively, use the EagleCAD files to order from somewhere else. PCB thickness is critical in the design to ensure case closes. Should be 1.6mm as listed on the PC Board BOM.
2. Order parts from the BOMs (PC Board and either the Extruder_version_BOM or Printer_version_BOM)
1. Print out the relevant parts
(Printer or Extrusion .stl's) in ABS with 20% infill, .5mm nozzle, .4mm
2. Paint inside of tower and top
plate sensor area with flat black craft paint (reduces light reflections).
3. Drill out the hole in the
tower to fit an LED (if needed) using #9 (0.196inch) Drill out the screw
holes in the top plate with a #50 (0.07 inch) to allow the 2-56 screws to
If all you want to do is load the firmware on the mcu you can use the software that came with the programmer board (USBDM board). If you install the drivers, it installs some flash programmer software, one called HCS08 Programmer. This software lets you load the compiled firmware 'hex' file (called FilamentSensorproto2.abs.s19 in the directory called FLASH in the zipped project) into the MCU. No need for the IDE in this case.
If you want to open the code in the IDE, see the dev tools for free from freescale: freescale.com/webapp/sps/site/overview.jsp?code=CW_SPECIALEDITIONS - look for the one for microcontrollers, eclipse version.
1. Use ABS juice to glue the tower onto the top plate using the attached photos as a guide. Hole in tower should line up with hole in top plate.
2. Print out the Case_labels.pdf on an injet printer and cut out the label to paste on the back of the case. Glue with ABS juice. Can let ABS juice soak in to the paper.
3. Press the PC board into the printed Base Plate. Make sure it fully seats against the standoffs (use an exacto knive to clear plastic)
4. Push the Top Plate assembly onto the Bottom Plate (they should mate) and fasten with the 2-56 screws (3 for extruder version, 4 for printer)
5. Attach the LED wires to the +An and -Cath screw terminals. LED has a flat on the -Cath terminal side.
6. Insert the LED into the tower (should fit gently) and screw on the ABS Cap while holding the leads in place.
Testing and Calibration
1. Connect a voltmeter to the 'Out' terminal and 'Gnd' terminal.
2. Provide 5 volt power to the correct terminals (I use a USB charger and cut-off USB cable)
3. LEDs should light up and voltmeter should read below 1v.
4. Place a piece of calibration rod (precise 1/16 in drill rod) in the sensor and gently hold level and down. - Voltage should show >1volt. Press and hold the button on the sensor for >3 seconds - indicator LED will go off and then on when complete.
5. Output voltage should show 1.56 volts, assuming power voltage is exactly 5.00 volts. Can press button <1 sec to switch modes to absolute output to confirm calibration. - see Board_instructions file for more details.
Attach the Sensor to 3D Printer or Filament Extruder
See Filament Extruder thing for instructions for Filament Extruder:
1. Add custom g code to your
slicer software to enable sensor:
M405 ; turn on filament control
2. While printer is idle you can
see the filament sensor reading by keying in and sending an M407 to your
printer. It will return the diameter to the log.
What's New in this Prototype
I improved the PC board (now Version 2) to use screw terminals for the connections. I removed the unused components. Board has the same dimensions as previous V1 for Prototype #2. Note that Prototype #1 had board V0 (hand-made), so board version number is one behind the Prototype #.
There are two case designs, one for 3D printers and one for filament extruders. The same PC board works in both.
Information on Prior Versions
There is lots of relevant discussion at the prior version sites:
4. If you want to avoid making and soldering your own board, I am selling a limited number of completed and tested pc board kits at:http://owi.storenvy.com/
Where to take it from here:
Here are some thoughts on where to take this idea, some suggested by others:
1. It only measures diameter in 1 dimension. Filament may be oval, so measure in more dimensions. Some options are multiple image sensors, or using an RC servo to physically scan the sensor around the filament and make a geometric average.
2. Improve existing precision - use lenses or better illumination to ensure filament distance from sensor does not affect reading. Also could use small rollers to hold filament in place.
3. Improve output so that it produces a digital I2C output rather than analog voltage.
4. Update Marlin so that the sensor also checks for end of filament.
5. Sensor should work for 1.75mm filament, but more info/feedback/work needed to refine the design (I don't have a printer that uses 1.75 mm filament)
6. The calibration rod is difficult to source in Europe, so make the board work with a 3mm calibration rod as well.
7. Make a version with an Atmel processor so it can use Arduino toolchain.
8. Use existing Arduino board and sensor board:
3d model print parameters
Summary list (see attached documents for details)
- ABS Filament
- Black acrylic craft paint
- sensor PC board (see specs attached)
- electronic... components for sensor board (see specs attached)
- electronic supplies (solder, smd solder paste, hookup wire, etc)
- Freescale HCS08 programmer (see details)
- Modified marlin software (see details)
- calibration rod (.0630mm drill rod)