I'm using the following circuit (from http://luckylarry.co.uk/arduino-projects/arduino-control-a-dc-motor-with-potentiometer-and-multiple-power-supplies/) to control the speed of a 6V DC motor powered by a separate power supply:
enter image description here
When I put a heavy load on the motor or stall it, serial communication between my Arduino Uno and my PC (over USB) fails. Data stops coming over and I need to disconnect the Uno, close the IDE, connect the Uno again, and then start the IDE in order to get the link back up.
Not sure if this is a grounding problem (I took care to make sure all grounds go to the same rail), a load problem (even though the Uno and the motor have separate power supplies) or a back-emf problem.
Any help would be appreciated.
Thanks,
-Rob
-
\$\begingroup\$ Are the supplies completely separate, with two mains connections? \$\endgroup\$Leon Heller– Leon Heller2011年04月15日 17:35:02 +00:00Commented Apr 15, 2011 at 17:35
4 Answers 4
I think the problem is the solderless breadboard. The motor connections will be taking a lot of current, which is unsuitable for the spring contacts in the breadboard, and introduces noise into the Arduino supply via the common ground when the motor stalls. The motor could be taking 1A or so under a heavy load or stall condition and those solderless breadboards are only rated for a few mA, IIRC. Wire the circuit up properly on a PCB or a prototyping board, with a single-point ground, and your problem will probably go away. Or, avoid stalling the motor and subjecting it to a heavy load.
You could monitor the motor current with a sense resistor and ADC input on the Arduino, turn off the drive when the current becomes excessive, and light an LED to indicate a fault condition.
It seems like it might be a ground issue of some kind. What are your power supplies, and how are they connected? Did you do the circuit on a breadboard like the picture in the link?
When you heavily load or stall the motor, it will pass significant current. Assuming you built it like the picture, a large current in your motor power return lead could cause the (-) rail on the breadboard to ride up. If the motor p.s. is referenced back to the PC's ground (beware the 'sneak path'!), this could cause the apparent voltage levels at the USB interface to be out of spec. You might even get some kind of latch-up effect that would require removal of power.
If your motor p.s. isn't a battery, you might want to try using a battery, and see if the condition persists.
-
\$\begingroup\$ Thanks for your answer. I have been suspecting a grounding problem as well, but I wasn't too sure. Your idea about the (-) breadboard rail riding up makes sense. All grounds in my circuit are on the same breadboard bus line. Even though the motor PS is a battery pack, the (-) lead from that is attatched to the ground rail on the breadboard, along with the ground pin of the Arduino and the ground pin of the pot. Perhaps cutting the power lead in the USB cable would help? If this is a grounding problem, how else can I ground if I need both externally powered motors and USB communication? \$\endgroup\$RobertoMPerez– RobertoMPerez2011年04月16日 12:28:51 +00:00Commented Apr 16, 2011 at 12:28
-
\$\begingroup\$ if your motor p.s. was already a battery, my theory is probably toast. Unless you had another wire from the battery (-) to the arduino. if the only connection to the battery (-) is via the breadboard, then it wouldn't matter if the battery (-) was slightly more negative than the breadboard ground. \$\endgroup\$JustJeff– JustJeff2011年04月16日 17:12:43 +00:00Commented Apr 16, 2011 at 17:12
I added a 0.1 μF capacitor across the leads of the motor, and a 470μF capacitor across the power and ground rails on the breadboard, right next to the Uno's ground lead insertion point. I no longer lose serial communication to the Uno when the motor comes under load or stalls.
I was coming close to building an isolator circuit in order to completely decouple the motor side from the Arduino/PC side, using an ADUM1402 (http://www.analog.com/en/interface/digital-isolators/adum1402/products/product.html), but I figured that this couldn't be the only solution. I did some more research and found that it's good practice to filter out the noise and spikes from DC motors by using capacitors as shown at http://www.pololu.com/docs/0J15/9 and in many other sites. A glaring display of ignorance on my part, but now I know better.
I'm not sure how (i.e. what's the theory behind it) this fixes the problem, because I'm still not sure what the cause of the problem was. If any one can shed some light on this, I'd be grateful. I don't like doing things without having and understanding of why I'm doing them. I'll keep reading until I figure out how this actually fixes things.
In any case, thanks to everyone that tried to help out!
I have a Makerbot - one of the boards drives a DC motor and also has a thermistor input - I was seeing similar issues - solved them by
1) routing the wires away from each other 2) dropping a 100nF cap over the analog input 3) putting a ferrite bead on that input lead
I would worry about grounds too - are the grounds connected elsewhere? (a ground loop)
Explore related questions
See similar questions with these tags.