Sunday 30 September 2007

Dribble and smoke

Not a very good day today. I started by trying to lay down a 50mm straight line of HDPE. I completely failed and ended up smoking my machine!

The first problem I decided to tackle was extruding just the right amount of filament. This should be easy because I can instruct my extruder controller to turn the pump an exact amount. Using the equations I described last time, I know what feed rate is required to give a particular diameter filament and what its exit speed will be. The problem is that when the extruder stops, the filament continues to extrude slowly for a while afterwards. This is because the molten plastic, being non Newtonian, is compressible.

To start with I was getting about 12mm of overrun. I have noticed that the flexible drive made from steel wire gets wound up and stores some energy. With no power applied to the motor it actually unwinds a bit driving the motor backwards. By default my software was preventing that because it monitors the shaft position and applies increasing power as the shaft moves backwards until equilibrium is reached.

The host can instruct the controller to turn off the motor completely and let the wire unwind. That reduces the overrun to about 4mm. The shaft encoder sees the motor go backwards so, when it's told to move again, it regains all the backlash as fast as it can before settling down to the desired speed. Therefore, there is no loss cumulative loss of accuracy in letting the wire unwind and wind up again.

I expect the amount of filament overrun could be reduced further, or even eliminated completely by running the pump backwards a bit at the end. Unfortunately I can't do that because this is what happens to the steel wire when it is turned the wrong way:-



Because of this I designed my electronics to only be able to go forwards. Apparently this effect is not observed on the RepRap at Bath university. They are using 3mm wire, whereas mine is only 2.5mm, so that might account for it. I may see if I can get better wire that won't unwind. If so I will have to upgrade my drive to an H-bridge to allow the motor to be reversed. There isn't any spare room on my Vero board so I will either have to make a new one or make some sort of 3D creation.

In the meantime I decided to bodge round the problem. As well as the 4mm overrun when the motor stops, it also extrudes about 15mm when the heater is allowed to cool down and is then warmed up again. This is usually accompanied by a sharp cracking sound which sounds like trapped air bursting through the HDPE. I am not sure of the exact mechanism, but air must get in when the plastic is cold and contracted and then get trapped while it is heating up again, forcing some molten plastic out. Perhaps I have discovered a new type of pump with no moving parts!

So, before I can start extruding I need to remove the excess filament hanging from the nozzle. I did this by attaching a scalpel blade to one corner of my XY-table and having the machine visit it to wipe its nose just before starting to extrude. It is just a lash up at the moment, it would be better if it was 20mm above the table and a razor blade might be better, but it seems to work OK.



Of course, once the overrun has occurred and been removed, there is a net deficit of material which manifests itself as a delay before extrusion starts when the motor is switched on again. That has to be made up by starting the extruder in advance of moving the table for the first line segment.

So the next step was to lay down the filament on the table in a straight line. The first problem was that I discovered a bug in my software that meant the table only moved at half the specified rate. So any previous references to milling feed rates in this blog need to be halved!

The bug was easily fixed of course but I could not get the filament to stick to my table. When it hits the table it curls upwards into a loop and sticks to the side of the hot nozzle. The table surface I used for milling is made of upside down laminate flooring. It is covered with a textured layer of what I assume is probably some sort of vinyl. No great surprise it didn't stick, the next thing I tried was paper, a post-it note to be precise. That did not work either so the next thing to try was MDF. I taped an 18mm block to the the table for a quick test and raised the z position by 18mm, but I forgot to program it to raise up to clear it after visiting the knife. The result was the nozzle collided with the block and that pushed the thermistor wires so they touched the heater wires.

The result was quite spectacular, the thermistor wires, being quite thin, lit up like a light bulb before burning out. The thermistor is toast and so is the micro. Three volt micros don't like 12V up 'em!

I should have insulated the wires but I didn't have any insulation handy that would stand the temperature. Also three 3A diodes in series across the thermistor would have saved the day but it's a bit late now.

Fortunately I have a couple more micros and a spare thermistor but the machine will be out of action for 24 hours while the JB-Weld cures.

It is very easy to get a tool crash with a 3D machine and it usually causes a lot of damage. When I was using it as a milling machine I got into the habit of getting it to mime what it was going to do by running the program with a Z offset higher than the workpiece. I should have done the same thing this time.

Friday 28 September 2007

Equations of Extrusion

When I first tested my extruder I found that the filament diameter varied with the flow rate and temperature. This was contrary to what others have experienced so I decided to investigate further. It turns out that this is known as die swell and is caused by non Newtonian fluids expanding after they have been squeezed through a hole. Apparently it is a very complicated subject.

To get an idea of what was going on I designed my extruder controller to be able to make measurements. Rather than drive the motor with open loop PWM I used a shaft encoder with proportional feedback. Instead of specifying what PWM setting to use, the host specifies how many shaft encoder steps to move and at what rate. The extruder controller then adjusts the PWM to maintain the correct shaft position at any given instant. Assuming the filament does not slip against the drive screw, that means I can extrude a known volume of plastic in a known time to the tolerance of the the original feed material. The host can then ask the controller what the total on time and off times have been so that it can calculate the average power that has been used.

