is this motor project possible?

Hi, I am a bit of a noob with electronics and would like to run a 12v motor in a circuit with an arduino board. Heres my plan?

I want to make a motor run for 20 seconds and then stop for 5 seconds then run for 20 seconds (Then repeat)

I will need to power the motor of a 12v battery and not through the Arduino board, but don't know how to make the motor be powered of the 12v battery, but get its on off commands from the Arduino board. I think I am correct in thinking this is possible but don't know if I have the correct stuff so I will list my components below :slight_smile:

An Arduino board
100 Ohm resistors
many kinds of transistors
some push buttons
wire
12v motor
9v battery
12v battery
LED's
Breadboards

Hope this is enough :-/

This sounds like a fairly straightforward motor control application. Chances of success are high :slight_smile:

Have a look at the Motor and Solenoid resources here:

http://www.arduino.cc/playground/Main/InterfacingWithHardware#Output

If your motor only ever needs to turn in one direction you can treat it like a solenoid. The "motor control" solutions are mostly geared towards H-bridges which allow motors to turn in both directions.

--
Check out our new shield: http://www.ruggedcircuits.com/html/gadget_shield.html

I kind of understand that stuff, but I find real pictures much easier to understand. Know of any? Also am I going to definitely need a diode for this project?

I kind of understand that stuff, but I find real pictures much easier to understand. Know of any?

Here is the first picture in the Solenoids section of the web site I suggested.

Also am I going to definitely need a diode for this project?

Definitely maybe. I would get my hands on one if at all possible. If you run without it you run the risk of damaging your transistor.

--
Check out our new shield: http://www.ruggedcircuits.com/html/gadget_shield.html

Ok I will get some diodes soon. And I should of been more clear by what I mean by "Picture" I learn better from real life pictures of completed projects rather than wiring diagrams. Do you know of any?

Get a L293D, it is the so easy to use. Connect the arduino to 2 pins (forward backward) and external power to another pin and there you go.

Thats a micro controller right?

The L293 might even be overkill for this application. From what I gather, Sam wants to accomplish his goal with the components he has on hand. With one diode, one NPN or PNP transistor, and one resistor he could make it work fine. If you don't include a freewheeling diode, you are risking more than your transistor. You would most likely destroy your arduino.

Perhaps this may be of use:

Thanks so much, this diagram has really helped! All I need to do I think is get a diode. Also one quick question, is there only one wire coming of the Arduino, or does that ground label go to the ground pin on the Arduino?

The Arduino, the transistor AND the 12 Volt Supply all share the ground potential. It's a "common" connection among all. This is commonly misunderstood so I understand that confusion.

The base of transistor will turn on when the Arduino sets its output pin the correct potential. The transistor, when turned on will close the circuit between the (-) or BLACK terminal on the battery (aka GROUND) thus making it run... BUT... the potential between the EMITTER (where ground is) and the BASE (where the Arduno is...) needs to be referenced to the ARDUINO potential or the transistor just won't work right. This is why the ground of the battery and the ground of the arduino need to be connected together.

The ONLY place the (+) of the 12 Volt battery goes is to the other side of the motor.

@pwillard
Thank you for clarifying that for me. Your wording is certainly better than mine would have been. :slight_smile:

Brilliant thanks, that has made everything much clearer for me :slight_smile: All I need to do now is buy some diodes :-/

Ok so since I did not have any diodes and since this is my first time using a transistor I decided to use LED's and no arduino. All I wanted to do is push a button which would turn on some super bright LED's which were powered by a 9v battery. Below is a diagram of what I did. It all worked correctly apart from my transistor got VERY VERY hot! Can someone please explain why? And sorry if this is a real noob question ::slight_smile:

http://www.flickr.com/photos/samuelcb17/4873430039/

I'm supprised you didn't burn up the transistor. You need to read the data sheet for whatever transistor you used and see what the max base current limit is and what the max collector emitter current is. I see no current limiting resistor for the transistor base.

Ok I now have labelled the transistor pins ass what I believed them to be

http://www.flickr.com/photos/samuelcb17/4875391776/

Umm I don't think I do have a resistor between the base pin and the 3v battery either, only between the LED's and the 9v battery.

The label on the transistor is, C1815 GR9L, hope this is enough.

I have also got a lot more transistor, but I just choose one at random and used it since like I said before I am a noob and learn by doing, even if I do make expensive mistakes ::slight_smile:

Thanks for the help!

Ok.. First of all: Five LEDs might require more than that transistor can handle.. According to the data sheet, Absolute Maximum Collector Current = 150mA. We would need to know your LEDs specs to be certain. However, standard LEDs operate in the 20mA - 30mA range. 30mA * 5 = 150mA.. The maximum that transistor can handle. I would say you need to go through your transistors and find a different one. The one you are using is recommended for audio frequency amplification. You want a simple switching transistor (general purpose) of NPN type. The 2N2222 has a max collector current rating of 800mA. If you can find one of those it would work nicely. Do you have any that start with 2Nxxxx? Those are pretty run of the mill. Once you found a more suitable transistor, you would need to address your incorrect circuit. There MUST be a resistor limiting current into the base. More on that when we know what you find.

I have a little silver transistor which has 2N2222A M0311 written on it?

Also I do not know about the LED specs, on the pack it said Super LED and they are clear and let of a very bright red light. I also know they draw more than a normal LED but don't know how much more!

I have a little silver transistor which has 2N2222A M0311 written on it?

That's the one.. I don't think your LEDs will require more current than that transistor can handle. You should know the forward voltage and max current rating of the LEDs to be safe. According to your most recent drawing you linked to, the wiring is correct(minus the resistor to the base of course). The 3V battery isn't needed, but if you want it for a proof of concept I can understand that. So wire it up the same way and put 200ohms(2 x 100ohm resistors in series) from the switch to the base. That should work without getting hot.

If you mean a multimeter, then yes I do have one, this one:


Whether I can use it to do the test you mentioned above, I am not sure?

Ok brilliant, I will try that then, I thought I needed that 3v battery there, else I might as well just have the button working with the 9v battery and LED's?