0

Arduino motor shield jerky in one direction
Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.

Arduino motor shield jerky in one direction

by mmollen1 on Tue Sep 14, 2021 7:46 pm

Hi,

I have a 19v laptop power supply. Voltage is stepped down to 12v through a buck transformer and then feeds the motor shield. The shield is atop an elegoo uno R3. This all connects to the rails of a model train. When the engine passes over a reed switch the direction reverses. This worked fine for one day.

The next day, the motor runs smoothly in one direction. In the other direction it runs momentarily, then stops for a little less than a second—so it’s like a buzzing metronome set at 50 bpm.

Would a short cause this? Any other candidates?

Thanks!
Mark

mmollen1
 
Posts: 5
Joined: Sat Aug 14, 2021 3:55 pm

Re: Arduino motor shield jerky in one direction

by adafruit_support_bill on Tue Sep 14, 2021 7:51 pm

Yes, a short or some other type of overload condition could cause that. If the H-Bridge chip starts to overheat it will shut down in an attempt to save itself. But a chronic overload can result in that kind of stuttering.

What size trains are you running? What is the current draw of the motors?

adafruit_support_bill
 
Posts: 82105
Joined: Sat Feb 07, 2009 10:11 am

Re: Arduino motor shield jerky in one direction

by mmollen1 on Wed Sep 15, 2021 3:00 pm

Thanks!

These are N-scale trains. I'm not sure of the current draw, but "people" say the pull about 250 mA tops.

Today I connected the shield directly to LED's, so that one LED lights on run(FORWARD), and the other lights on run(BACKWARD). Essentially two LED on the same circuit but with polarity reversed. This had worked like a charm for code building.

With this setup, motor 1 works great FORWARD and BACKWARD, motor 0 is solid on BACKWARD, but blinks on FORWARD, mimicing the behavior with the rails connected..

The center and right chip (viewed from power terminals) are cool. The left chip (closest to M1 and M2 terminals) becomes too hot to touch immediately upon driving motor(LED) 0 FORWARD, i.e. while blinking.

For what it's worth, even while this was still working, I occasionally got a burst of chatter on my two servos, which are connected on a 16 ch I2C board fed from a different buck transformer. When this would happen, LED's on the transformers and on the servo board would dim or flash for an instant.

mmollen1
 
Posts: 5
Joined: Sat Aug 14, 2021 3:55 pm

Re: Arduino motor shield jerky in one direction

by adafruit_support_bill on Wed Sep 15, 2021 3:25 pm

250mA is a reasonable estimate for a moving N scale loco. But the stall current could be several times that much - especially if it has lighting and/or sound. And startup current is essentially the same as stall current. So with a long consist you might be pulling close to an amp until things start moving.

Based on your LED experiment, it sounds like one leg of the Motor 0 H-bridge is either shorted or not working properly.

The servo chatter behavior is suspicious though. If it is powered from a separate supply, there should be no issue there - even if Motor 0 was totally shorted out.

Of you post some photos and/or a wiring diagram we can try to spot the problem.

adafruit_support_bill
 
Posts: 82105
Joined: Sat Feb 07, 2009 10:11 am

Re: Arduino motor shield jerky in one direction

by mmollen1 on Thu Sep 16, 2021 6:18 pm

Thanks again! Your comments were thought provoking. I think the key is in the sequence of what I did and the stalls I induced.
More background: this is the smallest layout I've ever made and will be portable. Also the first one I'm controlling with an Arduino. I've had fun learning.
I've attached a track diagram. Track labeled "A" is constant polarity, constant voltage, powered off a separate Buck transformer. It is isolated from track B.
When a loco passes over reed switch #1 (RS1), a servo motion is enqueued, and a direction change in the "B" track is NQ'd, so that when the loco passes from track A to track B, there is no short.
When the loco gets to reed switch #2 (RS2), a deceleration over one second is NQ'd, a servo motion the other direction is NQ'd, the polarity of track B is switched, a hold is NQ'd, then the loco accelerates back toward track A.
So on day one, I was testing the track, the programming, and the electronics with a trolley, which can take 8" radius turns, and tolerates bumps pretty well. I tweaked the track as best I could, then sat back and watched the sketch take the train forward and back for about 20 minutes.
On day two, I tried my crankiest loco. I found more track that needed tweaking on section A. Many stalls, but that would have had no influence on the motor shield since it is powered independently..
Then I let the loco get to track B, at the giant black arrow of death. The turn there was too sharp for it, and it regularly came off the tracks, in what I assume was an electrically unfriendly way. Only later did I realize the loco also needed a repair. But the turn was still too sharp. After a number of stalls there and elsewhere, the #1 motor driver developed the overheating rhythmic interruption I've described.

Based on what you have said, I believe I have fried one leg of the M1 H bridge. My plan is to re-lay some track, test it with the remaining motor circuits, then replace the whole shield so I can access four drivers.

I'd appreciate it if you'd let me know either way if you think I'm on track. If not, let me know which part of things you'd like a photo of.

Thanks again!
Mark.
Attachments
track diagram.pdf
(139.14 KiB) Downloaded 1 time

mmollen1
 
Posts: 5
Joined: Sat Aug 14, 2021 3:55 pm

Re: Arduino motor shield jerky in one direction

by adafruit_support_bill on Thu Sep 16, 2021 8:00 pm

A derailment is certainly a short-circuit risk scenario. Especially if there are power pickups on multiple axles. A short like that could easily explain the behavior of the M0 bridge. Sometimes these chips fail spectacularly in a flash with a puff of smoke. But sometimes they just become crippled and behave erratically.

I'm still curious as to why the motor shield misbehavior seems to affect the servos as well. With independent power supplies there should be no interaction. However, I have seen one case where a damaged bridge appeared to have an internal short to the logic supply also. That would be hard to confirm without an oscilloscope on the line.

In applications where a short-circuit is likely, a current limiting driver like the DRV8871 would add an extra level of protection. https://www.adafruit.com/product/3190

adafruit_support_bill
 
Posts: 82105
Joined: Sat Feb 07, 2009 10:11 am

Re: Arduino motor shield jerky in one direction

by mmollen1 on Fri Sep 17, 2021 10:11 am

ThanksI I was looking at the DRV8871 as an alternative myself. I think I may need to get up to 15 V on some of the blocks.

On the DRV8871 I was a little confused, though. If one PWM1 is held low, then the PWM2 controls speed in one direction. If PWM2 is held low, then PWM1 controls speed in the opposite direction. Is that correct?

mmollen1
 
Posts: 5
Joined: Sat Aug 14, 2021 3:55 pm

Re: Arduino motor shield jerky in one direction

by adafruit_support_bill on Fri Sep 17, 2021 10:18 am

That is correct.

adafruit_support_bill
 
Posts: 82105
Joined: Sat Feb 07, 2009 10:11 am

Please be positive and constructive with your questions and comments.