MPU-9150 + L293D + Arduino Mega + Li-Po Battery + Robot, Arduino Gets Stuck!

I have a Arduino Mega 2560 connected to

L293D Motor Driver IC connected to two small size dc motors.
MPU-9150 using i2c
Xbee v1.1 arduino shield by seeed
Li-po battery, 7.4 volts, 2200 mah.
all components are tested separately, they all are working fine, the sensor readings showing data on serial monitor, the l293 drives the motors, xbee sends wireless serial data on pc, and li-po is also working fine.

i have checked the wiring alot of times. it all seems to be correct.

the problem arises when i connect all of them together, since i am using a single power source, i power the l293d with the Li-po and the Arduino also with the Li-po.

When the L293D is powered using Li-po and it starts drawing current from the battery, the serial monitor/arduino gets stuck. it doesnt show sensor readings anymore, while the dc motors start spinning. and they continue to spin, until i break connection with the battery.

without the l293d powered, the sensor readings are working fine, everything is going normal, as it should, but as soon as the l293d is connected, arduino is stuck..

i have searched alot of forums for this, found some info, perhaps something to do analog and digital ground? mpu-9150 is digital ground. so that is why it stops the arduino mega as the l293d starts drawing current. all hell breaks loose.

can anybody please help me with this? it is giving me headaches ever since!

This is a very common problem when trying to run both motor and logic controller off a single battery. First, the motors put electrical noise on the controller power buss, and secondly, when the motors start running, they will often pull the battery buss voltage down temporarily, and reset the controller.

  1. try using 2 separate power supplies and see if that works.

  2. try putting additional filtering at the point where the battery connects to the rest of the system, eg 220-470uF [yeah, a big one] and 100nF. See the following page, re "Main Capacitor", and how transient loads cause large voltage transients on the buss. This is due to inductance in the leads from the battery.
    4QD-TEC: PWM speed control

  3. always use a "single-point" or "star-grounding" configuration. This helps prevent motor current transients from appearing on the controller power lines.
    How should I organize this star grounding network? - Electrical Engineering Stack Exchange
    http://www.interferencetechnology.com/designing-electronic-systems-for-emc-grounding-for-the-control-of-emi-3/ (scroll down)

oric_dan:
This is a very common problem when trying to run both motor and logic controller off a single battery. First, the motors put electrical noise on the controller power buss, and secondly, when the motors start running, they will often pull the battery buss voltage down temporarily, and reset the controller.

  1. try using 2 separate power supplies and see if that works.

  2. try putting additional filtering at the point where the battery connects to the rest of the system, eg 220-470uF [yeah, a big one] and 100nF. See the following page, re "Main Capacitor", and how transient loads cause large voltage transients on the buss. This is due to inductance in the leads from the battery.
    4QD-TEC: PWM speed control

  3. always use a "single-point" or "star-grounding" configuration. This helps prevent motor current transients from appearing on the controller power lines.
    How should I organize this star grounding network? - Electrical Engineering Stack Exchange
    Designing Electronic Systems for EMC: Grounding for the Control of EMI | Interference Technology (scroll down)

You mean he should add a large capacitor directly on the power supply right ?
When you say "single-point", you mean same ground or common reference, correct ?

You mean he should add a large capacitor directly on the power supply right ?
When you say "single-point", you mean same ground or common reference, correct ?

Not quite. It's all shown in the references I gave.

a. the capacitor goes right at the point where the battery connects to the system, meaning at the "+" below. With the capacitor there, it compensates for the inductance in the battery-wires, and removes the inductive voltage transient.

battery - battery_wires --- + --- controller

b. "single-point" means the ground wires, and power leads for that matter, from all of the subsystems [eg, battery, logic controller, motor controller] are brought to a single-point. So the wiring looks like a "star", or I prefer, an octopus. No ground loops. This way the current distributed to each subsystem goes through its own set of wires, and never goes through the wires of the other subsystems.

