0
\$\begingroup\$

I have the following circuit:

enter image description here

When I close the mosfet gate (i.e. set pin 1 to high), the dc motor will run for a few seconds and unexpectedly then stop. Inspecting with a multimeter, I found that pin 1 has unexpectedly gone low suggesting that the microcontroller has reset itself. I would imagine this is due to some sort of noise from the dc motor but I thought a flyback diode would fix the problem. What is causing this to happen?

\$\endgroup\$
2
  • \$\begingroup\$ I would say the first order of business is determining if the microcontroller resets. This can be entirely possible if your power supply is unregulated, since the motor can cause voltage drops that will bring the voltage to a level unsufficient for the chip to run. I have seen this happen often. I assume you have serial port to monitor the chip, so it would be easy to see if a reset happens. \$\endgroup\$
    – Mu3
    May 2, 2019 at 6:47
  • \$\begingroup\$ If you measure the motor DCR resistance and can guarantee that the supply stays in tolerance to the uC then you may have an EMI error , but most likely your supply cannot handle the current. Ensure adequate low ESR caps are used. \$\endgroup\$ May 2, 2019 at 6:47

1 Answer 1

3
\$\begingroup\$

When the motor starts rotating, it will draw a "start up" current, the stall current.
It's quite likely it pulls down the 5V. Use decoupling capacitors as shown in the schematic below.

enter image description here

Value of the resistor depends on the supply current of the attiny85. I assumed a big 10mA, causing an acceptable 100mV drop across the resistor. The supply current is probably lower.

The 100uF is also indicative; it depends on the stall current the rated 3V motor draws on 5V (so, not the datasheet value, but about 5/3 times bigger).

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.