Tuesday 16 October 2007

Scaling new heights

In my article laying-it-on-the-line I showed how I arrived at this test shape, a 20mm open ended cube :-



I decided to try different sized shapes to see how the process scales. It turns out that it doesn't and 20mm cubed is the magic size that is easiest to make!

The first thing I tried was taller :-



As you can see at 50mm tall it is starting to sag and 100mm is hopeless. The problem is that as the height increases, the plastic already laid down contracts as it cools and leaves the nozzle high and dry. I fixed that be reducing the Z increment from 1mm per layer to 0.95mm. That allowed me to make a good 20 x 20 x 95mm square tube :-



I presume with this increment I can keep going up, but who knows, I thought that at 20mm!

Next I tried low and wide. This was an attempt to make 120 x 120 x 20mm :-



I stopped it when the first two layers failed to weld. This was because with an object this large, by the time it has traced the perimeter to start the next layer, the first layer has cooled down to room temperature. In my post sticking point I predicted that to make an instantaneous weld between molten plastic and plastic at room temperature requires the molten plastic to be at temperature

T = 2 x Tm - Tr, for HDPE and 20°C this means about 240 - 250°C.

I set my extruder to 240°C and made this mess :-



I don't like running the extruder that hot because, although HDPE is not supposed to burn until 350°C, it smells like burning plastic and the end of the nozzle is glazed black. Also, the toothbrush that wipes the nozzle is showing signs of melting.

The object came unstuck from the foam board because of the extreme corner curling due to shrinkage. This is a fundamental problem with HDPE and room temperature FDM. HDPE shrinks about 2% when it cools from its melting point to room temperature. Commercial FDM machines use ABS, which has a lower shrinkage, and they keep the work piece in an oven close to the melting point. That means the hot plastic does not need to be so much hotter than the melting point, and most of the shrinkage occurs after the object is complete. The problem here is that the first layer cools and shrinks before the next layer lands of top. The next layer is bigger when it welds on top but then it shrinks, contracting the bottom layer more. Each subsequent layer increases the tension on the layers below. The bigger the object is, the worse the effect is because the mismatch between the size of the hot layer and the cold layer below it is bigger in absolute terms.

Following in Forrest's footsteps I tried laying down a raft of HDPE first to anchor the object to the foam base. The raft is 120 x 120mm but the object is now only 100 x 100 x 20mm.



As you can see that gives a big improvement but it wasn't strong enough to hold the corners down fully. A bigger raft, and perhaps a second layer might help but as it was an hour to build the raft and half an hour to build the object I didn't bother trying again. The blob, by the way, is where the firmware crashed on the last layer!

Here are some 40 x 40 x 20mm tests made with rafts, the second one had a bigger raft:-



Here the corner curl with a raft is comparable to the 20 x 20 x 20mm test without a raft showing how this effect gets dramatically worse as width increases.

Next I tried tall thin objects :-



Both were made on rafts and, the first is 15 x 15x x 75 mm, the second is 10 x 10 x 100mm. The photo is not very good but they both flare towards the bottom. The one on the left has an untidy surface as each layer is not well aligned with the layer below it and the one of the right has a completely wavy surface like basket work.

The reason for this is that because the perimeter is shorter, the layer below is still molten when the next layer is extruded on top of it. It moves around giving an untidy surface and also does not resist the contraction of the layer above. The bottom few layers are the correct size because they are welded to the solid raft but the layers above are too small as they have contracted inwards. A 5 x 5mm test shows this effect even more :-



The only way around this is either to wait for the layer below to cool, speed up its cooling with a fan, or extrude very slowly. I decided to experiment with a fan. It was immediately obvious that if you have a fan blowing near the nozzle you have to insulate it otherwise it doesn't reach its target temperature.

The RepRap design uses fiberglass wool but I wanted to be able to see the state of my heater so I decided to make a transparent cover. I started with a plastic test tube, donated by my wife, which used to contain bath salts.



I cut the end off this and drilled a hole to clear the nozzle. I converted a large plastic nut into a mounting flange by stripping out the thread on my lathe so that it was a push fit.



Here it is mounted on the extruder :-



The first fan I tried was a small North bridge cooling fan. It was so light that I could mount it on a stiff wire attached by ring tail crimps and bolts. :-



Unfortunately it wasn't very powerful so the next fan I tried was a PC case fan complete with speed control and blue flashing LEDs.



