Hello Guest it is April 25, 2019, 06:38:32 AM

Author Topic: Denford Cyclone retrofit  (Read 16969 times)

0 Members and 1 Guest are viewing this topic.

Offline mc

*
  •  381 381
    • View Profile
Re: Denford Cyclone retrofit
« Reply #20 on: October 29, 2013, 09:11:45 AM »
I noticed that earlier when I was comparing prices for a complete package (mostly out of curiousity), and realised that CS mention the IOs for the main modules on the IO module page. The CS has the benefit the main modules have more IO (32In/16Out) on the main modules compared with the Kanalog (only 8In/8Out that are 24V, along with 8 80V relay drivers).
Price wise there's not much between them. To get a Kflop with analog and comparable IOs to just a CS main module, CS is a bit cheaper, but if you then need a threading module, then Dynomotion is cheaper.

Anyway, I got the Click programmed. Then followed by a bit head scratching, and flipping all the logic in the position detection subroutine, the turret spins, locks, then starts spinning again  :-\
I need to run through all the logic that calculates the move direction and number of positions, as if I request position 3, it always moves in reverse, stopping and locking at 1 and 5. I'm hoping it's just something simple in my code.

Offline mc

*
  •  381 381
    • View Profile
Re: Denford Cyclone retrofit
« Reply #21 on: October 30, 2013, 07:04:09 PM »
The turret works!

Found a couple issues in the ladder that were causing the wrong move to be calculated, so fixed them and also added in rungs so it only attempts to move once for each toolchange attempt. I still need to add a couple time outs so the turret can't sit spinning endlessly if something goes wrong, but I'm happy the basics are now working.

I grabbed a quick vid - http://www.flickr.com/photos/mc_mtb/10582127085/

Now onto configuring the KFlop, so it works with Mach, and can talk to the PLC.

Offline mc

*
  •  381 381
    • View Profile
Re: Denford Cyclone retrofit
« Reply #22 on: November 04, 2013, 06:08:05 PM »
Cable trunking hides a multitude of sins :)


Wiring Tidied by mc_mtb, on Flickr

I've started modifying the basic lathe screenset to get a layout I'm happy with, and so it can handle the KFlop, as various buttons need to be changed so they notify the KFlop plugin, and the DROs changed so they read directly from the KFlop.

I'm also working on configuring the KFlop, and trying to decide how the various functions I need are going to be coded. I'm aiming to have the KFlop handle as much of the critical stuff as possible, and then just notify Mach when things havn't worked how they should. Things like halting everything when a Servo faults will be handled directly by the KFlop, along with talking to the PLC, and things like stopping when the door gets opened.

Offline mc

*
  •  381 381
    • View Profile
Re: Denford Cyclone retrofit
« Reply #23 on: November 05, 2013, 04:20:34 PM »
After some input from Tom at Dynomotion, I've started on the KFlop initialisation code, and one thing he mentioned was for spindle feedback, KFlop has to receive full A & B quadrature input.

So I dug the oscilloscope out tonight, and after some probing, it turns out for the British Encoders encoder that Denford originally specced, British Encoders simply cut the B wires where they enter the encoder housing and never soldered them onto the encoder board. I've probed the board, and the signals are there, so it'll just be a case of figuring out what is the high and low (just need to find a datasheet for the differential driver chip as the tracks from the chip to the holes are nice and visible), and solder in the extra couple of wires, then we'll be good to go :)

Offline mc

*
  •  381 381
    • View Profile
Re: Denford Cyclone retrofit
« Reply #24 on: November 07, 2013, 05:32:25 PM »
I now have a fully functional spindle encoder, after soldering in a couple extra wires, so the KFlop channel it's connected to actually increases and decreases when the spindle is moved.

Mach has now also been introduced to the loop.
Setting up the KFlop for basic use is actually pretty easy, and the instructions on the Dynomotion website cover the basics pretty well. The hardest part is setting up all the output values, as it's a bit more involved than doing it in Mach alone. First you need to configure and tune the motors using the KMotion software, then copy those settings into an initialisation file that gets loaded when you hit Reset in Mach. You then need to configure the motor tuning in Mach.

One thing I discovered, is the lower settings in either the KFlop or Mach will take precedence. Provided Mach is set slower, it's not an issue, however if the KFlop settings are slower than those in Mach, the Mach DROs will show the motion as complete, even though the KFlop is still processing the motion. On single moves, that's not an issue, however during programmes it would eventually cause the motion planner to overflow, so it's something to be aware of.

Now I've got the basics sorted, the next couple steps will be modifying the Mach lathe screen to add LEDs for the servo ready/fault signals, and also adding the KFlop code to handle servo faults/estop activation.

Offline mc

*
  •  381 381
    • View Profile
