Today I got the whole motion control chain from EMC2 on the pc through the Mesa m5i20 servo-card, homemade optoisolator card (far right), PWM to analog filter (small board on the right), servodrive (middle), powerstage (middle left, with heatsink), through to the motor (left, a Sanyo P5 1kW servo) working !

This is truly Open Source cnc: EMC is obviously an OpenSource project, but also the FPGA configuration on the m5i20 is published under the GPL, and my servodrive code will be available when it fully works.

The picture might seem messy with a whole lot of wires - but I can assure you that it's all very organized... :)

 

I actually got the servodrive working, in the sense that it was spinning the motor, a few weeks ago but did not have time to blog about it then.

Here is the setup from 28. May. Motor in the foreground, then servodrive, then powerstage which at that point did not have the heatsink+fan. The logic +5V and the +15V that the powerstage logic requires is taken from the fixed outputs of the lower powersupply. The upper powersupply powers the motor, it only goes to 50V so I am not reaching full rpm or power, but this is enough for testing. No-load current drain seems to be as low as 0.2 A for the 1 kW motor.

Â

Â

Â

Â

Â

Â

Â

Â

Now let's take a look at the boards in the chain from the top picture:


This is an optoisolator card for the 50-pin ribbon cable from the m5i20 pci-card. It has 12 HCPL2630 two-channel optoisolators, six configured for the outputs, and six for the inputs. This connector from the m5i20 has the motion control signals, so for each axis there is an encoder input (A, B, Index) and a DAC output (PWM and DIR). There's also an amp-enable signal for each axis. If you look closely you can see that I forgot the decoupling capacitors (100nF ceramics between Vcc and ground), so I had to solder them directly to the IC legs... well it's supposed to have a home-made feel to it anyway !


This small test-board filters the PWM output from the m5i20 to an analog voltage between 0 and 5 V which will be used as a speed command for the servodrive. It's a two-pole VCVS filter with a designed -3 dB frequency of 5 kHz and uses a TL071 op-amp (copied the design from Horowitz & Hill). I will need four of these for the mill. A bit of a hassle is created by the fact that the op-amp needs bipolar supply voltages, in the test setup I used +/- 12 V.

The informed reader will at this stage note that it is somewhat dubious to first have a digital servodrive card that outputs 0 or 5 V digital signals, then output a speed command using PWM with this card, filter it to smooth it out into an analog voltage, and finally digitize it in the servodrive back to a digital number.
A smart way would be to use some kind of fast serial digital protocol between the m5i20 and the servodrive to directly transfer a precise digital speed command to the servodrive. However life is short and at this stage I don't feel like I have the time and energy to learn how to program the FPGA, come up with a good protocol, program the dsPIC to receive this protocol, and finally test, debug, and re-test the implementation. So an analog voltage command will have to do for now. I'm hoping it will not degrade the overall performance of the servo system noticeably. If anyone has any comments on this I'd be glad to hear them!


Then comes the servodrive itself. I chose the Microchip dsPIC30F3011 because I had some previous experience with PICs, and the dsPIC included encoder and pwm-generator peripherals on-board. Differential encoder and hall signals come in at the left. They are filtered and converted to single-ended signals by two DS3486 ICs (Quad RS-422/423 Line receiver) and then fed to the dsPIC. Otherwise there is very little interesting on this board. A regulator at the top provides +5 V, LEDs in the middle (Encoder at top, status in the middle, Hall at the bottom) show the inputs to the drive, and LEDs at the right (45 deg row) show the PWM output signals. I program the dsPIC with an ICD2 through the modular jack in the right bottom corner.


Finally the powerstage. This is an International Rectifier IRAMS10UP60B. I've mounted a heatsink and a fan, probably meant for a P4 processor, which means I can run the drive as long as I want without overheating the powerstage - at least for now when there is no load on the motor. At the top there was a place for current sensing amplifiers (the black big cylinders are current sense resistors), but now I think it makes it unneccessarily complex to have current sensing in the servodrive so I am probably going to omit that in the next version.


The IRAMS powerstage requires very few components around it to work. Click the schematic for a pdf file.


Another thing I've been hooking up to the m5i20 is a jog-pendant. It will feature a jog-wheel (left bottom. Micronor 100ppr from ebay), one three position rotary switch (left middle) for selecting the jog-increment 0.1/0.01/0.001 mm, and one six position rotary switch (left top) for selecting jogwheel function (X/Y/Z/FO/RPM/?). There will also be push-buttons for speed-hold, program step, spindle on/off, and coolant on/off. The jog-pendant is connected through another 50-pin cable to the m5i20, again optoisolated (rightmost card), and to reduce the number of IO pins I've decoded the differential signals from the jogwheen with a DS3486 to single-ended signals, and I've encoded the state of the six-position rotary switch into a three-bit value with a 74HC148 (8to3-line priority encoder).

Â

Update 2006 June 14:Â

Mk 2 has just passed the obligatory blinking-LED test:


Mk2 integrates the powerstage and microprocessor one one 'long-eurocard' (i.e. 100x220mm pcb). I've also included the pwm to analog filter, and I got a bit scared by the amount of noise the powerstage generated - so the powerstage is now optoisolated (division-line at the right). The board is now populated with the bare minimum that the dsPIC needs: a Crystal with two small caps(center left), a pullup resistor for MCLEAR (top), and a decoupling cap for Vcc (top). The ICSP programming socket is the grey thing below/left of the dsPIC.