CNC style Pendant



  • @dc42 said in CNC style Pendant:

    could be adapted to drive the PanelDue port using a small board based on an attiny microcontroller

    How will this work, in addition to the Panel Due or instead of it?

    I am using a tethered PanelDue, so almost a pedant, and having a mechanical or even virtual joystick would simplify moving in x/y and Z compared to the existing Move screen.


  • administrators

    Very good point! In other win for SBC choice on Duet3!


  • administrators

    @zapta said in CNC style Pendant:

    @dc42 said in CNC style Pendant:

    could be adapted to drive the PanelDue port using a small board based on an attiny microcontroller

    How will this work, in addition to the Panel Due or instead of it?

    I am using a tethered PanelDue, so almost a pedant, and having a mechanical or even virtual joystick would simplify moving in x/y and Z compared to the existing Move screen.

    Either. From an earlier post:

    @danal said in CNC style Pendant:

    Note: A PanelDue would not be absolutely required.

    BTW, PanelDue has a connector with 3 spare inputs on it. I intended this to be used to support a rotary encoder with push button. This connector might be useful to connect a pendant, however I expect a pendant would need more than 3 inputs.



  • @dc42 said in CNC style Pendant:

    BTW, PanelDue has a connector with 3 spare inputs on it. I intended this to be used to support a rotary encoder with push button. This connector might be useful to connect a pendant, however I expect a pendant would need more than 3 inputs.

    Most of them (that are not USB) just break out all the switch contacts, plus a A,B,A-,B- for the rotary. It would be possible to diode or resistor matrix several of the switches and therefore use fewer pins... however... given that a widely available 3.3V candidate, the ESP32, has LOTS of input pins, my inclination for hobbyist/one-off is to just hook everything to a separate pin, and handle it in the script. Easier to understand for people new-ish to hardware and scripting.

    Summary: Probably a small number of pins (but more than 3) in a truly engineered product that will be built in hundreds or thousands; probably a dozen to fourteen pins in a one-off hobbyist style.

    P.S. I have been contacted by one user who sent me a wiring diagram. I'll post some of my thoughts here in the next few days.



  • Nice idea

    With 3 inputs we can do all we want

    The encoder need only 2 inputs
    And the third can be for "activate pendant wheel"

    All the other feature like :

    • axis select
    • ratio select

    can be done on paneldue



  • @fdem said in CNC style Pendant:

    All the other feature like :

    • axis select
    • ratio select
      can be done on paneldue

    Sorry, but no. That usage pattern REALLY misses the point of having a pendant on a CNC machine.

    I hope that does not come across as critical... I am only attempting to clearly communicating the "use case" or "user story".

    It is often true that when the machine operator is using a pendant, the main HMI (Human Machine Interface, in this case the PanelDue), is out of reach. Far out of reach. Like "Out Of Reach" being defined as "Operator has to get up from laying on the floor and walk completely around a piece of equipment" or similar. Again, this is VERY common on CNC, and can even be the case on 3D Print (I have printer setups that require six or more steps to get from some of the places where I'd be using a pendant, to get from there to the Panel Due... and my stride is almost a meter because I am just a hair under two meters tall.)

    Short version: When using a pendant, don't expect to reach other controls. That's why pendants have all of those switches, and not just a wheel.



  • Why paneldue must be fix ?

    When i use pendant, i'd like see tool coordinate.

    In fact, pendant and encoder wheel can be the same device and when not used is the cnc screen



  • Very VERY preliminary ideas for implementation:

    Buy one of these for about USD $10 (shipped) on Amazon: https://www.amazon.com/gp/product/B079PVCF2G/
    Programmable with Arduino IDE, and TONS of input pins.

    Follow these directions to set up your Arduino IDE for this board. When the physical board arrives:

    • Hook it up (USB mini cable)
    • Use the "Tools" menu, "Board", in the IDE to select ""ESP32 Dev Board".
    • Select a port just like you do for an Arduino.
    • There will be a bunch of new settings in "Tools", between "Board" and "Port"... leave them all at default.

    From that point, it programs just like an Arduino. Most libraries will work. Any sketch or library that DIRECTLY manipulates hardware registers will not work.

    Physical Wiring: Something like this:
    0_1566060266676_920e0b1f-d05c-4c15-9cd2-4ba14f43e258-image.png

    It is possible that Diodes will be needed on TX2/RX2, if this is "Parallel" with a PanelDUE.

    Arduino Sketch: Below is the beginning of an idea that can be expanded. Note, this compiles and outputs correct diagnostics when I ground one of the axis or feedrate switch pins, but I have no way to truly test it, and absolutely no way to test the encoder wheel; so wheel code is just not there (yet).

    Also note the "style" or "architecture" of this sketch is VERY "brute force", there would be much more elegant ways to code this. I'm intentionally keeping it simple so beginners can understand, and change, it.

    // Duet2_CNC_Pendant
    // Intended to run on an ESP32 and interface hardware pendant to Duet3d/RepRap
    // controller via TTL serial at 3.3V. Intended to run "in parallel" or "in place"
    // of a PanelDue. 
    // Example pendants can be found on E-bay; must have individual wires (not usb).
    
    /*
    Copyright (c) 2019 Danal Estes, all rights reserved. 
    Permission is hereby granted, free of charge, to any person obtaining
    a copy of this software and associated documentation files (the "Software"),
    to deal in the Software without restriction, including without limitation
    the rights to use, copy, modify, merge, publish, distribute, sublicense,
    and/or sell copies of the Software, and to permit persons to whom the Software
    is furnished to do so, subject to the following conditions:
    
    The above copyright notice and this permission notice shall be included in all
    copies or substantial portions of the Software.
    
    THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
    EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
    FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 
    IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
    DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
    ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
    */
    
    
    //Encoder Wheel 
    #define WheelA1    39
    #define WheelB1    36
    #define WheelA2    35
    #define WheelB2    34
    
    // Axis Switch
    #define SwitchX    33
    #define SwitchY    32
    #define SwitchZ    27
    #define Switch4    26
    #define Switch5    25
    #define Switch6    23
    
    // Speed Switch
    #define SwitchX1   22
    #define SwitchX10  21
    #define SwitchX100 14
    
    // Second Serial Port (for parallel with, or in place of, PanelDue)
    #define RXD2 16
    #define TXD2 17
    
    
    int  feedRate = 1800;
    char axis     = 'X';
    
    void setup() {
      Serial.begin(115200);
      Serial.print("");        // Clear any garbage from boot. 
      Serial.println("Duet2_CNC_Pendant initalizing.");
      Serial2.begin(57600, SERIAL_8N1, RXD2, TXD2);  // Baud must match PanelDue (if one is present)
    
    //Encoder Wheel 
    pinMode(WheelA1,INPUT_PULLUP);
    pinMode(WheelB1,INPUT_PULLUP);
    pinMode(WheelA2,INPUT_PULLUP);
    pinMode(WheelB2,INPUT_PULLUP);
    
    // Axis Switch
    pinMode(SwitchX,INPUT_PULLUP);
    pinMode(SwitchY,INPUT_PULLUP);
    pinMode(SwitchZ,INPUT_PULLUP);
    pinMode(Switch4,INPUT_PULLUP);
    pinMode(Switch5,INPUT_PULLUP);
    pinMode(Switch6,INPUT_PULLUP);
    
    // Speed Switch
    pinMode(SwitchX1,INPUT_PULLUP);
    pinMode(SwitchX10,INPUT_PULLUP);
    pinMode(SwitchX100,INPUT_PULLUP);
    }
    
    void loop() {
      if (digitalRead(SwitchX1  ) == LOW) {feedRate = 1800;}
      if (digitalRead(SwitchX10 ) == LOW) {feedRate = 18000;}
      if (digitalRead(SwitchX100) == LOW) {feedRate = 180000;}
      // Maybe put in logic to only include feedrate if it changed. 
    
      if (digitalRead(SwitchX) == LOW) {axis = 'X';}
      if (digitalRead(SwitchY) == LOW) {axis = 'Y';}
      if (digitalRead(SwitchZ) == LOW) {axis = 'Z';}
      if (digitalRead(Switch4) == LOW) {axis = '4';}
      if (digitalRead(Switch5) == LOW) {axis = '5';}
      if (digitalRead(Switch6) == LOW) {axis = '6';}
    
    // *******************************************
    // Need something to read wheel encoder here. 
    // *******************************************
    
      if (1) {    // Need "if the wheel moved" logic here. 
        // How far to move?? Numerically?
        int m = 10; 
        Serial.printf("G0 %c%d F%d\n",axis,m,feedRate);   // For Debugging
        // Possible need to listen before transmitting to avoid collisions.
        Serial2.printf("G0 %c%d F%d\n",axis,m,feedRate);   
      }
     // Required somewhere in main loop on ESP chipset to allow background tasks.
     yield(); 
     // If any part of sketch does not yield() or delay() for about 3 seconds, chip will reboot. 
    } // End main loop
    


  • @fdem said in CNC style Pendant:

    Why paneldue must be fix ?

    This is not a "fix" for panelDUE, it will not affect existing panelDue at all.
    It is an addition, for people who prefer a "hard click" wheel to a touch screen. By all means, anyone who likes the screen should stick with it.

    When i use pendant, i'd like see tool coordinate.

    In fact, pendant and encoder wheel can be the same device and when not used is the cnc screen

    Then you are in great shape. Use the screen you have.

    There are some other folks that specifically want a pendant with a click wheel, not a touch screen.



  • I already done my own pendant
    I use a a chinese pendant and a stm32f407 board from waveshare

    It work pefectly

    Why can't do a really simple pendant with only the most important thing for me :

    • the rotary encoder

  • administrators

    If we ever manufacture a pendant interface, we will use a attiny44a processor, because it can be obtained in a small package (smaller than the attiny25 or attiny45), is cheaper than the attiny45, and we already use them in two types of filament monitor and the Smart Effector. It's only work pending for Duet 3 that is stopping us making a prototype now.

    I appreciate that for someone building a one-off, using an Arduino Pro Micro or ESP8266 board or Teensy or similar is easier.



  • @fdem said in CNC style Pendant:

    I already done my own pendant
    I use a a chinese pendant and a stm32f407 board from waveshare

    It work pefectly

    That is fantastic. Are you willing to share the exact pendant, the wiring, and the STM code?

    Why can't do a really simple pendant with only the most important thing for me :

    • the rotary encoder

    I'm confused... you just said you already have one that works perfectly? Are you asking for something else to be developed?



  • @danal said in CNC style Pendant:

    I'm confused... you just said you already have one that works perfectly? Are you asking for something else to be developed?

    i have just reply to this post 🙂
    for me it's possible to have a usefull simple pendant with only 3 inputs

    @dc42 said in CNC style Pendant:

    BTW, PanelDue has a connector with 3 spare inputs on it. I intended this to be used to support a rotary encoder with push button. This connector might be useful to connect a pendant, however I expect a pendant would need more than 3 inputs.



  • @fdem said in CNC style Pendant:

    @danal said in CNC style Pendant:

    I'm confused... you just said you already have one that works perfectly? Are you asking for something else to be developed?

    i have just reply to this post 🙂
    for me it's possible to have a usefull simple pendant with only 3 inputs

    @dc42 said in CNC style Pendant:

    BTW, PanelDue has a connector with 3 spare inputs on it. I intended this to be used to support a rotary encoder with push button. This connector might be useful to connect a pendant, however I expect a pendant would need more than 3 inputs.

    Again, that's great. As you point out, a rotary encoder only needs two inputs... phase A and B (plus power and ground). Again, this discussion is about doing more than just the encoder.

    Also again, are you willing to share what you have done? Post a wiring diagram? Post the code? Here, or on github?



  • Yes i'll share soon


Log in to reply