Hello Guest it is March 28, 2024, 04:25:57 PM

Author Topic: Mach4 - Arduino and Touchscreen  (Read 31170 times)

0 Members and 1 Guest are viewing this topic.

Offline DazTheGas

*
  •  778 778
  • DazTheGas
    • View Profile
Mach4 - Arduino and Touchscreen
« on: May 16, 2015, 02:09:04 PM »
As promised heres a very short vid on an arduino being used as a keyboard to control mach4

https://youtu.be/8PV-OlcmqH4

DazTheGas
New For 2022 - Instagram: dazthegas
Re: Mach4 - Arduino and Touchscreen
« Reply #1 on: May 16, 2015, 02:32:05 PM »
Nice!  Wish all videos were as well done.

Offline DazTheGas

*
  •  778 778
  • DazTheGas
    • View Profile
Re: Mach4 - Arduino and Touchscreen
« Reply #2 on: May 16, 2015, 03:01:26 PM »
it was a bit weird trying to sync 2 camcorders and screen capture at same time.

DazTheGas
New For 2022 - Instagram: dazthegas

Offline simpson36

*
  •  1,369 1,369
    • View Profile
Re: Mach4 - Arduino and Touchscreen
« Reply #3 on: May 17, 2015, 06:50:08 AM »
Well done. Both the interface and the video.

