Robot supply problem [Solved]

Hello guys, I'm dealing with a problem I can't solve yet. I built a robot with Atmega328p, H bridge, couple motors, GLCD and PS2 keyboard. I attached schematic. Lcd shows keyboard outputs and some commands can control motors. The circuit was done on homemade pcb and it has some rust.

The robot is working 100% fine when connected to DC supply (7.5V regulated 2 A supply connected to LM7805). Also I connected it to another 4.5V regulated supply and works fine too, the motors run slower although.

But when I connect it to 6xAA batteries in series connected to LM7805 too, it works buggy. It communicates fine with keyboard, but when I turn on motors sometimes they don't work sometimes they do, lcd shows garbadge and sometimes Atmega328p reset itself. Batteries are rechargeable and they have energy (7.3 V in series).

I tried connecting capacitors for decoupling on both sides of 7805 both doesn't work. My guess is that it is a current problem, batteries cannot source enough current? Its kinda weird because 7.3V should be plenty of energy. Should I try with 9V battery?

Any hint will be helpful thanks in advance.

esq.PDF (188 KB)

Your circuit is unnecessarily complex to follow.

Measure the voltage of batteries when motors try to run. I bet there is a voltage drop so the 7805 regulator can't provide stable 5V output.

How you connect you motors? direct supply from the battery? or supply from the 5V 7805?

BillHo:
How you connect you motors? direct supply from the battery? or supply from the 5V 7805?

5v regulator too.
I fixed it anyway. I charged all batteries a couple of hours and now it works fine. But next time I'll get a separate supply for motors.