A Teensy -> Python Interface Manualmatic MPG/pendant

More
30 Dec 2021 20:52 #230361 by fletch
De scription

A Teensy based pendant using the user space Python LinuxCNC interface.Theoretically will require copying just two files to config directory (or globally?) and adding a single line to custom.hal.

Will one day optionally use an ini file for config and read options from machine config ini file.

Why?

Once I convert my mill to CNC, I want to continue to be able to use it manually – replicating some of the functionality of a DRO and having a pseudo power feed.So, slightly inspired by the rotary button reset on RotarySMP’s Maho control panel (the reset is mentioned elsewhere) and partly by This Old Tony’s ‘manual cnc’ comment at the end of one of his Maho videos ,  I thought I’d make a pendant my 2021 Christmas project.

Unfortunately, thanks to my location it has recently become much more expensive to get MESA cards (or anything) shipped from the EU - my $119 7i96 card cost me €194.58, so while the $49.00 7i73 pendant/control panel interface card is well priced, it would cost €113.91 to get it in my hands...

A bit of digging in the forums led me to ArcEye’s Arduino pendant - very good for almost a decade ago but microcontrollers have moved on somewhat since then. I also wanted to build something that is easy for anyone to install and flexible to use without tying it to a particular UI.

None of the solutions I found (and there are many, some of which I don’t understand) appear to make full use of the user space Python interface, so I thought I’d give that a try.

This pendant uses a touch screen primarily because there seems to be a dearth of non-touch screen SPI displays – and I like to support Adafruit as they contribute massively to the makerspace. I wouldn’t mind a screen that wasn’t offset though (I’m tempted to use it portrait for soley that reason). All primary operations will be button or encoder based (I prefer tactile Uis) – the touch screen will only be used for entering zero offset values and minor functions.

Huge credit also to PJRC , not just for the Teensy but also for the interrupt based fast encoder library that enabled me to wrap an callback based encoder/button library around it – 100% lossless encoder steps FTW!The schematic is designed to work with a Teensy 4.1 – it will also work with a 4.0 but you will lose the pins for the 5 physical buttons under the screen (so they would have to be operated via the touchscreen).All the button switches and rotary encoders are easily obtainable from eBay, including the MPG. It is intended to have a hard wired Estop but the backlight control pin can be traded for a soft estop.

Obviously this is a work in progress/proof of concept but here is a quick and some pictures and my notes (anything maked with a '~' is not even looked at!):

 

 

 

 

This browser does not support PDFs. Please download the PDF to view it: Download PDF

Attachments:
The following user(s) said Thank You: Pro_El, Markyd, Sadmeatball, lomas8

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

More
30 Dec 2021 20:58 #230363 by fletch
Here is a quick Youtube video which I would edit into the post but the url links go a bit mad when I open the edit window!
The following user(s) said Thank You: tommylight

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

More
30 Dec 2021 22:11 #230369 by tommylight
Very nice, thank you.
The following user(s) said Thank You: fletch

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

More
30 Dec 2021 22:18 #230370 by fletch
Thank you - still a long way to go, but I think the concept is proven. I will release it all once the embarrassment factor is reduced in my code (neither Python or C++ are my first language)
The following user(s) said Thank You: billykid

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

More
12 Jan 2022 20:13 #231600 by fletch
Making good progress on this now (although a bit more than a Christmas project).

The first part of releasing the source code is the EncoderButton library that underpins the MPG and spindle/feed controlsand button callbacks - I've cleaned it up, documented and published it here on github .

It is also available in the Arduino IDE Library Manager if anyone is playing with Arduinos and encoder buttons (they really are an excellent interface for microcontrollers).

 

Feel free to nudge me if you're interested in testing or playing with this project.
 
Attachments:
The following user(s) said Thank You: phillc54, tommylight, ALittleOffTheRails

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

More
15 Jan 2022 03:56 #231855 by tuzki
Does the mpg have a delay? I see that the mpg and the PC are not synchronized. When the mpg stops rotating, the value on the PC is still changing. Is this the real situation.

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

More
15 Jan 2022 09:53 #231878 by fletch
The MPG can generate jog instructions far, far faster than the CNC machine can move (I suspect this is the case for all MPGs?) so if the MPG quickly sends a single or multiple instruction(s) to jog (say) 25mm, that may take the machine a couple of seconds to complete the move, especially if you have the jog velocity set low.

The axes on the pendant display and the gmoccapy display show the same values at the same time (well, within 0.2 seconds, which is the refresh rate I have set for the pendant display).

Short answer: No, there is no delay from the MPG - although it is not real time, as operates in the linuxcnc userspace like all the other GUIs. :-)

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

More
15 Jan 2022 10:01 #231879 by fletch
Addendum: The 'lossless' bit of the EncoderButton library enables me to send a single instruction to the LinuxCNC Python Interface for multiple jog instructions, so avoids swamping the userspace component with both serial and jog instructions to linuxcnc. This should, in practice, make the pendant more responsive than a touchscreen or keyboard. Eg, if you whizz the MPG around 50 steps of 0.1mm, the pendant will send a single instruction to jog 5mm rather than 50 x 0.1mm instructions.

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

More
15 Jan 2022 13:58 #231891 by tuzki
Very nice, thank you.I'm going to try
The following user(s) said Thank You: fletch

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

More
19 Jan 2022 09:14 - 19 Jan 2022 09:17 #232421 by fletch
Another step fowards, this is a new (as in written for this project) Arduino utility library to help work with the various display areas and the flicker free drawing of the large rapidly changing X, Y, Z & A axes.

Available on github and as DiplayUtils in the Arduino Library Manager:

 

The rest of the Manuamatic code is nearly there - all the manual and auto functionality is now in place - just needs a fair bit of tidying up though. Refactoring FTW...
Attachments:
Last edit: 19 Jan 2022 09:17 by fletch.
The following user(s) said Thank You: phillc54, tommylight, tuzki

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

Time to create page: 0.223 seconds
Powered by Kunena Forum