Ever wonder how much filament did you actually use for a project? Have an old mechanical ball mouse laying around waiting for recycling? Let's convert it into a filament counter with simple Arduino and 3D printed parts.
The mechanical PS/2 mouse contains fairly high-resolution encoder wheels and a simple serial interface as well as electronics to process the quadrature input signals from the encoder wheels. There are Arduino libraries written to talk to the mouse and get the direction of the distance of rotation of the encoder wheels. By connecting the encoder wheel to a filament roller, we can track the actual usage of the filament for each project by using the Arduino and display the results in millimeter on a LCD display. Since the mouse outputs the relative position to its original position in both positive and negative directions, the counter is able to accurately measure and actual usage of the filament even when the filament direction is reversed occasionally.
The mouse has two channels, i.e. X and Y. So far only X is used, but it can be easily extended with an additional channel, handy for those have dual-extrudes. Just print and assemble another sensor body and make a small circuit board to transplant the IR emitter and receiver to the 2nd sensor body. The software is capable of reading the Y axis already, just need to add some extra lines of code and maybe the Reset to make it work.
Now it has basic functions, also considered is the implementation of jamming/print finished sensor if the wheel stops for extended time, and interface with the printer firmware to pause the print or notify the user.
Detailed instruction is available on the Instructablses
For the project, see
See it in action: