Jump to content
 

Arduino Interference - Sporadic Operation


Recommended Posts

Good Afternoon All,

 

I was just wondering if anyone here has previously experienced interference problems whilst using Arduino products before?

 

I'm currently using a DCC Interface TMC2208 and Arduino Nano to drive a stepper motor which is connected to CNC Slide which drives a sector plate to three positions. The sector plate can either be driven by a DCC Command or a Push Button for each position.

 

I'm not an Arduino wiz but understand the basics and am able to up/download software/code. The code I'm using was mainly wrote by Tender, who I unfortunately haven't heard from for some time and hence this post.

 

Having operated the layout more recently, I've noticed I've got a problem with the sector plate sporadically changing position without pressing a button/driving a DCC Command. I've rewired the stepper motor power supply and control circuits completely separately from the rest of the layout wiring to rule out interference and I've even fed them all from seperate power supplies but I still occasionally get a random uncommanded movement.

 

The movement happens sometimes (Not every time or in anyway repeatable) when I either drive a tortoise point motor (most common) or turn on an additional plug/unplug something on the nearby extension lead - Something else external has to operate to cause the movement, I.e. it is always in time with the point motor's moving or a plug being unplugged but not everytime or in anyway repeatable. 

 

I assume it is some sort of interference or power drop (Even though the stepper and drive board have seperate supplies), and was just wondering if anyone had whitnessed/experienced any similar problems?

 

I've read somewhere that it could be to do with pull up and pull down resistor values? Or additionally I could perhaps utilise ferrite caps to reduce interference?

 

I'm looking for some guidance on how I could rectify this problem, so if anyone can help or may be able to share any thoughts I'd be most appreciative?

 

Thanks & Regards

Josh

Edited by josh993
Link to post
Share on other sites

  • josh993 changed the title to Arduino Interference - Sporadic Operation

I had a similar issue with an Arduino (Nano) control of some steppers.  The input control was switches on a panel, and moving other motor devices in the region could cause random movements of the stepper (due to input signal being seen).  

 

My solution, in code, was to over-sample the inputs (50 times, approx 10ms apart, taking approx 0.5seconds) before acting.  If not getting 50 identical values (ie. 50 of zero, or 50 of one) then do nothing.   Roughly this in pseudo code (translate it yourself into valid Arduino): 

   for i = 1 to 50
       {       myval += digitalRead(input);   pause 10ms;  increment i;  repeat loop }

  if (myval = 0) {  // can be certain we got 50 readings of 0, do the action for switch=0 }

  if (myval =50) {  // certain we got 50 readings of 1, do the action for switch=1 }

 

 

- Nigel

  • Like 1
Link to post
Share on other sites

It sounds like you're picking up noise on the input signal. If so, you could maybe solve it in SW as suggested by Nigelcliffe or with a series resistor and capacitor at the input pin to filter any noise spikes. Say 10kOhm series resistor with 1nF cap to ground.

Link to post
Share on other sites

Sounds very much like RF interference (like radio transmission) rather than conducted interference (coming through the power wires). If it's RF the trick is to find the antenna that's collecting the RF energy. Are the push buttons some distance from the Nano? I'd suggest you completely disconnect them from the Nano and run some tests to see if there is any improvement.

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...