| Project Specification

Open Source 3-D Filament Diameter Sensor for Recycling, Winding and Additive Manufacturing Machines

An open-source sensor uses two mirrors for 3D filament diameter measurement.


3D printed partsTwo Filament guide: 6g
Mirror stand: 18g
Front camera case: 15g
Back camera case: 14g
CameraOpenMV H7 Camera
Resolution: 640x480 RGB images
FPS: 1 frame per second
Battery3.7V 1000mAh lithium polymer battery
Charger5V 1A TP4056 battery charger
Power consumption 150 mA
Battery lifeContinuously for 6hrs
MirrorTwo Mirror plate (45-degree angles)
MicrocontrollerMicroPython OS
Processor480 MHz ARM processor


This tech spec was submitted by Joshua Pearce as part of the University Technology Exposure Program.

Problem / Solution

Powerful tools tend to become a double-edged sword, such as in the rising prominence of 3-D printing, where its contribution to solid waste has gone massive. Measures are now in place to mitigate its unfavorable effects. One in the lead is a process called DRAM, or distributed recycling and additive manufacturing. The process involves turning waste materials into filaments recycled for 3-D printing new products. If overlooked, even the tiniest deviation in the filament diameter can cause irregularities in the filament. While multi-axis laser meters allow control over the diameter, their affordability hinders the open source community from accessing its usage.

This 3-D filament diameter sensor allows optical control of the filament diameter using two mirrors, allowing accessible analysis of the spool's surface structure. This modular system saves measurement history and marks defective areas along the spool. The open source diameter sensor is an independent module integrated into the RepRapable Recyclebot, processing plastic filaments on a 400g/hr average at a consistency output of ±4.6%.


The diameter sensor has four main components; (a) camera, (b) mirrors, (c) filament guide, and (d) rollers. The camera used plays a vital role in the success of the sensor. It is based on the OpenMV H7 design, installed with a microcontroller board that runs on MicroPython. Using a 480 MHz ARM processor, various interfaces, like I2C, I/O pins, and SPI facilitate its usage as an independent control. As the system only takes 150 mA, the camera can operate for 6hrs using a Lithium-ion battery rated 3.7V 1000mAh. There is also the option of powering the camera using either a portable battery of a different supply or a shared power supply with the recyclebot system.

Needing only 50g of plastic material, printing the necessary parts is an easy task. The printing equips the lightweight open source sensor with a filament guide, a mirror stand, and cases for both front and back cameras to ensure its accuracy.

The camera also captures 640x480 RGB images recorded at one frame per second, highlighting the entire length of the filament—not leaving a section unmeasured. The added presence of mirrors located at 45-degree angles boosts the device capturing ability from three different angles. With this inclusion, measuring the ovality deviation within the cross-section is possible.

Another aspect of this 3-D diameter sensor is its open-source code, allowing the community to access its features at a relatively lower price. The sensor is written in Python to account for the MicroPython OS in the installed camera, which automatically starts working once the power is on. The Secure Digital (SD) memory card saves the captured images on a cyclic subroutine schedule. The user can also change the interval between saving images for more thorough tracking of the spool and its section.

The Python notebooks then assess the captured images, segmenting the filament and measuring the diameter pixel by pixel. Further analysis of the visible parts through combined texture patches tallies a measurement record—characterizing filament segments within diameter, ovality, and surface texture deviations.


A research paper describing the challenge, design, and outcome of the research.

Aliaksei L. Petsiuk and Joshua M. Pearce


3D Printinguniversity program

Continue Reading