Diecimila resets easily when controlling a motor

Tony:

the PTC's won;t have much to do with this: they won't trip unless you pass an amp through them for about five seconds; once tripped they take several minutes or more to recover. They actually never recover their inital resistance, and over time they get higher and higher resistance values with additional trips.

D

Maybe it varies from PTC to PTC. The ones I used and tested, tripped very quickly and recovered very quickly as well. I didn't do any resistance measurement. I tested by shorting +V with GND, and what I could see was that on the USB side, there was a small fluctuation, but once the PTC tripped, it went back to normal in less than 1 second (I recall seeing a recovery of milliseconds). And on the shorted side of the PTC, the short lasted until I released the short, of course... and then the PTC recovered in less than 1 second as well.

I don't remember storing any scope screens, but if anyone is interested how the PTC reacts, I can rerun the tests and post some scope pictures.

Everybody that has worked with DC motors has seen this from time to time.

If you take apart some toys you will often see the standard industry motors fixes of .1 (104) caps between both motor terminals and more caps between each motor terminal and the motor body.

I would second everything Daniel said about diodes to the power supply lines and and some big caps on the power supply too. Try some different sizes of caps in parallel such as 1000 ufd electrolytic, 1 and 10 ufd tantalums, and 104 ceramics. In theory the capacitance adds up, but in practice each cap is good at killing a unique set of noise frequencies.

Also try twisting together the supply lines, and the motor lines, (but don't twist the supply lines With the motor lines) instead of running them individually. And then look at the thing on a scope, so you'll really know what's going on.

Paul

Have you tried to lower the PWM frequency and see how it behaves?

eighthave,

We spoke about this problem at the recent Arduino hacklab (which was awesome, btw). I wanted to make some suggestions which might give some insight as to what's happening here. I wrote a writeup on another blog because I could upload images there :wink:

Here is the link,

I think we have to file this one under "red herring". I just tried the setup and it works, no reset.

I had it driving a gear motor powered from 12, 24 and 32V, at currents up to 500ma, and not a reset in sight.

I also tried powering it on the 5V Arduino line, no resets.

Disconnecting and reconnecting the motor wire to the transistor while powered by 32V: blue sparks, but no reset.

Doing all of the above on the first Diecimila and on the Diecimila marked "prototype, limited edition": no resets.

Doing the above while eating linguini, listening to Louis Armstrong and drinking an inexpensive but well-reviewed burgundy: no resets.
( I did not try Jazz- that may indeed be the problem.)

I imagine the reset in the original post was caused by the type of motor (small wires, many turns== high inductance) and the PWM frequency interacting to send some nasty noise into the Arduino. In that case, a few simple capacitors on the power and/or logic lines is the obvious solution.

D

I imagine the reset in the original post was caused by the type of motor (small wires, many turns== high inductance) and the PWM frequency interacting to send some nasty noise into the Arduino. In that case, a few simple capacitors on the power and/or logic lines is the obvious solution.

D

As I mentioned before, I was deliberately using a crappy circuit and a noisy motor to illustrate the difference between the Arduino NG and the Arduino Diecimila. Watch the video that I posted near the beginning of this thread, it illustrates the difference well:

http://dropbox.at.or.at/dropbox/diecimila_motor_problem.mov

I tested this on about 6 or 8 different Arduinos and it seemed pretty clear that only the Diecimilas were affected. There is a key difference between the NG and the Diecimila: the RESET pin is connected on the Diecimila.

If you want to reproduce this, find a noise source, like a really crappy motor in a super basic circuit and make sure you have enough current to supply the motor. Then once you get the Diecimila resetting, try the same circuit on the NG.

It doesn't matter if your using a Diecimila, NG, STK500 Dev Board, or just have your own Atmel in a circuit.

Unless you can observe the reset pin with a O-Scope, then we can't really solve this today.

However, it can be stated that if your circuit produces a characteristic on the reset line that brings the voltage down below 0.2*Vcc =1V and does so for >=2.5microseconds, then we can say the Atmel is being reset.

See the following image for reference,

Also, if your supply voltage goes below brown out voltage AND brown out detection is turned on, then your Atmel can reset. Does anyone know if the brown out fuses have been set on the Diecimila? on the NG? It would have been done with an in-circuit programmer.

If you can verify that the brown-out detection is turned on, then consult the following table when you find out at which voltage,

Other questions which I'm not sure are answered (or completely answered):

1.) How much power is your motor taking to run (full speed RIGHT before shut off)?
2.) Are you overloading the voltage regulator (some linear regulators can have thermal shutoffs)?
3.) What are the O-scope plots between the following points: RESET - GND, and 5v-GND right near the Atmel when your motor is running AND right before your Atmel resets?
4.) Are you creating EMI that is propagating through your circuit causing havoc at multiple places?
5.) Did you try carefully wrapping the Arduino in some kind of metal shield for EMI protection?

