Back emf from motor resetting uC.

Go To Last Post
11 posts / 0 new
Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Earlier i built a line follower but due to back emf from the motor, the uC kept on resetting.So i had to make a new circuit altogether with external flyback diodes.I also put capacitors in the motor terminals,provided decoupling for all the ics, still the problem aint resloved.
motors im using 12v dc motors.
battery-2000mAh 12V li-ion battery.

Ive attached the schematic,Pls have a look.

Attachment(s): 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I can't see anything obvious with the circuit.
a) Does it crash only when you turn a motor off (back-emf) or at any time (noise).
2. Do you have the short tracks on the board for the supplies to the motors.
3. Do you have a ferrite's in series with the motor feeds to give you more effective de-coupling.
4. Have you had a look at the supply line of the MPU. Any drop out?

It might be a good idea to send some pictures of your circuit/wiring, to see if we can spot something visually.

Charles Darwin, Lord Kelvin & Murphy are always lurking about!
Lee -.-
Riddle me this...How did the serpent move around before the fall?

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Thanks for replying.
a) I use pwm to drive the motors.According to the inputs from the sensors the motor also reverses the direction of rotation.The ic resets in about 3 or 4 seconds from switching on the supply.
b) Yes, i have short tracks.I have soldered it on a strip board.
c) No, i havent added ferrite beads, how effective are they?
d)I checked the vcc of the uC, there is a steady 5v, if that is what you ask.
ive attached the pictures.

Attachment(s): 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

One have to separate Vcc and GND for:
Atmega
sensors
motors/bridge
Grounds shall be connected only at one point at the supply ("star" layout).
A good practice is allocating 5V regulator close to the logic, use of decoupling ceramics at each IC and ferrite beads for motors.
A fast scope on Atmega Vcc shall show the real picture. DMM is useless here.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Quote:
The ic resets in about 3 or 4 seconds from switching on the supply.

Whether the motors run or not? Or after they start running?
Obviously not when they get turned off!
Quote:

b) Yes, i have short tracks.I have soldered it on a strip board.

Vero board is always a bit iffy. You should probably have two or three tracks in parallel, with a weave of a single wire to join them together. Nice low impedance!

Quote:
c) No, i havent added ferrite beads, how effective are they?

They are very effective for decoupling and in conjunction with caps at both the driver end give you a second order effect.

Quote:
d)I checked the vcc of the uC, there is a steady 5v, if that is what you ask.

How did you check it, with a CRO. It could be spiking hi or low or just have noise, but it will keep on showing +5. V on a multimeter (a trap for beginners).

Quote:
ive attached the pictures.

I can see lots of inductance, capacitance & stray coupling.
As well as considering how it works at DC, you need to consider it's performance at AC.

The ground on the xtal & load capacitors needs to be nice low impedance (not just resistance) to Vss/Gnd/Common.

Edit 1
Cross post with Kas. I think we both said the same using different words.
Edit 2 After thought.
What happens if you disconnect one wire on one or both motors, does it reset consistently then?
Watchdog enabled & not being reset in time?

Charles Darwin, Lord Kelvin & Murphy are always lurking about!
Lee -.-
Riddle me this...How did the serpent move around before the fall?

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

In addition to the above you may want to add a 0.1 uF cap from Reset\ to Ground.

If you replace the motors with a pair of back-to-back LEDs and a resistor does the circuit work correctly, (i.e. no inductive load).

Is your 7805 overheating, and going through thermal shut-down? A heat sink would help this.

JC

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Thanks a lot for the replies. I gave a separate power supply for the uC vcc with common ground and so far the problem seems rectified. So it was indeed the spikes from the motor which caused all the trouble. :)

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

This leaves you with the problem of what to do when you need to run it from one power supply ( which is generally the requirement and also the most efficient). That comes back to de-coupling the motor supply & MCU supply adequately. You will gain a lot of experience/knowledge in doing that!

Charles Darwin, Lord Kelvin & Murphy are always lurking about!
Lee -.-
Riddle me this...How did the serpent move around before the fall?

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Do you think the micro can get damaged from all this back emf? cos i had an atmega168 which doesnt work anymore (actually shows error while uploading)..Im not sure if the ic is really dead.Any method by which i can recover it or check if its working?

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Quote:

Do you think the micro can get damaged from all this back emf?

Yes.

Also, here's a tip for you when posting photos the next time... :wink:, but still seriously : http://imageresizer.codeplex.com/

As of January 15, 2018, Site fix-up work has begun! Now do your part and report any bugs or deficiencies here

No guarantees, but if we don't report problems they won't get much of  a chance to be fixed! Details/discussions at link given just above.

 

"Some questions have no answers."[C Baird] "There comes a point where the spoon-feeding has to stop and the independent thinking has to start." [C Lawson] "There are always ways to disagree, without being disagreeable."[E Weddington] "Words represent concepts. Use the wrong words, communicate the wrong concept." [J Morin] "Persistence only goes so far if you set yourself up for failure." [Kartman]

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Quote:
i had an atmega168 which doesnt work anymore

You must have some feeling now what it is like to be in quick sand!
I would not get side tracked by the "non-cooperating MCU" and concentrate on the original issue. It will only confuse the thread and there are plenty of threads that cover the topic!

Charles Darwin, Lord Kelvin & Murphy are always lurking about!
Lee -.-
Riddle me this...How did the serpent move around before the fall?