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 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
RoadTests & Reviews
  • Products
  • More
RoadTests & Reviews
Blog Stepper Motor Driver Kit + Motor - Position Encoder
  • Blog
  • RoadTest Forum
  • Documents
  • RoadTests
  • Reviews
  • Polls
  • Files
  • Members
  • Mentions
  • Sub-Groups
  • Tags
  • More
  • Cancel
  • New
Join RoadTests & Reviews to participate - click to join for free!
  • Share
  • More
  • Cancel
  • Author Author: Workshopshed
  • Date Created: 19 Aug 2019 8:42 PM Date Created
  • Views 1944 views
  • Likes 6 likes
  • Comments 1 comment
Related
Recommended

Stepper Motor Driver Kit + Motor - Position Encoder

Workshopshed
Workshopshed
19 Aug 2019

To test the accuracy of the stepper driver I am using a large test rig with a pointer to indicate the position. There is also an optical encoder mounted on the back of the stepper motor and the TMC5161 chip can read the pulses from this and make it's own conclusions about missed steps. So thought it would be good to wire up the encoder and see how it behaves.

 

Wiring the encoder

 

From the datasheet

ABN Incremental Encoder Interface The TMC5161 is equipped with an incremental encoder interface for ABN encoders. The encoder inputs are multiplexed with other signals in order to keep the pin count of the device low. The basic selection of the peripheral configuration is set by the register GCONF. The use of the N channel is optional, as some applications might use a reference switch or stall detection rather than an encoder N channel for position referencing. The encoders give positions via digital incremental quadrature signals (usually named A and B) and a clear signal (usually named N for null or Z for zero).

Note that on the encoder the N channel is labelled Z and on the evaluation board it is N.

 

As mentioned in the comments against the roadtest, the encoder has push pull signals for the outputs. This should make it good for noisy environments. The evaluation board on the other hand has just one input pin per channel.

imageimage

trinamic_lisa  provided a breakout cable from the encoder to bare ends. So I wired up the connectors as follows:

imageimage

At the same time I extended the cables on the motor in preparation for the testing with the test rig.

 

Setup

 

The TMCL-IDE has a tool to check the registers of the TMC5161 and there are several to do with configuration of the encoder. Given the wiring of the hardness the ones that were of main interest were the encoder mode Pol_A, Pol_B and Pol_N.

imageimage

After a bit of experimentation I discovered a loose wire in my harness and that the default values for these registers works fine so I did not need to change these.

 

Reading the encoder position

 

Using the velocity mode, I set the motor moving at a reasonable speed.

 

One method to read the encoder position is to use the "Direct Mode" this has an option to "get axis parameter" for "209 encoder position". This gets you a snapshot value for the encoder in the answer box.

 

The other is to use the register browser and display the X_ENC value. This will update automatically.

 

I found the latching and clearing registers quite confusing but it does seem that you can configure these in such a way that it captures a value X_ENC into ENC_LATCH when the N signal is triggered. This could be used to snapshot fast moving values, automatically determine steps per revolution or to measure the position of an end stop.

For my purposes the X_ENC values should be sufficient so I'm not planning to investigate the latching mechanics any further at this time.

image

One final tip. The encoder cable is quite tricky to remove. Squeeze in the middle section and gently pull it out, I found levering the ends helped a little here.

  • Sign in to reply
  • Workshopshed
    Workshopshed over 5 years ago

    There are some additional notes in the datasheet 12.4 Reference Switches for using the latching mechanism to home a system.

    • 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