New motor control unit

 I've been busy on a couple of things. First off has been painting the new machine and generally finishing things off (I hate paint!). While I waited for the paint to dry I gave some thought to what steppers to use. I really wanted to use some of the higher current motors to get higher speeds. But the controller I got with my 3 Axis machine wasn't really up to the job. Also this was the only part left from the original machine. So out with the PCB design software (Eagle) and a couple of days later I had artwork. I was going to mill the board but I had a real job fitting things into the board area of the free version of Eagle, so I've ended up with lots of traces between pads. I didn't fancy trying to mill that, so out with the chemicals - oh well!

The picture above shows the PCB layout. I created the layout as a double sided board but minimized the traces on the upper side. As you can see it was a little tight and some of the traces are longer than I would have liked but it seems to be ok. When I etched the board I only etched the bottom side and wired the upper side traces by hand. You can see these connections below.

Anyway here it is. Basically it is a bipolar chopper based board (using a ST L6219 stepper driver per motor). It has a PIC 16F877 on board to do all of the actual driving has three channels, inputs for limit switches and emergency stop and has 3 Leds and buzzer. the control commands are provided by a serial port operating at 56K baud.

The power supply I'm using comes from a high end audio amplifier which provides -40V..0..+40V with lots of amps and good smoothing. It also provides +24v and (after reworking an adjustable regulator) +5V. I'm also reusing the case and connectors. Initial testing showed that the heatsinks get hot when running at 40V so I've used the +24V supply to provide fan cooling. 

The above picture shows the controller mounted in the amplifier case. The fan keeps things nice and cool. I've also used the phono connections as connectors for the motors and limit switches. Everything seems to work well so far.

I've replaced the rotary volume control and selector switches with LEDs I need to make a new front panel strip at some point.

Firmware

I had originally intended to make the PIC controller accept simple movement commands (like goto X, Y, Z) and to do the move generation with the microprocessor. In fact the first few versions did exactly that. However after working with the system for a while I decided that having some form of command blending to give smooth motion when using lots of small movements (like approximating a circle with a lot of short lines), gives much better performance. Unfortunately the PIC really isn't fast enough (and does not have enough ram) to do this and handle the pulse generation so a new approach was needed. 

After much thought and experiment I decided to make the PIC simply act as a pulse generator with all of the the actual move generation being performed by the PC. So the PC simply sends a series of velocity vectors to the control unit and the PIC generates the step pulses for the three stepper controllers. I'm currently using a system of sending 1000 velocity vectors every second using a byte for each of the X, Y , Z components. The microcontroller reads these from the serial port buffers them (I have an 80 command buffer) and generates the step sequence. I use a 1/4 step microstep sequence (The best you can do with the 6219) and can generate up to 50 steps every millisecond giving an overall max step frequency of 50KHz. With 200 step per revolution steppers this gives a top speed of  62.5 rev/s or 3750rpm. With the motors and machine I have I don't get close to this, typically running at a max speed of  60ipm which works out to be 1219rpm or about 16KHz.

The picture above shows the controller under development. The unit attached by a ribbon cable is a Microchip MPLAB ICE 2000 an in circuit emulator for the PIC. This thing is not cheap but it makes developing for the PIC much easier and is great when working on tricky timing problems. 

In addition to the pulse generation the microprocessor also monitors limit switches and an emergency stop button. It also drives the front panel display.

Above the unit is in action driving the Z axis. All of the control software is written in C using the CCS compiler. You can see that I moved the cooling fan to provide better airflow over the driver chips.

Above is the front panel display when driving both the X an Y steppers. I made the X, Y, Z logo plates from Perspex on the machine and they push fit into the the locations of the controls on the old amplifier. The intensity of the LED is proportional to the speed at which the stepper is being driven.

 

Copyright 1998-2011 Andy Shaw