Author Topic: Arduino freezes when working with stepper motors  (Read 2589 times)

0 Members and 1 Guest are viewing this topic.

Offline branjbTopic starter

  • Contributor
  • Posts: 16
  • Country: us
Arduino freezes when working with stepper motors
« on: May 29, 2016, 03:13:40 pm »
Hello,

Student CpE newbie here and this is the first time I've worked on a project of this magnitude.  I've got a project going on with stepper motors and an arduino.  The basic topology is 3 stepper motor drivers connected on an RS485 bus to talk to a GUI on a laptop.  I've put the arduino on the RS485 bus as well for some expanded GPIO functionality.  The drivers, motors, and arduino are all connected through a 120V to 24V switching power supply.  The arduino is powered through a buck converter fed off the switching power supply.  There is a large 400uF capacitor on the outputs of the buck converter but I think it's not enough to help against the noise.  If the motors are not running, the arduino will stay powered on without freezing.  If the motors are running, the arduino freezes up after about a minute of operation and required a cold start to continue communicating.

I'm guessing that when the motors are running the arduino is getting noise from the ground loop; haven't had a chance to look at it with a scope, but will on Wednesday.  Does this sound reasonable?

The stepper motor driver boards have an output to an encoder that I am not using; 5V out, 100mA max current.  Depending on feedback here and what I can see with a scope, I'm considering using the encoder outputs to power the arduino instead of the buck converter off the driver board, assuming that since the encoder has a separate MCU that the board filters to account for it.

Looking for general advice on if I'm headed in the right direction or taking the wrong approach.  Thanks
 

Offline Cerebus

  • Super Contributor
  • ***
  • Posts: 10576
  • Country: gb
Re: Arduino freezes when working with stepper motors
« Reply #1 on: May 29, 2016, 03:21:31 pm »
First obvious question. Do you have snubbers or reverse protection diodes across the motor coils? If not, there's your problem.

Further. It's never easy to do this without a schematic diagram of the circuit in question. If you want a quick and accurate answer, post one.
Anybody got a syringe I can use to squeeze the magic smoke back into this?
 

Offline branjbTopic starter

  • Contributor
  • Posts: 16
  • Country: us
Re: Arduino freezes when working with stepper motors
« Reply #2 on: May 29, 2016, 03:57:24 pm »
Attached is the datasheet for the motor driver; no schematic information available, but zooming in on the motor outputs it looks like there's three diodes across each motor output.  Also drew up a quick view of the topology for the power supply.
« Last Edit: May 29, 2016, 04:04:58 pm by branjb »
 

Offline matkar

  • Regular Contributor
  • *
  • Posts: 153
  • Country: si
  • Sixty percent of the time it works EVERY time.
Re: Arduino freezes when working with stepper motors
« Reply #3 on: May 29, 2016, 08:53:59 pm »
Try the obvious:
-Power Arduino from another source
-Put galvanic isolation on the communication between Arduino and driver
 

Offline batteksystem

  • Regular Contributor
  • *
  • Posts: 167
  • Country: hk
    • My ebay store
Re: Arduino freezes when working with stepper motors
« Reply #4 on: June 01, 2016, 03:32:16 am »
Hello,

Student CpE newbie here and this is the first time I've worked on a project of this magnitude.  I've got a project going on with stepper motors and an arduino.  The basic topology is 3 stepper motor drivers connected on an RS485 bus to talk to a GUI on a laptop.  I've put the arduino on the RS485 bus as well for some expanded GPIO functionality.  The drivers, motors, and arduino are all connected through a 120V to 24V switching power supply.  The arduino is powered through a buck converter fed off the switching power supply.  There is a large 400uF capacitor on the outputs of the buck converter but I think it's not enough to help against the noise.  If the motors are not running, the arduino will stay powered on without freezing.  If the motors are running, the arduino freezes up after about a minute of operation and required a cold start to continue communicating.

I'm guessing that when the motors are running the arduino is getting noise from the ground loop; haven't had a chance to look at it with a scope, but will on Wednesday.  Does this sound reasonable?

The stepper motor driver boards have an output to an encoder that I am not using; 5V out, 100mA max current.  Depending on feedback here and what I can see with a scope, I'm considering using the encoder outputs to power the arduino instead of the buck converter off the driver board, assuming that since the encoder has a separate MCU that the board filters to account for it.

Looking for general advice on if I'm headed in the right direction or taking the wrong approach.  Thanks

Do you have free wheeling diode on stepper motor? I guess your arduino "pass out" on the back emf.

Offline branjbTopic starter

  • Contributor
  • Posts: 16
  • Country: us
Re: Arduino freezes when working with stepper motors
« Reply #5 on: June 01, 2016, 11:46:59 pm »
Hello,

Student CpE newbie here and this is the first time I've worked on a project of this magnitude.  I've got a project going on with stepper motors and an arduino.  The basic topology is 3 stepper motor drivers connected on an RS485 bus to talk to a GUI on a laptop.  I've put the arduino on the RS485 bus as well for some expanded GPIO functionality.  The drivers, motors, and arduino are all connected through a 120V to 24V switching power supply.  The arduino is powered through a buck converter fed off the switching power supply.  There is a large 400uF capacitor on the outputs of the buck converter but I think it's not enough to help against the noise.  If the motors are not running, the arduino will stay powered on without freezing.  If the motors are running, the arduino freezes up after about a minute of operation and required a cold start to continue communicating.

I'm guessing that when the motors are running the arduino is getting noise from the ground loop; haven't had a chance to look at it with a scope, but will on Wednesday.  Does this sound reasonable?

The stepper motor driver boards have an output to an encoder that I am not using; 5V out, 100mA max current.  Depending on feedback here and what I can see with a scope, I'm considering using the encoder outputs to power the arduino instead of the buck converter off the driver board, assuming that since the encoder has a separate MCU that the board filters to account for it.

Looking for general advice on if I'm headed in the right direction or taking the wrong approach.  Thanks

Do you have free wheeling diode on stepper motor? I guess your arduino "pass out" on the back emf.

Yeah, the board driving the motors has it built in.

I put a scope on the arduino and there was virtually no noise from the power supply going to it.  I finally figured it out, but am not entirely sure on the reason why.  The Arduino had an RS485 interface on one UART but in addition to that I had a debug interface set up on a second UART.  Whenever the debug interface would transmit at the same time the RS485 had data on the line, the Arduino would lock up.  I ended up disabling the debug UART as it was no longer needed and not a single problem.  I suspect there's probably something going on behind the scenes with how the Arduino libraries configure the UARTs, but I'm not going to dig any deeper into it at this time.  Thanks for the suggestions everyone.
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf