- Hardware & Machines
- Driver Boards
- How to do wiring to generate quadrature encoder signal in Mesa 7i95 board
How to do wiring to generate quadrature encoder signal in Mesa 7i95 board
- suraj9735
-
Topic Author
- Offline
- Senior Member
-
Less
More
- Posts: 79
- Thank you received: 1
30 Jan 2026 10:54 #342199
by suraj9735
How to do wiring to generate quadrature encoder signal in Mesa 7i95 board was created by suraj9735
Dear LinuxCNC User,
I am using Mesa 7i95 board to run a single axis AC Servo motor. I want to control feed override externally using LabVIEW while the LinuxCNC G-code is running at programmed feed rate. This is my part of PhD research work to control the feed override of a running G-Code based on some unstable/chatter vibration in the process.
As I now aware that, there is no analog input pin available in Mesa 7i95 board such that I feed analog voltage and bind that pin with mpg feed override inbuilt pin of LinuxCNC software. From the forum, I got suggestions that is it possible to use encoder pwm pin for the same purpose. The idea is, generate a digital signal A and B of 90 phase lag with LabVIEW and send it to encoder pin of 7i95 using LabVIEW cDAQ module NI-9401. So, I have generated two digital signal called A and B and create logic as following
A-0, B-0; A1, B0; A1, B1; A0, B1. This logic clearly generated two A and B digital pwm type signal with 90 degree phase lag. I checked that in oscilloscope and it shows perfect squrae signal of 5 volt in high and 0 volt in low with 400 mV noise.
Now the following wiring I have done from NI-9401 to 7i95 encoder 2 slot.
A signal or digital output 1 of NI-9401 to A+ or pin 1 of 7i95
B signal or digital output 2 of NI-9401 to B+ or pin 4 of 7i95
GND of NI-9401 to GND or pin 3 of 7i95
After this connection, I checked the encoder count of encoder 2 in Hal show configuration. I observed that, the count is increasing, then decreaseing, and then again increasing, but overall it increases. I see it randomly increasing or decreasing. I played with loop timing of digital signal generator from 1 second to 1 mili-second but no improvement. I was expecting that if I set 1 sec loop time the counter of encoder will increase by 4 times because it is in quadrature mode. But again important point is I have not used the other encoder pin of encoder 2 slot. There are 8 pin available in encoder slot, A+, A-, GND, B+, B-, 5 Volt output, Z+, Z- respectively from pin 1 to pin 8. Out of the eight pin I am using only 3 pin.
Truly speaking, I don't understand how the mesa driver actually counts the quadrature pulses and how the motor encoder generate those pulses. At what frequency motor encoder generate those pulses and what frequency mesa drive read those pulses.
I believe either I am doing wrong wiring or setting wrong frequency to generate the signal.
I request expert to please guide me in doing proper wiring, frequency setting of loop in LabVIEW, HAL code setting in .hal and .ini file to get stable counter in encoder 2. After I get stable counter and full control on number of pulses, I will bind that pin with feed override pin and control the feed override externally using LabVIEW. From LabVIEW I will send fix number pulses either to increase or decrease the feed override. I will scale those pulses to match the feed override required value.
If this is possible let me know, else suggest me a different approach to do the same task either by buying new most suitable daughter board that supports with 7i95 and has analog input and output pin or any other way.
Thanks
Suraj Kumar
I am using Mesa 7i95 board to run a single axis AC Servo motor. I want to control feed override externally using LabVIEW while the LinuxCNC G-code is running at programmed feed rate. This is my part of PhD research work to control the feed override of a running G-Code based on some unstable/chatter vibration in the process.
As I now aware that, there is no analog input pin available in Mesa 7i95 board such that I feed analog voltage and bind that pin with mpg feed override inbuilt pin of LinuxCNC software. From the forum, I got suggestions that is it possible to use encoder pwm pin for the same purpose. The idea is, generate a digital signal A and B of 90 phase lag with LabVIEW and send it to encoder pin of 7i95 using LabVIEW cDAQ module NI-9401. So, I have generated two digital signal called A and B and create logic as following
A-0, B-0; A1, B0; A1, B1; A0, B1. This logic clearly generated two A and B digital pwm type signal with 90 degree phase lag. I checked that in oscilloscope and it shows perfect squrae signal of 5 volt in high and 0 volt in low with 400 mV noise.
Now the following wiring I have done from NI-9401 to 7i95 encoder 2 slot.
A signal or digital output 1 of NI-9401 to A+ or pin 1 of 7i95
B signal or digital output 2 of NI-9401 to B+ or pin 4 of 7i95
GND of NI-9401 to GND or pin 3 of 7i95
After this connection, I checked the encoder count of encoder 2 in Hal show configuration. I observed that, the count is increasing, then decreaseing, and then again increasing, but overall it increases. I see it randomly increasing or decreasing. I played with loop timing of digital signal generator from 1 second to 1 mili-second but no improvement. I was expecting that if I set 1 sec loop time the counter of encoder will increase by 4 times because it is in quadrature mode. But again important point is I have not used the other encoder pin of encoder 2 slot. There are 8 pin available in encoder slot, A+, A-, GND, B+, B-, 5 Volt output, Z+, Z- respectively from pin 1 to pin 8. Out of the eight pin I am using only 3 pin.
Truly speaking, I don't understand how the mesa driver actually counts the quadrature pulses and how the motor encoder generate those pulses. At what frequency motor encoder generate those pulses and what frequency mesa drive read those pulses.
I believe either I am doing wrong wiring or setting wrong frequency to generate the signal.
I request expert to please guide me in doing proper wiring, frequency setting of loop in LabVIEW, HAL code setting in .hal and .ini file to get stable counter in encoder 2. After I get stable counter and full control on number of pulses, I will bind that pin with feed override pin and control the feed override externally using LabVIEW. From LabVIEW I will send fix number pulses either to increase or decrease the feed override. I will scale those pulses to match the feed override required value.
If this is possible let me know, else suggest me a different approach to do the same task either by buying new most suitable daughter board that supports with 7i95 and has analog input and output pin or any other way.
Thanks
Suraj Kumar
Please Log in or Create an account to join the conversation.
Moderators: PCW, jmelson
- Hardware & Machines
- Driver Boards
- How to do wiring to generate quadrature encoder signal in Mesa 7i95 board
Time to create page: 0.108 seconds