Limit switch random activation

I have a tic249 driver running a stepper motor using the ticgui software. The stepper motor works perfectly when I control its position using the set position command when limit switches are not activated. When I activate the forward and reverse limit switches in the advanced setting tab, it seems to bring up false trigger switching which makes the position setting choppy. I have my limit switches hooked up to sda and scl. I also tried it on the tx and rx pins. In addition I have the switches properly grounded. I have attached a video of the problem. Any ideas?


It seems like the wires to your limit switches might be catching electrical noise from other parts of your system. Could you post some pictures of your setup and use an oscilloscope to look at what is going on with those signals? Does the issue still occur if you remove power from other parts of your system and only power the Tic through its USB connector?

- Patrick

Hello Patrick:

We removed power from other parts of the system and only powered the driver from the USB port of our RPi4. We also have a 12V connection from the power supply to the driver. We read the limit switch with an oscilloscope before energizing the stepper motor and there was no noise. After energizing the stepper motor using GUI there was considerable noise. In addition there is a humming noise from the stepper motor that is supposed to be normal.

The pix attached show the before and after energizing the stepper motor.

Just to clarify, does the Tic read the limit switch signals correctly if you remove the motor power and power it up from just USB?

If that is correct, then the noise you are seeing in the second photo is probably a byproduct of how your setup is wired. Could you try separating you limit switch wires as far away as possible from other wires (especially the high power wires, like the ones from the power supply or to your stepper motor)? If that does not help, can you post some pictures that show your wiring?

- Patrick

Thanks Patrick.

Here’s a pic of the wiring. the 4 orange wires are the stepper motor inputs. the orange wire perpendicular to them is the ground wire to the DB9 connector. the blue and yellow are the limit switch signal wires. lastly there are 2 pull up resistors to 5V on the switch signal wires.

It is important to note that all these wires are connected to a bread board/DB9 adapter. we tested grounding the shielding on the DB9 connector but that didn’t help.

We changed the setup by separating the DB9 connector to the input wires by extending them. A pic is attached.

We saw a bit of frequency change in the noise but the noise is still. Pic attached. Where could the noise generate from? Cables? We have a 2 meter long cable to the motor and limit switch input.

From all the testing we think the source of noise is in the stepper motor. We hear the hum from the motor but it runs smoothly but the noise from the limit switch creates false activation. Any ideas?

Your stepper motor power could definitely be interfering with your limit switch wires since they are running through the same cable from the DB9 connector. There is probably not too much shielding between the wires within the cable. Can you try connecting your limit switches with wires separate from your cable to see if that makes the problem go away? I recommend removing the blue and yellow wires hugging your breadboard and routing the new wires like as shown below to keep them separated from your stepper motor wires as much as possible.

By the way, it looks like your external pull-up resistors are not connected to a source. You might not need those anyway though if you are already enabling the Tic’s built-in pull-ups (though using stronger external pull-ups might be helpful for reducing noise issues).

- Patrick

Hi Patrick:

Please look further up at the pic which shows we separated the cables but still see the noise.

I see that you added some wires in the more recent picture, but it looks like the pins for your limit switch are still simultaneously getting routed into the DB9 connector and cable where they could be picking up noise from the stepper motor power wires. Can you try removing the removing the blue and yellow wires hugging your breadboard like I suggested and move your new wires so they directly connect to the breadboard rows with your SCL and SDA/AN pins (so the motor output wires aren’t passing directly over them)?

- Patrick