Ethernet PokeysCNC LinuxCNC

More
27 Oct 2016 20:46 #82159 by timmert
Hello

I have a question and I can't find a good answer with some googling.

I have a CNC mill with MESA hardware. But I'm also converting my lathe to CNC.
Only one machine will run at the time. And I want to use 1 computer.

- I have a PokeysCNC board (can be controlled by USB and Ethernet). I would like to use the Ethernet option (better than USB imho).
Does LinuxCNC work by Ethernet with a PokeysCNC board?

- USB with PokeysCNC and Linuxcnc should work. Is it possible to connect the lathe by USB and the mill with MESA hardware -> create 2 profiles (one for my lathe, one for the mill)? Is that possible? Or is the only way a complete dual boot setup?

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

More
28 Oct 2016 08:37 #82168 by rodw
Replied by rodw on topic Ethernet PokeysCNC LinuxCNC
This might help forum.linuxcnc.org/24-hal-components/29816-pokeys
But I know nothing about it.

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

More
31 Oct 2016 17:36 #82278 by DaBit
Replied by DaBit on topic Ethernet PokeysCNC LinuxCNC
My lathe is running a Pokeys57E for the control panel connected over Ethernet. Works well. I did write my own component to read/write to the Pokeys, but the component mentioned earlier works too.

Since the PoKeys library abstracts the actual physical connection and connects by serial number (which is on the backside of the PCB) it works with both Ethernet and USB. However, I recommend using Ethernet; once the VFD/servo drive starts the USB communication to the Pokeys becomes unreliable at best.

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

More
31 Oct 2016 18:10 #82279 by timmert
Replied by timmert on topic Ethernet PokeysCNC LinuxCNC
Thanks for the replies.
I will check if I can get it to work with rodw's link

But will the following work?
Can I make 2 sessions for LinuxCNC
One for my Lathe using Ethernet
One for my Mill using the MESA card
The mill and lathe won't run at the same time.

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

More
01 Nov 2016 08:21 #82297 by DaBit
Replied by DaBit on topic Ethernet PokeysCNC LinuxCNC
What motion hardware will you use for the lathe?

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

More
01 Nov 2016 08:32 #82298 by timmert
Replied by timmert on topic Ethernet PokeysCNC LinuxCNC
I want to use the PoKeys57CNC controller board
But link from rodw is only for the USB function.
I think Mach3 will be the better option at the moment, until I buy a new lathe with LinuxCNC

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

More
01 Nov 2016 08:44 #82299 by DaBit
Replied by DaBit on topic Ethernet PokeysCNC LinuxCNC
There is currently no support for the Pokeys57CNC board as a motion controller.

What Mesa hardware are you using? If it is 5i25/6i25: do you use the second port?
The 5i25/6i25 has no problems running two breakoutboards. It would not be too expensive to buy a second 7i76 or whatever you need and a cable. Probably even cheaper than a Pokeys57CNC.

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

More
01 Nov 2016 08:49 #82300 by timmert
Replied by timmert on topic Ethernet PokeysCNC LinuxCNC
Thanks for the fast Reply.
I already had a Pokeys57cnc laying around.

My next lathe will be running mesa hardware :)

Mach3 for now

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

More
05 Jun 2018 05:50 #111646 by chimeno
Replied by chimeno on topic Ethernet PokeysCNC LinuxCNC
Hi DaBit,
I am using the Pokeys57E with the Ponet panel for the keypad in my linuxcnc panel, could you publish your component that you made to control it using TCP?
Thank you
Chimeno

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

More
05 Jun 2018 07:28 #111650 by DaBit
Replied by DaBit on topic Ethernet PokeysCNC LinuxCNC
Sure, no problem:
component voorpaneel "Driver for DaBit Emco8 front panel";

option userspace yes;
option extra_link_args "-lPoKeys -lusb-1.0 -lm";

pin out bit isconnected		"true when the pokeys device is found and connected";	
pin out bit chgpump_out		"toggling charge pump output. May be used to check if the component is alive";

pin out bit jog_z_up		"Joystick z-up direction";
pin out bit jog_z_down		"Joystick z-down direction";
pin out bit jog_x_up		"Joystick x-up direction";
pin out bit jog_x_down		"Joystick x-down direction";
pin out bit jog_sel_speed1	"connect the jog-sel-speedX pins to gmoccapy jog-inc-X";
pin out bit jog_sel_speed2;
pin out bit jog_sel_speed3;
pin out bit jog_sel_speed4;

pin out signed wheel_jog_x_counts	"X axis handwheel jog counts"; 
pin out signed wheel_jog_z_counts	"Z axis handwheel jog counts";
pin out float wheel_jog_scale		"jogwheel scale, 1/0.1/0.01/0.001 machine units";

pin out float jogspeed_slider		"Jogspeed pot output, range 0.0-1.0. Connect to gmoccapy.jog-vel-value";
pin out float rapidspeed_slider		"Rapidspeed pot output, range 0.0-1.0. Connect to gmoccapy.rapid-vel-value";
pin out float feedspeed_slider		"feedspeed pot output, range 0.0-1.0. Connect to gmoccapy.feed-override-value";

