Machsupport Forum

Mach Discussion => General Mach Discussion => Topic started by: native34 on November 11, 2015, 08:17:00 PM

Title: Control Panel Setup
Post by: native34 on November 11, 2015, 08:17:00 PM
Good Evening, I would like to setup my control panel to have a series of buttons to control functions like cycle start, feedhold, X zero, Y zero, etc.. I would also like to add an encoder to move the Different Axis. I would like to do this without purchasing anymore hardware than I already have. I have a cnc4pc C32 Multifunction board, Ethernet Smoothstepper. How would I go about implementing these features with this setup.

Could I just take a button and connect one end to an input on my BOB and the other end to a grouns on the BOB then tell mach what pin is being used and what to trigger when it is pressed? Or do I need to have some more electronics installed between the button and mach? I see a lot of stuff regarding MODI/O, Brains, POKEYS, etc.. Do I need these or can it be done in a much simpler way?
Title: Re: Control Panel Setup
Post by: robertspark on November 12, 2015, 02:07:59 AM
If you want an encoder wheel.... You will need to buy an encoder wheel... That will then need to be wired to two inputs

You will then need buttons for the other inputs to get them to trigger....

You will then need to write either a brain or a macropump which will monitor those inputs and trigger the functions you want

....

Can I make a suggestion..... Consider buying a USB contour Shuttle Pro v2. .... And then just programme all 15 buttons and the two jog wheels with what you want....

It would be much easier to do ... And you would have it all working in about half an hour

Another option is to buy an encoder (as stated above) and then buy teensy and set it up as a keyboard emulation device with a load of buttons... And programme each button with a keyboard function as what you are trying to do I think most of them have keyboard shortcuts.

You could also buy a vistacnc pendant too...

All of these options are machmach 3 and 4 compatible now.

Rob
Title: Re: Control Panel Setup
Post by: dude1 on November 12, 2015, 04:54:28 AM
you can make a encoder using a teensy they have a special library for it and keyboard and mouse emulation as well, or just get a pokeys board they are made for that sort of thing it would make life easier,
there are a tonne of ways to do what you want.
the easiest is with a modbus type system, PLC, pokeys or even easier a pendant, if you want to future proof your setup a  contour Shuttle Pro v, vistacnc, xbox360 joystick or number pad are working pendants with M3 and M4 at this time and the pokeys pendant with a pokeys board is the same in M3 or M4
it down to your budget
Title: Re: Control Panel Setup
Post by: native34 on November 12, 2015, 07:56:39 AM
Thank you for the replies. I am trying to get this done without purchasing more boards, I already have a myriad of buttons and encoders from my Arduino (Uno) stuff, plus The wife gets a little antsy when I spend more money. Plus I already have all these inputs and outputs that I'm not using on my current boards. I was just thinking if it's not to bad I could make it happen. The DB25 port on the C32 already has pins 2_2 - 2_9 setup as input and the C32 also has other pins that are setup as output. Here is my thought and please correct me if I'm wrong. I could take a button and wire it to the proper pin on the C32 DB25 port. Then configure an input in Mach Input config page. at this point is where my knowledge is really limited. Would I then create a brain to tell Mach what to do with the input or would I set an oem trigger to handle the input from the button.

Question1: Can I just run a wire from one side of a button to pin on DB 25 and then run another to ground on the DB 25 or do I have to wire in some other power as well? I'm assuming I would need to be supplied power as it would need to be 0V state until pressed then it will go to 5V state. once at 5V then the button will trigger a Mach 3 event.

Question2: What steps need to happen after Question1 is complete. I think I would create a Brain to handle what happens after 5V is sent to the Pin, but I'm not sure. I see a lot of stuff regarding MOD I/O, POKeys, and various other terms which are muddling my ability to decipher how to implement this.

I currently have the system working with an Xbox 360 remote, But m final machine build will have a Control Panel similar to a Haas, so I can eliminate the need to have a Keyboard and Mouse.
Title: Re: Control Panel Setup
Post by: robertspark on November 12, 2015, 10:00:27 AM
You can do it with purely the buttons and an encoder.

I will have a look at your bob but how have you wired your limit switches in?

I will have a look at a macropump / brains for you later...

Do you have an itemised list of what commands or macros or functions you wish to run?

Rob
Title: Re: Control Panel Setup
Post by: native34 on November 12, 2015, 12:43:22 PM
Rob,
I have a CNC4PC C32 Multifunction Board. I currently don't have limit switches. I'm in the process of installing them. I would like the following commands to be run with hard switches and encoder:
I would like to add more later but these are the ones I want to start off with.

Cycle Start
Feedhold
Stop
Rewind
Reset

Encoder to move X,Y,Z
Buttons to Select X,Y,Z for movement with Encoder
Buttons for Zeroing X,Y,Z
Title: Re: Control Panel Setup
Post by: robertspark on November 12, 2015, 02:33:26 PM
The last one is that 3 buttons... Or one button?

All of the rest is easy enough
Title: Re: Control Panel Setup
Post by: native34 on November 12, 2015, 04:26:33 PM
it would be individual buttons for Selecting and zeroing X,Y,Z
Title: Re: Control Panel Setup
Post by: robertspark on November 13, 2015, 04:58:41 PM
....hmm....

Think you need to explain what you mean by "zeroing X,Y & Z".

I know this may seem obvious to you but are you asking the machine to zero the DRO's for each axis

Or are you asking the machine to home and zero each axis?

......................................

Attached is a "brain" that will do all the button presses you asked for.   You will need to copy and paste it to your brains folder, and you will need to enable the brain via the "brain control..." under "Operator" .... you also need to click "reload all brains to get them to start working or restart mach3  (every time you do a change to the pins and ports etc configuration ... with the smooth stepper you really should restart Mach 3 so that the FPGA on the smooth stepper is reloaded with the pins settings and code)....

