• Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

Microcontroller controlling a DC Motor

Status
Not open for further replies.

inktomi

New Member
Hi

I have an AVR (AtMega32) microcontroller controlling a permanent magnet dc motor. I'm using an L298 dual H-bridge chip with the motor voltage supply coming from a seperate supply than that of the microcontroller. The H-bridge logic inputs are driven directly by the microcontroller and after a while the microcontroller goes crazy. Just to check, I disconnected the H-bridge logic inputs from the microcontroller and connected them directly to the microcontroller power supply (5V and GRD). Doing this did not stop the erratic behaviour.

Somehow the motor seems to be affecting the digital supply even though it is running from a different supply. What filtering strategies should I use?
 

Sceadwian

Banned
Post a schematic (in detail) of how you have things connected and also post the C or ASM code you're using. The micro controller should have a small electrolytic almost right on it's +VCC and GND pins, right at the chip for one, it depends on the rest of your schematic how you should chose where to put caps or what not.
 

inktomi

New Member
Post a schematic (in detail) of how you have things connected and also post the C or ASM code you're using. The micro controller should have a small electrolytic almost right on it's +VCC and GND pins, right at the chip for one, it depends on the rest of your schematic how you should chose where to put caps or what not.
Maybe I was not clear, but the interference with the microcontroller occurs even when the bridge is not connected to it (only connected to its power supply).

I'll draw a schematic and will post it.

Thank you
 

q5101997

New Member
Possably ESD (electro static discharge) from the motor windings/brushes. These are relativly strong electromagnatic waves produced when there is a sudden chane in inductor (winding) current and a very high voltage is produced. This will play havoc with CMOS, due to their high input sensitivity (high input impedance). Put a snubber circuit accross the motor to reduce high voltage spikes induced in its windings.
 

Sceadwian

Banned
Not clear enough, because if the bridge isn't connected that means the motor isn't being driven, which means something else is going on.
Schematic and code required =)
 

q5101997

New Member
No S, he said he is driving the motor but not driving the logic for the motor from the MCU. He is running the motor and the MPU is running irratically. Try a 1µ, 100n, 10n or 1n cap accross the motor terminals. Use shielded cable for the wires.
 

inktomi

New Member
Here's a reduced schematic. As q5101997 said, I'm not really using the microcontroller to control the motor. Microcontroller has a 0.1uF capacitor at the Vcc pin is not shown. All bypass capacitors are Metalized Film type. (Also tried an electrolytic at the uC)



The motor is a small 5V dc motor and its about half a meter away. I should add schottky clamping diodes at the bridge output pins, but its too late to get them today.

As some have said, I'm suspecting its ESD. I'm carefully looking at your replies and I'l do further research. (No idea what a snubber circuit is)

Thank you all
 

Sceadwian

Banned
There are no caps on the motor at all? Put the largest cap you have handy on the motor like q51 says. Dc motors almost always need to be filtered at their terminals. Keep in mind, if this is a reversible motor it has to be a non-polar cap, or it'll fail really fast.
 
Last edited:

q5101997

New Member
Snubber

A snubber curcuit filters to earth any high voltage spikes induced in an inductive load that recieves a sudden change in current. This spike can be extremely brief and of high voltage, and so a small capacitor acting as a high stop filter, should snub these fast duration, high frequency components to earth.
 

inktomi

New Member
There are no caps on the motor at all? Put the largest cap you have handy on the motor like q51 says. Dc motors almost always need to be filtered at their terminals. Keep in mind, if this is a reversible motor it has to be a non-polar cap, or it'll fail really fast.
There was no capacitor. I added a 1000uF cap accross the motor terminals. For a given voltage, the rpm with the cap, dropped. The eratic behaviour went away. I also changed the psu driving the motor, because I suspect it was playing a part.

Thank you.

Edit: Tried a 2.2uF cap with the same results
 
Last edited:

Sceadwian

Banned
+1 to q51 =)
 

inktomi

New Member
+1 to q51 =)
Yes, of course. I'm still thinking about what q51 said, that's why I haven't reply to him yet.

Adding fast-switching clamping diodes or capacitors seem to do the same thing. In the case of diodes, I will be needing four. If I use capacitors, as q51 suggested, I think two are enough. The only diffrence I see is that capacitors always short to ground.

I'm not sure which solution is the best. The L298 datasheet shows 4 diodes and a singe cap, from rail to ground
 

Sceadwian

Banned
Ooo, no clamp diodes either? I overlooked that I assume they're there not matter what I guess. Yeah, that'll cause all sorts of hell for EMI if not damage other IC's. Those diodes and the cap are in the PDF for a reason, it's the suggested setup. I don't know if you're set on the L298 but there should be bridge drivers out there that have integrated clamp diodes. I'd definitely put both the diodes and the capacitor on there. Should eliminate your problem.
 
Last edited:

inktomi

New Member
Ooo, no clamp diodes either? I overlooked that I assume they're there not matter what I guess. Yeah, that'll cause all sorts of hell for EMI if not damage other IC's. Those diodes and the cap are in the PDF for a reason, it's the suggested setup. I don't know if you're set on the L298 but there should be bridge drivers out there that have integrated clamp diodes. I'd definitely put both the diodes and the capacitor on there. Should eliminate your problem.
Yes, I'm set on the L298. Is it essential to have the diodes at the motor terminals? The control board will be almost a meter away from the motors, so I would have to run an additional 2 wires with the supply and ground apart from the h-bridge outputs.

If I could avoid 2 extra wires, I would not hesitate to do so.

Thank you for your reply
 

Sceadwian

Banned
Hmmm I'm not sure about that, I dont' think so but I've never seen a stepper motor that far away from it's controller either. I'd say mounting them on the PCB is fine. I'm not sure sure stepper wires that long are a good idea I imagine they'd produce some decent EMI problems.
 
Last edited:
Status
Not open for further replies.

Latest threads

EE World Online Articles

Loading

 
Top