Wednesday, 4 November 2009

Extruder Part 3: the Filament Sensor

The disadvantage of using a DC motor instead of a stepper motor for the extruder is that you can't control the rate at which the filament is extruded without some kind of feedback mechanism. The standard way to do this is with a magnetic rotation sensor, and I've already blogged about etching my own version of the magnetic rotation sensor board. The way I'm using the board is not so standard.

The usual approach is to mount the magnet on the drive axle, so that the sensor detects the rotation of the motor. This is fine so long as the drive doesn't slip on the filament, but actually this happens quite often. What we really need is an independent axle which is driven by the movement of the filament, not the motor. My design is cheap and seems to work well.

You need an M3 bolt, two 10x3x4 bearings, a short length of silicone tubing, and a microswitch with a roller lever:

The silicone tubing should fit tightly onto the bolt. Glue the magnet from the rotation sensor onto the head of the bolt with epoxy resin, getting it as central as you can. The sensor IC specifies a 6mm diameter magnet, but I couldn't get hold of one at a reasonable price, so I used a 10mm which works fine. The parts fit together like this:

The roller lever on the microswitch pushes the filament against the bolt, and the silicone tubing gives it enough grip to rotate the bolt when the filament moves. You need some kind of block to hold everything in place; in the long term this should be printed on the RepRap but (as usual) I made mine out of oak:

It fits on top of the pinch-wheel block like this:

and the filament feeds straight through. The microswitch is connected to D9 or D10 on the extruder controller, so the software can detect when the filament runs out.

The silicone tubing is about 5mm external diameter, and the rotation sensor detects 1024 events per revolution, so the resolution should be about 0.015mm. Assuming 3mm filament extruded to 0.5mm, this gives a resolution of extruded plastic of about 0.5mm, which isn't bad. We could improve it a bit by using thinner walled tubing.

Thursday, 22 October 2009

Extruder Part 2: the Pinch Wheel Drive

For some reason NEMA17 stepper motors are much harder to get hold of than NEMA23s. I got a great deal on a set of four 23s, but I couldn't find 17s at less than list price, which works out at about £25 each. Then I remembered some gear motors that I've had in my junk box for about 25 years and never used:

They're on a NEMA17 frame, rated 12V 0.7W, and geared to 8.2rpm. A quick test shows that they can lift 1Kg using a 2in pulley without straining, which works out at 0.25Nm so plenty of torque. Ideal!

Next job: make the drive block. Here is my first attempt:

As you can see, it is based on the standard RP part, but made out of oak. I've started writing my extruder PID software, and I couldn't get it to work at all, so I thought I'd see how the drive behaved under constant power. The results were terrible. Here's a typical run:

The blue line is the PWM power output to the motor, and the green line is the measured speed of the filament. Note the enormous spikes when the filament starts moving: it's obviously sticking, then springing free. No wonder my feedback loop didn't work!

Peering at the pinch wheel mechanism, I could see what was wrong. The ball bearing is held by an M3 cap screw, bolted to a fairly narrow bit of wood. The force needed to pinch the filament hard enough pushes the bearing sideways, and the filament doesn't line up with the hole it goes through. That's why it sticks, and also why it's so hard to load the filament.

I decided to make a new block which holds the bearing on both sides, so it can't be pushed sideways. The bearing slides in through a slot at the side, which is a bit fiddly, but I've assembled it and disassembled it several times, and it's not too bad. I even managed to get a washer in on each side of the bearing. Here it is:

You can see the slot at the side where the bearing goes in, the small hole for the bearing axle screw, and the large hole for the motor spindle. Assembled, it looks like this:

It loads the filament without any trouble, it happily lifts 2Kg, and the spikes on the graph are gone. Success! Now back to programming.

Friday, 9 October 2009

Magnetic Rotation Encoder Board

This really ought to be something like part 4 of the extruder, but I'm posting it out of sequence because somebody emailed me to ask about it, and I thought I'd put the details here instead of writing an email, then repeating it all.

I'm using a gear motor to drive my pinch wheel, and I decided I needed feedback to control the speed. Unfortunately, I didn't order a rotation sensor PCB when I bought the electronics from MakerBot. The various charges mean that buying it now would cost me about £30, which is daft, and no-one else seems to sell it. I looked into getting one made, but that's almost as much, especially as it's double-sided. In fact, the only people I could find offering to make PCBs in small quantities for a reasonable price have pictures on their website that look just like home-made boards I have seen. Maybe I should find out how it's done?

I decided (since I've never made a PCB before) to simplify the board as much as possible. My aims were:

  • Keep the same position of the IC relative to the mounting holes, in case I ever want to replace the board with the MakerBot version;
  • Keep the same connector and pin assignment so that it connects to the Extruder Controller;
  • Switch to a single-sided PCB if possible;
  • Switch to through-hole components, except for the IC (which is surface mount only).
The compromises I had to make were:

  • Lose the two extra mounting holes near the centre of the board;
  • Lose the analog output on pin 2 of the connector.
Since I can't imagine needing either of these, I don't care about losing them. Here's my PCB layout, tracks and components (both seen from the components side):

I used very low power LEDs, and adjusted all the resistor values accordingly, because the AS5040 datasheet says it can only drive 4mA, but otherwise the components are the through-hole equivalents of the originals. Also, I used red LEDs for MAG+ and MAG- because they should only come on if there's a problem, and green for the others. There are two wire jumpers on the components side, one vertical next to C1, and one horizontal next to the IDC connector. There is no hole under the chip, because it is mounted on the other side of the board, nearer to the magnet. This also means that you can use 10mm magnets, which seem to be much easier to obtain than 6mm.

To etch the board, I basically followed the instructions here. I don't have a laser printer, but my local library was happy about me using my own paper in their HP, though they didn't know which way up to feed it in! I tried two different papers which I already had, and the better was the cheaper: ICE professional inkjet photo paper (gloss, 210gsm). I turned my old steam iron up to "linen" and about 30 seconds of heat, followed by a bit extra along the edges, stuck the toner to the copper pretty well. After soaking for about ten minutes, the paper came straight off, leaving just the clay coating. After a few experiments I found that blu-tack (well stretched to soften it) gets the clay off easily, leaving just the toner behind. For etching, I used sodium persulphate (from Maplin) instead of ferric chloride, because it doesn't stain.

At first I thought I could get away without tinning, cause tinning crystals are expensive, but I'd forgotten how much harder soldering is without through-plated holes. Then I remembered seeing a suggestion somewhere that you tin PCBs with solder, and I've got most of a syringe of solder paste left. I squirted a bit on, and pushed it about with my soldering iron, and it worked. Finally I soldered the components on, tested the connections, and here it is:

It seems to work perfectly, but (as far as I can find) there is no firmware available for generation 3 electronics which supports it, so I've got to write my own. Why does that feel so much more like work?