How to setup spindle speed feedback from TACHO?
01 Dec 2019 18:13 #151681
by idea
How to setup spindle speed feedback from TACHO? was created by idea
I'm looking for soe guidance to setup spindle speed control feedback using the TACHO signal from the brushless motor controller (motor is up to ~20,000rpm (micro mill). So i'm not looking for tapping ability, but want to correct for the low inertia of the motor/spindle when running loaded / unload.
I have the PWM signal working, with start / stop and speed control working correctly. I've tried using the encoder / counter to setup feedback but I dont think that is the correct methodology.
The first stage i'm looking for is to convert the TACHO [true/false] into rps/rpm that would then be of use. Any thoughts on how to do this?
The [spindle-vel-fb-rps] signal should then feed into the PID loop already present in the HAL?
I have the PWM signal working, with start / stop and speed control working correctly. I've tried using the encoder / counter to setup feedback but I dont think that is the correct methodology.
The first stage i'm looking for is to convert the TACHO [true/false] into rps/rpm that would then be of use. Any thoughts on how to do this?
The [spindle-vel-fb-rps] signal should then feed into the PID loop already present in the HAL?
Please Log in or Create an account to join the conversation.
01 Dec 2019 19:37 #151685
by PCW
Replied by PCW on topic How to setup spindle speed feedback from TACHO?
If the tachometer output is a frequency output proportional to spindle speed then
an encoder is the proper way measure this frequency and present it as a hal pin
Converting the encoder velocity signal to RPM/RPS is done by setting the encoder scale
an encoder is the proper way measure this frequency and present it as a hal pin
Converting the encoder velocity signal to RPM/RPS is done by setting the encoder scale
Please Log in or Create an account to join the conversation.
01 Dec 2019 20:30 #151690
by idea
Replied by idea on topic How to setup spindle speed feedback from TACHO?
I tried to connect the encoder but it ignored the tacho net for both the A and Z of the encoder and connecting the pin to those two threw an error.
Will encoder work without the index pin [Z] connected?
Will encoder work without the index pin [Z] connected?
Please Log in or Create an account to join the conversation.
01 Dec 2019 20:42 - 01 Dec 2019 20:42 #151693
by PCW
Replied by PCW on topic How to setup spindle speed feedback from TACHO?
1. You can connect the A and Z pins of the software encoder to the same signal
perhaps you have a hal connection error of some kind
2. if the pulse width can get narrower than 1 ms, you need to use a hardware encoder instead of a software encoder
3. Index is only needed for threading or tapping (and tapping would not work with a 1 count per turn signal)
Index is not needed for simple counting
perhaps you have a hal connection error of some kind
2. if the pulse width can get narrower than 1 ms, you need to use a hardware encoder instead of a software encoder
3. Index is only needed for threading or tapping (and tapping would not work with a 1 count per turn signal)
Index is not needed for simple counting
Last edit: 01 Dec 2019 20:42 by PCW.
Please Log in or Create an account to join the conversation.
01 Dec 2019 21:44 #151704
by idea
Replied by idea on topic How to setup spindle speed feedback from TACHO?
The spindle motor outputs 20 pulses per rotation, so at full speed ~20000rpm that is 2.5us pulse width, so software is out of the question.
It does not look like i can specify a hardware encoder on any given pin / i'm limited to what is setup in the hardware? so that would be using an encoder that is nominally associated with one of the axis steppers?
It may be easier to setup an MCU to read the tacho signal, PWM signal and then control the motor to respond to the changing load.
It does not look like i can specify a hardware encoder on any given pin / i'm limited to what is setup in the hardware? so that would be using an encoder that is nominally associated with one of the axis steppers?
It may be easier to setup an MCU to read the tacho signal, PWM signal and then control the motor to respond to the changing load.
Please Log in or Create an account to join the conversation.
02 Dec 2019 00:09 #151714
by PCW
Replied by PCW on topic How to setup spindle speed feedback from TACHO?
Many 7I93 configurations include one or more hardware encoders
Since LinuxCNC can read the velocity (and filter/display it locally)
and has a full floating point PID with FF2,FF1, FF0 I limits E limits
etc I would think it likely simpler to do this in LinuxCNC
Since LinuxCNC can read the velocity (and filter/display it locally)
and has a full floating point PID with FF2,FF1, FF0 I limits E limits
etc I would think it likely simpler to do this in LinuxCNC
Please Log in or Create an account to join the conversation.
03 Dec 2019 13:10 #151851
by andypugh
Replied by andypugh on topic How to setup spindle speed feedback from TACHO?
Your HAL file contains
Try "num_encoders=1" and see if some encoder pins appear.
Then you just need to work out which IO pins they are on.
loadrt hm2_eth board_ip="192.168.1.121" config="num_encoders=0 num_pwmgens=2 num_stepgens=4"
Try "num_encoders=1" and see if some encoder pins appear.
Then you just need to work out which IO pins they are on.
Please Log in or Create an account to join the conversation.
04 Dec 2019 03:34 #151941
by idea
Replied by idea on topic How to setup spindle speed feedback from TACHO?
Thanks for the patience (seems to be a common theme with many variations) - I'll attempt to document in workflow for others.
Ok so i've added a 5th encoder (at some point i will add axis encoders and these are already wired) and linked A to the tacho line i have connected on I/O 46. This was by following the guide here [wiki.linuxcnc.org/cgi-bin/wiki.pl?Editing_MESA_Bitfiles] by making up a new bit file to add and assign an additional encoder (only the A line connected to the outside world).
Then loaded/flashed to the MESA 7i93 board, in my case by using;
Then readout to test
So the next step is to update the hal, i'm struggling got find a clear explanation of how the spindle encoder is read out. The information in [www.linuxcnc.org/docs/html/examples/spindle.html] seems to be for software encoder. Any good threads or suggestions?
Ok so i've added a 5th encoder (at some point i will add axis encoders and these are already wired) and linked A to the tacho line i have connected on I/O 46. This was by following the guide here [wiki.linuxcnc.org/cgi-bin/wiki.pl?Editing_MESA_Bitfiles] by making up a new bit file to add and assign an additional encoder (only the A line connected to the outside world).
Then loaded/flashed to the MESA 7i93 board, in my case by using;
sudo mesaflash --device 7i93 --addr 192.168.1.121 --write 7i93_svst2_4d_5.bit
Then readout to test
david@linuxcnc:~$ mesaflash --device 7i93 --readhmid
Configuration Name: HOSTMOT2
General configuration information:
BoardName : MESA7I93
FPGA Size: 9 KGates
FPGA Pins: 144
Number of IO Ports: 2
Width of one I/O port: 24
Clock Low frequency: 100.0000 MHz
Clock High frequency: 200.0000 MHz
IDROM Type: 3
Instance Stride 0: 4
Instance Stride 1: 64
Register Stride 0: 256
Register Stride 1: 256
Modules in configuration:
Module: WatchDog
There are 1 of WatchDog in configuration
Version: 0
Registers: 3
BaseAddress: 0C00
ClockFrequency: 100.000 MHz
Register Stride: 256 bytes
Instance Stride: 4 bytes
Module: IOPort
There are 2 of IOPort in configuration
Version: 0
Registers: 5
BaseAddress: 1000
ClockFrequency: 100.000 MHz
Register Stride: 256 bytes
Instance Stride: 4 bytes
Module: QCount
There are 5 of QCount in configuration
Version: 2
Registers: 5
BaseAddress: 3000
ClockFrequency: 100.000 MHz
Register Stride: 256 bytes
Instance Stride: 4 bytes
Module: PWM
There are 2 of PWM in configuration
Version: 0
Registers: 5
BaseAddress: 4100
ClockFrequency: 200.000 MHz
Register Stride: 256 bytes
Instance Stride: 4 bytes
Module: StepGen
There are 4 of StepGen in configuration
Version: 2
Registers: 10
BaseAddress: 2000
ClockFrequency: 100.000 MHz
Register Stride: 256 bytes
Instance Stride: 4 bytes
Module: LED
There are 1 of LED in configuration
Version: 0
Registers: 1
BaseAddress: 0200
ClockFrequency: 100.000 MHz
Register Stride: 256 bytes
Instance Stride: 4 bytes
Configuration pin-out:
IO Connections for P2
Pin# I/O Pri. func Sec. func Chan Pin func Pin Dir
1 0 IOPort StepGen 0 Step/Table1 (Out)
3 1 IOPort StepGen 0 Dir/Table2 (Out)
5 2 IOPort StepGen 1 Step/Table1 (Out)
7 3 IOPort StepGen 1 Dir/Table2 (Out)
9 4 IOPort QCount 0 Quad-A (In)
11 5 IOPort QCount 2 Quad-A (In)
13 6 IOPort QCount 0 Quad-B (In)
15 7 IOPort QCount 2 Quad-B (In)
17 8 IOPort QCount 0 Quad-IDX (In)
19 9 IOPort QCount 2 Quad-IDX (In)
21 10 IOPort QCount 1 Quad-A (In)
23 11 IOPort QCount 3 Quad-A (In)
25 12 IOPort QCount 1 Quad-B (In)
27 13 IOPort QCount 3 Quad-B (In)
29 14 IOPort QCount 1 Quad-IDX (In)
31 15 IOPort QCount 3 Quad-IDX (In)
33 16 IOPort StepGen 2 Step/Table1 (Out)
35 17 IOPort StepGen 2 Dir/Table2 (Out)
37 18 IOPort StepGen 3 Step/Table1 (Out)
39 19 IOPort StepGen 3 Dir/Table2 (Out)
41 20 IOPort PWM 0 PWM (Out)
43 21 IOPort PWM 0 Dir (Out)
45 22 IOPort PWM 1 PWM (Out)
47 23 IOPort PWM 1 Dir (Out)
IO Connections for P1
Pin# I/O Pri. func Sec. func Chan Pin func Pin Dir
1 24 IOPort None
3 25 IOPort None
5 26 IOPort None
7 27 IOPort None
9 28 IOPort None
11 29 IOPort None
13 30 IOPort None
15 31 IOPort None
17 32 IOPort None
19 33 IOPort None
21 34 IOPort None
23 35 IOPort None
25 36 IOPort None
27 37 IOPort None
29 38 IOPort None
31 39 IOPort None
33 40 IOPort None
35 41 IOPort None
37 42 IOPort None
39 43 IOPort None
41 44 IOPort None
43 45 IOPort None
45 46 IOPort QCount 4 Quad-A (In)
47 47 IOPort None
So the next step is to update the hal, i'm struggling got find a clear explanation of how the spindle encoder is read out. The information in [www.linuxcnc.org/docs/html/examples/spindle.html] seems to be for software encoder. Any good threads or suggestions?
Please Log in or Create an account to join the conversation.
04 Dec 2019 03:44 #151944
by PCW
Replied by PCW on topic How to setup spindle speed feedback from TACHO?
you can read the hostmot2 manual page for description of the encoder pins
or you can launch LinuxCNC and just list all the encoder pins/params with:
halcmd show all *.encoder*
or you can launch LinuxCNC and just list all the encoder pins/params with:
halcmd show all *.encoder*
Please Log in or Create an account to join the conversation.
06 Dec 2019 02:58 #152129
by idea
Replied by idea on topic How to setup spindle speed feedback from TACHO?
Ok, so I managed to get the spindle feedback working, but the only way was connect the rps lines which i then need to increase the multiplier to FF0=60 to get it running
Is there a better way to set this up?
Is there a better way to set this up?
Please Log in or Create an account to join the conversation.
Time to create page: 0.088 seconds