Tuesday 4 August 2009

More PLAying

Way back in April last year I tested a sample of PLA and got as far as making a test block with it and establishing that the warping was much less than the other plastics and you don't need a raft. I finally got round to making some objects with it last week.

The first bed material I used was balsa wood. That works well without a raft. The only downside is that when the object is peeled off it takes a few fibers from the wood with it. No big problem for functional objects, but it does spoil the aesthetic appearance a bit. The top and sides of the object are nice and shiny, but the base is cloudy.

I tried MDF, that gives a smoother finish, but I could not get it to stick reliably. Vik suggested 3M blue masking tape, but I didn't have any to hand, so I tried some sticky back plastic instead. That made objects with a nice glossy base but I could not get the outline to stick reliably.



The lid on the left was made on balsa. I think the black flecks are bits of black ABS which was the last plastic I used in the extruder. The one on the right was made on sticky black plastic. It looks much nicer, but on the top right you can see a bit of missing outline.

I also made this screw-able jewelry box, which looks nice in PLA.



PLA is very nice to extrude. It has a higher melting point than the other plastics but it viscosity falls rapidly with temperature so you can extrude it at lower temperatures. I did the first outline at 210°C, the first layer infill at 200°C and the rest of the object at 180°C. It does not seem critical.

I run the fan after the first layer to make it set quickly. I also needed a fan blowing on the heatsink of my extruder. Otherwise it can heat up past the glass transition of the PLA, which is only about 70°C. When that happens it jams fast and has to be drilled out.

Not needing a raft saves a lot of machine time and also my time removing it.

Even larger objects don't show any warping. I made this contraption to hold a scope probe in place for a job I am doing at work.



Vias are so small nowadays that attaching a wire is difficult and risks ripping the tracks off. Here it is in operation: -

Thursday 30 July 2009

Lessons from the A3977

Having established that I want to move to a stepper driven extruder I set about designing a new extruder controller for HydraRaptor. I fancied using one of the Allegro micro-stepping chopper drivers.

With these chips there are a few things you can adjust by changing component values, like the off time, minimum on time and percentage fast decay. The data sheet explains what they do and gives the formulas but it's not obvious what you should set them to for a particular motor.

Not having any previous experience with Allegro drivers I decided I needed to knock up an evaluation circuit. Fortuitously Zach had sent me some PCBs a long time ago that were his first version of the Stepper Motor Driver v2.0. They used the PLCC version of the A3977.

PLCC packages were a bit of a halfway house between through hole and surface mount. They have leads which come out of the side and then curl underneath.



They are handy for programmable devices because you can either surface mount them or put them in sockets (which can be either SMT or through hole). The problem with them in this application is that using a socket is not recommended for current and heat dissipation reasons.

That makes the package a worst of both worlds solution. It is big and bulky like through hole parts but still difficult to hand solder because the pins are underneath. The surface mount version of the A3977 is a fine pitch (0.65mm) TSSOP with a heat slug underneath, so again not easy to solder by hand, it really needs to be done by the solder paste and oven / hotplate method.

Zach moved to the A3982 on subsequent versions, which is easy to hand solder because it is in a SOIC package with 1.27mm pitch. It also has a lower external component count. The down side is that it does not do micro stepping and is only 2A rather than 2.5A. I will probably use the A3983 (which is like the A3982 plus micro stepping and in a TSSOP package).

I managed to hand solder the PLCC at my second attempt. My first attempt had a short, which damaged the chip. I damaged the board removing it (with a cutting disk), so I had to start again on a second PCB. Lots of cursing! The lesson is always to meter a PLCC for sorts before powering up as you can't see shorts underneath it.

Here is my test lash up: -



I can set the step rate with a signal generator, vary the supply voltage from 8 to 35V, see the temperature of the chip and look at the current waveform on a scope .

The initial results were disappointing due to a couple of problems: -