license "GPL";
;;

#include "PoKeysLib.h"
#include <unistd.h>   /* UNIX standard function definitions */
#include "math.h"

#define POT_EPSILON 0.005
#define POT_AVGCNT 4

int first = 1;
sPoKeysDevice * dev=0;
int i=0, avgidx=0;
float avg_jog[POT_AVGCNT];
float avg_feed[POT_AVGCNT];
float avg_rapid[POT_AVGCNT];



void user_mainloop(void) 
{ 
    while(1){
	float ftmp;
       FOR_ALL_INSTS() {
	isconnected = (dev!=NULL);	
	if(first){
		dev = PK_ConnectToDeviceWSerial(23249, 1000);	/* Oh well, for personal use adding the serial in code is OK */
		if (dev) {
			PK_PinConfigurationGet(dev);
	        	PK_EncoderConfigurationGet(dev);
			usleep(50000);
			first=0;
		}
	} else if (dev) {
		/* Fetch values from Pokeys device */
		if (PK_EncoderValuesGet(dev) != PK_OK) { dev=NULL; }
		if (PK_DigitalIOGet(dev) != PK_OK) { dev=NULL; }
		if (PK_AnalogIOGet(dev) != PK_OK) { dev=NULL; }
		if (dev) {
			/* joystick pins. Note that indexes are one lower than the pokeys pin number */
			jog_z_up = dev->Pins[31].DigitalValueGet;
			jog_z_down = dev->Pins[32].DigitalValueGet;
			jog_x_up = dev->Pins[29].DigitalValueGet;
			jog_x_down = dev->Pins[30].DigitalValueGet;
			jog_sel_speed1 = dev->Pins[39].DigitalValueGet;
			jog_sel_speed2 = dev->Pins[38].DigitalValueGet;
			jog_sel_speed3 = dev->Pins[37].DigitalValueGet;
			jog_sel_speed4 = dev->Pins[36].DigitalValueGet;

			/* feed overrides. ain-4 is jogspeed, 5 is rapid, 6 is feed */
			ftmp=0; avg_jog[avgidx] = ((float)dev->Pins[44].AnalogValue) / 4095.0;			
			for (i=0;i<POT_AVGCNT;i++) ftmp+=(1.0/(float)POT_AVGCNT)*avg_jog[i];
			if (fabs(jogspeed_slider - ftmp) > POT_EPSILON) 
				jogspeed_slider = ftmp;
			
			ftmp=0; avg_rapid[avgidx] = ((float)dev->Pins[45].AnalogValue) / 4095.0;
			for (i=0;i<POT_AVGCNT;i++) ftmp+=(1.0/(float)POT_AVGCNT)*avg_rapid[i];
			if (fabs(rapidspeed_slider - ftmp) > POT_EPSILON) 
				rapidspeed_slider = ftmp;
				
			ftmp=0; avg_feed[avgidx]= ((float)dev->Pins[46].AnalogValue) / 4095.0;
			for (i=0;i<POT_AVGCNT;i++) ftmp+=(1.0/(float)POT_AVGCNT)*avg_feed[i];
			if (fabs(feedspeed_slider - ftmp) > POT_EPSILON) 
				feedspeed_slider = ftmp;
			if (++avgidx >= POT_AVGCNT) avgidx=0;

			/* handwheels */
			wheel_jog_x_counts = dev->Encoders[0].encoderValue;
			wheel_jog_z_counts = dev->Encoders[1].encoderValue;
			ftmp=0;
			if (dev->Pins[54].DigitalValueGet) ftmp += 1.0;
			else if (dev->Pins[52].DigitalValueGet) ftmp += 0.1;
			else if (dev->Pins[51].DigitalValueGet) ftmp += 0.01;
			else if (dev->Pins[50].DigitalValueGet) ftmp += 0.001;
			wheel_jog_scale = ftmp;
			
			//for(i=0;i<55;i++)dev->Pins[i].DigitalValueSet=out(i);     
			//PK_DigitalIOSet(dev); 
			chgpump_out = !chgpump_out;	
			usleep(50000);
		} 
	  } else {
	  	/* No device handle. Setup default values */
	    	jog_z_up = false;
		jog_z_down = false;
		jog_x_up = false;
		jog_x_down = false;
		jog_sel_speed1 = true;
		jog_sel_speed2 = false;			
		jog_sel_speed3 = false;
		jog_sel_speed4 = false;
		jogspeed_slider = 0.5;
		rapidspeed_slider = 0.5;
		feedspeed_slider = 0.5;
		/* Restart init */
	    	first = 1;
	  }
        }
    }

    exit(0);
}

Mind you: this is a purpose-written component, not very generic. However, it should be easy to adapt to your situation.

To compile this run 'sudo halcompile --install voorpaneel.comp' (or without the sudo if you are running a RIP install). You will need libusb-1.0.0-dev and the 'mbosnak' PoKeys library.
The following user(s) said Thank You: chimeno, silopolis

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

Time to create page: 0.207 seconds
Powered by Kunena Forum