
Interface
futurelink/linuxcnc-spindle-encoder
A small AVR controller and a component to connect high precision encoder to LinuxCNC via Modbus RTU

A small AVR controller and a component to connect high precision encoder to LinuxCNC via Modbus RTU
Interface is an open-source printed circuit board by futurelink, from the futurelink/linuxcnc-spindle-encoder repository on GitHub, published under the GPL-3.0 licence. It is a 2-layer board of 43.2 × 64.1 mm with 35 parts on 29 nets, routed with 358 tracks and 13 vias.
It is built around the L7805 and MAX483EPA+. Its parts include 12 resistors, 6 capacitors, 6 diodes, 5 connectors and 3 ICs. It belongs with the interfaces and adapters and robots and motor control boards and the AVR (ATmega, ATtiny) boards of this library.
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.

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.
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.
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.
Go to ./linuxcnc and execute:
$ sudo makeThis 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.intAlso you'll need to load mb2hal module into userspace:
loadusr -W mb2hal config=modbus_config.iniCopy 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.
| Qty | Value | Footprint | References |
|---|---|---|---|
| 6 | 4K7 | Resistor_SMD:R_0805_2012Metric | R4, R5, R6, R7, R8, R9 |
| 4 | 10K | Resistor_SMD:R_0805_2012Metric | R1, R10, R11, R12 |
| 3 | BZX84Cxx | Diode_SMD:D_SOT-23_ANK | D3, D4, D5 |
| 2 | 100uF | Capacitor_SMD:CP_Elec_6.3x5.3 | C4, C5 |
| 2 | 1K | Resistor_SMD:R_0805_2012Metric | R2, R3 |
| 2 | 22pF | Capacitor_SMD:C_0805_2012Metric | C1, C2 |
| 1 | 0,1uF | Capacitor_SMD:C_0805_2012Metric | C6 |
| 1 | 0.1uF | Capacitor_SMD:C_0805_2012Metric | C3 |
| 1 | 16MHz | Crystal:Crystal_SMD_HC49-SD | Y1 |
| 1 | ADDRESS_SW | Button_Switch_THT:SW_DIP_SPSTx04_Slide_9.78x12.34mm_W7.62mm_P2.54mm | SW1 |
| 1 | ATTINY2313-S | Package_SO:SOIC-20W_7.5x12.8mm_P1.27mm | IC1 |
| 1 | CONN_01X04 | Connector_JST:JST_XH_S4B-XH-A_1x04_P2.50mm_Horizontal | P3 |
| 1 | CONN_01X06 | Connector_JST:JST_XH_S6B-XH-A_1x06_P2.50mm_Horizontal | P1 |
| 1 | CONN_02X03 | Connector_PinHeader_2.54mm:PinHeader_2x03_P2.54mm_Vertical | P2 |
| 1 | D | Diode_SMD:D_1206_3216Metric | D6 |
| 1 | L7805 | Package_TO_SOT_SMD:TO-252-2 | U1 |
| 1 | LED_RED | LED_SMD:LED_1206_3216Metric | D1 |
| 1 | LED_YEL | LED_SMD:LED_1206_3216Metric | D2 |
| 1 | MAX483E | Package_SO:SOIC-8_3.9x4.9mm_P1.27mm | U2 |
| 1 | Screw_Terminal_01x02 | TerminalBlock:TerminalBlock_bornier-2_P5.08mm | J2 |
| 1 | Screw_Terminal_1x02 | TerminalBlock:TerminalBlock_bornier-2_P5.08mm | J1 |
The 34 most common of 35 parts.
It measures 43.2 × 64.1 mm and has 2 copper layers, 1.6 mm thick.
35 parts, built around the L7805 and MAX483EPA+. The full list of its parts is on this page, with links to each part's symbol and footprint where PCBKit's library has them.
From the futurelink/linuxcnc-spindle-encoder repository on GitHub, at the commit this page was made from: the board is device/v1.3/interface.kicad_pcb. PCBKit opens the board in the browser, with nothing to install.
Its repository publishes it under the GPL-3.0 licence: you may reuse it on that licence's terms (keep the author's notice, and for a copyleft licence share your changes alike).

futurelink/linuxcnc-spindle-encoder
A small AVR controller and a component to connect high precision encoder to LinuxCNC via Modbus RTU

f0sse/eenx16-modbus-rs485
Kod för ett kandidatarbete, där ett delmoment var att kommunicera med ABB A43 över Modbus och RS-485.

Allen-Synthesis/EuroPi
EuroPi: A reprogrammable Eurorack module based on the Raspberry Pi Pico

peterheinrich/InternetOverSpaghetti
Transmitting IP packages over a pair of spaghetti thus demonstrating how media independent IP really is.


Tircown/ERCF-easy-brd
More informations on how to reset for flashing:\ https://wiki.seeedstudio.com/Seeeduino-XIAO/#enter-bootloader-mode

matthewcieplak/super-sixteen
Code and schematics for the Super Sixteen Eurorack sequencer

NikodemBartnik/Mini-Mars-Rover
Educational robotic platform made to look like a mini mars rover

starlightk7/OpenSFC
OSHW Reproduction Parts related to the Super Famicom / Super Nintendo game console