Electromagnetic noise in simple L293D dc motor circuit + ATMega

Hi,

I have some weird noisy behaviour in my circuit and I can't explain it.

The setup is very simple: driving a dc motor with a L293D (actually a L293DNE), controlled via an Atmel ATMega32(no PWM, just a pin out).

The dc driver layout is similar to the application notes of the L293D datasheet, i.e. the motor is connected directly to the 1,2 outputs of the L293D, no external diodes. Thus I can drive it forward and backward.

Also connected to the MCU via USART is a serial LCD. Now I tried two different settings:

  1. A 9V battery/power supply for both the MCU (via a 7805 regulator) and the dc motor (before the voltage regulator).
  2. Separate 9V for the MCU and 10V for the motor.

Both setups give me trouble: The first one doesn't do it's job at all. As soon as I initiate motor movement (by setting the Atmegas output pin to high), everything goes wild and the MCU reboots eventually.

Does this mean that the voltage drops in the rest of the circuitry so that the MCU brownouts/blackouts? What can I do to alleviate these problems?

The second setup works, but everytime I run the engine, my LCD displays random characters, i.e. it seems to receive noise over the RX line.

Where does this come from? Is it that the motor somehow induces interference in the circuit? If so, how do I have to change my design to get rid of the effects? I have rather long, single wires (~10-12 inches) for most of the connections, does this make difference (vs. e.g. twisted pairs)?

I can post layouts, but the setup is really simple, anyways.

I am not an electronics guy, so any help appreciated!

Thanks,

-Steve.

Reply to
robbe75
Loading thread data ...

I have found that besides having isolated Motor/Logic supplies, it helps to isolate the ground rails between the logic and motor as well:

L293D-VSS 5V logic supply L293D-VS Motor power supply + L293D-GND Motor power supply - L293D-GND 10 Ohm to Logic supply ground

I.e. connect the logic (5V) ground supply through a small resistor (10 Ohm) to the L293D-GND terminals.

See ya, -ingo

Reply to
Ingo Cyliax

I assume you are using a brush type DC motor (commonly but incorrectly called a servo motor). These motors generate noise at very high levels. The problem is the commutator. Every time it switches, you get an inductive flyback on the coil switched. This generally arcs over between the brush and the commutator, and then between the commutator and its neighbor. Nasty broadband stuff.

To deal with it there are several things you can do. Think of the motor as a noise source, and the wires as both antennas and inductors.

- Twisting the wires together will reduce the signal transmitted through the air.

- Putting a small surge supressor across the motor terminals helps

- Putting a capacitor across the motor terminals helps.

- All of the above helps.

- It works even better if the outgoing wires are connected near the body of the capacitor, instead of to the motor terminals. On the circuit board...

- Keep the power, ground, and signal traces along the same path and as close together as you can.

- Put a big capacitor from power to ground between the motor driver and the power supply connection.

- Put the power supply connection between motor driver and the processor.

- Put another capacitor between the power supply connection and the processor.

- Try putting a diode between the power supply connection and processor side capacitor (power lead only, don't break the ground!)

- MAKE SURE NO HIGH CURRENT WIRES OR TRACES ARE PART OF THE CIRCUIT ON THE PROCESSOR SIDE OF THE CONNECTION.

- If you have a feedback loop of any kind, find a way to isolate it.

The way to think about this is the following:

- Any wire or circuit trace will act as an inductor to high frequency noise (the kind the interferes with the processor). So don't count on a trace having the same voltage at either end. Force it!

- A loop of wire is an antenna, the less area it encloses, the less it will pick up (this is why you keep the power, ground, and signal close together and along the same path).

- The motor circuit will be noisy, you want the digital stuff in a quiet backwater, so hang it out on the other side of the power connection.

- Think about the current flowing, wherever the noise current is the voltage will be bouncing around, try to "direct" the noise current away from the processor. You can block it with capacitors, or see to it that there is a lower impedance somewhere between the source and the processor (like the power supply).

- You will always do better if you nip the noise near its source.

Reply to
Police Box

I have rather long, single wires (~10-12

Steve, motor systems always have noise problems that need to be addressed. Those inductors generate and radiate like crazy. Besides what others have said, regards adding more filtering/etc [ie, every point in the system - motors, controller, etc - needs to have some protection features], one especial problem is long wires from the battery to the motor controller. The inductance in the wires leads to similar spikes, just like the inductance in the motor windings. Use of short, heavy wires is best. See "main capacitor" section here .....

formatting link
Another thing which helps is to connect the cktry together in an "octopus" wiring arrangement. IOW, don't daisy-chain the units together, especially the grounds, rather think of the motor controller as center point, and send wires to the other units [motors, batteries, logic controller] separately from each other. This helps keep the noise from the motors away from the logic, etc.

There is a lot of general info on this site .....

formatting link

- dan michaels

formatting link
=======================

Reply to
dan michaels

Hi,

Thanks for the answers. I tried some of the things you suggestest, putting a small R between the ground as well as the design suggestions from policebox.

The thing that turned out to work the best also is the ugliest solution: I wrapped the motors and wires up to the L293DNE in aluminum foil. No interference any more. I.e. I need to get shielded cable, right?

best,

-Steve.

Reply to
robbe75

Hi Steve, as I mentioned, the best approach is to have at least a "minimal" amount of filtering/etc at every important point in the system. These sort of problems are really systems-level, and sometimes it takes several fixes to eliminate the problems. This means filters at the motors, recirculation diodes on the h-bridge, caps on the motor controller battery terminals, and lots of bypass caps on the logic controller. It might also help to use series-R's in the i/o lines going from the logic to the motor controller.

That being said, the first thing is obviously to try and quench the problem at the source - ie, motors. Since shielding helps, you might try putting small caps [0.047-0.1 uF] across the motor terminals, and also from the motor terminals to the motor case (this is a common solution you see a lot). Personally I prefer a snubber (R-C in series, with R=10-50 ohms) across the motor. Also, it would be interesting to know whether it helps to run a 3rd wire from the motor case to the system ground - short of going to shielded cable - since shielding helps.

- dan michaels

formatting link
========================

Reply to
dan michaels

PolyTech Forum website is not affiliated with any of the manufacturers or service providers discussed here. All logos and trade names are the property of their respective owners.