How to do wiring to generate quadrature encoder signal in Mesa 7i95 board

  • suraj9735
  • suraj9735's Avatar Topic Author
  • Offline
  • Premium Member
  • Premium Member
More
30 Jan 2026 10:54 #342199 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 

Please Log in or Create an account to join the conversation.

  • tommylight
  • tommylight's Avatar
  • Away
  • Moderator
  • Moderator
More
30 Jan 2026 13:17 #342210 by tommylight
Set the Mesa board for "single ended" encoder, use only GND, A+ and B+ wiper/pins.
Also, very short wires if the cable is not shielded, otherwise for anything longer than 10-15CM use shielded wire.

Please Log in or Create an account to join the conversation.

  • suraj9735
  • suraj9735's Avatar Topic Author
  • Offline
  • Premium Member
  • Premium Member
More
02 Feb 2026 01:21 #342301 by suraj9735
Thanks Tommylight,

I have set the encoder now in single ended mode from 0 to 1. It is working fine now but have different problem. 

Current status:
I have wired the following
NI-9401 Digital output pin1 to A+ of encoder 7i95
Ni-9401 GND to GND of encoder

Set the loop timing in LabVIEW is 1 sec. 
In Hal show configuration, I can see the A pin gets on and off after each 1 sec.while the B is always on. When the A pin is in off condition no counter increases for 1 sec. When the A pin gets on for 1 sec, the counter is keep increasing randomly.

I expected the counter will not increase during off time when A is off
this is correct.
I expected the counter will increase by just one time for next 1 sec---- this is not happening.

I didn't understand your comment B+ wiper/pins. Please tell me more about the connection/wiring of B+, B-, and A- pins.

Also suggest me one daughter board compatible with mesa 7i95 for analog input output with cable model number. I want to buy daughter board and necessary cable together.


Thanks 

Please Log in or Create an account to join the conversation.

More
02 Feb 2026 01:43 #342305 by PCW
If you get counts when there is no activity, that sounds like a noise issue

Is the encoder filter bit set true?
 
setp hm2_7i97.0.encoder.00.filter true

(for channel 00)

Please Log in or Create an account to join the conversation.

  • suraj9735
  • suraj9735's Avatar Topic Author
  • Offline
  • Premium Member
  • Premium Member
More
05 Feb 2026 21:14 #342512 by suraj9735
Hi PCW,

The filter is already by default set to true. Suggest any other troubleshoot method for the same. 
Or suggest me a daughter board having analog input output pin

Please Log in or Create an account to join the conversation.

More
05 Feb 2026 21:34 #342514 by PCW
If you still get random counts, that suggests a signal integrity issue of some kind (missing grounds?)

Unfortunately our normal analog input card (the 7I87) is out of stock currently

What voltage range, resolution and conversion speed do you need?
 

Please Log in or Create an account to join the conversation.

  • suraj9735
  • suraj9735's Avatar Topic Author
  • Offline
  • Premium Member
  • Premium Member
More
07 Feb 2026 19:18 #342618 by suraj9735
Could you suggest any Mesa board that can connect to my Mesa 7i95 and provide analog input support?This is urgent for my project, and I need to finish it as soon as possible. I cannot wait for the 7i87 to come back in stock.Thanks.

Please Log in or Create an account to join the conversation.

More
07 Feb 2026 19:32 #342619 by PCW
What is the required analog  input range, speed and resolution?

Please Log in or Create an account to join the conversation.

Moderators: PCWjmelson
Time to create page: 0.109 seconds
Powered by Kunena Forum