Giter VIP home page Giter VIP logo

linuxcnc-spindle-encoder's Introduction

Incremental encoder Modbus RTU interface

This device is an interface to read incremental encoder meanings with Modbus. It supports encoders from 100 to 1000PPR and interpolate position up to 4 times, so maximum resolutuion is 4000PPR.

Device KiCAD 3D view

It's tested on 1000PPR encoder and it reads correct values on about 1000RPMs on internal 8MHz ATtiny2313 RC oscillator, and about 2000PPM on 16MHz crystal.

What does it do?

This small attiny2313 module and LinuxCNC component allows you to connect almost any precision encoder into LinuxCNC and it works even if it has no Z phase output.

It allows your lathe execute G33, G33.1 (synchronized motion) and G76 (threading) canned cycles and use G96 (constant surface speed) spindle control strategy.

Modbus

Device has slave ID 0x85. There are 6 16bit analog registers starting from reference address 0x00, containing (0)heartbeat, (1)current position, (2)position increment, (3)current speed in RPM, (4)current Z-index value and (5)encoder direction.

Device UART speed is 38400bps.

Connection to LinuxCNC

Go to ./linuxcnc and execute:

$ sudo make

This will install component into your LinuxCNC.

Then you need this component in your HAL:

loadrt spindle_encoder
addf spindle-encoder.0 servo-thread
setp spindle-encoder.0.ppr 4096
net spindle-heartbeat  spindle-encoder.0.heartbeat <= mb2hal.spindle-encoder.heartbeat.int
net spindle-pos-in     spindle-encoder.0.pos-in <= mb2hal.spindle-encoder.pos-in.float
net spindle-pos-out    spindle-encoder.0.pos-out => motion.spindle-revs
net spindle-speed-rpm  spindle-encoder.0.speed-rpm <= mb2hal.spindle-encoder.speed-rpm.int
net spindle-speed      spindle-encoder.0.speed-rps => motion.spindle-speed-in
net spindle-index      spindle-encoder.0.index-in <= mb2hal.spindle-encoder.index.int
net spindle-index-ena  spindle-encoder.0.index-enable <=> motion.spindle-index-enable
net spindle-dir        spindle-encoder.0.direction <= mb2hal.spindle-encoder.direction.int

Also you'll need to load mb2hal module into userspace:

loadusr -W mb2hal config=modbus_config.ini

Copy modbus_config.ini from ./linuxcnc into your lathe configuration directory. Write your serial port device to SERIAL_PORT option in that ini file. Correct SERIAL_DELAY_MS if you need.

linuxcnc-spindle-encoder's People

Contributors

futurelink avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.