Introduction: Filament Metering

About: Made my own robot for you to 3D print

Get to know the assets of your filament stock

Step 1: 3D Printer

If you have one of these machines,

Step 2: Nearly Empty Spools

Sooner or later you will get many of these.

Nearly empty spools with some meters of filament.

If you are somehowe like me, you can't throw them away. Perhapse there comes a small project some day where you can use them?

Step 3: Filament Meter

Based on my needs, I did develop a 3D prinatable filament meter.

It is adopted to fit the top frame of an Anet A8, and are powered with a 9V battery.

The power consumptiuon is only 4,5 mA so the battrery will last many hours.

Step 4: OLED Display

The OLED display frame is carefully made by Mr Dumnac and can be found on Thingervis -

Many thanks to him.

Step 5: Home Made PCB's

The PCB's are design specially for this purpose and etched at my kitchen sink. Perferct results and without any "links".

The princip is to have an encoder wheel to be turned around as you drag the filament over a wheel on the other side of the "bugger". The encoder is counted by an photo interupter. Because of variable speed and hence frequencies, the signal from the photo interupter is fed to a HW Schmit trigger (SN74 14), before loaded to the Attiny 85.

In the Attiny an interupt is used to count the pulses, and a divider to correct from pulses to cm filament.

All is powered by a LM 7805 voltage regulator.

Step 6: Lay Out

Here is the lay out of the PCB's The smal PCB is soldered to the main board by means of some 90 degrees pins.

Step 7: Schemastic

Schematic diagram for those of you wanting to make it.

Step 8: 3D Printable

Here you can see all the parts needed. Including a bearing 608 Yx2Z.

Step 9: The Code

#include "avr/interrupt.h";

#include #include U8X8_SSD1306_128X64_NONAME_SW_I2C u8x8(/* clock=*/ 2, /* data=*/ 0, /* reset=*/ U8X8_PIN_NONE); // Digispark ATTiny85

int pulse=0;

void setup(void) {

u8x8.begin(); GIMSK = 0b00100000; // turns on pin change interrupts

PCMSK = 0b00001000; // turn on interrupts on pins PB3

sei(); // enables interrupts }

void loop(void) {


u8x8.drawString(1,2,"Reset and drag");


u8x8.print(" fillament ");


u8x8.print("cm: ");




ISR(PCINT0_vect) { pulse=pulse+1; }

Microcontroller Contest

Participated in the
Microcontroller Contest