Current Drop From Motor Resets Microcontroller

Thread Starter

Lights&Sound

Joined Dec 29, 2023
4
Hi, I'm a beginner so please understand if I... you know... don't understand.

I have the attached circuit built and when I run the motor it works fine, but when the motor stops it (sometimes) resets the microcontroller. I know it is not too little current from the supply, but more likely the quick change in current as the motor shuts off. I understand from research and looking at an older forum post (see: Weird drop in voltage, or something else, resets microcontroller) that I likely need capacitors to handle the changes in current, but I don't quite understand what size and where. Would appreciate any help or a different solution! Thanks!
 

Attachments

BobTPH

Joined Jun 5, 2013
8,922
The motor stop more quickly and probably not crash the processor if you set both outputs to low to stop it. This makes a short circuit which acts as a brake.
 

Reloadron

Joined Jan 15, 2015
7,511
Current Drop From Motor Resets Microcontroller

I see you are using an older L298 motor controller. I gather from your drawing you are only running the motor in one direction. Keep in mind that a motor start current can be 10X greater than the run current especially if the motor starts under load. If the power supply dips enough then yes, the uC will reset. Also I see you have a Step Down Regulator in there as a buck converter I assume. Something you can try is placing a large cap across your power supply output, Large as in a few thousand uF rated at 25 volts or greater. Lastly a power supply capable of delivering higher current. This is all pure speculation not knowing your motor or power supply specifications. There are much better H Bridge motor controllers out there today, the old L298 is not very efficient and has voltage drop inherent to the design.


Ron
 

Thread Starter

Lights&Sound

Joined Dec 29, 2023
4
What I don't quite understand is why the reset happens only when the motor stops, not on start. I may be wrong, but doesn't that imply it is not an issue of lack of amperage? I am aware the L298N is not right for the job, it is just what I had on hand. It is also not rated to the current I'm using, so maybe that's simply the problem. I'm using 12v 2.5A
 

BobTPH

Joined Jun 5, 2013
8,922
When power is removed from a spinning motor, it becomes a generator, and depending on the load, can generate a high voltage. That is likely what is crashing your micro. Shorting the motor out suppresses the high voltage and dissipates the energy quickly.
 

MisterBill2

Joined Jan 23, 2018
18,405
The error I see immediately from the published circuit is the lack of any return path for the two digital circuits connected between the L298 IC and the processor module. The immediate result is some unknown voltage developed at the I/O portion of the processor module, which will surely have some effect. Brush-type motors do produce noise voltage that certainly will be able to cause problems. Some if that noise may also travel back to the unknown 12 volt power supply.
That power supply may not be adequately able to hold the output stable with the sudden switching off of the DC motor. Is it the supply is rated for 2.5 amps? or that the load current is known to be 2.5 amps???
 

sarahMCML

Joined May 11, 2019
370
What I don't quite understand is why the reset happens only when the motor stops, not on start. I may be wrong, but doesn't that imply it is not an issue of lack of amperage? I am aware the L298N is not right for the job, it is just what I had on hand. It is also not rated to the current I'm using, so maybe that's simply the problem. I'm using 12v 2.5A
From looking at your schematic, I surmise that you are using one of the ready made modules from Amazon or AliExpress?
If so there are 2 things that you can try:
1) As per the L289N datasheet, connect both channels in parallel. This will give both twice the drive current capability to the motor, and put more Back EMF diodes across the circuit, which may help to clamp the spikes.
2) Secondly, put a large (1000uF or larger) electrolytic capacitor directly across the power inputs to the L298N module to absorb any Back EMF voltage.
 

MisterBill2

Joined Jan 23, 2018
18,405
nobody else sees any issue with there not being any return path for the digital control lines? and nobody thinks that might have something to do with the problem??
Perhaps the common side in that "step down regulator" is not isolated??
 

MisterBill2

Joined Jan 23, 2018
18,405
I made the assumption that the second converter was an isolated device for the simple reason that it was drawn that way.
And in any case, good practice requires providing a complete direct loop for digital signals, primarily to avoid unwanted results such as resetting when there are events in the power circuit loop. THAT is the reason for those extra GND connection points shown on the processor module drawing. Putting a digital output and motor current in the same conductor is universally a poor choice. That should have been apparent at the first look at the circuit drawing.
 

MisterBill2

Joined Jan 23, 2018
18,405
Now, GIVEN that the unintended reset is actually happening, where else would it be coming from?? Unless it is somehow triggered by the software, which does not seem reasonable.
 

MaxHeadRoom

Joined Jul 18, 2013
28,669
I still think the shunting of the motor at turn off is worth trying, the two bottom H-bridge semi's are turned on, as per the spec sheet noted in posts 6 & 8.
 

djsfantasi

Joined Apr 11, 2010
9,160
Since the motor runs in only one direction, I’d add a diode reverse-biased in parallel with the. 0.1μF cap. and motor. All the ideas presented here are good. Particularly when interfacing microcontrollers with inductive loads (relays, motors, etc..). The LM398 module ground should be connected to the Arduino ground UNLESS the regulator module input and output grounds are common. And a big, honking (technical term) cap on the 12V input.

Noise and spikes are bad in an analog circuit. They are DEATH in a micro one.
 
Top