element14 Community
element14 Community
    Register Log In
  • Site
  • Search
  • Log In Register
  • Community Hub
    Community Hub
    • What's New on element14
    • Feedback and Support
    • Benefits of Membership
    • Personal Blogs
    • Members Area
    • Achievement Levels
  • Learn
    Learn
    • Ask an Expert
    • eBooks
    • element14 presents
    • Learning Center
    • Tech Spotlight
    • STEM Academy
    • Webinars, Training and Events
    • Learning Groups
  • Technologies
    Technologies
    • 3D Printing
    • FPGA
    • Industrial Automation
    • Internet of Things
    • Power & Energy
    • Sensors
    • Technology Groups
  • Challenges & Projects
    Challenges & Projects
    • Design Challenges
    • element14 presents Projects
    • Project14
    • Arduino Projects
    • Raspberry Pi Projects
    • Project Groups
  • Products
    Products
    • Arduino
    • Avnet & Tria Boards Community
    • Dev Tools
    • Manufacturers
    • Multicomp Pro
    • Product Groups
    • Raspberry Pi
    • RoadTests & Reviews
  • About Us
    About the element14 Community
  • Store
    Store
    • Visit Your Store
    • Choose another store...
      • Europe
      •  Austria (German)
      •  Belgium (Dutch, French)
      •  Bulgaria (Bulgarian)
      •  Czech Republic (Czech)
      •  Denmark (Danish)
      •  Estonia (Estonian)
      •  Finland (Finnish)
      •  France (French)
      •  Germany (German)
      •  Hungary (Hungarian)
      •  Ireland
      •  Israel
      •  Italy (Italian)
      •  Latvia (Latvian)
      •  
      •  Lithuania (Lithuanian)
      •  Netherlands (Dutch)
      •  Norway (Norwegian)
      •  Poland (Polish)
      •  Portugal (Portuguese)
      •  Romania (Romanian)
      •  Russia (Russian)
      •  Slovakia (Slovak)
      •  Slovenia (Slovenian)
      •  Spain (Spanish)
      •  Sweden (Swedish)
      •  Switzerland(German, French)
      •  Turkey (Turkish)
      •  United Kingdom
      • Asia Pacific
      •  Australia
      •  China
      •  Hong Kong
      •  India
      •  Japan
      •  Korea (Korean)
      •  Malaysia
      •  New Zealand
      •  Philippines
      •  Singapore
      •  Taiwan
      •  Thailand (Thai)
      •  Vietnam
      • Americas
      •  Brazil (Portuguese)
      •  Canada
      •  Mexico (Spanish)
      •  United States
      Can't find the country/region you're looking for? Visit our export site or find a local distributor.
  • Translate
  • Profile
  • Settings
Project Videos
  • Challenges & Projects
  • element14 presents
  • Project Videos
  • More
  • Cancel
Project Videos
Documents DIY Shapeoko CNC Pendant -- Episode 420
  • Documents
  • Members
  • Mentions
  • Sub-Groups
  • Tags
  • More
  • Cancel
  • New
Join Project Videos to participate - click to join for free!
Related
Recommended
Engagement
  • Author Author: tariq.ahmad
  • Date Created: 11 Nov 2019 10:04 PM Date Created
  • Last Updated Last Updated: 15 Nov 2019 8:24 AM
  • Views 14880 views
  • Likes 10 likes
  • Comments 88 comments

DIY Shapeoko CNC Pendant -- Episode 420

You don't have permission to edit metadata of this video.
Edit media
x
image
Upload Preview
image

One of the great joys of being able to design with electronics is the ability to make your own custom tools. DJ recently picked up a CNC router and in order to make his life a wee bit easier, he’s designed and built a pendant that will allow him to more comfortably, and accurately set up his parts in the machine. Follow along as he tinkers his way to new gadget that, hopefully, will be of use or inspiration for fellow makers and CNC enthusiasts.

Bill of Material:

Product Name Manufacturer Quantity Buy Kit
Panel Mount Push Button Grayhill 7 Buy Now
5mm LED Multicomp 7 Buy Now
680R Resistor Multicomp Pro 7 Buy Now
3D Filament Verbatim 1 Buy Now
Rotary Encoder Bourns 1 Buy Now

 

Additional Parts:

 

Product Name
Teensy LC
Attachments:
Resources_DIY Shapeoko CNC Pendant.zip
image
DIY Shapeoko CNC Pendant