Re: Denford Cyclone retrofit
« Reply #25 on: November 16, 2013, 07:24:03 PM »
Things are now progressing, after a few issues that took longer that I'd hoped to solve.

The major headache of the past week has been getting the KFlop to talk to the PLC using modbus, and retrieve the information I needed.
First up the Kanalog port is numbered backwards, so what should of needed a straight through cable, actually needed a crossover cable. Once this was realised, I just had to cut the cable and crimp on a new RJ connector, and the sample script provided with the KMotion software burst into life and worked flawlessly.
Then there was the case of figuring out how to read and write to the correct Holding Registers within the PLC, which I only figured out after sitting and going through the Address Picker within the Click software to figure out exactly the sample script was working, and realising you can access the inputs and outputs using two different methods.
Once I'd managed to get past those issues, I managed to get the KFlop reading the current tool position, and writing a new commanded tool position.

The spindle is now setup as a closed loop servo (albeit a very slow reacting one due to still being VFD controlled), so the set speed is highly accurate.
I did have an issue with the spindle reversing direction whenever a new speed was set with it already running, which Tom at Dynomotion explained was due to Mach not issuing a direction command to the plugin on a speed change, so he quickly sent me a modified sample script that stored the previous direction command.

I've also got the homing routines working, so they use the proximity switches followed by the servo index.


I'm now working on getting everything working together,, and getting it all combined into the one initialisation file that gets loaded via Mach.
I've so far got most of the code done for the KFlop monitoring, where an E-Stop has to be activated. For this I've essentially got two levels of E-Stop. First there is the physical circuit that triggers when a limit or an e-stop button is activated, and second there is the monitored circuit for things like a servo fault (the servos are connected and configured to do a fast stop if any fault) or tool changer issue, where the KFlop will stop things and notify Mach.
As Mach can only accept one E-Stop input, all E-Stop control is ultimately mapped to a single virtual bit within the KFlop, that Mach monitors just like a normal input pin.

Next up is the tool changer, which will require several parts. First up the macro within Mach needs to notify and transfer the requested position to the KFlop, then the KFlop has to transfer that position to the PLC, followed by the Tool Change allowed output being activated, then once the TC Ok input is activated again, I need to read the position back into Mach. I don't really need to read the position back into Mach, but I can use it to avoid commanding a tool change when one isn't actually needed.

Offline Hood

*
  •  25,785 25,785
  • Carnoustie, Scotland
    • View Profile
Re: Denford Cyclone retrofit
« Reply #26 on: November 17, 2013, 04:43:51 PM »
Sounds like a lot of work to get things set up but it should be worth it in the end :)
Hood

Offline mc

*
  •  381 381
    • View Profile
Re: Denford Cyclone retrofit
« Reply #27 on: November 17, 2013, 06:03:28 PM »
It is, but that's probably more to do with lots of things being new to me, and this isn't exactly a simple build.
For example if the Konnect board had been available a month or so earlier, then I could of avoided the pain of adding a PLC and modbus to the mix, and all the coding could of been done directly in the KFlop.

If you were just going for a simple machine using step/dir, then setting up the KFlop isn't much more involved than anything else as you can access all the in/out via ports and pins. Just use the standard init.c file, and you're pretty much good to go.

Although having said that, I'm probably still going to use a PLC for the tool changer on the Matchmaker, as I don't fancy running 30+ wires from the tool changer cabinet around to the main cabinet! Just a few wires for power and modbus seems much more appealing...

Offline Hood

*
  •  25,785 25,785
  • Carnoustie, Scotland
    • View Profile
Re: Denford Cyclone retrofit
« Reply #28 on: November 18, 2013, 02:56:35 AM »
Although having said that, I'm probably still going to use a PLC for the tool changer on the Matchmaker, as I don't fancy running 30+ wires from the tool changer cabinet around to the main cabinet! Just a few wires for power and modbus seems much more appealing...

That is one thing I like about the CS-Lab modules, they connect together via CANBus. I have the MPG unit and an extra I/O unit in the control panel of the Chiron which allows me to connect all my switches and MPG etc with short wires and then all I have to do is run a CANbus cable back to the main electrical cabinet.
Hood

Offline mc

*
  •  381 381
    • View Profile
Re: Denford Cyclone retrofit
« Reply #29 on: November 18, 2013, 11:33:17 AM »
The issue is a KFlop+Kanalog+Konnect work out about £250 cheaper than a CSMIO/IP-A+MPG+ENC+IO(x2), assuming all the tool changer requirements could be handled by a single CS-IO. That £250 can buy a couple PLCs, and several expansion modules. I won't make any decisions until I've got a full IO requirement list done for the tool changer.

Anyway, getting back on topic, I've got a new screen, macropump and some new KFlop code to go test.