This worked a lot better but it is difficult to get it as close as I would like it. Here is the tallest thing I have made so far, it is 10 x 10 x 150mm. At this point I changed to 4mm per second travel and a feed rate to give a 1mm filament. I found that you can get finer filament just by stretching it as it leaves the nozzle so the work I did with flow rate and filament size is not really relevant. I had to reduce the layer height to 0.8mm.



This worked well on the windward side, with a nice tight corner, but not so well on the leeward side. The corner away from the fan is more rounded and the layers are less tidy. A cross section shows that the two sides cooled by the fan are straighter and longer.

The 5 x 5 x 20mm test is much improved but its surface area is so small that the fan fails to keep it cool enough. I think the only option with something as small as this is to slow down, and possibly drop the temperature.



Again the leeward side is not as good. The filament short cuts the corner because the layer below is not strong enough to hold it in place. I think to make the fan effective a cowling and duct is needed to get a strong flow of air directed downwards around all sides of the nozzle.



I have noticed that there is always an excess of material at the corners. This is because the head makes a perfect right angle but the filament has a minimum bend radius and takes a short cut. I am not sure how to compensate for this. I can't really pause the extruder because its response is too slow, so I either have to speed the head up as it takes a corner, or perhaps make it move in an arc that matches the bend radius rather than a right angle.

And finally here is an improved version of the magic 20mm cube :-



This is with the benefit of a raft, finer filament and fan cooling. The corners are a bit sharper and the corner curling a bit less. The reasons why this turned out to be the optimum shape are :-
  1. It is small enough that the filament does not cool too much when you go round it.
  2. It is large enough to make it long enough to traverse so that it does not stay too hot.
  3. It is short enough for the fan to be able to cool the back wall from the inside as well as the front.
  4. It is small enough for corner curling to not be too extreme.
From these experiments I now think I have a good understanding of how the parameters: temperature, flow rate, traversal rate, z increment and fan use affect the result. I have only looked at thin walled boxes, I expect solid objects to add more thermal and contraction issues.

The only reason I am using HDPE is that it seems to be the only thermoplastic filament I can buy off the shelf in the UK without getting it specially made.

With a bit of trial and error I expect I could make the machine produce a wide range of shapes and some useful objects but therein lies the problem. It is not supposed to be trial and error. The dream is to be able to input an arbitrary 3D model, of any size within the build volume, and have the item appear a few hours later. At the moment I can't see how that can happen with room temperature extrusion of HDPE. Its melting point is too high and its contraction too great. Managing the temperature of the object being built is very tricky as the features of the object vary from large to small.

Saturday 13 October 2007

GM3 motor suppressor

I have also been asked for more details on my motor suppression circuit that I first blogged in dc-to-daylight, so here goes :-



The Solarbotics GM3 generates large amounts of RF noise from 20MHz up to at least the TV band, which is 470- 850MHz in the UK. I know this because I can see the 20 MHz on my scope and it was also affecting our TV reception.

This is the circuit I used :-



The 1nF capacitors were axial ceramics and the 10nF was a radial ceramic, mainly because that is what I had to hand. I don't know the spec of the ferrite beads because I salvaged them from an old disc drive. Here is what they look like though :-



They should be a low Q type rated for at least 1A. The current rating is not so much about how much current they can carry but about the point where the magnetic field saturates the ferrite and the inductance disappears.

We want them to have a high impedance from 20 MHz to 800 MHz. I don't have much knowledge in this area but think this is quite a big ask for a ferrite and that I fell lucky with these. To get more impedance at the low frequency end it is normal to increase the number of turns to increase the inductance which is proportional to their square. The problem with that is that it increases the capacitance, reducing the attenuation at the high frequency end.

These beads are a good compromise: they have nearly a whole turn compared to a straight through bead which is half a turn, hence four times the inductance, but the wires maintain 0.1" separation so minimizing the capacitance.

The first two 1nF capacitors are soldered to the motor case. This is easier than you might imagine because steel is such a poor conductor of heat compared to copper, although it has to be said I am using a 50W temperature controller soldering iron. I cleaned the area first with a PCB cleaning block.



This is the rest of the circuit before it was soldered on top of the two capacitor leads. Spot my mistake!



Ignore the back emf diode, it is specific to my controller and should really be part of it. I used twin screened cable with the braid grounded at the controller end and left unconnected at the filter end.

Tuesday 9 October 2007