It's not as straight forward as saying that one is more sensitive than the other.

Characterize FIRST how your electrically stressing your Arduino. THEN, apply the appropriate measures to fix the problem. Otherwise aren't we all just shooting from the hip with guesses to fix the problem? If we have the data, then we can make a correction.

All this talk has made me really interested in getting that motor that you used. I would love to characterize the circuit more. Where did you buy that exact motor? If you're unsure, then maybe we can play with this at the next Arduino hacklab?

While I didn't test all of the current-related possibilities, since the NG would not reset while using USB power while the Diecimila would reset when using external power, it seemed to me relatively safe to assume that the resets were not being caused by current-related issues. It would be good to test to make sure.

I think this would be a good thing to try at the next hacklab so we can get to the bottom of it. I'll bring that little motor. I don't know the exact specs of the motor, it doesn't have any markings on it, but it looks almost exactly like this one:

http://www.jameco.com/webapp/wcs/stores/servlet/ProductDisplay?langId=-1&storeId=10001&catalogId=10001&productId=154915&pa=154915PS

PS: I put a scope on the reset line, the 5V Vcc and the motor power- no significant fluctuations or anything out of the ordinary.

@eighthave, you never said if the problem is solved by using a larger power supply capacitor on the Arduino 5V supply- is it?

Several people made suggestions in the posts above about how to solve the problem, so I'd be curious to know if any of them worked. I know you are after the "core issue", but sometimes solving the issue leads to that answer.. sort of troubleshooting by induction.

D

I did try adding a biggish cap, like 10uF, from the motor's Vcc to ground. I don't think it helped, but my memory is hazy. I think the scope is the way to get to the bottom of this.

.hc

10UF is tiny in terms of a motor- try 220UF, on on the Motor VCC an done on the logic Vcc and let us know if it works!

D

I just discovered that according to the Diecimila schematic, when you are running from USB power, there is only about .2Uf of power supply filtering. The 47UF filter cap is only connected to +5V when you are running from external power! At least according to the published schematic.

D

The latest Arduino boards come with 22uF caps

The latest Arduino boards come with 22uF caps

Those would be C6 and C7 on the Diecimila schematic? They're only in the dc input circuit. When running from usb power, only C1 and C4 provide filtering for a total of 200nF. This means plugging is very easy on the usb port's fuses and I actually like it that way.

Keep high and low power electronics properly isolated, filtered and snubbed, plain and simple. One board being more susceptible to noise than another is irrelevant to me, as long as the required noise level for a fault is reasonably overt which in this case it is.

the only problem with having .2Uf/200nF filtering on a board like this is when... somebody plugs in a motor. :slight_smile:
I've never seen a motor close to a processor without lots of power supply bypass.

D

All of you seem to suggest that the reset is caused by a power supply problem. I'm not sure this is the cause, specially as the reset does not happen when powering up the motor but after a while.

It seems more like the USB port is being reset. Could you check this out? Do you have a serial arduino to test it?

I've got some trouble myself with certain external power supplies causing the above mention USB port reset.

Just my two cents,

Miguel

Just wanted to chime in and say that I have similar problems with an Arduino Mega and the Tamiya 70097 dual motor. I've it hooked up to a TB6612FNG motor driver from Pololu.

I'm also a total electronics noob, though. So I'm going to take the wise advice and buy a stack of caps, see if that solves the issue.

I can definitely say that if I hook up the motors to a battery and power the Arduino via USB, that the reset takes a lot longer to kick in and I can actually get the motors to spin for several minutes.

Sounds like motor noise from what I've read.

I'll report back.

After following a short lesson on de-coupling and implementing the lesson learnt, the electrical noise seems to be a lot better. I still can't run both DC motors on full speed when powering the Arduino and motors via USB. But when I use a LiPo battery to power both, the motors go up to full rev perfectly.

Might try servos next project :slight_smile: