Stepper motor creates voltage spikes in Due

Hi,

I have a sketch on an Arduino Due controlling two stepper motors based on data read from an SD card. The sketch works fine as long as I don't connect the motors to the external power supply. If I do, the sketch stops at random times throughout the sketch.

I'm using 23Y106S-LW8 motors and G203V controllers. The motors' 8 lead wires are connected to the controllers in 4-lead bipolar parallel fashion as described in the datasheet. The controllers are connected to one 24V power supply. The controllers' control terminals are connected to digital pins 3-5 (8-10), and the common terminals are connected to one of the Due's GND pins.

I hooked up the Due with only one motor connected to the oscilloscope and used the following very simple sketch for testing:

#define DISABLE_PIN 5
#define DIR_PIN 4
#define STEP_PIN 3

#define TEST_PIN 52

void setup() {
  pinMode(DIR_PIN, OUTPUT);
  pinMode(DISABLE_PIN, OUTPUT);
  pinMode(STEP_PIN, OUTPUT);

  pinMode(TEST_PIN, OUTPUT);

  digitalWrite(DISABLE_PIN, LOW);
  //digitalWrite(DISABLE_PIN, HIGH);  

}

void loop() {
  // Nothing to loop
}

Once the power supply is on and the DISABLE_PIN is set to LOW, I can see large spikes in the TEST_PIN's voltage (see attached image, blue is the voltage on TEST_PIN, yellow is the voltage on the 3.3V pin). If the DISABLE_PIN is set to HIGH, these spikes disappear, even though the power supply is still connected, suggesting that it's the motor creating these spikes. I don't understand where this is coming from, the controller's terminal are supposed to be opto-isolated. Any help how to solve this is highly appreciated!

You've not shielded the wires from controller to Due?
You've run the signal wires near the supply or motor wires?
You're wires are random and not nicely bundled as twisted pairs or equivalent?

I think a photo of the layout might help here...

MarkT:
You've not shielded the wires from controller to Due?
You've run the signal wires near the supply or motor wires?
You're wires are random and not nicely bundled as twisted pairs or equivalent?

I think a photo of the layout might help here...

Correct. Unshielded stranded wires. Bundled, but no twisted pair either. Obviously the signal wires are near the motor wires, the terminals are right next to each other.

Are you suggesting the signal wires pick up stuff from the motor wires? Keep in mind, though, these effects are present even if the motor is not running (but is electrified). In this case I would think there is no current present in the motor wires, and therefore nothing can be picked up?

Please see attached picture to get an idea of what kind of wires I used. This is quite messy, though, the problem is also present if the wires are laid out more nicely in an ordered fashion! Also, the screw shield has no influence on the issue, I tested that as well.

Did you try ‘ALL 3’ of the suggestions they told you to do?

BTW, That is a very poor location for your scope ground, use the actual physical GND interconnection point.

“REDUCING RF INTERFERENCE

Nov 13, 2017 693
This application note is meant for those with applications requiring a reduction in RF noise from Gecko drives. There are three ways of doing this and they are arranged from the simplest to the most complex. The first one should suffice for most applications; if the level of noise is still unacceptable then move on to the other two.

METHOD ONE:

Use a shielded 5-conductor cable for your motor to drive connection; 4 of the wires go to the motor leads while the 5th goes to the motor case. Return the motor case wire to the drive’s power supply ground connection. Ground the shield to your electronics control box at the control box end only, leaving it disconnected at the drive end.

METHOD TWO:

Install 20 to 50 uH chokes in series with each motor wire as close to the drive as is practical. The choke outputs go to the cable described above.

METHOD THREE:

Install an L-C low pass filter (pi section) from your power supply to the drives. Make L 100uH; make C 1uF non-inductive (multi layer ceramic capacitor). Use this in addition to both of the above.”

larryd:
Did you try ‘ALL 3’ of the suggestions they told you to do?

I didn't try any suggestions, yet, and didn't claim I did. I guess "they" is the quote you offered?

Thank you for this, I didn't find it before. Also, since I had these problems even without the motors running, the term RF interference didn't cross my mind.

Testing their suggestion unfortunately requires some effort on my end (meaning I have to mingle with the motors), the motors come with 8 lead wires, no ground wire and no connector. Is it likely that I experience RF interference on the motor cables without the motors running?

larryd:
BTW, That is a very poor location for your scope ground, use the actual physical GND interconnection point.

Thanks! I'm obviously new to this stuff - what/where is the actual physical GND interconnection point on a Due?

Your scope GND should be moved to the GND common point between the Arduino and controllers.

BTW, don’t daisy chain grounds, look up ‘star point grounding’.

The quote is from the web site you linked for the controller.