Arduino freezes when working with stepper motors - Page 1
Forum section: electronics / beginners

author: branjb
author_rank: Contributor
timestamp: May 29, 2016, 03:13:40 pm
content: 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

author: Cerebus
author_rank: Super Contributor
timestamp: May 29, 2016, 03:21:31 pm
content: 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.

author: branjb
author_rank: Contributor
timestamp: May 29, 2016, 03:57:24 pm
content: 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.

author: matkar
author_rank: Regular Contributor
timestamp: May 29, 2016, 08:53:59 pm
content: Try the obvious:-Power Arduino from another source-Put galvanic isolation on the communication between Arduino and driver

author: batteksystem
author_rank: Regular Contributor
timestamp: June 01, 2016, 03:32:16 am
content: Quote from: branjb on May 29, 2016, 03:13:40 pmDo you have free wheeling diode on stepper motor? I guess your arduino "pass out" on the back emf.

author: branjb
author_rank: Contributor
timestamp: June 01, 2016, 11:46:59 pm
content: Quote from: batteksystem on June 01, 2016, 03:32:16 amYeah, 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.