Main Site Documentation

Grounding Component Best Practices


I am using a Spider with a rotary encoder and two pulse modules to make distance measurements on a piece of laboratory equipment. The encoder is measuring linear distance. Two sensors generate start and stop signals which I detect using interrupts. I think I am getting noise due to the high standard deviation of my measurements. I am not an electrical guy so I am unsure how to ground these devices. Can I ground the Spider to the grounded lab equipment? Can I tie the ground on the pulse module to the ground on the lab equipment? I am using two pulse modules because the signals I am sensing come from different sources and I am worried that the grounds may not be the same.This has come up with other measurements I have made and I have wondered if there was a “Best Practices” document on this topic.


All of the modules that are connected to the Spider will have their grounds tied together as standard. This is part of the module connection to the spider.
Can you give more details on how the sensors for start and stop are connected?
Pictures are always useful too.
Where do you see the noise in the results? Is it in the encoder data? the more info you can give the better.


Thanks HughB,

Two signals are being monitored. Each is connected to a pulse module. One signal is from a rotary encoder and the other is from a separate piece of equipment. I was concerned that there might be a potential difference between the grounds on the two signal lines which is why I used two pulse modules but your comment that the grounds are ultimately joined on the Spider board made me realize one pulse module would have been ok.

Both signal lines are shielded and the shields are connected and grounded.

The start/stop signal is generated by photo diodes. The signals are available on a single output line which is typically used to trigger a counter. I am using the signal to start and stop counting pulses. the signal goes from 0 to 5 volts on a start and 5 to 0 on a stop. I am using a single interrupt (interrupt mode rising and falling) to reset the counter and report total pulses. I am getting interrupts at times when I should not be. Noise?

The rotary encoder is connected by a cable to a piston which is passing by the photo diodes. As the photo diodes trigger the pulses from the encoder are counted. The total pulses are higher than what I expected. Also, the variability in repeated tests is high. The bias and variability made me think noise could be the problem. The bias and variability are roughly the same magnitude, 0.05".

I will get a picture tomorrow when I am at work.


perhaps something like this could solve your problems.

Optokoppler mit Schmitt-Trigger Sharp PC 900 DIP



You have overestimated my technical ability. I will look into the trigger and in the long run this may be what I need. My next step is to connect a counter in place of the spider and pulse modules. I can trigger and count with a bit more control like triggering sensitivity and filtering. If my results agree with the Spider system then I will conclude the problem lies with the equipment producing the signals.

I am still wondering about the proper grounding of these systems. Is this something I should even be concerned about?


Is the output from the encoder electronic or mechanical?

From that I mean, is the output electronic via some kind of optical circuit or mechanical where it uses a switch type output (or wiper on a PCB trace)?

If the output is some form of mechanical switch you may be seeing some form of bouncing type input to the counter. You may need to put a filter on the counter input if this is the case. Try putting a 0.1uF capacitor between the input and GND to each of the encoder inputs.

A good ground is needed and if the distance from the encoder to the counter input is long and it is mechanical, you are best to use screened cable.

I have a system that uses an electronic type output from a proximity sensor to detect rotation on a shaft and it runs fine over a 20M cable with loads of other signals present in the same cable. The overall cable is screened and connected to ground.



I got the encoder from Sparkfun, COM-11102
Rotary Encoder - 1024 P/R (Quadrature) - I have been using it in Quad4 mode to get max resolution.

I will put the capacitors you recommend between the encoder inputs and their ground. l will also put a capacitor in the trigger signal as well. We have filters for our counters that can be inserted into the coaxial line. When I put one of these into the trigger line it no longer triggered. I suspect that is a capacitor as well but I do not know the size. I will start with the 0.1uF you have suggested.

My signal lines are shielded and grounded. The spider and components are mounted on a piece of perforated board. I have checked the grounds in the power supply and they are good.


Bit confusing on the Sparkfun website as they refer to gray code which it is not. It’s an incremental type with quadrature and a home pulse and this would have a clean output. I am pretty sure these are optical sensors. I use this type all the time with machine turns detection.

I think the encoder should be OK but how is your photo-diodes connected?

Are they a nice clean 0-5V for instance?

Can you reset the count, rotate the encoder 1 full turn and read the count? What do you get?

Then do the encoder in reverse and see if it goes back to zero?


Dave McLaughlin,

You nailed it. I put the 0.1uF capacitors in the encoder lines and the standard deviation in the readings dropped by two orders of magnitude. The data is killer now. I apologize for the delay in responding but I was taking and analyzing data.

Thank you.

I will stop worrying about grounding so much. Signal conditioning was the solution here.