Hello Guest it is April 18, 2024, 11:22:46 PM

Author Topic: Mach4 Serial Pendant  (Read 3371 times)

0 Members and 1 Guest are viewing this topic.

Offline SimonRafferty

*
  •  46 46
  • Movie SFX Design Engineer
    • View Profile
Mach4 Serial Pendant
« on: May 25, 2020, 05:50:20 PM »
I had wondered how to make a more functional Pendant controller than the ones that you can buy off the shelf.  By more functional, I mean including DROs that are updated from Mach4 and confirmation lights on buttons, again controlled by Mach4 - so you know it has received and understood the instruction.

In place of Buttons, I've used a Capacitive Touch LCD (which works with wet fingers, unlike Resistive screens).

It uses an Arduino Nano as a USB Serial Device.  When a button is pressed, it sends a (short) Serial Message to Mach4.  When Mach4 receives it, it enacts it and sends back the state of the thing it changed (Coolant for example) which in turn causes the button to Illuminate.

The MPG Wheel Sends "I" for Increment & "D" for Decrement.  If the DRO value for an axis changes, it's sent back to the Pendant for display.  With the short messages and fast serial (115200bps) the lag is minimal making the pendant very responsive.

While this is not just a 'script', the scripts it contains may well be useful, particularly for anybody wanting to communicate externally using Serial.  Most of the heavy lifting with the serial was done by Mike https://www.machsupport.com/forum/index.php?topic=42084.msg274487#msg274487

I used a variant of his code to talk to my Servo Drive - then adapted it for this. 
DanTheGaz's posts & particularly videos were invaluable discovering what's under the covers of Mach4

I'm sure I've done some of it the 'wrong' way - but life is for learning!

I've uploaded all the code, including Arduino to GitHub:
https://github.com/SimonRafferty/Mach4-Serial-Pendant

Offline Tweakie.CNC

*
  • *
  •  9,198 9,198
  • Super Kitty
    • View Profile
Re: Mach4 Serial Pendant
« Reply #1 on: May 26, 2020, 03:57:21 AM »
Excellent work SimonRafferty and thank you for sharing the information.

Tweakie.
PEACE
Re: Mach4 Serial Pendant
« Reply #2 on: August 29, 2020, 06:23:13 AM »
hi Simon
I can't press any buttons on the touch screen
Mach4 has no function 

Please help me
another video
https://youtu.be/prVtSM3IG08

 :)


« Last Edit: August 29, 2020, 06:38:21 AM by olaf008 »
Re: Mach4 Serial Pendant
« Reply #3 on: August 29, 2020, 01:17:45 PM »

Offline SimonRafferty

*
  •  46 46
  • Movie SFX Design Engineer
    • View Profile
Re: Mach4 Serial Pendant
« Reply #4 on: August 29, 2020, 01:53:06 PM »
I would first have a look at the Arduino Serial Console (in the Arduino IDE).

You are clearly receiving Serial data from Mach to update the DRO's but either it's not being sent to Mach, or it's not responding to it.

Let me know whether the Arduino is sending data to Mach & we'll go from there.

Si
Re: Mach4 Serial Pendant
« Reply #5 on: August 29, 2020, 02:10:23 PM »
My English is not that good
Re: Mach4 Serial Pendant
« Reply #6 on: July 27, 2022, 09:37:25 PM »
I appreciate that this topic dates from 2020 but I would appreciate if anyone would comment.
I am running Mach4 on my CNC and wish to add a pendant. I have built Simon Rafferty's design from GitHub.
My Mach4 screen set recognises the pendant, I can monitor the serial data which appears to be correct so far but the display is not updating. I suspect that my problem is with the Hunda HB35-1C display.

Has anyone had success with the Visual LCD Display software? I can compile, download (upload) the Hunda example and Simon's script to the Nano.
I can compile, load and get the example to work with the Visual LCD Studio software.
However the Lcds Test & Touch Panel Test do not appear to do anything.
I have Visual LCD Studio software ver 1.1.2.0. Is there a later version?

Thanking you in advance for any help.
Re: Mach4 Serial Pendant
« Reply #7 on: August 25, 2022, 12:59:33 AM »
This is cool stuff. I've done something similar.

The Mach4 screen set is just XML. It's possible to create an automated installer for your device instead of just a default screen set. I've done this for a diy pendant using Python, py2exe and wxWidgets.

Here is the script (with GUI) for editing the screen set using Python and transforming the machine 'ini' file into a dictionary and then back again. It's commented where the code looks ugly but it's portable. There's a pre-built exe made from py2exe in the repo but it's tailored for modbus via tcp and specific IO configs in Mach4.

https://github.com/kethort/esp32-cnc-mpg-handwheel-conversion-mach4/blob/master/src/installer/MPGInstaller.py
« Last Edit: August 25, 2022, 01:15:44 AM by compewter_numerical »

Offline Azalin

*
  •  181 181
    • View Profile
Re: Mach4 Serial Pendant
« Reply #8 on: February 03, 2023, 04:14:06 PM »
Hi @SimonRafferty,
I wanted to thank you. I used some of your code in my project.

Best,
Suat
https://www.youtube.com/watch?v=bvMAy_FzZig