Monday 7 December 2015

A start on the controller


CNC Electronics 

While waiting for the castings I got a welcome break from routing cutters and MDF and standing about watching machine tools, and assembled the controller PC and Mesa cards. 


This is a DN2800 Mini-ITX motherboard that I already had (and might end up swapping). It has the advantage of being very thin, and running off of a singe 12V supply. It has the disadvantage of having wierd graphics that Linux struggles with. I eventually managed to hack together an Xorg.conf file to force it to use the native resolution of my monitor. 
Also mounted on the same aluminium base-board are a Mesa 6i24 FPGA card (PCIe mounted on a riser over the motherbaord, then a 7i49 6-channel resolver board. At the top is a 7i84 smart-serial GPIO board and hiding under that is the 7i44 8 channel smart-serial breakout. Not shown are the two 8i20 servo drives and the 7i73 remote GPIO unit. 


This photo shows how much smaller electronics is now than in 1968. You can fit an entire Microcomputer and CNC contoller in the space vacated by a single 1960s rectifier!

What there isn't quite space for in the electronics cabinet is the DC power supply and the servo drive boards. I decided to put them both in a case at the back of the spindle, where the feed motor currently fits. 

The 8i20 motor drives need a DC supply of up to 400V. I am just rectifying 240V mains into a capacitor for this. The feed to this PSU probably ought to be through an isolation transformer, though I have been running the milling machine this way with no problems as yet. 

In the case of the milling machine PSU I have a soft-start in the form of a power resistor that is in series with the incoming mains. After a fixed time (controlled by a 555 timer) a relay closes that bypasses this resistor. The reason for this is simply that putting a 6600uF capacitor across the mains without a surge limiter pops the RCD every time. 

The Mill PSU also has a discharge resistor that is brought in by a second NC relay when power to the PSU goes off. Otherwise lethal voltages can hang around in the PSU indefinitely. 
Unfortunately this relay / resistor combination means that the PSU can not be turned back on again until the caps are discharged, as doing so leads to the relay trying to break up to 300V DC, and they can't do that. I found this failure mode the exciting way by double-tapping the touchscreen. The crowbar relay welded shut leaving the resistor across the 300V supply permanently. As it was only a 100W resistor, and it was being asked to dissipate 900W, it wasn't long before it failed explosively:



I added a delay before restart in HAL on the Mill to prevent this happening again. 

However... In the case of the lathe I have a better idea. The Mesa 8i20 drives report bus voltage back to HAL. So I can let LinuxCNC HAL actively control the PSU. Hal can turn the PSU on, watch the bus voltage rise, and then bypass the surge resistor when the voltage tops out, then enable the drives and LinuxCNC. It can also time-out if this takes too long (say, if the crowbar relay is welded shut)
Also, it can refuse to allow the PSU to be re-energised until the bus voltage is less than a few volts, to protect against the relay welding issue. 

I also decided to put the drives in the same box as the PSU. 

The first box I got from eBay was very nice indeed. But turned out to be much too small. So I bought a different box which isn't quite as nice, but still nice enough. And is nearly big enough. 



The 8i20 drives also report back card temperature. I will be keeping an eye on that, there isn't much air circulation space. However the 8i20 drives on the milling machine seem to run pretty cool, so I am fairly sanguine. 

Despite appearances the lid does actually fit on. 



The left-side RJ45 socket is for the 8i20 enable and fault lines, and the two relay-control signals. The other two are the smart-serial links for the 8i20 drives. The blue connector is a Neutrik PowerCON main-inlet connector, being used for the specified job. The other two connectors are Neutrik 4-pole speaker connectors being used for a very different job to their designated use, but they are rated 20A 400V, so work rather well for 3-phase motor connections. 

Motors

I have been acquiring motors whenever one was particularly cheap on eBay. 
For the Z drive I am going to use a 1kW Reliance motor. This has a resolver for feedback (I like resolvers) and some really odd ball-retainer quick-release connectors. 


I couldn't actually find the mating connectors, and my experience has been that if I did find them then I would not want to afford them. So I swapped the power connector for a metal Neutrik Speakon, the resolver for a 6-pin Lemo and the thermistor for a 2-pin Lemo. I found the Lemo connectors in a skip, 48 of them!




On eBay I found some really nice encoder/resolver drag-chain cable. Unfortunately in Austria, and a vendor who would not ship to the UK. But he would ship to German, so I arranged for a German friend to buy it. Some weeks later I arranged a trip to Munich to meet up with her and retrieve the cable. 


It is a rather fancy cable, with 3 x individually screened pairs, 4 x small wires and 2 x larger wires. It is very nice, but is also rather too thick for the 1B Lemos from the skip, so I bought a cheap 2B pair from eBay, and did a swap. 


I confess that wiring that plug was not the most fun that I have ever had. Partly because I was soldering into crimp terminals and the slightest hint of solder on the outside meant that the terminals did not fit in the housing. The plug works, but I know it is scruffy inside. I have enough terminals to re-wire, so I will. 
I have a crimp-tool on order, and have found a terminal extractor I can borrow. 

The other motor is a 600W one with a brake and a serial absolute encoder that I broke trying to figure out how it worked. This was unfortunate, but I my eBay habit had also left me with a homeless resolver. 
So, I performed the rather unusual step of taking an encoder off of a motor and fitting a resolver in its place. 

The motor with the brake was rather longer than necessary. So I decided to delete the brake and shorten the motor.

First, the motor apart:



Then I wrapped the rotor in tape to try to make it possible to clean the swarf off and re-machined it. The drawing underneath shows before-and-after sizes. 


Then I machined down the brake housing. 


And put it all back together again. With a couple more Lemos 


Once again, the green wire won't fit the 1B size Lemo, so I have another 2B size pair on order. 



I have had the big motor spinning under LinuxCNC control, but not the small one yet. It turns out that the larger motor is a 4-pole with a x2 resolver, and that the resolver is aligned to motor zero in the same way as Mesa define motor zero. This means that the resolver angle can connect directly to the drive angle in HAL, and the motor works perfectly. ie, for those who are used to this:
net angle hm2_5i24.0.resolver.00.angle => hm2_8i20.0003.angle (using the little-known use_serial_numbers Hostmot2 modparam). 

The smaller motor will not be as simple, that has an unknown pole count and a resolver attached at random. But the bldc HAL component can deal with that. 








5 comments:

  1. Great mechanical work as always, but some electrical friends are going to need to have an intervention so they can let you know how much you're hurting them by using a big spool of red wire to wire your entire electrical panel. White is neutral, black is hot (high voltage AC) and red is a second AC phase if needed. Blue is low voltage DC for control signals. That makes everything nice and safe and easy to troubleshoot later.

    Also, I'm not a fan of a HAL software delay to prevent an electrical fire.

    :-)

    ReplyDelete
    Replies
    1. I am awaiting delivery of a force-guided safety relay to augment the HAL based fire prevention.

      Delete
  2. The wiring in the lathe is all original, and was all red.
    However, the black=live white=neutral thing is US only. In the UK it was always black neutral, red live for single phase or red/yellow/blue for three phase. Then we harmonised with the EU and it is now brown=live, blue=neutral for single phase and brown / black / grey for 3-phase. So, the EU harmonisation mean that Blue can be phase or neutral, black can be phase or neutral, but at least brown is always live.

    ReplyDelete
  3. I'd be amazed if you hadn't come across them - but for replacement motor/encoder cables I can't recommend Igus highly enough - they'll make up pretty much any motor cable you can imagine, and for the more common connectors will put one or both connectors on. All designed with cable chain in mind funnily enough.

    Switching from CY cable properly twisted and shielded cable from the signal interpolater to the mesa card on my mill (about a 100mm run) made the difference between seeking 0.5mm and being... pretty much bob on

    ReplyDelete
    Replies
    1. After getting http://www.amazon.co.uk/gp/product/B007G5QBDC suddenly wiring Lemo cables is no trouble at all. And at the moment the resolvers are dithering around 1.0000 and 1.0006 mm with the final scales put in. Time will tell what that is like in an electrically noisy environment, but that's with the full 30m reel of cable between the ends.
      If I went to Igus I would need to know what I wanted, and I haven't decided yet :-)

      Delete