PLC to Linuxcnc using Panasonic A4 Servos.
04 Feb 2014 17:33 #43528
by Richy
PLC to Linuxcnc using Panasonic A4 Servos. was created by Richy
I have an ongoing project here which essentially is to remove a windows based plc setup with either mach 3 or if possible Linux cnc.
The initial path I chose was to run the panasonic a4 servos and motors in an open loop configuration via position control mode with step direction signals.
That all worked out nicely and you can see more background info and images about that if you follow this link machsupport
The initial path I chose was to run the panasonic a4 servos and motors in an open loop configuration via position control mode with step direction signals.
That all worked out nicely and you can see more background info and images about that if you follow this link machsupport
Please Log in or Create an account to join the conversation.
04 Feb 2014 17:46 #43530
by Richy
Replied by Richy on topic PLC to Linuxcnc using Panasonic A4 Servos.
Halfway through that conversion, Hood piped up with the idea to run the pana stuff in velocity mode and to close the loop, not via mach 3 but in linuxcnc which would be perfect for us.
I have quite a bit of experience of linux and linuxcnc having built a coilwinding machine and a done a lathe conversion, both based on stepper configurations in linuxcnc or mach, dual boot pcs.
The waterjet currently controls the servo drives and motors in velocity mode and after googling around it was clear that a good choice of hardware to progress this concept would be a 5i25 / 7i77 combo from Mesa.
A called placed to a friend just down the road for advise resulted in us buying a 6i25 card and a 7i77 card with the correct cable which he had imported from mesa in the us but decided to go off in another tangent.
The 6i25 was marked on the back with a sticker marked "firmware 7i76" which meant I had a weekend pulling my hair out trying to get this combo running and then yesterday I found the sticker and realised I had to use the mesaflash utility to flash the 6i25 with 7i77 firmware.![:laugh: :laugh:](/media/kunena/emoticons/laughing.png)
Now it fires up nicely and the red LED changes to flashing yellow upon linuxcnc startup.
I have quite a bit of experience of linux and linuxcnc having built a coilwinding machine and a done a lathe conversion, both based on stepper configurations in linuxcnc or mach, dual boot pcs.
The waterjet currently controls the servo drives and motors in velocity mode and after googling around it was clear that a good choice of hardware to progress this concept would be a 5i25 / 7i77 combo from Mesa.
A called placed to a friend just down the road for advise resulted in us buying a 6i25 card and a 7i77 card with the correct cable which he had imported from mesa in the us but decided to go off in another tangent.
The 6i25 was marked on the back with a sticker marked "firmware 7i76" which meant I had a weekend pulling my hair out trying to get this combo running and then yesterday I found the sticker and realised I had to use the mesaflash utility to flash the 6i25 with 7i77 firmware.
![:laugh: :laugh:](/media/kunena/emoticons/laughing.png)
Now it fires up nicely and the red LED changes to flashing yellow upon linuxcnc startup.
Please Log in or Create an account to join the conversation.
04 Feb 2014 18:01 #43532
by Richy
Replied by Richy on topic PLC to Linuxcnc using Panasonic A4 Servos.
During the "weekend of torment" I had reason to google around an read lots of stuff about this kind of conversion, Ordinarily I wouldn't try something as complicated as this but I'm hopeful I can get a helping hand from some of the experts on here.
My first question relates to the manual for the 7i77 from the mesa website, on page 21 it states the following:
OPERATION
SOFTWARE PROCESS DATA MODES
The 7I77's digital I/O section (normally on sserial channel 0) has 4 software
selectable process data modes. These different modes select different sets of 7I77 data
to be transferred between the host and the 7I77 during real time process data exchanges.
For high speed applications, choosing the correct mode can reduce the data transfer sizes,
resulting in higher maximum update rates.
MODE 0 I/O only mode (32 bits of input data, 16 bit of output data)
MODE 1 I/O plus analog input mode (32 bits of input data, 16 bits of output data, 4
analog input channels on inputs 0..3)
MODE 2 I/O plus analog input and field voltage mode (32 bits of input data, 16 bits of
output data, 4 analog input channels (on inputs 0..3) and field voltage analog
in)
MODE 3 I/O plus analog input and field voltage mode (32 bits of input data, 16 bits of
output data, 4 analog input channels (on inputs 0..3), field voltage analog in
and 2 MPG encoders on inputs 16..19). Default encoder count mode is 1X
to match normal 100 PPR MPGs. Encoder input threshold is fixed at 2.5V for
compatibility with 5V encoder outputs.
*********************************************
Unless I'm mistaken the manual makes no mention of how to change or enable these modes, a google around led me to bigjohnt's page about installing an mpg (i need to do this also) , he stated "To enable the MPG inputs set the mode to 3. Find sserial_port_0=000xxxxx in your main hal file and change it to sserial_port_0=300xxx.
Is that correct? Where did this info come from, is the difference in the number of "x's" in that string significant? is it in a manual I have failed to download?, how do I enable mode 2 if I wanted to?
My first question relates to the manual for the 7i77 from the mesa website, on page 21 it states the following:
OPERATION
SOFTWARE PROCESS DATA MODES
The 7I77's digital I/O section (normally on sserial channel 0) has 4 software
selectable process data modes. These different modes select different sets of 7I77 data
to be transferred between the host and the 7I77 during real time process data exchanges.
For high speed applications, choosing the correct mode can reduce the data transfer sizes,
resulting in higher maximum update rates.
MODE 0 I/O only mode (32 bits of input data, 16 bit of output data)
MODE 1 I/O plus analog input mode (32 bits of input data, 16 bits of output data, 4
analog input channels on inputs 0..3)
MODE 2 I/O plus analog input and field voltage mode (32 bits of input data, 16 bits of
output data, 4 analog input channels (on inputs 0..3) and field voltage analog
in)
MODE 3 I/O plus analog input and field voltage mode (32 bits of input data, 16 bits of
output data, 4 analog input channels (on inputs 0..3), field voltage analog in
and 2 MPG encoders on inputs 16..19). Default encoder count mode is 1X
to match normal 100 PPR MPGs. Encoder input threshold is fixed at 2.5V for
compatibility with 5V encoder outputs.
*********************************************
Unless I'm mistaken the manual makes no mention of how to change or enable these modes, a google around led me to bigjohnt's page about installing an mpg (i need to do this also) , he stated "To enable the MPG inputs set the mode to 3. Find sserial_port_0=000xxxxx in your main hal file and change it to sserial_port_0=300xxx.
Is that correct? Where did this info come from, is the difference in the number of "x's" in that string significant? is it in a manual I have failed to download?, how do I enable mode 2 if I wanted to?
Please Log in or Create an account to join the conversation.
04 Feb 2014 18:21 #43533
by Richy
Replied by Richy on topic PLC to Linuxcnc using Panasonic A4 Servos.
Another question.
This waterjet has two 24 volt solenoid that control pneumatic valves to open and close the abrasive feed and high pressure water.
In stepper mode, LPT arrangement, I created custom m code command scripts as per the linux cnc manual.
Here is a filed called "M101" which sits in the nc_files directory. Whenever M101 is mentioned in the gcode it executes the following:
#!/bin/bash
# file to turn on parport pin 16 to open the HP valve
halcmd setp parport.0.pin-16-out True
exit 0
There is another file called M102 which sets the pin to "false" which turns the water off. There are 2 more files like that to control the abrasive solenoid. These m101 -m104 files are used with a g64 dwell to slightly delay the on off cycle as per material thickness etc.
I'd like to keep using these custom files for mcodes but what do I put in those files instead of he files instead of the instruction "halcmd setp parport.0.pin-16-out True"
I have tried in vain today to solve this problem by myself. I used a whole bunch of variations of "net water hm2_5i25.0.7i77.0.0.output-12" but got nowhere fast. I was basically pasting made up commands into the hal configuration wizard thingy and clicking execute! no dice! Please help!
This waterjet has two 24 volt solenoid that control pneumatic valves to open and close the abrasive feed and high pressure water.
In stepper mode, LPT arrangement, I created custom m code command scripts as per the linux cnc manual.
Here is a filed called "M101" which sits in the nc_files directory. Whenever M101 is mentioned in the gcode it executes the following:
#!/bin/bash
# file to turn on parport pin 16 to open the HP valve
halcmd setp parport.0.pin-16-out True
exit 0
There is another file called M102 which sets the pin to "false" which turns the water off. There are 2 more files like that to control the abrasive solenoid. These m101 -m104 files are used with a g64 dwell to slightly delay the on off cycle as per material thickness etc.
I'd like to keep using these custom files for mcodes but what do I put in those files instead of he files instead of the instruction "halcmd setp parport.0.pin-16-out True"
I have tried in vain today to solve this problem by myself. I used a whole bunch of variations of "net water hm2_5i25.0.7i77.0.0.output-12" but got nowhere fast. I was basically pasting made up commands into the hal configuration wizard thingy and clicking execute! no dice! Please help!
![:P :P](/media/kunena/emoticons/tongue.png)
Please Log in or Create an account to join the conversation.
04 Feb 2014 20:06 #43535
by andypugh
That is because it depends on the Driver, not the hardware:
www.linuxcnc.org/docs/html/man/man9/hostmot2.9.html#config modparam
Some more info here: www.linuxcnc.org/docs/devel/html/man/man9/sserial.9.html
Replied by andypugh on topic PLC to Linuxcnc using Panasonic A4 Servos.
Unless I'm mistaken the manual makes no mention of how to change or enable these modes
That is because it depends on the Driver, not the hardware:
www.linuxcnc.org/docs/html/man/man9/hostmot2.9.html#config modparam
Some more info here: www.linuxcnc.org/docs/devel/html/man/man9/sserial.9.html
Please Log in or Create an account to join the conversation.
04 Feb 2014 20:17 #43536
by andypugh
If you are setting the value from an M101 bash script with a setp then you don't need to "net" anything at all in the HAL.
You do need to know the HAL pin name though. If you have a linuxcnc system that starts up properly then the easiest way to get a full pin list is to open a separate terminal window and typeand then copy and paste the output to a text document. If you prefer you can useto create the text document directly. You probably also want totoo.
If you want to use the same bash script for more than one machine or configuration then you can do that. if the parport machine hasand the 7i77 machine hasthen your M101 script can beand the same script will work for any config with a "water" signal defined. (setp is "set pin" or "set parameter" and sets is "set signal")
The reason that your attempts are failing is probably that the GPIO pins don't appear unless the 7i77 has field-power connected, as the smart-serial hardware on the GPIO uses that power to run itself.
Replied by andypugh on topic PLC to Linuxcnc using Panasonic A4 Servos.
I have tried in vain today to solve this problem by myself. I used a whole bunch of variations of "net water hm2_5i25.0.7i77.0.0.output-12" but got nowhere fast. I was basically pasting made up commands into the hal configuration wizard thingy and clicking execute! no dice! Please help!
If you are setting the value from an M101 bash script with a setp then you don't need to "net" anything at all in the HAL.
You do need to know the HAL pin name though. If you have a linuxcnc system that starts up properly then the easiest way to get a full pin list is to open a separate terminal window and type
halcmd show pin
halcmd show pin > pins.txt
halcmd show param
If you want to use the same bash script for more than one machine or configuration then you can do that. if the parport machine has
net water parport.0.pin-16-out
net water hm2_5i25.0.7i77.0.0.output-12
#!/bin/bash
# file to turn on parport pin 16 to open the HP valve
halcmd sets water 1
exit 0
The reason that your attempts are failing is probably that the GPIO pins don't appear unless the 7i77 has field-power connected, as the smart-serial hardware on the GPIO uses that power to run itself.
Please Log in or Create an account to join the conversation.
05 Feb 2014 10:36 - 05 Feb 2014 11:03 #43565
by Richy
Field power is connected to the 12v side of a pc power supply via TB2 pins 1 and 8. I have the 6i25 jumpered not to supply 5v to the 7i77 and the 7i77 jumpered not to receive 5v from the 6i25 as per the manuals. TB1 is connected to the 5v of the pc power supply. At first I had it set up so the 7i77 got its 5v from the 6i25 thru the cable but yesterday I changed it because I was reading that to get an mpg running you must make sure there is a common ground between field power on TB2 and TB1, the pc power supply. This is why I was asking about enabling the different modes because I think I need mode 3 to get the mpg signals on inputs 16,17,18,19. More on mpg later.
I think it was failing not because of field power but more likely I don't really know what I'm doing![:lol: :lol:](/media/kunena/emoticons/grin.png)
Wonderful!![:P :P](/media/kunena/emoticons/tongue.png)
So now my M101 file looks like this:
#!/bin/bash
# file to turn on "net water hm2_5i25.0.7i77.0.0.output-11" in 1234.hal" to open the HP valve
halcmd sets water 1
exit 0
And to close the water via file M102 it seemed logical to simply change the "1" to a 0"....
#!/bin/bash
# file to turn off "net water hm2_5i25.0.7i77.0.0.output-11" in 1234.hal" to close the HP valve
halcmd sets water 0
exit 0
Working!![:woohoo: :woohoo:](/media/kunena/emoticons/w00t.png)
I did similar for the abrasive control, M103 and M104 "net abrasive hm2_5i25.0.7i77.0.0.output-12
Ok, off to read more about the Hostmot2 modparam stuff.......
Replied by Richy on topic PLC to Linuxcnc using Panasonic A4 Servos.
The reason that your attempts are failing is probably that the GPIO pins don't appear unless the 7i77 has field-power connected, as the smart-serial hardware on the GPIO uses that power to run itself.
Field power is connected to the 12v side of a pc power supply via TB2 pins 1 and 8. I have the 6i25 jumpered not to supply 5v to the 7i77 and the 7i77 jumpered not to receive 5v from the 6i25 as per the manuals. TB1 is connected to the 5v of the pc power supply. At first I had it set up so the 7i77 got its 5v from the 6i25 thru the cable but yesterday I changed it because I was reading that to get an mpg running you must make sure there is a common ground between field power on TB2 and TB1, the pc power supply. This is why I was asking about enabling the different modes because I think I need mode 3 to get the mpg signals on inputs 16,17,18,19. More on mpg later.
I think it was failing not because of field power but more likely I don't really know what I'm doing
![:lol: :lol:](/media/kunena/emoticons/grin.png)
net water hm2_5i25.0.7i77.0.0.output-12
halcmd sets water 1
Wonderful!
![:P :P](/media/kunena/emoticons/tongue.png)
So now my M101 file looks like this:
#!/bin/bash
# file to turn on "net water hm2_5i25.0.7i77.0.0.output-11" in 1234.hal" to open the HP valve
halcmd sets water 1
exit 0
And to close the water via file M102 it seemed logical to simply change the "1" to a 0"....
#!/bin/bash
# file to turn off "net water hm2_5i25.0.7i77.0.0.output-11" in 1234.hal" to close the HP valve
halcmd sets water 0
exit 0
Working!
![:woohoo: :woohoo:](/media/kunena/emoticons/w00t.png)
I did similar for the abrasive control, M103 and M104 "net abrasive hm2_5i25.0.7i77.0.0.output-12
Ok, off to read more about the Hostmot2 modparam stuff.......
Last edit: 05 Feb 2014 11:03 by Richy.
Please Log in or Create an account to join the conversation.
05 Feb 2014 17:36 #43575
by Richy
Replied by Richy on topic PLC to Linuxcnc using Panasonic A4 Servos.
Sadly I'm getting the following error upon clicking enable amp in the open loop test inside pncconf.
PNCconf encountered an error. The following information may be useful in troubleshooting:
Traceback (most recent call last):
File "/usr/bin/pncconf", line 9482, in on_enableamp_toggled
self.update_axis_params()
File "/usr/bin/pncconf", line 9452, in update_axis_params
halrun.flush()
IOError: [Errno 32] Broken pipe
I have pncconf running from a terminal and this gets printed in the terminal:
hm2_5i25.0.encoder.00
halrun: Realtime already running. Use 'halrun -U' to stop existing realtime session.
Any ideas?
I'm using buildbot version 2.6.0 pre0-5152.gb16a107
PNCconf encountered an error. The following information may be useful in troubleshooting:
Traceback (most recent call last):
File "/usr/bin/pncconf", line 9482, in on_enableamp_toggled
self.update_axis_params()
File "/usr/bin/pncconf", line 9452, in update_axis_params
halrun.flush()
IOError: [Errno 32] Broken pipe
I have pncconf running from a terminal and this gets printed in the terminal:
hm2_5i25.0.encoder.00
halrun: Realtime already running. Use 'halrun -U' to stop existing realtime session.
Any ideas?
I'm using buildbot version 2.6.0 pre0-5152.gb16a107
Please Log in or Create an account to join the conversation.
05 Feb 2014 17:58 - 05 Feb 2014 18:14 #43577
by Richy
Replied by Richy on topic PLC to Linuxcnc using Panasonic A4 Servos.
I just found the fix for that by googling to
here
Last edit: 05 Feb 2014 18:14 by Richy.
Please Log in or Create an account to join the conversation.
05 Feb 2014 18:48 #43578
by Richy
Replied by Richy on topic PLC to Linuxcnc using Panasonic A4 Servos.
well itried that fix but now just get more error messages:
Traceback (most recent call last):
File "/usr/bin/pncconf", line 9453, in on_enableamp_toggled
self.update_axis_params()
File "/usr/bin/pncconf", line 9423, in update_axis_params
halrun.flush()
IOError: [Errno 32] Broken pipe
anybody can attach a pncconf file that works?
Traceback (most recent call last):
File "/usr/bin/pncconf", line 9453, in on_enableamp_toggled
self.update_axis_params()
File "/usr/bin/pncconf", line 9423, in update_axis_params
halrun.flush()
IOError: [Errno 32] Broken pipe
anybody can attach a pncconf file that works?
Please Log in or Create an account to join the conversation.
Moderators: cmorley
Time to create page: 0.089 seconds