Wednesday 31 August 2011

Chapter 15 - In which I hack a parallel cable into a programmer

With the success of getting windows to recognise my electronics, I thought that uploading the firmware wasn't going to be too tough. Then I did a little reading, and realised it would be harder than I thought.

It seems that although the firmware can be downloaded to the board via the USB cable, the processor has to have a bootloader burnt to it first in order to accept the download. This tripped me up a little, as the small amount of chips I've programmed in the past have only needed a single step. Also I came across this by accident while browsing the forums - I hadn't seen the requirement for a bootloader anywhere else.

There's now a good tutorial up on how to use an Arduino as an in-system-programmer (ISP) to burn the bootloader here, but I don't have an Arduino. (Ironically if I did, I would have known all about bootloaders...)

One of the recommendations on the forums is to use a USBtinyISP as the programmer. They're available on ebay but from Hong Kong and China, so shipping times are fairly long and I'm feeling impatient. Another recommendation from the same thread is to use a parallel programmer. These can be made from an existing parallel printer cable/adaptor and some resistors. It looked fairly easy to make, and I was heading to Maplin anyway to get the cable for the rest of the printer so I picked up the required resistors. I searched fruitlessly for a parallel cable at home, and eventually begged an old one from my Dad.

The first thing to do was to add the ICSP header to my Sanguiniololu.  I hadn't fitted it as I had believed it was for expansion etc. I used leftover male pin headers from the main build to make the header, and the female sides will make the plug. (Today's photography comes courtesy of my phone - please excuse the poor shots!)


Next I used a multimeter to buzz out the cable. I had considered cutting the plug open, but it is moulded on and would have been very difficult to get apart. Instead I decided to solder onto the other end of the cable. This gives an additional benefit: since Bernard doesn't have a parallel port, I will be programming the bootloader from my main Pc. The long run of cable will give me some much-needed reach from behind my Pc to some clear workspace.

Curiously the PC-end of the cable has 25 pins, whilst the printer-end has 36. I used the meter to determine which pin went where:

              PC end        Printer end
Pin #            1                  1
                    2                  2
                   11                11
                   16                31
                   18                19

I used a very small soldering iron to attach the resistors directly to the spring-terminals in the plug.


 At only 5 wires, it was simple enough to make. I used red wire to indicate pin 1 on the board-end plug.


The board-end plug completed. I buzzed-out all the lines as I went, and it all looks good.


So, I now have the world's most fragile programmer. The solder joints to the printer-end plug are very small, and won't hold up to much handling, but I think I should only need to use this ISP once......

Might add cable ties and judicious amounts of hot-glue later to firm everything up.

Next up - Can I burn a bootloader with a makeshift programmer? We'll find out.....

Chapter 14 - In which my power drill pretends to be a lathe

Saturday. Inspired by Friday's success with the electronics, I decided to tackle something that had been on my mind for a while - the hobbed bolt.

I dug the bolt out of my dwindling box of parts. I couldn't find a shoulder bolt when I was collecting materials, so I had to make do with a full length thread:


I started by test-assembling the extruder so I could mark off where the hobbed section needed to be. I pushed a pair of bearings into the extruder body. They were a very tight fit, but didnt sit flush in the housing. I'll have to look at this in more detail when I come to build the extruder for real:


I assembled the rest of the drive, and used a CD marker to mark the position. I disassembled the drive, and maesured the marks. I  made a crude dimensioned drawing, so I would know where to put the hobbing when the pen marks wore off.


Time to go back to the garage. I only have 2 power tools available to me (power drill and an electric screwdriver) and for this job I needed both of them. I mounted the drill upside down in my vice.


I fitted the bolt into the chuck, right up to the line. I was lucky in that the chuck is quite small, and the jaws are retracted right into the housing and so don't show at all.


I set the bolt spinning away from myself, and started to reduce the width of the section to be hobbed. This is pretty dangerous! I made especially sure the bolt was true in the chuck, and didn't wobble, and was sure to move my head out of the line of the chuck/workpiece when it was spinning, just in case. I used a selection of files to made the reduction, and was sure to move them along their length to reduce wear and heat buildup.



It was pretty hard work. I know that stainless is hard, but I had forgotten just how hard! Reducing the width took some time. Eventually I stopped, and used the edge of a file to mark a straight line around the bolt.