The first was that the chopping occasionally had glitches in it. With the motor stationary I could hear it clicking, and with a scope I could see some cycles shorter than they should be. It got worse with higher supply voltages. At low speeds it did not make much difference, but it did lower the maximum speed. I tracked it down to a lack of high frequency decoupling on the 12V rail. I added a 220nF de-coupler close to the chip and the problem went away. Adding it further from the chip actually made it worse.

The next problem was that the microstepping was very uneven. I had noticed that same effect with the z-axis of my Darwin using the $800 microstepping drivers (that I got cheap) that I use on HydraRaptor. At the time I put it down to the small, large step angle tin can motors I was using at the time not being very linear. When I moved to larger 7.5° tin can motors I still had the same problem, and even with the Keling NEMA23 1.8° motors it did not seem right. This puzzled me because they are very similar to the NEMA23 motors on HydraRaptor, which work well with the same drivers. The shaft encoders have the same resolution as the ×10 microstepping and they are always spot on or one count out, so pretty linear.

With the A3977 it is easy to get an idea of the current waveform of the motor by measuring the voltage on the sense resistors. It should be a stepped sine wave like this: -



Regardless of which way the coil is energised, the current flows to ground through the sense resistor, so the waveform looks like a full wave rectified sine wave. The current only flows in the sense resistor when the chopper is in the on state though. In the off state the current is circulating through the coil and the bottom two transistors of the H-bridge, so the current in the resistor is zero. That is why there is a bright line along the X-axis. On the falling edge of the wave you can see the sense current goes negative. That is because the chip switches to fast decay mode. When the chopper is in the off state, instead of short circuiting the coil, it reverses the voltage on it, causing the current to flow backwards through the sense resistor onto the supply rail. It only spends part of the switching cycle in fast decay so you see positive current, a lot of zero and some negative current, hence the relative brightness of the lines. This is a case where an analogue scope gives you more information than a digital one.

Initially the waveform looked like this, it was somewhat distorted: -



The current rises too quickly at the start of the waveform. The chopper has a constant off time (20uS in this case) and varies the current by changing the on time simply by turning it on until it reaches the target value. But, there is a minimum on time of about 1.4uS, called the blanking period. During that time it ignores the current sense signal to avoid false readings due to ringing on the switching waveform. That means there is a minimum mark space ratio of 1.4 : 21.4 in this case. That sets a minimum current, which also depends on the ratio of the supply voltage to the motor voltage. If this minimum current is more than the lowest microstep value (19.5% of the peak for 1/8 steps) then you get a distorted waveform as above, and the steps are uneven.

To fix it you can lower the supply voltage, raise the current setting or increase the off time. The latter reduces the chopping frequency. If it is below about 15 kHz it will be audible when the motor is stationary. It can also start to beat with the stepping frequency when running at high speeds, particularly when micro stepping, as the step rate is n times faster.

This form of distortion is analogous to crossover distortion on a class B audio amp. You can also get the equivalent of clipping if you use a high voltage motor on a low supply voltage. If the current setting is set to a value which is more than the motor will draw when connected to the supply, then the top of the waveform is flattened off and again the microsteps will be uneven.



Yet another form of distortion occurs when running at high speed: -



Here the back EMF from the motor acting as a generator is preventing the current from falling fast enough to follow the sine wave. This can be fixed by increasing the Percentage of Fast Decay, set by the voltage on the PFD pin. If there is too much you get excessive ripple as shown here: -



For a particular speed and motor there is a sweet spot which sounds audibly quieter: -



So setting up a microstepping drive is not straight forward unless you have an oscilloscope. You can tune the PFD by ear though, as this video demonstrates: -

Tuning PFD from Nop Head on Vimeo.

You can also see the other forms of distortion if you attach a long pointer and step it round slowly.

Another lesson is that you cannot simply just set the current to accommodate different types of motor. You really need to be able change the off time and the PFD as well, especially if you use different supply voltages.

So I solved the mystery of why microstepping does not work well with the expensive drives on my Darwin. They are rated at 7A but I am only using them at 1A, I am also using low voltage motors on a 36V supply. I bet it is a constant off time chopper and the minimum current is too high.

