I'm going to start off with a warning that I am quite new to Arduino but very excited to start working with it, I've used breadboards in the past and love how simple it is to integrate the programming with the Arduino. I have a project that I'm actually working on for school in which I have a randomly generated password that has to be repeated by the user, which works perfectly fine. However I want to turn a motor when the program finishes and the motor just is not getting power. I've tried hooking it up directly but that didn't seem to work, then I tried wiring up as shown here (I have left out the wiring for the password part for simplicity) : but this also doesn't seem to work. I can't imagine the problem being my coding, as it doesn't even work with simple code such as
I'm sure it's a basic simple mistake that I just made due to inexperience so an expert's eye would be much appreciated! Thank-you so much in advance for any help let me know if I broke any etiquette rules on the forum or if there's any more information that you need me to provide!
I think this issue comes up almost once a day. The arduino can only output 40 mA from a pin which is not enough current to run any but the tiniest of dc motors. You need to power the motor separate from the arduino. The most common ways to do this are with h-bridge circuits or dc motor controllers.
Oops crossroads haha I screwed up my diagram. I assure you in the actual thing I didn't make such a silly mistake and jester thank you so much, I think that's definitely my issue! It's so annoying how many guides there are online that teach you to use the motor in such a way but don't give a warning like that. I'll try it out when I get home today and keep you updated on how it goes thanks again!
Sorry I hate to be a pain in the butt, but is there any way to power it without having to get the H-bridge chip or some other new component? I tried wiring it up using a relay as seen in the guide here http://www.canadarobotix.com/doc/ROBOTIX-Arduino-Discovery-Kit-Lite-Guide-R2-2013-07-24.pdf (page 42) in which I had the opposite problem, the motor was being powered constantly. There's not much around me parts store wise so I can't exactly go out and get new components. What I have available to me is:
330 Resistor
10K Resistor
10K Potentiometer
Push Buton / Tactile Switch
Photo-resistor
Transistor
Small Signal Diode
SPDT Relay
DC Motor
Otherwise I'll be in a bit of a pickle, but any help is appreciated
There is nothing wrong with the circuit on p. 42 of the pdf that you linked, so if you have wired it EXACTLY as specified, including placing the transistor the right way around, some component is not working correctly. Always remove the power when you change components or wiring.
One suspect is that the transistor is internally shorted. Remove it completely from the circuit and if the motor still runs, then the relay may be stuck or not wired correctly.
You can use a multimeter or an LED and resistor to check that the Arduino pin 9 is positive when commanded high and zero when commanded low. Other possibilities include improper connections on the breadboard, which you can also check with a multimeter (if you do not have one, now is the time to buy).
Edit: again, always run a motor and the Arduino from separate power or battery supplies, but be sure that the grounds (usually the negative leads) are connected together.