The first time I had occasion to mess with the keyboard plugin was in the current 2441 release and it is broken  :(     however, I read that the plug-in from the prev version can be brought forward and it works. Have not tried that yet, but I have noted that the pre-defined jog entries on the setup screen do not include an explicit JogOFF command, so it must be built in to a macro that is actually what the plug-in is calling.

That might explain a user report that MACH4 will imitate a jog while disabled, but the jog does not stop. That would be a nasty bug indeed. Are you experiencing this?


Couple question, if you don't mind;

Are you using the Arduino driver to talk to the plug-in via a COM port or are you emulating a USB device?

The touch screen looks like a 4D. I found it difficult to choose between the built in graphics library and the Arduino library. I was not expecting two vastly different methods and the need to choose one over the other.  Each has advantages and disadvantages. Which did you choose and why? I have decided against using the touch screen, but the dual methodology is still a point of curiosity.

Offline dude1

*
  •  1,253 1,253
    • View Profile
Re: Mach4 - Arduino and Touchscreen
« Reply #4 on: May 17, 2015, 07:19:56 AM »
Well done. Both the interface and the video.

The first time I had occasion to mess with the keyboard plugin was in the current 2441 release and it is broken  :(     however, I read that the plug-in from the prev version can be brought forward and it works. Have not tried that yet, yes you can Daz sent me copy from the last version it fixes the problem its in the last place we spoke

but I have noted that the pre-defined jog entries on the setup screen do not include an explicit JogOFF command, so it must be built in to a macro that is actually what the plug-in is calling.
that was talked about in the mach yahoo page


That might explain a user report that MACH4 will imitate a jog while disabled, but the jog does not stop. That would be a nasty bug indeed. Are you experiencing this?
the M4 scripting manual has the correct code to stop that happening with a external button with a small change when I have it bang on I will post it I don't get my machines computer back to the end of the week Daz have you worked it out save me re-posting
« Last Edit: May 17, 2015, 07:21:32 AM by daniellyall »

Offline DazTheGas

*
  •  778 778
  • DazTheGas
    • View Profile
Re: Mach4 - Arduino and Touchscreen
« Reply #5 on: May 17, 2015, 09:13:03 AM »
The one in the video is an arduino leonado emulating a keyboard thus connected by usb, this was purely to show that the keyboard plugin can be used if required. And they do a Ethernet version.

At the moment I am designing a shield that connects to the ESS and uses the input and output signals and uses a mega chip to run the 4D screen and external functions, this wont be used for jogging as the screen will be mounted in the case, but could be used for homing and moving to preset points etc. All signals will then be sent and recieved through the ESS, and as something comes up that is required I dont have to wait for someone else to implement it. I have been testing out with great success in the PLC script a form off sending out a series of output signals and the mega displaying something (er a bit like binary if you like). will keep you posted on that.


Yes the keyboard plugin does have its drawbacks, only this morning mach4 was in the background whilst I came to have a look at this board (did you and daniellyall stay up all night??) and went to reply to a thread, DAM!!! the 4 keys were still assigned to jogging from yesterday and the machine started moveing, but has been tested using the signal inputs not keyboard with success, they must use internal mach4 functions.

Although even that dont put me off the keyboard principle, its all down to what you can achieve in the PLC script, IE most things are safer to run in the PLC a simple function, if wxlua screen lost focus then dissable keyboard plugin etc.


DazTheGas
New For 2022 - Instagram: dazthegas

Offline simpson36

*
  •  1,369 1,369
    • View Profile
Re: Mach4 - Arduino and Touchscreen
« Reply #6 on: May 17, 2015, 10:08:58 AM »
The one in the video is an arduino leonado emulating a keyboard thus connected by usb, this was purely to show that the keyboard plugin can be used if required.
My question was not clear. The Arduino typically uses the USB physical connection to the computer, but it is not a native USB device. When it is plugged in, the USB buss discovers it and a driver loads which then emulates an old style serial COM port. The conversion is done on a single chip, usually from FTDI, but Atmel now makes a similar chip as found on the newest MEGA (and I think also the DUE).

It is my understanding that the Arduino can become a native USB device. I have not done this, so I know little about it, including if it requires a separate 'shield' like Ethernet.

So to ask the question another way, does the keyboard plug-in talk to a COM port or only native USB devices (typical keyboard)?

And they do a Ethernet version.
An Ethernet version of what? The Arduino or the plug in.?

Yes the keyboard plugin does have its drawbacks, only this morning mach4 was in the background whilst I came to have a look at this board (did you and daniellyall stay up all night??)

Can't speak for anyone else, but I am a consulting engineer and my hours typically match the location in the world where the project is. I've tried getting 20 other engineers on-site to teleconference with me at 3AM their time, but so far, not much luck with that . . . :D

Although even that dont put me off the keyboard principle, its all down to what you can achieve in the PLC script, IE most things are safer to run in the PLC a simple function, if wxlua screen lost focus then dissable keyboard plugin etc.

I don't know much (actually nothing at all) about the keyboard plug-in, but certainly it is another avenue into MACH that does not require programming, so that's a good thing. I am not, however, a fan of USB.

I think it would be correct to say that fundamentally there are three ways to get stuff in and out of MACH4, those being a plug-in (usually only made for a specific device), plugging into an actual or pseudo screen button and launching the desired actions from the button (either by 'action macro' or scripting), or via the PLC script. BTW, 'action macro' is my own term. I don't know if there is an 'official' name for these guys, but the term 'action' is used in the button setup, so there you have it.

For those who know how to program, the PLC script is extremely flexible and powerful. The MACH team recently added a separate thread (processor thread, not forum thread) dedicated to running the PLC script, so there is almost no practical limit on what you can run in there, and there seems to be access to everything from there.

Offline simpson36

*
  •  1,369 1,369
    • View Profile
Re: Mach4 - Arduino and Touchscreen
« Reply #7 on: May 17, 2015, 10:19:39 AM »
Daz sent me copy from the last version it fixes the problem its in the last place we spoke

I have since moved an earlier plug-in forward and it *seems* to be accepting keystrokes in the setup. That's as far as I got . I really do not have a use for the keyboard plug-in. It is just a curiosity.

the M4 scripting manual . . . .

You have mentioned this 'Scripting Manual' before and I have not found such an animal so far. There are three documents that list the MACH4 Lua functions. Is there something else available?
« Last Edit: May 17, 2015, 10:24:04 AM by simpson36 »

Offline DazTheGas

*
  •  778 778
  • DazTheGas
    • View Profile
Re: Mach4 - Arduino and Touchscreen
« Reply #8 on: May 17, 2015, 10:42:01 AM »
Quote
I don't know much (actually nothing at all) about the keyboard plug-in

I am the same, I only know from trial and error when i was going to use the plugin, but after decided to make use of the ESS

Quote
An Ethernet version of what? The Arduino or the plug in.?

There is an ethernet version of the arduino.

Quote
the M4 scripting manual . . . .

Can I get a copy too  ;)

DazTheGas
New For 2022 - Instagram: dazthegas

Offline simpson36

*
  •  1,369 1,369
    • View Profile
Re: Mach4 - Arduino and Touchscreen
« Reply #9 on: May 17, 2015, 11:06:56 AM »
. . .  decided to make use of the ESS

First, let me report that moments ago, I read a confirmation that the nasty jogging bug is either in MACH4 or the supplied keyboard plugin. That's not cast -in-stone, but it is certain that the problem is not being caused by the ESS.

My guess is the Keyboard plug-in, but that speculation, plus 5 bucks, will get you coffee at Starbucks   :-[

It makes good sense to me to leverage the Ethernet connection and I/O that the ESS provides, provided you only need bitwise I/O.
 

 
There is an ethernet version of the Arduino.

Got it.  Normally, I would not want to hijack a thread, but since it's your thread and you are using both Arduino and ESS, you may benefit from knowing that the Arduino Ethernet shield and the ESS get along nicely in the same sandbox, just in case you (or a reader) ever decide to put them in there together. . I ran them both simultaneously in the following configs:

*Each hardwired to the same computer each with its own NIC
*Thru an Ethernet switch with no other devices on the network
*Thru a full operational network with and without Internet access.

In all cases, there was no conflict. Notes:

*The 'default' ESS IP was not used in favor of the more conventional 192.168.x.x
*The Arduino shield was a genuine Arduino part with a legit MAC number.

Edit: Oops, forgot to mention the above has not been tested with the new ESS plug-in released recently.
« Last Edit: May 17, 2015, 11:08:44 AM by simpson36 »