Measuring temperature the easy way

I have been asked for more details on my temperature measurement scheme so I have consolidated some of my previous articles :-

The objective is to measure temperature from room temperature to about 250°C using a thermistor. The thermistor resistance is a extremely non linear. It is approximated by a negative exponential of the reciprocal of absolute temperature.

Ro is resistance at known temperature To, in this case 25°C, expressed in Kelvin. Beta is a second parameter of the thermistor which can be calculated if you know the resistance at two different temperatures or can be found on the data sheet.

The RepRap thermistor is an Epcos B57540G0103+, data sheet here. R25 is 10KΩ and beta is around 3500. Several values are given on the datasheet for different temperature ranges illustrating that the above equation is only an approximation. Here is a graph of its resistance against temperature :-


This can be made more linear by putting a fixed resistors in parallel. The magic value to use appears to be the value of the thermistor at the middle of the temperature range. In this case it is about 470Ω. Here is the resulting combined resistance, the formula for two resistors in parallel is :-

1/R = 1/R1 + 1/R2

I.e. the total conductance is the sum of the two conductances.


The resulting resistance is a lot more linear, however to measure temperature with an ADC we need a voltage rather than a resistance. This is easy, instead of wiring the resistor in parallel connect it in series to a voltage source equal to the full scale voltage of the ADC.



The voltage across the thermistor is then :-

V = Vref . Rth / (R + Rth)

Here is a graph of the the output voltage when Vref is 5V.



Note that the voltage decreases as the temperature rises. This could be inverted by swapping the resistor and thermistor but I prefer to keep one end of the thermistor at 0V so I can use single screened cable. It is also a good idea to put a capacitor across the ADC input to filter out any noise when using long leads like RepRap does. I used a 10uF tantalum bead.

Another consideration is how much power is dissipated in the thermistor as it will cause heating and alter the reading. The maximum dissipation will occur when its value equals the value of the resistor. At this point half the voltage is across the thermistor so the power dissipated in it is :-

P = (Vref / 2)2 / R

In the example above this works out at 13.3mW. The thermistor datasheet specifies a maximum of 18mW and a dissipation factor (in air) of 0.4 mW /K. I think this means that the temperature will rise by 33°C by self heating. The error would be less when not in air, but it is still perhaps a bit high. My system uses a Vref of 1.5 volts which, because it is a square law, only dissipates 1.2mW giving a 3°C rise at the mid range temperature in air.

For a 5V system is is probably worth sacrificing some of the ADC resolution to reduce the self heating error. This can be done by using two resistors :-



The full scale voltage is now :-

Vfsd = Vref * R1 / (R1 + R2)

We also want the source impedance of this voltage, which is R1 in parallel with R2, to be 470Ω.

1/R = 1/R1 + 1/R2

Solving these simultaneous equations gives :-

R1 = R / (1 - Vfsd / Vref)

R2 = R . R1 / (R1 - R)

So for Vfsd = 1.5V, Vref = 5V and R = 470:

R1 = 671Ω and R2 = 1569Ω, preferred values are 680 and 1K6.

And finally here is the Python code to work out the temperature :-
from math import *

class Thermistor:
"Class to do the thermistor maths"
def __init__(self, r0, t0, beta, r1, r2):
self.r0 = r0 # stated resistance, e.g. 10K
self.t0 = t0 + 273.15 # temperature at stated resistance, e.g. 25C
self.beta = beta # stated beta, e.g. 3500
self.vadc = 5.0 # ADC reference
self.vcc = 5.0 # supply voltage to potential divider
self.vs = r1 * self.vcc / (r1 + r2) # effective bias voltage
self.rs = r1 * r2 / (r1 + r2) # effective bias impedance
self.k = r0 * exp(-beta / self.t0) # constant part of calculation

def temp(self,adc):
"Convert ADC reading into a temperature in Celcius"
v = adc * self.vadc / 1024 # convert the 10 bit ADC value to a voltage
r = self.rs * v / (self.vs - v) # resistance of thermistor
return (self.beta / log(r / self.k)) - 273.15 # temperature

def setting(self, t):
"Convert a temperature into a ADC value"
r = self.r0 * exp(self.beta * (1 / (t + 273.15) - 1 / self.t0)) # resistance of the thermistor
v = self.vs * r / (self.rs + r) # the voltage at the potential divider
return round(v / self.vadc * 1024) # the ADC reading