I have a 3v dc motor. It works when I connect it to the 5v pin on my Ardunio card, but when I connect it to other pins and write digitalWrite or analogWrite commands, it does not work. As far as I know, it also gives 5v current from other pins. There is no problem with the pins. When I connect the LED with the resistor, the LED turns on. There is no problem with the motor, it works when connected to a 3v battery source. Why might it not be working?
The Arduino cannot directly supply the necessary current. You are stressing the Arduino and the 5V is dropping when you try to drive the motor.
...You'd see the LED dim if you connect it at the same time, but I don't recommend stressing the Arduino anymore than you already have.
You need a motor driver circuit.
A digital output pin on your Arduino(I will assume a simple Uno, since you didn't tell us), is only capable of around 20-30 mA of current. Your motor likely requires much more than that. So the output doesn't deliver, and might very quickly fail entirely.
You need a motor driver, as was pointed out.
The Arduino is not designed to power motors, and can be damaged if you try.
Use a separate motor power supply, a motor driver and don't forget to connect the grounds.
You are a very lucky person, what you did generally blows the ports of the Arduino. Here is some advice.
Gil's Crispy Critter Rules, they apply to processor hardware:
Rule #1. A Power Supply the Arduino is NOT!
Rule #2. Never Connect Anything Inductive (motor, speaker) to an Arduino!
Rule #3 Don't connecting or disconnecting wires with power on.
Rule #4 Do not apply power to any pin unless you know what you are doing.
Rule #5 Do not exceed maximum Voltages.
LaryD's Corollary's
Coro #1 when first starting out, add a 220R resistor in series with both Input and Output pins.
Coro #2 buy a DMM (Digital Multi-meter) to measure voltages, currents and resistance. Violating these rules tends to make crispy critters out of Arduinos.
Hint: It is best to keep the wires under 25cm/10" for good performance.
When you get a motor driver get one with MOSFET outputs, the L298 is a big problem.
The voltage requirement of the motor is not the only specification that needs to be satisfied. Different motors require different amounts of power. Generally any dc motor draws more power than the I/O pins can supply.
Consider you have a automobile. You need to start it but it has no battery. OK you go out and purchase 8 AA batteries, connect them in series and you have 12V. Do you think you will be successful starting the engine? I'm not trying to be snarky but trying to put it in a different context.
Connect the power supply to the motor driver. The motor driver will supply power and control to the motors. The Arduino will control the motor driver. A ground potential must be shared among Power Supply, Motor Driver and Arduino.
This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.