Machsupport Forum

Mach Discussion => General Mach Discussion => Topic started by: rrc1962 on November 26, 2010, 12:30:50 PM

Title: PLC With Analog Input
Post by: rrc1962 on November 26, 2010, 12:30:50 PM
If I had a PLC (DirectAutomation DL-05) with analog input capability of 0-10VDC, could I monitor that voltage in Mach using a brain?  My thought is to use this device as a THC and Monitor the voltage coming in on the PLC from the voltage divider.  Compare that voltage to a set voltage and trigger the THC up and down outputs as needed.  Could this be done?

There would also be some anti-dive logic involved.  Something like...If actual voltage exceeds set voltage by say 10%, suspend Z movement until voltage comes within range.  Could a brain do this as well?

TIA
Title: Re: PLC With Analog Input
Post by: Hood on November 26, 2010, 02:12:13 PM
I use  brains with the current type analogue inputs for FRO and SRO pots but voltage type can also be used as its the same data that gets sent to Mach no matter which type of analogue input you use.

I compare the inputs and if below or higher than a set value it writes to the FRO and SRO override DROs, if between two values then it sets the DROs to 100% So its kind of like what you are asking so could probably be done although I dont really know anything about THC so cant say for sure.
Hood
Title: Re: PLC With Analog Input
Post by: BR549 on November 26, 2010, 02:25:10 PM
A brain can do it , BUT at 10 reads per sec it may be too slow to work at a usefull feedrate(;-).

Just depends, (;-) TP
Title: Re: PLC With Analog Input
Post by: rrc1962 on November 26, 2010, 04:00:20 PM
Would it be better to do the programming inside the PLC and have the PLC trigger the THC up and down?  I'm assuming the PLC has that programming capability.

The other hurdle is building a usable voltage divider.  I know the basic concept and can breadboard a simple two resistor device that works on a clean power supply, but not sure if that will work on a plasma power supply.  I suspect tip voltage is rather "noisy".  We have one power supply with an automation interface and one without.  Currently using a sound logic THC on that one, which works, but I need to add a PLC anyway for more inputs, so I'm trying to integrate the THC into that as well.
Title: Re: PLC With Analog Input
Post by: rrc1962 on November 26, 2010, 04:04:01 PM
For you guys that know brains inside and out, I had another brains questions.  Please take a look at this thread.

http://www.machsupport.com/forum/index.php/topic,16622.0.html

TIA
Title: Re: PLC With Analog Input
Post by: rrc1962 on November 26, 2010, 04:44:43 PM
Additionally, what would you guys recommend for a PLC.  I'm thinking the DL05 (Model D0-05DR)...

http://www.automationdirect.com/adc/Overview/Catalog/Programmable_Controllers/DirectLogic_Series_PLCs_%28Micro_to_Small,_Brick_-a-_Modular%29/DirectLogic_05_%28Micro_Brick_PLC%29/PLC_Units

And F0-04AD-2 add-on module for analog input. 

http://www.automationdirect.com/adc/Overview/Catalog/Programmable_Controllers/DirectLogic_Series_PLCs_%28Micro_to_Small,_Brick_-a-_Modular%29/DirectLogic_05_%28Micro_Brick_PLC%29/Analog_I-z-O

This my first time with PLC's, so I'm shooting in the dark as far as what I need.  Basically, I want the ability to input a few remote switches plus the analog input for a THC.  Near as I can tell, the above will do that, but if I'm headed down the wrong road, please set me straight.

Thanks
Title: Re: PLC With Analog Input
Post by: Hood on November 26, 2010, 05:25:38 PM
I use the D0-06DR, its more expandable than the 05 so might be a better choice for the future. As said earlier I use the current type analogue inputs but I do have the voltage type and it works fine, so no problems there.

As for programming in the PLC then yes you should manage that, not sure the difference between the 05 and 06 but maybe better check up as I know there are a few things not available in the 05's programming capabilities compared to the 06.