I used a 3mm round needle file to make the groove:


As you can see, the groove has wandered off-centre. Its only a couple of millimetres though, and I think I can space it out using washers. I found a couple of M8 halfnuts the other day, and they will do for locking up the bolt in the extruder if the standard height nuts are too big.

Once the groove was of a sufficient depth, I removed the bolt from the drill, and remounted it in the vice with a couple of bearings:


The power drill is only single speed, and way too fast for this operation, so I mounted an M3 tap in a hex-chuck and fitted it to the screwdriver.


I hobbed the bolt by pushing, hard. The bolt really ought to turn under the tap, but I found the tap would rather advance, and I would pull it back to turn the screw. This was hard going, and the tap kept slipping. I adjusted the nut nearest the groove to prevent this.

The end result:


It has a groove and teeth - good enough for me! The stainless is so hard the tap didn't bite very deeply, despite going round several times. This is probably due to my not being able to put enough force on it, and the screwdriver battery giving up near the end!

Just need to see how well it drives feedstock now.

Next up - more electronics.

Chapter 13 - In which I build the electronics, and hopefully make a good job of it

I don't really want to progress any further with the build of the machine until I can move the axes. I need to raise the Z to get the main bed in place, but if I moved it by hand I would have to re-level it afterwards. I thought this was a good opportunity to get the electronics assembled and working.

I had to visit several sources to get everything I needed to build the complete board. I bought the MOSFETs that control the heaters and the reset switches (and some heat-sink compound) from protoPIC - http://proto-pic.co.uk/ .


The resonator, pin headers and stepsticks are from ebay:



I picked up the USB socket, screw terminal, 0.33uF cap and the 4.7uF cap from Maplins:


This is the top of the Sanguiniololu 1.1 board:


And the bottom - this one has the USB to serial chip already fitted:


The processor is an ATmega644P-20PU from farnell:


The remaining components are off-the-shelf from work:


I started the build by fitting the USB components. The 0.1uF capacitors I had chosen were a little bit big, a problem that would recur throughout the build. I used a pair of tweezers to put a bend in the leg to make them fit.


The pin headers I bought were 40 pins long. The build documentation says to use 16 way headers, but the spacing remains constant along the board. I cut the headers down and fitted them.


The male pin header was 40 ways as well, but the spacing was different for these. I fitted the jumpers and cut it down:


I fitted the jumpers, but they are a pain to keep in place as you turn the board over. They are a bit wonky, but functionally they'll be fine.

I also fitted the radial caps and resistors between the pin headers:


I put the resonator in place, but then ran into a problem. My socket has 2 horizontal connectors, rather than the 1 as shown in the build photos. It wouldn't fit correctly, so I took a pair of cutters to it and removed the offending brace.


Remember I said those 0.1uF caps were too big? They presented a bigger problem here. They are supposed to be tiny caps that should just bridge the pins and sit neatly in the socket, but these are just too massive. It took a couple of attempts, but eventually I found a way to make them fit into the socket's footprint:


I fitted most of the remaining capacitors and resistors: (please excuse the solder wire and dodgy photography. Some combination of the lighting and low battery level made some of these shots come out a bit blurry)


Next I fitted the large charge capacitor, the MOSFETS, reset buttons and LED:


I fitted the edge connectors, 5v regulators and remaining components next, and encountered a slight problem - the 0.33uF cap from maplin was an electrolytic (polarised) one, and I hadn't noticed! I studied the layers in the board, and fitted it with the "+" leg on the +12v side - hopefully this is correct!

I then pushed the stepstick pin headers home, and dropped the board over them.


The stepstick boards needed a little work along the ends to make them sit flush, but they eventually all went down:


All done, bar the processor. Dry fitted, the legs are too wide for the socket:


This is rectified by running the chip through a "lead setting tool" (is this the same as the "pillow block" mentioned here?):


All better:


I didn't push the processor home yet, as I wanted to take the installation etc slowly, and only fit it when I start programming. The full build took just short of two and a half hours.

With the board finished, it was time to plug it in. I found a suitable USB lead, and plugged it into Bernard. After a little thought, I was greeted with the following popup:


Windows promptly found and installed the drivers, and then did the same for the "USB serial port" - happy days!

And there I left things - not too bad for a friday afternoon. Next up, some extruder mechanics!

