Skip to main content

3D Printer Filament Joiner

I have been looking at various ways of joining 3D printing filaments.

One method involves running one end of a filament through a short PTFE tubing, melting it with a lighter or candle, retracting it back into the tubing and immediately plunging the filament to be fused into the tubing:

One problem with this method is that you can't really control the temperature at which you melt the filament, so you frequently end up with a brittle joint that breaks upon the slightest bend.

Aliexpress even sells a contraption that works along the same line. As it uses a lighter or candle as well, it suffers from the same weakness. I am not even sure why you need a special contraption when a short PTFE tubing will work just as well.

Another method involves using shrink tubing/aluminium foil, and a heat gun:

But a heat gun is rather expensive, so I wanted to explore other alternatives.

The candle + PTFE tubing method actually works quite well when you happen to melt it at the right temperature. It’s just very difficult to get it right. I get like one good joint for every 10 attempts. So that got me thinking. Maybe we need to replace the candle with a controlled heat source that is also affordable.

After some experimentation, I came up with such a heat source that cost very little to build. It is basically a 3D printer hotend driven by a MOSFET. A hotend is only a couple of dollars off Aliexpress.

The hotend has 2 thick wires (red in photo) that should be connected to the 12V source. It also has 2 thinner wires (white in photo) connected to the thermistor that can be used to measure the hotend temperature.

You also need a 12V DC power source (anything from 1A and above should give you sufficient power to drive the hotend; I use a 12V/2A power supply that was salvaged from years past), a MOSFET that is capable of handling the power, 2 x 10K resisters, an Arduino MCU (I am using the Nano for this project), and we are good to go.

The entire circuit looks like this:
Let's break it down.

One wire from the heating element is connected to the 12V source. The other wire is connected to the MOSFET "source". The MOSFET "drain" is connected to ground.

The "gate" of the MOSFET is connected to D3 on the Arduino. When that is high, source connects to drain, the circuit is completed, and the heating element starts to heat up.

During operation, we output a PWM on D3, which controls the speed at which the hotend heats up.

It is important that all wires connected to the hotend side of things must be of a thicker gauge to handle all that current, otherwise the wires will melt down (as I learnt the hard way).

The wires from from the hotend is hooked up to a voltage divider network. The resistance of the thermistor varies with temperature, and by measuring its resistance (via the A6 pin on the Arduino), we can infer the hotend's temperature.
It's a pretty simple circuit as things go. Here's what it looks like on a prototype board:

The hotend sits on a makeshift holder made of particle board. Everything is held down by epoxy glue.

You can find the code to tune and drive the hotend on Github

heating.ino makes use of PID (proportional-integral-derivative) to stabilize on the target temperature that you want. But before you can use it, you need to figure out the PID parameters (KP, KI and KD) required for your hardware. This is done via an auto-tuning process, implemented in autotune.ino.

First, upload autotune.ino to the Arduino and observe its output via the serial window. It will take a few minutes. Upon completion, it will print out the values of KP, KI and KD, which you will need to enter into heating.ino

pwmOut = 0.00, curTemp = 187.29
pwmOut = 0.00, curTemp = 187.02
pwmOut = 0.00, curTemp = 186.42
pwmOut = 0.00, curTemp = 186.12
kp: 17.07, ki: 0.75, kd: 96.57

Usage information about the autotune library is quite scarce, and in sources that use it, the autotune code is typically integrated the PID system. Even the sample code in the Autotune library takes that approach. I have chosen to separate out the autotune and the PID code instead because I find it easier for a newcomer like myself to understand the 2 different processes.

Once you have updated the PID parameters in heating.ino,  set the target temperature (setTemp).  I find the best temperature to set is 10c below the printing temperature of the filament material. So for PLA, I use 175~180C. After that is done, you can upload the code to the Arduino and monitor its output via the serial window.

