Saturday, 7 April 2007

... like a bride's nightie!

The z-axis was advertised as accepting a NEMA23 dimension motor without any adapter flanges. The motors that I have are more than 10 years old and I don't have any data on them so I don't know if they are true NEMA23 or not but they weren't quite compatible in two ways. The shaft exits from the wrong end and the holes are tapped M4 but the holes in the frame are also tapped M4 and blind. I resolved this by mounting it upside down on some aluminium pillars that were nearly the right length. I had to turn them down in the lathe, drill them and tap them to insert M4 bolts with the heads cut off. The result was very solid because the pillars exactly fit the semi-cylindrical recesses of the motor.



I used a flexible coupler, shown above, to join the motor shaft to the drive screw. This allows for slight misalignment. A cheap alternative can be made from plastic or rubber tubing and pipe clips but I had a couple in my junk collection so I used one. This may have been a mistake because the z-axis is very noisy when it is running. This is made worse by the fact that it is mounted on an MDF box structure which resonates. A softer coupling may help here. Another idea I had was to fill the box with something to dampen the sound, fine sand perhaps, I am open to suggestions.

BTW, if anybody is interested, there were more of these axes available here when I last looked.

The z-axis only needs to move relatively slowly so I used a simple unipolar drive circuit based on a ULN2803 octal darlington driver chip. I paired up the channels to get enough current because with only 3.3V inputs they are derated somewhat. The 2803 has internal clamping diodes to protect it from the back e.m.f. generated when a winding is turned off. Rather than tie these to a zener off the positive rail, like the RepRap version does, I clamped the outputs to ground with some external diodes. This makes use of the fact that each centre-tapped winding behaves like an auto transformer, so if you stop one end going below zero you stop the other end going above twice the supply rail, in my case 48V. This technique has the advantage of returning the energy in the coil to the supply rail, rather than dissipating it in the zener. It has the slight disadvantage that if you disconnect the motor while the power is on you risk damaging the driver. I used fast recovery rectifiers salvaged from the same broken PC power supply I mentioned before. These will perform better than ordinary rectifiers if I do any high frequency PWM for micro stepping.

The motor got quite hot when it has been on a while, leveling off at about 60°C. It is, after all, dissipating about 19W. While I didn't think this was a big problem I decided to stick a spare CPU heatsink and fan on the top. I ran this from 5V rather than 12V to keep the noise down. It reduces the temperature to about 40°C. With a constant voltage drive, keeping the temperature down stops the torque falling off due to increased winding resistance.



The next step is to write some code and test the axes.

Friday, 6 April 2007

Bundle of nerves

The wiring is fairly straightforward. The power rails are 24/0.2 and the sensors are connected with multi-core 7/0.1 screened cable salvaged from a mouse's tail. The rest of the connections are 7/0.2. The manual for the MDM7 stepper motor controllers recommends using screened cable for the motor connections because they are switching at hundreds of kHz. I couldn't find any that would handle the current so I used twisted pairs which are the next best thing. I made these by twisting two pieces of 7/0.2 write with a drill and then put them inside plastic tubing to protect them.

I recycled a mains inlet and switch from a broken PC power supply.



I also got a 0.2 inch 2 pin connector from it for the 24V feed to my I/O board. The rest of the I/O connections are 0.1 inch headers.

Again, I had all these parts lying about for years so my wife is pleased that I am starting to use up some of the "junk". The only things I have had to buy so far are the axes, wood and three 9 way D type connectors.

Thursday, 5 April 2007

Brain Box

The RepRap machine uses a network of Microchip PICs plus a comms board to control the axes and the extruder(s). The controller boards are multi-purpose so this gives a flexible scheme for experimenting and extending the machine. This topology does not make so much sense for HydraRaptor because I have invested in a set of professional quality axes which I hope to be using in a stable configuration for a long time. Using three controller boards plus a comms board to drive these is a bit over the top.

Instead I have chosen to use a demo board that I had lying around to control all three axes. This is a DEMO9S12NE64 from Freescale Semiconductor. It has an on-chip Ethernet controller and a good array of analog and digital I/O ports plus serial ports, timers, etc. It comes with a free TCP/IP stack and a CodeWarrior IDE, C compiler and debugger.



I bought this a couple of years ago from Digikey to acquaint myself with Ethernet and TCP/IP but had not really done anything with it. Strangely, although the chip has masses of I/O, only a subset of this is available at the connector and some of these lines are also connected to the on-board switches and LEDs. Annoyingly the C compiler has a 12K code limit but that should not be a problem for this project. The IDE and debugger are not the best I have used and I have seen the compiler produce some terrible code. There is no excuse for this as the instruction set of the 9S12 is fully featured and well suited to C, unlike say the PICs. Sadly most C compilers I see these days produce worse code than one I used 20 years ago.

It comes with a preloaded monitor program which allows code to be loaded into on-chip flash via a serial port and then debugged at the source or register level with breakpoints and single stepping, etc. All in all the dev kit is not too bad, certainly nicer than the Microchip stuff.

I will use Ethernet to link my machine to the PC as that gives me complete freedom where I locate it. There is enough I/O to drive an extruder as well as the axes. I may well do that initially, but eventually I will use one of its serial ports to drive a network of head controllers.

One snag of using the demo board is that it is 3.3V volt logic. My XY table uses 5V logic so I had to do some level translation and that is most of what the veroboard underneath is about. The outgoing signals to the opto inputs of the stepper controllers are driven by a 7407 open collector buffer. The proper way to handle the incoming signals would be to use a level translating buffer chip but I didn't have any to hand and I suspect they are not available in leaded packages as most 3.3V stuff is surface mount. Instead I buffered them with a 74LS244 and then used potential dividers to drop the voltage. If I had not buffered first I would have reduced the noise immunity in the long leads around the machine which would not be good. This way it is only the noise immunity across the board that is slightly compromised.

Other things on the board are the z-axis driver and a 2A switching regulator which steps down the 24V to 5V to drive the level changing logic. This is actually an L5973 evaluation board from ST. Doing this with a linear reg would waste a lot of power and need a big heat sink. The DEMO9S12NE64 comes with its own 6V mains PSU but I found it works fine fed from 5V as well.

I wired the board using the Verowire system, see en.wikipedia.org/wiki/Wiring_pencil.



This is quite a quick way to produce high density prototype boards but it is a bit fiddly and requires a lot of concentration. It is not easy to make changes afterwards either.

In summary I was able to cobble together the control system from bits I already had.