I build a simple avr circuit that on/off a small dc motor.The power supply of circuit is a simple linear regulator(7805).for driving the motor a power mosfet(irf9540) was used.But when motor is on the avr did not work correctly and reset and lock.
I used an filtering of power supply by inductor and tantalium capacitor but this problom occured.
Use inductors on both sides of the voltage regulators and tantalum+100nF very close to the microcontroller ..
Also, you can try to separate the MOSFET from microcontroller by an optocoupler ..
This separation will allow you to connect additinal inductor between 0V of microcontroller/voltage regulator and 0V of th MOSFET, thus separatig power ground from microcontroller controller ground ..
Do you have the proper components on the motor/mosfet to prevent inductive feedback from the motor during load changes? I'm asuming you're driving the mosfet using a PWM channel on the AVR. Although it would cause some extra heating of the mosfet, integrating the PWM output that goes to the mosfet a little bit will smooth out the motor pulses a bit but will waste more as heat because the mosfet isn't driven as close to saturation at each end. Given the frequency of PWM that AVR's can generate, make sure the frequency is ideal for the mosfet you're using.
I changed IRF9540 by L298 and this circuit worked correctly.But L298 is warmed and need a heat sink.
I think that a simple mosfet driver with isolated ground could be used for this work.
Incidentally this happened to be my first circuit with avr. I too used 7805 and a hexfet for driving a motor. It worked. You should first check your algorithm. If thats not the problem try using 2 capacitors one at iput an dother at oput of 7805
I changed IRF9540 by L298 and this circuit worked correctly.But L298 is warmed and need a heat sink.
I think that a simple mosfet driver with isolated ground could be used for this work.
warming means your mosfets are not switching properly or new mosfet's ON resistance is higher than for IRF9540 - which means also lower current goes on and lower noise for power.
i think there are could be few reasons - you did not separate current return loop for motor so it flows through mcu circuit , or you did not properly filtered the motor power connection and switching noise is on power line , or less possible you have radiated EMC problem.