-1
\$\begingroup\$

This question already has an answer here:

I have a simple working circuit to control a DC motor with an Arduino as indicated in the Arduino examples. For instance,

https://learn.adafruit.com/adafruit-arduino-lesson-13-dc-motors/breadboard-layout

The circuit uses 3 AA batteries and has a diode. When I changed the arduino to an Attiny85, the motor switches between on and off randomly. Looking in the internet, I found that this may be happening because the Attiny cannot handle the amperage but also because when the motor is on it reduces the amperage to the Attiny.

I presume it is the second option because the circuit works well when I use an adaptor instead of the batteries. I presume replacing the diode for a capacitator could prevent the reduction of the amperage to the Attiny. But I wonder if you know what is the best solution to this problem?

Thanks,

Camilo

\$\endgroup\$

marked as duplicate by nidhin, Daniel Grillo, tcrosley, pjc50, Dave Tweed Feb 28 '15 at 16:32

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

  • 2
    \$\begingroup\$ That's not a circuit, it's a cartoon -1 \$\endgroup\$ – Andy aka Feb 18 '15 at 18:05
  • \$\begingroup\$ What are your brown out detector fuse settings? \$\endgroup\$ – Chris Stratton Feb 19 '15 at 1:09
1
\$\begingroup\$

The diode shown in the layout drawing is across the motor + - pins to prevent flyback pulses from the motor from disturbing the rest of the circuit, it should not be removed or changed. If you were to install a capacitor to prevent voltage dips (from when the motor turns on) you would place it from the motor + wire to ground.

Be sure you are using the transistor as shown in the layout. An Arduino, or ATtiny chip itself cannot supply enough power directly from its I/O pin to power a motor.

Also if you are using just the ATtiny85 you should also have a decoupling cap from its Vcc pin to ground, this will reduce voltage spikes from getting into the chip and causing bad behavior.

The cap on the motor + may need to be 100uF or more. The cap on the ATtiny pins should be about 1uF or so.

A weak battery in your pack could also cause a similar condition.

As a last resort you might place a large value inductor between the + supply and the motor +, with the cap placed closest to the motor. The inductor would need to have a very low DC resistance, (so it might be a physically large component).

\$\endgroup\$
  • \$\begingroup\$ Thank you. is there are a specific voltage you recommend for the capacitors? \$\endgroup\$ – user3029447 Feb 19 '15 at 3:06
  • \$\begingroup\$ A small decoupling cap between the vcc and grd in the attiny fixed the problem, thanks \$\endgroup\$ – user3029447 Mar 18 '15 at 7:46

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