Wednesday 22 July 2009

Thoughts on rafts

Erik asked me for details of how I do the rafts so here are my thoughts.

I am not totally happy with the way they are currently and keep fiddling about with them. At the moment they hold well and give a good flat surface on the bottom of the object, but they can be difficult to remove. I use a blunt penknife to remove them.



I use the long blade to remove the raft from the bed and the object. The smaller blade is handy for clearing out strings from internal areas.

It needs to be not too sharp otherwise it tends to cut into the object, or the bed, rather than prizing them apart, or scraping off strings.

I have developed a thick callous on my thumb while making the Darwin parts, and I frequently stab myself, another reason for not having it too sharp!

I think most people use more sparse rafts than I do. They will be easier to remove, but I find that gives a ribbed base on the object.

My rafts are orthogonal to the axes and the infill is at 45°. I find that convenient because you can tell where the raft ends and the object begins.

The bed I use for ABS is, I think, Foamex PVC foam board. It is a solid dense foam 3mm thick, not the type that is soft foam laminated with paper. I glue it to a piece of wooden floor laminate with Evostick contact glue. Now that Evostick has gone solvent free / water based I find it takes much longer to dry than it states on the tin. Blowing it with a gentle breeze from a fan makes it dry much faster.

Even when it is glued down, I find the warping force is strong enough to lift the edges, so I have a frame around the edge that is screwed down. The foam board is reusable over and over again. I only have to replace it when I have had an accident that makes the raft impossible to remove (head too low, or temperature too high).

Other people have reported good results with Acrylic sheets and of course an ABS sheet will work. I have yet to try these. For HDPE I use a PE-LLD chopping board from Ikea that is 10mm thick.

I find that I need at least three raft layers. I.e. each of the three layers has a definite function.

The first layer of the raft has to stick well to the bed but still be peelable. It also has to be thick enough to cope with bumps and troughs that develop on the bed with use and slight errors in the z-calibration.

The filament diameter I use for the base layer is twice the nozzle diameter or 0.8mm, whichever is the biggest. The height of the head is 0.7 times that. The pitch of the zigzag is 3 times the diameter. The head is relatively low, so that it gives a wide filament pressed against the bed. It is widely spaced so that when the bed has a bump it can spread further without merging. It is extruded at the maximum rate that the extruder will do, which works out at only 4mm/s with 1mm filament through a 0.5mm nozzle. The temperature is 225°C for ABS and 215°C for HDPE. The other layers of the raft are extruded at 240°C to bond strongly to the layer below.

The middle layer's function is to give the raft some strength and bridge the ridges created by the bottom layer. The filament diameter is 1.5 times the nozzle aperture. The height of the nozzle above the layer below is again 0.7 times the nozzle. The pitch is 1.2 times the diameter, so that gives closely packed threads that tend to merge.

The top layer aims to present a flat platform to the object but still be discrete threads so they can be picked off one by one. The diameter is the same as the nozzle and the height is 0.8 times that. The pitch is 1.8 times the diameter.

The raft is cooled back to room temperature with a fan before the object is placed on it. The first layer outline of the object is done at half the normal speed (8mm/s for ABS, 4mm/s for HDPE) and at a temperature of 215°C for ABS and 230°C for HDPE. The first layer infill is done at full speed and at 195°C for ABS and 205°C for HDPE. The rest of the object is 240°C.

One annoying thing is that when I peel the raft most of the top layer is left stuck to the object not the middle layer. This is despite the fact that it was bonded to the middle layer at a high temperature, and to the object with a low temperature. I think the reason is that the contact area is 100% against the bottom of the object, but the top of the middle layer is quite wavy so has less contact area. I think adding another dense layer between the middle and the top will fix that, but waste more time and plastic. It is on my very long list of things to try.

As Erik suggested, small objects do not need to be bonded as strongly to the raft as large objects. Something else I mean to try is some logic like this: -
If the length or the width is > 30mm and the height > 5mm then use a strong raft else a weaker one.