element14 Presents  |  DJ Harrigan's VCP Profile  |  Project Videos

  • shapeoko
  • carbide 3d
  • digital fabrication
  • fusion 360
  • cnc
  • 3D Printing
  • cad
  • usb hid
  • element14 presents
  • xxl
  • rotary encoder
  • microcontroller
  • multicomp
  • dj
  • cam
  • bourn
  • arduino
  • router
  • dj harrington
  • friday_release
  • woodworking
  • e14presents_djharrigan
  • Share
  • History
  • More
  • Cancel
Actions
  • Share
  • More
  • Cancel
  • Sign in to reply

Top Comments

  • rogo
    rogo over 6 years ago +2
    The project is very nice but a cabling scheme would not be refused!
  • thomasvdd
    thomasvdd over 6 years ago +1
    Awesome project! I'm definitely building this, it solves exactly the annoyance I encounter when milling. Could you share the file for the front plate which includes the text?
  • DAB
    DAB over 6 years ago +1
    Nice build. DAB
  • thomasvdd
    thomasvdd over 6 years ago in reply to wildmack

    See my previous post:

     

     

    So the number never changes from 0 to 1 or higher?

    Try to connect two buttons instead of the rotary encoder and check the output of this code again:

    1 button between pin 9 and ground, 1 button between pin 10 and ground.

     

    long newScrollPos = encoderScroll.read();

      Serial.println(newScrollPos );

     

    Do you have a part number of that rotary encoder?

    I am suspecting that you are not using an encoder, but a potentiometer (variable resistor).

    Can you turn the shaft more than 360 degrees or does it have limits? A rotary encoder should be able to continously turn.

     

     

    • Helpful Yes | NoLike (0)Reply
    • Actions
    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • More
    • Cancel
  • wildmack
    wildmack over 6 years ago in reply to thomasvdd

    Hi Thomas, any other ideas?   to me it looks like for some reason the program is never getting to this part:  I tried understanding the logic, but it's way above my head.

    long newScrollPos = encoderScroll.read();

     

      if (abs(newScrollPos - lastScrollPos) >= 4) { // there are roughly four presses detected from each rotation to the next detent

        if (newScrollPos - lastScrollPos > -1){ // positive increase

          switch(activeAxis){

          case X_AXISr:

            Keyboard.press(KEY_RIGHT);

            Keyboard.release(KEY_RIGHT);

          break;

          case Y_AXISr:

            Keyboard.press(KEY_UP);

            Keyboard.release(KEY_UP);

          break;

          case Z_AXISr:

            Keyboard.press(KEY_PAGE_UP);

            Keyboard.release(KEY_PAGE_UP);

          }

        } else {

          switch(activeAxis){

          case X_AXISr:

            Keyboard.press(KEY_LEFT);

            Keyboard.release(KEY_LEFT);

          break;

          case Y_AXISr:

            Keyboard.press(KEY_DOWN);

            Keyboard.release(KEY_DOWN);

          break;

          case Z_AXISr:

            Keyboard.press(KEY_PAGE_DOWN);

            Keyboard.release(KEY_PAGE_DOWN);

          }

        }

        lastScrollPos = newScrollPos;

      }

     

      if (activeAxis != lastAxis){

        digitalWrite(lastAxisLED, LOW);

        switch(activeAxis){

          case X_AXISr:

            digitalWrite(PIN_LED_X, HIGH);

            lastAxisLED = PIN_LED_X;

          break;

          case Y_AXISr:

            digitalWrite(PIN_LED_Y, HIGH);

            lastAxisLED = PIN_LED_Y;

          break;

          case Z_AXISr:

            digitalWrite(PIN_LED_Z, HIGH);

            lastAxisLED = PIN_LED_Z;

          break;

        }

        lastAxis = activeAxis;

      }

     

     

      if (activeSpeed != lastSpeed){

        digitalWrite(lastSpeedLED, LOW);

        switch(activeSpeed){

          case SPD_FAST:

            Keyboard.press(KEY_4);

            Keyboard.release(KEY_4);

            digitalWrite(PIN_LED_FAST, HIGH);

            lastSpeedLED = PIN_LED_FAST;

          break;

          case SPD_1MM:

            Keyboard.press(KEY_3);

            Keyboard.release(KEY_3);

            digitalWrite(PIN_LED_1MM, HIGH);

            lastSpeedLED = PIN_LED_1MM;

          break;

          case SPD_01MM:

            Keyboard.press(KEY_2);

            Keyboard.release(KEY_2);

            digitalWrite(PIN_LED_01MM, HIGH);

            lastSpeedLED = PIN_LED_01MM;

          break;

          case SPD_001MM:

            Keyboard.press(KEY_1);

            Keyboard.release(KEY_1);

            digitalWrite(PIN_LED_001MM, HIGH);

            lastSpeedLED = PIN_LED_001MM;

          break;

        }

        lastSpeed = activeSpeed;

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • More
    • Cancel
  • thomasvdd
    thomasvdd over 6 years ago in reply to wildmack

    So the number never changes from 0 to 1 or higher?

    Try to connect two buttons instead of the rotary encoder and check the output of this code again:

    1 button between pin 9 and ground, 1 button between pin 10 and ground.

     

    long newScrollPos = encoderScroll.read();

      Serial.println(newScrollPos );

     

    Do you have a part number of that rotary encoder?

    I am suspecting that you are not using an encoder, but a potentiometer (variable resistor).

    Can you turn the shaft more than 360 degrees or does it have limits? A rotary encoder should be able to continously turn.

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • More
    • Cancel
  • wildmack
    wildmack over 6 years ago in reply to thomasvdd

    I don't see a change when I ground pins 9 and 10 to ground.  I see the change if I turn the encoder, but not by grounding the pins??

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • More
    • Cancel
  • wildmack
    wildmack over 6 years ago in reply to thomasvdd

    I changed to pins 22 and 23, but get the same results as before.

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • More
    • Cancel
  • wildmack
    wildmack over 6 years ago in reply to thomasvdd

    Interesting.  I included this in the program

    long newScrollPos = encoderScroll.read();

      Serial.println(newScrollPos );

      if (digitalRead(PIN_ENC_A) == LOW){

    Serial.println("ENC A TRIGGERED");

    if (digitalRead(PIN_ENC_B) == HIGH){

    Serial.println("ENC B TRIGGERED");

     

     

    Here are the results.  when I'm not turning thr encoder, it keeps putting out 00000000000000

    image

    And I included this where it should be outputting the left, right, up, down

     

    Serial.println("NEW_NEW");

     

    but "NEW_NEW" never showed up in the serial monitor.  For some reason, it's not going past this line

     

    if (abs(newScrollPos - lastScrollPos) >= 4) { // there are roughly four presses detected from each rotation to the next detent

        if (newScrollPos - lastScrollPos > -1){ // positive increase

          switch(activeAxis){

     

    Any more ideas??  Thanks Dave...........

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • More
    • Cancel
  • thomasvdd
    thomasvdd over 6 years ago in reply to wildmack

    As a last suggestion for today:

    The code should also work jf you add a switch between pin 9 and ground or pin 10 and ground. This should give the same result as using an encoder (but less practical of course). By trying this we can rule out a faulty encoder.

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • More
    • Cancel
  • thomasvdd
    thomasvdd over 6 years ago in reply to wildmack

    You can also try soldering it to 2 other pins.

    Change the used pin numbers in the code:

     

    #define PIN_ENC_A     9

    #define PIN_ENC_B     10

     

    And add these two lines in setup:

     

    void setup() {

         pinMode(PIN_ENC_A, INPUT_PULLUP);

         pinMode(PIN_ENC_B, INPUT_PULLUP);

         ...

    }

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • More
    • Cancel
  • thomasvdd
    thomasvdd over 6 years ago in reply to wildmack

    Wiring looks good too.

    Try adding a println here:

     

    long newScrollPos = encoderScroll.read();

    Serial.println(newScrollPos );

     

    The number should increase every time you turn the encoder.

    As an additional check, also add these lines (will trigger if the encoder gives a pulse):

     

    if (digitalRead(PIN_ENC_A) == LOW){

        Serial.println("ENC A TRIGGERED");

      }

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • More
    • Cancel
  • wildmack
    wildmack over 6 years ago in reply to thomasvdd

    Look OK?

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • More
    • Cancel
<>
element14 Community

element14 is the first online community specifically for engineers. Connect with your peers and get expert answers to your questions.

  • Members
  • Learn
  • Technologies
  • Challenges & Projects
  • Products
  • Store
  • About Us
  • Feedback & Support
  • FAQs
  • Terms of Use
  • Privacy Policy
  • Legal and Copyright Notices
  • Sitemap
  • Cookies

An Avnet Company © 2026 Premier Farnell Limited. All Rights Reserved.

Premier Farnell Ltd, registered in England and Wales (no 00876412), registered office: Farnell House, Forge Lane, Leeds LS12 2NE.

Follow element14

  • X
  • Facebook
  • linkedin
  • YouTube