element14 Community
element14 Community
    Register Log In
  • Site
  • Search
  • Log In Register
  • About Us
  • 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 Boards Community
    • Dev Tools
    • Manufacturers
    • Multicomp Pro
    • Product Groups
    • Raspberry Pi
    • RoadTests & Reviews
  • 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
      •  Korea (Korean)
      •  Malaysia
      •  New Zealand
      •  Philippines
      •  Singapore
      •  Taiwan
      •  Thailand (Thai)
      • 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 11181 views
  • Likes 10 likes
  • Comments 81 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 5 years ago +2
    The project is very nice but a cabling scheme would not be refused!
  • thomasvdd
    thomasvdd over 5 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 5 years ago +1
    Nice build. DAB
Parents
  • thomasvdd
    thomasvdd over 5 years ago

    I have made the project and can confirm that the original code runs just fine.

    The behavior you described is how it is intended to function, as you can see from the code:

     

    When pressing one of the speed buttons, the activespeed variable is being changed.

     

      if (buttonFast.fallingEdge()) {

        activeSpeed = SPD_FAST;

      }

     

    The next time the loop() executes, the if statement triggers and presses a key (KEY_4)

     

    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;

     

    When pressing one of the X, Y, Z buttons, the activeAxis variable is being changed.

    (uncomment the serial print to verify if your button works)

     

      if (buttonX.fallingEdge()) {

        activeAxis = X_AXIS;

        //Serial.println("X");

      }

     

    HOWEVER, the corresponding button (KEY_RIGHT) is ONLY being pressed when the encoder is turned.
    Pressing the X, Y or Z button only will NOT press any keyboard key.

     

      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_AXIS:

            Keyboard.press(KEY_RIGHT);

            Keyboard.release(KEY_RIGHT);

          break;

     

    In conclusion: if your CNC doesn't move, your rotary encoder is probably badly connected.

    Check the connections from encoder to teensy (also the middle ground pin). If that fails, I would buy a new encoder and try again.

     

    Hope this helped

    Thomas

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

    Hello Thomas, thank you so much for helping me out with this, it's driving me nuts.   I bought 2 encoders, so I'll try changing them out today.  I checked the impedance on the encoder, and it changed as I rotated it, so I assumed it was working.  I used the three sided pins of the encoder, outer pin goes to pin 9 on the controller, the center pin is to ground, and the other outer pin is connected to pin 10 on the controller.   I opened the serial monitor and uncommitted the serial print line and each time I press the X,Y,X buttons it shows on the output of the serial monitor screen.  Should it repeat the X,Y,Z on the screen if I turn the encoder?   I'm still learning how to program, so this is way above my understanding.  Is there any way to see if the controller is actually sending the commands, like KEY_RIGHT?  I really need to get this working, so I really appreciate your help.  I just can't figure out what I'm doing wrong.  I have tried it on Easel, and Universal Gcode Sender, and my CNC doesn't move, but it moves if I use the up,down,left,right on my keyboard.

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

    No, I just tried that small sketch and the Serial Monitor showed that the encoder was doing what it should.  Still don't know why my other sketch isn't working.  Do you see anything wrong in the output I provided?

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

    I don't see any issues. Send me the exact file you are using right now, I'll take another look.

    Try downloading the original file again, maybe you accidentally changed something..

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

    The file I sent is the original file.  I downloaded it right before I sent you the data.  Maybe I'm missing something on my pin inputs.  I connected everything to the sketch pin call out, but maybe there is something else that I'm not aware of.  Here are some pics of the Teensy pins that I'm using.  I only connected one ground wire and it's the same grounds that the encoder is connected to.  I do see there is another ground shown on the schematic but I didn't connect anything to it.  If the program ran fine for you, and if my pin connections look correct, the only thing I can think of is the Teensy isn't working correctly, but it was brand new.imageimageimageimage

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

    You could try to program the Teensy via another PC, preferably with a fresh install of Arduino IDE and the necessary libraries.

     

    If that fails, try a Teensy 2.0, which I am using. I don't have a Teensy 3.2 to test.

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

    That's what I did on the one I sent you.  I loaded everything on my surface pro.   I've been trying to change the program so it only has a KEY_RIGHT command to see if I could open a word document and turn the encoder and get the courser to move to the right when I turn it.  But I haven't figured out how to do it yet, I keep getting error messages when I try to verify.  I just bought the Teensy LC  maybe I'll try that and see if it works, I really don't want to have to buy another Teensy.  Have you tried to see if your's will move the courser in a document? If the computer just thinks it's another keyboard, shouldn't it move the courser around?

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

    Yeah, all keystrokes work since it simply emulates a keyboard.

    Hopefully the LC will work!

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

    I'll let you know, after I try it.  Do you use yours on the  Shapeoko ?

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

    No, I modified mine to run my Xcarve.

    But all keyboard commands are working for me (also arrow keys etc. )

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

    OK, I'm trying to use this on the xPro V3 controller, which I think was used on some of the Xcarve machines.  Can you tell me the changes you made for it to work on your Xcarve, or share the sketch and let me try that?

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

    I tried the Teensy LC and still no go.  I must be doing something wrong.  I'm following the pin connection per the sketch.  I ordered the Teensy 2 but I don't think it's the Teensy.  When I plug the Teensy in to the computer after I flash it, it says setting up keyboard, then comes back and says keyboard ready to use??

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

    I tried the Teensy LC and still no go.  I must be doing something wrong.  I'm following the pin connection per the sketch.  I ordered the Teensy 2 but I don't think it's the Teensy.  When I plug the Teensy in to the computer after I flash it, it says setting up keyboard, then comes back and says keyboard ready to use??

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

    Strange... it has to be a problem in the code...

    It can't be the teensy, since the example sketch of the rotary encoder did work.

     

    Try changing:

      for (int ii = 2; ii < 11; ii++) pinMode(ii, INPUT_PULLUP);

    To:

      for (int ii = 2; ii < 9; ii++) pinMode(ii, INPUT_PULLUP);

     

    Otherwise, try starting with only the code related to the rotary encoder. If that works, you can start adding pieces of code bit by bit and see wheter it keeps working fine.

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

    Thank you, Thank you, Thank you  Thomas, that was it.  Moves in X, Y, and Z as I turn the encoder.  The only thing that doesn't work is the speed, but I don't think there is a way to control the speed in Easel using the keyboard.  Now I just have to print the 3D models and carve and engrave the face plate.  Can't wait to get it done.  Thanks again.  Dave...............

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

    Great!!! That really was my last hope :-D

    I don't use Eagle myself, so I don't know about the speed.

    I'm glad that it works in the end, have fun with it!

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • More
    • Cancel
  • angryboy
    angryboy over 5 years ago in reply to thomasvdd

    thanks you, I had the same probleme and i've resolve him thanks you verry much

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • More
    • Cancel
  • azbrewer
    azbrewer over 4 years ago in reply to wildmack

    Another thank you, had same issue and that fixed it.

    • 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 © 2025 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.

ICP 备案号 10220084.

Follow element14

  • X
  • Facebook
  • linkedin
  • YouTube