0
\$\begingroup\$

I tried to calculate the value for analogwrite which is 77 but that doesn't work. I also tried a bunch of other value but none of them spin the motor. Is this possible and am I missing something? the motor is a FF-N20ta-2232 and i am using pin 13 on the Arduino uno.

schematic

simulate this circuit – Schematic created using CircuitLab

\$\endgroup\$
  • 1
    \$\begingroup\$ How much current does your motor need? The Uno can only supply about 10-40mA. Your motor might need more current. \$\endgroup\$ – Stefan Wyss Apr 6 at 18:57
  • 1
    \$\begingroup\$ Don't try driving an electric motor, even a small one, from a microcontroller output. Your motor is rated to draw 0.2A at its nominal voltage. You will likely damage the Uno. You can buy a cheap H bridge shield to drive the motor instead. \$\endgroup\$ – Pzy Apr 6 at 18:59
  • 1
    \$\begingroup\$ Also, the "analog" output of the microcontroller is a series of pulses. The motor has high inductance which means that there will be a high voltage spike every time you switch off the output. These spikes have the ability to destroy the output of the microcontroller - if not the whole chip. \$\endgroup\$ – Transistor Apr 6 at 19:15
  • \$\begingroup\$ You need an H bridge to drive the motor, but beware not to buy one of the horrible ones based on a Darlington chip like an L293 or L298 - find something with an FET chip or discrete FETs. If you only want to run it in a single direction you can use a single NFET on the negative side, there are a number of existing questions on that here. \$\endgroup\$ – Chris Stratton Apr 6 at 21:42
0
\$\begingroup\$

Firstly, the Arduino microcontroller is not suited to driving any motor directly. See the comments for a discussion of suitable solutions, including H-bridge drivers. Motor shields are widely available for Arduino Uno controllers.

Secondly, I have checked the Arduino reference for AnalogWrite and it appears this function is not available for pin 13 on the Arduino Uno which you mentioned you are trying to use.

On most Arduino boards (those with the ATmega168 or ATmega328P), this function works on pins 3, 5, 6, 9, 10, and 11. On the Arduino Mega, it works on pins 2 - 13 and 44 - 46. Older Arduino boards with an ATmega8 only support analogWrite() on pins 9, 10, and 11.

Finally, if you would like to use this motor then you should check the datasheet. The motor is rated for a nominal voltage of 1.2 V and a no load current of 0.2 A (200 mA). Under load or stalled, the motor will draw more current.

\$\endgroup\$
  • \$\begingroup\$ Beware that most cheap "motor shields" have the problematic Darlington drivers like L293, L298, etc which should be avoided \$\endgroup\$ – Chris Stratton Apr 7 at 0:34

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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