Thursday 25 August 2011

Chapter 12 - In which I finish the X axis, and have a good idea

I wasn't happy with how the X carriage was travelling, and so I loosened off the smooth rods and rotated them (one at a time) until the carriage moved much more freely. I then fitted the belt clamps.


As you can see, the suggested M3 by 25mm screws are very long. In fact the back pair are so long they interfere with the smooth rods, and the carriage binds (this is probably due to how the carriage sits on its bushings). I replaced the rear screws with a pair of 12mm ones taken from the X axis ends (which were too long in the X ends anyway, and were replaced with some M3x6 screws I had found in a draw earlier).

I fitted the X belt in the same orientation as the Y, namely with the teeth facing downwards in the clamps. It was only when I threaded the rest of the belt around the idler and back that I noticed that it was wrong - the teeth should face upwards, and the belt travel above the carriage rather than under it. I reassembled it and tightened everything up. The carriage now moves very smoothly, seemingly with no backlash.


I cut the belt off leaving a little for adjustment later if needed.


And that's as far as I can go today. Next I will build the electronics, but I need a PSU before we have any movement. I can also build the extruder once I get a few more bits delivered.

Whilst in the draw that yielded the earlier M3x6 screws, I also found the solution to the spring problem. I had previously been unable to find a cheap source for the springs needed to tension Wade's idler bearing in the extruder. I found this clothes peg, the spring from which is perfect:


I scoured ebay and picked up a pack of 24 for £2.50 - that's just over 10 pence each, a marked improvement on the £1 or £2 each I had previously seen springs going for.

Next up: Electronics build

Wednesday 24 August 2011

Chapter 11 - In which more gets built, and I spot another potential problem

Encouraged by the progress made on Thursday, I pushed on on Friday. I started by fitting the belt mounting clamps, and the Y axis belt. This turned out to be pretty tricky, and during the fitting and tightening process I had the printer on my knees and upside down at least twice. Eventually I got everything tight and the belts with (hopefully) the right amount of tension in them.


Next it was time to fit the X axis to the vertical rods. I used the bottom plate to hold it horizontal whilst I manoeuvred the bushings into place. I held them in place with blue-tac while the glue dried.



I left the screws on the X rods loose whilst the bushings were gluing, and tightened them up afterwards. Whilst the glue was drying, I made up the Z leadscrew clamps. These are the alternate clamps supplied by Nophead, and require additional M3x20 bolts, nuts and washers.


I screwed them together taking care to make sure they were the right way round.


Once the glue on the bushings was dry, I added the nuts to the axis ends that will hold the leadscrews. The instructions don't make it clear whether the top nut is required if you are not using the springs (which I am not). I fitted it anyway, and will remove it if it causes trouble later.


I screwed the leadscrews home, and was about to fit them to the clamps when I remembered I needed to add the tubing.



This goes around the motor shafts, and helps to eliminate wobble when used with the new clamps. I would recommend fitting it to the motor shafts before fitting the motors, rather than after - it would have been much easier! I had also fitted the motors with screws and washers, and decision that would come back to haunt me a little later.


I fitted the couplers to the motor shafts, and then propped the gantry on a small box so that I could screw the leadscrews into the couplers.


I screwed the leadscrews as far into the coupler as they would go without being forced, and tightened the screws. The coupling feels very solid and secure now it is all done up - I doubt I'll have any trouble with them coming undone or breaking! I removed the box and levelled the gantry.

The next job was some work on the X axis. I fitted the pulley to the motor.


Then I tried to fit the motor to the axis end. However due to some mis-calculation somewhere, I had run out of M3x12 screws. I removed a pair from each of the Z axis motors (I'll replace them later), and used them to fit the X axis motor in place. The "bulkhead" that mounts the motor to the x axis end is thinner than the Y and Z axis mounts, and the screws bottomed out. I added an extra spring washer to each one and tightened them up.


Lastly I snapped the remaining bushings in place and glued the X carriage to them.


Lastly, the problem I mentioned earlier. While mounting the X axis to the leadscrews,  I noticed something was a bit wonky. It looks as if the lower bed plate may have shifted whilst it was re-gluing, and has become wonky. I really don't want to have to do it again, but might have to if it is too bad. I'll wait until I fit the upper bed to see how badly misaligned it is.

Next up: fitting the X belt.