Also, adding item 4 to the three above, in general with electronics there is no magic bullet. IE, no one "fix" may cause all the problems to go away. Electronics is really always a systems-level problem, and everything has to be done properly. The first thing is always to get rid of the spaghetti wiring lashup, and do it right. This helps reduce noise, ground loops, cross-talk, signal radiation, on and on.

oric_dan:

You mean he should add a large capacitor directly on the power supply right ?
When you say "single-point", you mean same ground or common reference, correct ?

Not quite. It's all shown in the references I gave.

a. the capacitor goes right at the point where the battery connects to the system, meaning at the "+" below. With the capacitor there, it compensates for the inductance in the battery-wires, and removes the inductive voltage transient.

battery - battery_wires --- + --- controller

b. "single-point" means the ground wires, and power leads for that matter, from all of the subsystems [eg, battery, logic controller, motor controller] are brought to a single-point. So the wiring looks like a "star", or I prefer, an octopus. No ground loops. This way the current distributed to each subsystem goes through its own set of wires, and never goes through the wires of the other subsystems.

Also, adding item 4 to the three above, in general with electronics there is no magic bullet. IE, no one "fix" may cause all the problems to go away. Electronics is really always a systems-level problem, and everything has to be done properly. The first thing is always to get rid of the spaghetti wiring lashup, and do it right. This helps reduce noise, ground loops, cross-talk, signal radiation, on and on.

a: understood XD XD
b:That's what is called common ground reference, when all grounds end up to the same point ..

b:That's what is called common ground reference, when all grounds end up to the same point ..

I think common ground reference means something different than [SPSG] single-point star-grounding. SPSG refers to a specific wiring arrangement, ie geometry, and not voltage reference.

Typically, the grounds in any system are all connected together, so whether you use SPSG or not, or a big mishmash of spaghetti and ground loops, supposedly you will have a "common ground reference". But in reality, there can be all sorts of noise and voltage-shifts on the grounds in the system, and you'll probably never have the same potential at every ground point in the entire system.

Thanks for replying again,

So are there any advantages of SPSG ?

i have used two power sources but to no avail

here is a diagram of the circuit, iv tried something. please if someone can guide me as to what exactly am i suppose to do?

i have changed L293D to L298N arduino motor shield. so it has a voltage regulator onboard, which regulates the voltage coming in from the Li-po and powers the L298N. grounds are connected. what possibly could be the problem?

You need to isolate the problem area. Remove unneeded components, get the thing working, add the removed components back in.

  1. disconnect the MPU and get the Arduino <--> motor part working first.

And you obviously did NOT try items 2 and 3 in my first reply.

i tried removing all the components connected it one by one,

sensor working fine(SEPARATELY)
l298 working fine(SEPARATELY)

but together they dont.

item 3 was tried , the star configuration,nothing happened problem persisted. but item 2 wasnt clear. could u please explain it?

  1. try putting additional filtering at the point where the battery connects to the rest of the system, eg 220-470uF [yeah, a big one] and 100nF. See the following page, re "Main Capacitor", and how transient loads cause large voltage transients on the buss. This is due to inductance in the leads from the battery.
    4QD-TEC: PWM speed control

Yeah, I've already explained it 2 or 3 times. Read the link.

sensor working fine(SEPARATELY)
l298 working fine(SEPARATELY)

but together they dont.

When all together, does the processor stop working, and stop communicating with the PC? Can you still turn the motor on and off?

I'd also put a 10-22uF cap across the MPU Vcc to gnd pins. Also, the MPU chip operation may be highly sensitive to spaghetti wiring like you end up with when using whiteboards. Item 4 above:

Also, adding item 4 to the three above, in general with electronics there is no magic bullet. IE, no one "fix" may cause all the problems to go away. Electronics is really always a systems-level problem, and everything has to be done properly. The first thing is always to get rid of the spaghetti wiring lashup, and do it right. This helps reduce noise, ground loops, cross-talk, signal radiation, on and on.