Hi everyone, I am new to arduino so this is probably a pretty basic question.
How can I control (using code) when a DC motor connected to a 9V battery is operating?
Is there some kind of switch that allows me to stop the connection between the battery and the motor when a digital port of an arduino is outputting current?
Welcome to the forum
Let's start with the subject of supplying power to the project and in particular the motor
The 9V battery that you mention is very likely what I know as a PP3 smoke alarm battery. It cannot supply enough current to run an Arduino for very long and certainly not an electric motor. You will need an alternative power supply, perhaps 6 AA cells in series
Now to how the motor is connected to teh Arduino. Do not power it from an Arduino pin whether or not there is a switch of some kind between the two. The Arduino is not a power supply and even with an external power supply an Arduino pin cannot supply enough current to drive anything more than sensors
So, what to do ?
- use a better power supply than a PP3 battery
- investigate motor shields. They allow an Arduino to control the speed and direction of an electric motor
This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.