My temperature control works in a similar way. The host calculates the resistance the thermistor should have at the desired temperature, and from that, what voltage reading the ADC should produce. It sends that setting to the controller which turns the heater on and off. Again it keeps track of the total on and off times so that the host can calculate the average power.

My heater has a resistance of 8.5Ω and has 11.8V across it after the drop in the MOSFET switch and the wiring. That gives a power of 16.4W. This is a graph of the temperature reading from the thermistor plotted against the heater duty cycle :-

As you can see it is not quite a straight line. This is because the resistance of the nichrome heating element increases slightly as it gets hotter, so power does not quite rise in line with the duty cycle. I measured the resistance at 200°C to be 9.7Ω. Using the formula:

R = R0[1 + α(TT0)]

that gives a temperature coefficient α of 7.8 × 10-4 which is about twice the figure I found on the web for nichrome. I expect that it varies widely according to the exact alloy being used.

Here is a graph of temperature against power, calculated using the above formula for resistance :-

It is a lot closer to the straight line I was expecting.

I decided to investigate how much extra power is needed to heat the incoming plastic when extruding. I found that while feeding the filament in at 1mm/s, which is about the maximum my motor can do, the PWM to maintain 200°C increased from 44.6% to 61.2%. An increase of 16.6% corresponding to an extra 2.4W. Feeding a 3mm filament at 1mm/s gives a flow rate of 7.1 × 10-3 cc/s. HDPE has a density of around 1 so that is 7 × 10-3 g/s. The specific heat capacity is 2.2 J/g-°C which gives 2.8W to heat 7 mg from 20°C to 200°C per second. I think that is reasonably close to the value I measured, given that HDPE has quite a wide range of densities.

Next I decided to look at the effect of temperature on the motor power required to extrude at a given rate :-

I concluded that temperature has little effect on the motor power required, except when it gets close to the melting point, where it rises rapidly as expected. That was how I broke my extruder!

Next I looked at filament diameter against temperature :-

No real correlation, so it seems temperature is not very important as long as it is above the melting point. This was a surprise to me as I imagined molten plastic would get less viscose as temperature increased. It may become more critical when I start laying down filament as it will effect how it fuses together and shrinks. I did all the subsequent measurements at 200°C.

Feed rate (in mm/s) against PWM was another surprise. I expected power to rise rapidly with feed rate but, in fact, it is quite proportional :-

Presumable 30% is the power required to overcome static friction in the system.

Here you can see the output rate versus the feed rate :-

It does not increase in proportion, so if conservation of matter is true then it must be getting bigger in diameter. Indeed it does, here is output diameter against output rate :-


Either it is a very complex relationship with multiple inflexions or it is just linear with lots of measurement error. I made three measurements per test with digital calipers and took the average but the deviation between samples was quite high.

I prefer to think it is a simple linear relationship which means I can make a simple mathematical model of my extruder. As you can see it will hit the Y axis at about 0.93 mm. I think that must be the size of the hole in my nozzle. I drilled it 0.5mm but perhaps I drilled the hole from the back too far and opened it out a bit. It seems to have got bigger with use because I could get 0.8mm filament when I first tested it but I don't seem to be able to now, even at very low extrusion rates.

So if the filament diameter equals hole size plus a constant times extrusion rate then from conservation of volume I can relate the output rate to the feed rate.

do = dh + kvo

vodo2 = vidi2

So: vo(dh + kvo)2 = vidi2 a cubic equation!

Where do is the output filament diameter, di is the input filament diameter, dh is the nozzle hole diameter and vo is the output filament speed, vi is the input filament speed.

With these equations I can calculate the output rate to get a particular filament diameter. That also tells me how fast to move the head. From the output rate I can also calculate the feed rate required.

Conclusion? Well I definitely have die swell which increases with extrusion rate but other people have reported constant die swell. The only explanation I can think of is that I drilled my nozzle too deep from the back so the aperture has almost zero thickness instead of the 0.5 to 1mm expected.

I have a simple mathematical model which allows me to exploit the variable filament width if I need to. This may all become irrelevant when I start laying down filament to build things because the filament can be stretched or compressed if the head movement does not match the output rate.

Tomorrow I will try laying down the filament.

Monday 24 September 2007

Self destruction

Not managed any self replication yet but my machine has done a bit of self destruction!

While doing some experiments running my extruder at different speeds and temperatures, I managed to run it at too low a temperature such that it forced the PTFE barrel out of its clamp. That broke off one of the heater wires under the JB Weld. Fortunately I was able to dig out the end of the nichrome and reconnect it. I soldered the joint but that is not the best idea as solder melts at 183°C and I am running my barrel at about 200°C. The heater gets a bit hotter than that. Presumably molten solder is still a good conductor. The ideal way to make the connection would be with a miniature barrel crimp but I don't know if they exist. Here it is repaired :-



Clamping a very slippery plastic rod with a clamp made out of a slightly less slippery plastic is probably not the best design.

I seem to spend as much time stripping down and rebuilding my extruder as I do running it. Looking on the bright side at least the thermistor didn't fall off again despite some rough treatment. Here it is all back together again and working :-