pwmOut = 206.21, diff = 41.88, curTemp = 138 / 180
pwmOut = 187.58, diff = 41.09, curTemp = 139 / 180
pwmOut = 167.37, diff = 40.28, curTemp = 140 / 180
pwmOut = 145.74, diff = 39.47, curTemp = 141 / 180
pwmOut = 179.30, diff = 38.71, curTemp = 141 / 180
pwmOut = 145.92, diff = 37.93, curTemp = 142 / 180
pwmOut = 113.38, diff = 37.12, curTemp = 143 / 180
pwmOut = 81.37, diff = 36.30, curTemp = 144 / 180
P_ON_M activated.
pwmOut = 0.00, diff = 35.46, curTemp = 145 / 180
pwmOut = 0.00, diff = 34.67, curTemp = 145 / 180
pwmOut = 0.00, diff = 33.84, curTemp = 146 / 180

When the hotend temperature is within 1% of the target temperature, the built-in LED on the Arduino will light up, and filament joining can begin. The video below shows how the 2 ends of the filament are joined:

The correct technique is to melt about 2~3mm of one end of the filament in the PTFE tubing, then align the other end to touch the melted filament, wait a little so that it becomes slightly soft as well (don't wait too long as it will become too soft!), then push the PTFE tubing through to "scoop" up all the bits.

Note that the PTFE tubing should be touching and scraping the hotend as it moves through. If you try to lift everything up too early, the plastic may cool too soon and you will not get a good joint. The PTFE tubing has a much higher melting point (327C), so it won't be damaged by the hotend temperature. Just be careful not to touch the hotend with your fingers.

With a little practice, I was able to get a higher than 9 out of 10 success rate. If for whatever reason the joint is bad, simply trim a little bit off the ends and try again.

The important result of using a controlled heat source to melt the plastic is that the joint is very strong! As shown in the video, the joint can be bent without breaking, just like a regular filament. This is because the temperature is never high enough to rearrange the crystalline structure of the plastic during melting.

Any residual PLA can then be scraped off the hotend with a penknife while it is still at temperature.

One question that often arises is how to get the PTFE tubing off the joined filament, especially when you are joining 2 spools. My suggestion is to just leave the tubing on. It will slide along the filament just fine as you print.

Alternatively, it is possible to cut the tubing off with a sharp pen knife and a steady pair of hands. As mentioned before, PTFE tubing is dirt cheap. A meter worth of tubing can be had for $2 off Aliexpress, and you only need a 3cm segment for each joint.

I plan to add a rotary knob and a tiny OLED screen to this project to make it totally self-contained. Parts have been ordered and are on their way.


  1. Understanding its been a few years.. I have been attempting to get the PID process to work reliably with your code exampiles as my starting point. when runing autotune i get values that simply prevent the heater from getting warm.. my issue when adjusting or using your listed values is that i get over shoot on the temps..

    Any suggestions for fine tuning that..



Post a Comment

Popular posts from this blog

Update: Line adapter for Ozito Blade Trimmer

Update (Dec 2021): If you access to a 3D printer, I would now recommend this solution , which makes it super easy to replace the trimmer line. I have been using it for a few months now with zero issue.

Attiny85 timer programming using Timer1

This Arduino sketch uses Timer1 to drive the LED blinker: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 /* * Program ATTiny85 to blink LED connected to PB1 at 1s interval. * Assumes ATTiny85 is running at 1MHz internal clock speed. */ #include <avr/io.h> #include <avr/wdt.h> #include <avr/sleep.h> #include <avr/interrupt.h> bool timer1 = false , led = true ; // Interrupt service routine for timer1 ISR(TIMER1_COMPA_vect) { timer1 = true ; } void setup() { // Setup output pins pinMode( 1 , OUTPUT); digitalWrite( 1 , led); set_sleep_mode(SLEEP_MODE_IDLE); // Setup timer1 to interrupt every second TCCR1 = 0 ; // Stop timer TCNT1 = 0 ; // Zero timer GTCCR = _BV(PSR1); // Reset prescaler OCR1A = 243 ; // T = prescaler / 1MHz = 0.004096s; OCR1A = (1s/T) - 1 = 243 OCR1C = 243 ; // Set to same value to reset timer1 to