I'd also suggest you viewing the brain to make sure it's what you are after...

The best way to edit a brain is to go to the operator tab.... click on "Brain Editor..." and when it asks for a name, click cancel, and then once the brain editor loads... click open and open and edit the brain you want to edit.

You will also need to define your OEM Trigger Inputs (on the Ports & Pins / Inputs Tab) as follows:
Cycle Start --- OEM Trig #1
Feedhold --- OEM Trig #2
Stop --- OEM Trig #3
Rewind --- OEM Trig #4
Reset --- OEM Trig #5

Encoder to move X,Y,Z  --- you will need to install an encoder on MPG#1 (and ref your pins on the ports & Pins / MPG tab).

Buttons to Select X (for encoder) --- OEM Trig #6
Buttons to Select Y (for encoder) --- OEM Trig #7
Buttons to Select Z (for encoder) --- OEM Trig #8

Buttons for Zeroing X --- OEM Trig #9
Buttons for Zeroing Y --- OEM Trig #10
Buttons for Zeroing Z --- OEM Trig #11

One little caveat.... you may need to invert the signals..... basically this is done in the brain by editing it.... where you see the box that says "No Operation signal pass", click on it twice and a box will open one of the options is "invert" this will flip the signal... sometimes bob's invert the signal.... and also it depends if you are using "make" (NO / normally open) or "break" (NC / Normally Closed) switches / buttons.

You may wish to consider something like these (they are all from china so available on various ebay around the world sites):
http://www.ebay.co.uk/itm/12V-OFF-ON-Momentary-Push-Button-Horn-Switch-Car-Light-Dashboard-Boat-SPST-/361345440863?var=&hash=item5421dddc5f:m:mihtRXVIAMpThMNLLOw0XwQ
or dealextreme or aliepress etc etc.... just to give you some ideas of a functional button.

Rob
Title: Re: Control Panel Setup
Post by: native34 on November 14, 2015, 05:27:02 PM
There will be three buttons. One for x, one for y, one for z. When you press the button, it will zero the axis for the respective button pressed. For the encoder. There will be one encoder that will control movement for each axis depending on which axis is selected.
Title: Re: Control Panel Setup
Post by: native34 on November 14, 2015, 08:27:13 PM
What would the wiring diagram look like for the encoder? I have an encoder from Adafruit. It also has a push button. There are 2 pins on one side, and three pins on the other side. The data sheet says that the three pins on the same side are "A" on left, Ground in the middle, and "B" on the right. I believe the two pins on the other side are for the switch. I don't see any pins that supply the 5V.
Title: Re: Control Panel Setup
Post by: robertspark on November 14, 2015, 08:57:36 PM
Yup that is how it is setup.
Title: Re: Control Panel Setup
Post by: native34 on November 14, 2015, 09:06:43 PM
Not sure what you mean by your last post
Title: Re: Control Panel Setup
Post by: robertspark on November 14, 2015, 09:08:35 PM
Sorry I was reading the post before.... When I typed that... On the page before...

Wiring ... Give me a minute
Title: Re: Control Panel Setup
Post by: robertspark on November 14, 2015, 09:10:14 PM
Is this your encoder?
https://www.adafruit.com/products/377
Title: Re: Control Panel Setup
Post by: native34 on November 14, 2015, 09:10:22 PM
Does 5v get connected to "A" pin and does the wire that goes to pin for "A" on the db25 as well
Title: Re: Control Panel Setup
Post by: native34 on November 14, 2015, 09:11:32 PM
Yes it is my encoder
Title: Re: Control Panel Setup
Post by: robertspark on November 14, 2015, 09:16:44 PM
If you look at this diagram, you can see that the encoder is what I thought it was .... Just two switches, each one makes and breaks to ground

https://learn.adafruit.com/trinket-usb-volume-knob/wiring

So connect a 0v/ ground from your bob to the ground connection

And then connect one pin of your bob to an a and one pin to the b connection exactly the same way your bob manual shows you to wire up a switch.

Rob
Title: Re: Control Panel Setup
Post by: native34 on November 14, 2015, 09:18:31 PM
Ok but where does the 5v come from?
Title: Re: Control Panel Setup
Post by: robertspark on November 14, 2015, 09:50:49 PM
Looking at the encoder manual you are going to have a problem using it:
http://www.adafruit.com/datasheets/pec11.pdf

If you look at the first section: electrical charactoristics, current rating = 1mA @ 5V

Looking at your C32 board all of the limit switches and probe inputs have a pullup resistor (basically a resistor that connects between 5V and the connected pin, so that the switch grounds the input pin)
http://cnc4pc.com/Tech_Docs/C32R5%204_USER_MANUAL.pdf

The problem comes from the input arrangement where (yup this is very common across bobs) the optoisolator input is an LED... and they require a certain current to function which looking at the pullup resistor ratings in your manual is somewhere around:
19mA for the probe input  (5v - ~1.2V) / 200 ohm = 19mA
23mA for a 12V prox input (12v - ~1.2) / 4700 ohm = 23mA
5mA for a 24v prox input (24v - ~1.2v) / 4700 ohm = 5mA

and your encoder is only rated at 1mA...

I cannot tell what chips they have used with the C32 to provide the optoisolated inputs but if you can workout which chips deal with the inputs you can find the datasheets and see what their current requirements are for the LED to operate (there are some high speed switching optoisolators that use very little current too)

Rob

Title: Re: Control Panel Setup
Post by: dude1 on November 14, 2015, 10:52:11 PM
that encoder is not quite what you need, you really need a proper encoder. they are are simple as mud to make you can use a dead printer to get all the parts need and that would give you a ir encoder with a wheel