Hood
Title: Re: PLC With Analog Input
Post by: BR549 on November 26, 2010, 06:59:50 PM
THC's are a very specific critter. I would suggest you get a dedicated THC.

(;-) TP
Title: Re: PLC With Analog Input
Post by: rrc1962 on November 26, 2010, 07:16:43 PM
Thanks guys.  I have a Sound Logic on the automation machine, which also works well on the manual machine.  I don't desperately need another THC but thought that I'd take the opportunity to try and find a better way.  I kind of like the idea of programming all of the THC code into the PLC...If it works.  PLC's are not terribly expensive, so it won't cost much to try.  I think the biggest hurdle is making a voltage divider than delivers a clean and relatively stable voltage.

Hood...Will the D0-06DR accept an analog input without using an add-on I/O module?
Title: Re: PLC With Analog Input
Post by: Hood on November 26, 2010, 07:20:37 PM

Hood...Will the D0-06DR accept an analog input without using an add-on I/O module?

No.
Title: Re: PLC With Analog Input
Post by: rrc1962 on November 26, 2010, 07:36:05 PM
Looks like the 05 is not capable of floating point math.  I think I'll need that.  Looks like the 06 is it.
Title: Re: PLC With Analog Input
Post by: poppabear on November 28, 2010, 10:30:14 AM
Yes, you can use a DL06 Plus an analog module to do THC.

   In the DL06 you can use "PID Loops" to handle your Z hiegth drive, if your Z hiegth is driven up/down by an analog motor control then I recommend you get a Analog module with both input and output capability. I use the 4/2 cards, (4 in, 2 out), they are around 200+ dollars. If your Z uses a Stepper
motor drive, then you will need to have the Analog input card (like the one you have), plus the CTRIO (hs counter card), it is capable of driving a Stepper
motor at a faster response time but it is around 200+ dollars also........ another option is you can use the built in Stepper pulse out in the DL06, but its step rate is slower than the HS module.......

   In your PLC, you can set up in the PID, an upper and lower MAX range, (for your maximum down amount for instance), and for anti-dive, the easiest to do is
