Changing negative analog voltage from Ethercat terminal to VFD

More
08 Jul 2020 02:55 #173947 by CORBETT
Hi All,

I am using the 0-10 volt spindle speed code linking my Beckhoff EL4132 analog output terminal to my VFD. Everything works totally fine in forward; it will speed up & down and works perfect except for reverse. The reverse circuit all works, but the analog output from the EL4132 is negative voltage to the VFD. In forward the voltage is positive and it will speed up correctly with LCNC, but in reverse it will not do anything as the output is negative. I removed the wiring from the EL4132 to the VFD and used a AAA battery to check if this was correct. So, in forward it would speed up when using positive voltage and with the same setup it would work in reverse. In other words my VFD needs 0 - +10 for Reverse and not -10 - 0.

What do I need to change in HAL or the INI file to correct this problem in reverse. Below is the code I am using. Also, I am using Ethercat with Beckhoff hardware with a Servo thread only, no Base thread.

loadrt scale count=1
setp scale.0.gain 0.00025
net spindle-speed-scale <= motion.spindle-speed-out => scale.0.in
net spindle-speed-DAC => scale.0.out => lcec.0.D11.aout-0-value

If I can get my reverse speed under control then I can at least do some T&C/floating tapping.

Thanks,
Robert

Please Log in or Create an account to join the conversation.

More
08 Jul 2020 10:34 #173967 by tommylight
Use the abs component before the output in hal, that makes sure the output is always positive.
The following user(s) said Thank You: CORBETT

Please Log in or Create an account to join the conversation.

More
08 Jul 2020 12:54 #173973 by CORBETT
Tommy,

Thanks for getting back with me. I had read about the ABS component but thought it would flip both the positive & negative output therefore messing up the forward positive output side. I will go back and re-read so I can add the abs component. Thanks for pointing me in the right direction, much appreciated.

Thanks,
Robert
The following user(s) said Thank You: tommylight

Please Log in or Create an account to join the conversation.

More
08 Jul 2020 14:25 #173982 by tommylight
It should be as easy as sending the analogue output to abs input, and abs output to the actual output.
Might not be that easy though, i never used it for the spindle but i did use it for other stuff, like triggering when the boost should be activated depending on the f-error value. Worked like a charm.

Please Log in or Create an account to join the conversation.

More
08 Jul 2020 17:41 #174000 by CORBETT
Yeah I will have to get the code figured out as I went and pulled the manual for the VFD and it doesn't show any way of changing the analog input other than choosing between 0-10V or 4-20mA. So it looks like I will have to do this through LCNC.

The VFD is a Saftronics GP5 drive if anyone has had a similar experience. I searched the forums and would think this has come up for sure with other VFD's.

Tonight I may jump on the Ethercat thread and see if "Chimeno" knows a way to change the output from the EL4132 terminal in TwinCAT, but I don't think that is a very promising fix. Pretty sure will have to do this in HAL.

Thanks,
Robert

Please Log in or Create an account to join the conversation.

More
08 Jul 2020 17:48 #174002 by tommylight

Pretty sure will have to do this in HAL.

That is the only viable solution that does not require anything more than two lines of code in hal.
Maybe Ethercat has something for that.
Other than that, building an ABS component from electronic parts is also a solution, requires more than 2 wires ... and plenty of other stuff. :)
The following user(s) said Thank You: CORBETT

Please Log in or Create an account to join the conversation.

More
08 Jul 2020 20:24 - 09 Jul 2020 04:09 #174025 by chimeno
Hello @Corbett,
The EL4132 device has several ways to represent the value, the default is without presentation, you can set it to value 1 for only positive values.

0x8010:02 / 0x8020:02 value 1: unsigned presentation
maximum presentation 16bit range
0 .. + 65535dec

you still have to use the raw signal "raw"
lcec .0.D11.aout-0-raw


I attach the configuration .xml file, you can try it if it helps you.

Another way a little more difficult would be to modify the file lcec_el41x2.c and change the signal to a U32 for only positive values,

another way is suggested by tommylight.

I hope I have helped you in something

Edit:
In the linuxcnc-ethercat code, there is an enable pin for ABS mode, this is the easiest solution I think
setp lcec .0.D11.aout-0-absmode 1

Greeting
Chimeno
Attachments:
Last edit: 09 Jul 2020 04:09 by chimeno. Reason: edit: ABS signal
The following user(s) said Thank You: tommylight, CORBETT

Please Log in or Create an account to join the conversation.

More
09 Jul 2020 15:00 #174098 by CORBETT
Tommy and Albert,

Thanks for getting back with me, I meant to message back last night. I am going to try this in a bit and will let you know if it works. Was tied up on another project yesterday and didn't get back on this until now.

Thanks,
Robert.

Please Log in or Create an account to join the conversation.

More
09 Jul 2020 17:07 #174111 by CORBETT
Albert, your the man.... Success... That one line did it. Dude you have EtherCAT figured out and I greatly appreciate the help.

Tommy, super thanks for jumping on this quick. I went with the EtherCAT code as it kept from adding another "component" to the code. But have learned about ABS and know how to use it if needed in the future. Had already prepped the ABS code last night ready for today until I saw Alberts response with the one line code.

You guy's both have helped me in the past and once again have helped get me up the next level. Super thanks. Now going to start building the encoder bracket for my spindle so I can get rigid tapping. At least now I can break out the T&C holders and do some floating tapping. Super happy, another great day. :)

Thanks,
Robert
The following user(s) said Thank You: chimeno, tommylight

Please Log in or Create an account to join the conversation.

More
09 Jul 2020 18:16 #174115 by tommylight
Chimeno is very good at it and is very helpful.
The following user(s) said Thank You: chimeno

Please Log in or Create an account to join the conversation.

Time to create page: 0.213 seconds
Powered by Kunena Forum