So I know that simple DC motors can be controlled using a transistor with the arduino input connected to the base and the end of the motor connected to ground. However, is there anyway to change the direction of the motor so that it goes the opposite way?
Yes it is called a H-bridge circuit look it up and buy a chip rather than trying to make your own.
Using H-Bridge Motor Controller module.
ChromeBit:
So I know that simple DC motors can be controlled using a transistor with the arduino input connected to the base and the end of the motor connected to ground. However, is there anyway to change the direction of the motor so that it goes the opposite way?
ChromeBit - I'm curious:
Did you try doing a search via google or another search engine (including the search function on these forums) in order to answer your question?
If so - what were the results?
If not - then what prevented you from doing so?
I'm only curious because this issue comes up a lot here, and I am trying to understand why it is so. For some, I can see it being an issue with language, but that doesn't seem to be the case here, since you were able to articulate your question in english without a problem.
Perhaps you thought that this question could only be answered by those with experience using the Arduino? If so - what led you to that conclusion? In other words, what led you to believe that motors can only be properly controlled using an Arduino, versus any other method, that would therefore necessitate seeking the advice of this forum (as opposed to another forum)?
Your question is one among several very, very common questions that people ask here - questions which have been answered multiple times in multiple languages - both here and across the broader internet. It isn't that we don't want to help, but certain general questions such as this have been answered so often, in so many ways, in vast numbers of venues, over the course of decades (believe me, I could probably dig something up out of an alt.comp.robotics newsgroup archive from the late 1980s) - that to rehash it here does little to advance common knowledge of the solution.
I see these questions, and I (along with others, I am certain) wonder if there is any way at all that we could make it easier for those with these questions to find their answers in a way that isn't simply yet another echo of what already exists. Sadly, I don't think it is possible - despite the stickys and such left at the top of the forums, we still get questions which have been answered within those stickys.
I would even suggest a "very top-level" forum on the main forum page that says "Read This First!!!" or something similar - that would have these basic questions as "topics" and a series of stickys and such within each one - that could perhaps help act as a clearinghouse for these common questions, but I know in my heart-of-hearts that even that would be ignored.
I suppose this is an issue which has vexed librarians and educators for centuries, if not millennia.
![]()
Maybe a forum called "typical hardware setups", read only, with basic connections for setting up the hardware:
LED with resistor, LED with shift register, LED matrix, LED matrix with MAX7219
Button & switch with internal pullup
Potentiometers, Resistor dividers into analog pins
Motor with NPN, motor with N-channel MOSFET, motor with relay -bridge, motor with H-bridge chip
PWM for LED fading
PWM for Motor speed control
RS232, RS422, RS485 network connections
SPI as master connections to slave devices
SPI-SPI comms
I2C as master connections to slave devices
I2C-I2C comms
Using Arduino as a programmer, other programmers
Ping sensor for distance, other distance sensor?
Light sensor
Level shifters, 3.3V to 5V, 5V to 3.3V
SD & uSD cards
Looks like a lot of this stuff exists, Nick Gammon's pages come to mind. We just need an eye-catching forum that people will browse first before asking questions.