set up a timer so that if your movement amount is suddenly MORE than 10% of your set point (or what ever % you want to say, since most sheet shouldn't be that warped...... hopefully........), then it will not dive more than 10% for *********x number of micro seconds, this will allow you to cross cut lines or small gaps, depending on what you set your timer too. So, when it crosses a cut line, it will wait for *********x seconds if it still says, go more than 10% it would then Go to what ever your MAX Lower end of your PID loop would stop it at........ which would be some minimal distance above your sheet so as to not crush your tip.

scott
Title: Re: PLC With Analog Input
Post by: rrc1962 on November 28, 2010, 11:08:21 AM
Thanks Scott.  That about the logic I had in mind.  I hadn't considered using analog out to a DC motor drive.  The Z still has to be able to be driven by Mach for manual UP/Down jogging and initial height sensing, but that would probably be possible through the modbus link.  My plan was to use a stepper, and use the outputs on the PLC to drive the THC Up and Down inputs in Mach, but after reading your post, I'm thinking the CTRIO may provide a faster pulse rate and better response time for cutting irregular surfaces like corrugated metal.

Do you think the CTRIO would be considerably faster than just driving the THC UP/DOWN mach inputs? Not sure what the max pulse rate is on the PLC outputs.

You mentioned the built in stepper pulse out.  Do you think this would be faster than driving the THC UP/DOWN inputs?
Title: Re: PLC With Analog Input
Post by: poppabear on November 28, 2010, 04:37:46 PM
CTRIO if MUCH faster than the built in pulse gen in the native PLC, faster than machs lower PP engine settings but mach can outrun it at faster settings.
just so you know, you can jog up/down for initial and other stuff with JUST the PLC also if you want, analog can be driven by external buttons or from screen buttons across the modbus......  it is just a matter of getting it into your rungs.

Just a side note: there is price, then there is price.......  I can beat Toms price on a THC by using a ADC PLC.... but not a HUGH gap in price point. He offers
an excellant, well thought out, integrated system....  If I do my PLC and it malfuncitons what ever, I get to do the Tech support, but if you buy his, then
HE eats the tech support, warrenty, etc.........   so, when you buy Toms stuff, his price includes your future headaches (to an extent).
There is a time/learning/debugging curve involved with setting up a ADC PLC, ESPECIALLY the CTRIO module if you use it for motion, it is NOT simple to use.
just want you to understand that what you are considering is not trivial.

scott
Title: Re: PLC With Analog Input
Post by: rrc1962 on November 29, 2010, 10:28:36 AM
It's not really about the money.  I'm just looking for a more "industrial" solution (for lack of a better term).  I have a Sound Logic THC and it works fine, and buying another one is the easy way out, but I think I can build a better one using a PLC.  I also need a PLC anyway because I want to build an LCD touch screen remote.
Title: Re: PLC With Analog Input
Post by: kf2qd on November 29, 2010, 11:50:08 AM
You should be able to control the THC with just the PLC. Yiou would need some communication between MACH and the THC so it would know when initial heaght has been set. Initial height can be set with just a timer, go down until the switch contact opens, raise for some amount of time, stop motion and tell MACH that the torch is in position. Another timer can be used to raise the torch when the THC run is turned off by MACH. The PLC will work for a THC with just about any type of motor - yiou could use a reversable AC motor, or a DC motor - you would have to use relays to control either - Pheonix contact made some small din rail mounted relay modules that worked real well. If you have 2 analog inputs you could use a potentiometer to set your arc voltage.

I have used an Omron CP1-H PLC to control a THC using stepper motors and it worked well. A stepper interface might work with the DL06, but there is a problem with most PLC's that they don't like the step commands changed while in a move. The Omron PLC has a nice workaround and lets the motion commands be changed on the fly.

Analog output could be used but unless you can program a proper deadband in the motor drive you will have to deal with creep in the THC when it should be sitting stationary.

I would think that it would be easier to treat the THC as a seperate component and not try to control the height with MACH because the  height doesn't have a good number as it is relative to what is happenenig between the torch and the plate.
Title: Re: PLC With Analog Input
Post by: rrc1962 on November 29, 2010, 01:51:13 PM
You should be able to control the THC with just the PLC. Yiou would need some communication between MACH and the THC so it would know when initial height has been set.

Mach has an input for ArcOK.  You would just need to provide a signal on that pin so Mach knows that it's OK to start movement.  If ArcOK is lost, then Mach automatically pauses the program until ArcOK is restored.

Initial height can be set with just a timer, go down until the switch contact opens, raise for some amount of time, stop motion and tell MACH that the torch is in position. Another timer can be used to raise the torch when the THC run is turned off by MACH.

I hadn't thought of just using a standard DC motor.  That would work as long as the PLC can reverse the motor direction.  A better solution might be to just use a simple DC motor control that way you can control speed...Unless the PLC can send a DC pulse similar to a motor speed control.


The PLC will work for a THC with just about any type of motor - you could use a reversible AC motor, or a DC motor - you would have to use relays to control either

Ah yes...I've done that before.  Used a DPDT relay to reverse a DC motor.  If you fed the relay through a speed control and used the PLC to switch the relay, that should work.  CNC control over Z feed rate wouldn't be needed but a way to adjust the speed would be.

I would think that it would be easier to treat the THC as a separate component and not try to control the height with MACH because the  height doesn't have a good number as it is relative to what is happening between the torch and the plate.

My reasoning there was that the PLC would handle all of the logic.  ArcOK is just a low current voltage or a relay contact coming from the Plasma unit.  The PLC can monitor that and apply 5V to Mach's ArcOK input.  Mach Also has inputs for THC UP and DOWN.  If I used a stepper and stepper driver connected to Mach, the PLC could just control Mach through the UP/DOWN inputs, although that may be slower than a DC motor.  The other advantage to letting Mach control motion is that I would retain the ability to attach a router, drill, engraver, etc. to the same machine, all of which do require Mach control of the Z axis. 

This is how the Sound Logic THC works.  Not sure, but my guess is that Toms unit works the same way. It controls Mach through the THC UP/DOWN inputs.  The above idea would basically just replace the sound logic or CandCNC board with a PLC.  All that would be required is a PLC with analog input.  Not sure if this is possible, but instead of setting a PP pin high for torch UP/DN and ArcOK, just signal Mach through the serial interface without using any inputs or outputs.  If you can programatically control an input on the PLC, you should be able to signal Mach from software just as if a physical input were applied to the PLC.  
Title: Re: PLC With Analog Input
Post by: BR549 on November 29, 2010, 02:03:30 PM
Tom has a new low cost unit out as well. One thing to think about there is more to the THC than meets the eye. IF it were as simple as it seems everyone would be doing it with a simpl plc (;-).

From experience there are THC's and there are GOOD THC's. 

Just a thought, (;-) TP
Title: Re: PLC With Analog Input
Post by: rrc1962 on November 29, 2010, 02:39:58 PM
I agree completely but look at it this way.  Most, if not all of these low cost THC's use a pic or some other programmable microcontroller.  It their simplest form, they read an analog voltage, compare it to a set analog voltage and set the Mach THC UP/DN pin accordingly.  What makes a good THC is the programmed logic, and I agree, there is a lot to consider.  I have to believe that the programming capacity of a good PLC at least equal that of a micrcontroller, which means that the same even more complex logic could be done with a PLC.

The other end of this is the voltage divider.  A stable analog voltage to the THC is pretty important.  This is a bigger deal for me than programming the PLC.  My electronics background is minimal.   
Title: Re: PLC With Analog Input
Post by: kf2qd on November 30, 2010, 03:25:53 PM
A voltage divider is not all that complex... The right combination of resistor of a high enough wattage and MAYBE a small cappacitor across the output side to filter it slightly. Then you have to program a little bit of deadband around your setpoint (2 to 5 counts out of 256) and it will behave pretty well. There may also be some averaging in the A2D circuit in the PLC to help with the noise. I have built a couple of PLC based THC and it does not have to be complex at all. Mostly you are looking at whether the arc voltage is greater or less than some reference value and then triggering the appropriate output for up or down.

Using MACH - you could send the Plasm Start signal to the PLC and then when the Initial height is set the PLC gets the Arc Transferred signal and sends it back to MACH. When MACH drops the Plasm Start signal then PLC turns off the plasma and waits for a second or 2 for the plasm to shutoff and then retracts for some preset time.

The main advantage of the PLC over the PIC is that you don't have to worry about the Real Time part of the process, the PLC does that itself. Also the programming might be a bit easier for someone else to understand because, while some try to disparage it, ladder logic is rather universal and thus easy to figure out.

I have had to figure out others ladder logic and been able to do major additions, the other option is STL and poorly written STL is a vile as poorly written assembler...
Title: Re: PLC With Analog Input
Post by: kf2qd on November 30, 2010, 03:27:41 PM
Looks like the 05 is not capable of floating point math.  I think I'll need that.  Looks like the 06 is it.

Foating point is not necesary for a THC. All you need really need is some way to get a scaled value in for the set point and compare it to the A2D and then make greaterthan/Less then descisions.
Title: Re: PLC With Analog Input
Post by: rrc1962 on November 30, 2010, 03:41:30 PM
I wouldn't need floating point math to compare two voltages?  The voltage readings should be doubles.  Not sue how many decimal places there would be but it won't be an integer.  When I compare, am I actually comparing the numbers or an I comparing the hex equivalent of the number or the 16 bit word sitting in the analog input register?