Far-seeker:
First a schematic or other diagram of how everything is wired would be very helpful in most cases when you are asking for advice on this forum.IANfinity:
So we bought a small DC motor (not sure of the specs)If it has any markings, look them up on-line. You might be able to find a data sheet for it. After all this is the Information Age...
IANfinity:
I have a 9V battery which is to power an Arduino Uno AND a DC motor.Regardless of your other problems if it's the standard rectangular 9V battery, you want a different power supply. A 9V battery usually has less than an 700 mAh,(or it can also be expressed as 0.7 Ah), of charge capacity. The units "mAh" or "Ah" stand for "milliAmpere-hours" or "Ampere-hours", in other words how much current the battery can supply for one full hour. This is enough to power an Arduino and a few other things like LEDs for several hours, but it wouldn't power most DC motors for long and at least some it couldn't supply enough current to get them moving (though it might not be the case with your motor).
On the other hand, common alkaline AA usually have a capacity of over 2200 mAh. They have a nominal voltage of 1.5 VDC (nominal because the exact voltage of any battery varies a bit based on how much charge is remaining), but six of them can be put in series to get a nominal 9 VDC. By the way, all the standard "letter" sized alkaline batteries have nominal voltages of 1.5 VDC. The only difference is the maximum charge capacity and as you might guess the capacity increases with the battery size.
IANfinity:
What kind of DC motor do I need?The primary requirement will be "Can the motor do what I want it to do?", in this case spin your weight reliably with enough force to tip over the can. Any other requirements will be imposed by limitations like volume, weight, and power constraints (which in this case shouldn't be a problem). With a few extra components and the right programming an Arduino can control almost any DC motor.
IANfinity:
What kind of transistor do I need? What kind of resistors do I need, if any?The transitor will have to be able to handle the voltage and the current levels necessary to power your DC motor, while still being able to be controlled by the output of an Arduino pin, which can only output 0 or 5 VDC @ a maximum current of 40 mA. The number and rating of resistors will be determined by what's necessary to properly bias the transistor.
You should also have a couple of diodes as well.
Here's a link to a tutorial about working with small DC motors and Arduinos. It's written by an active forum member that goes by "Grumpy_Mike".
Here are some pictures.
This is everything
Here is a close up of the wiring setup.
My program is just a modified version of the "blink" program, which is what our proffessor reccomended in class. I have pin 2 coded to wait 32 seconds then turn the motor on, "digitalWrite(pin 2, HIGH)", then stop after 6 seconds (which should be enough time to tip the can over, but this would be no problem to edit if need be). You can see the red wire going from pin 2 to the base of the transistor. The black wire connects the emitter to the blue wire which connects to the pin labeled (GND). The red wire connected to the collector is what we connect to the positive part of the motor. The green wire, which is in the 5V pin on the power strip connects to the negative part of the motor. The motor DID turn on with this setup, and seemed as if it would have enough power. The motor did NOT turn on without the transistor.
Our transistor is an NPN transistor purchased from RadioShack. Here is a data sheet for it: http://rocky.digikey.com/WebLib/On-Semi/Web%20Data/MPS2222,%20MPS2222A.pdf
I do not understand much of what it's saying. The equations we've been given in class are I=V/R, which I understand to be Current=Voltage/Resistance. According to the notes from the lecture, the easy way to calculate the resistance you need is to use R=(Source Voltage - Forward Voltage)/Forward Current. Honestly, I haven't thought about it too much, but I don't understand how to determine my forward voltage or forward current. I assume the source voltage is 9V (if I use my 9V battery).
The motor says "SuperJack" and "R-3" on the bottom. I can't find any info on it on the web. I found SuperJack's company website, but it wasn't much help. We are probably going to buy a different motor anyways, since we want one that has a gear on the shaft rather than just a smooth cylindrical shaft.
We do know how to put a resistor on this setup, we just haven't done it yet. We have 10kohm, 220ohm, and 270ohm resistors (these came in our Arduino kit).
The reason we are using an Arduino for this project is because we will most likely need to use one for our final design project coming up, and we wanted to get some practice with how it works.
So from what you have said about the 9V batter, I think that this setup does NOT need a resistor. Is this correct?
We are sending 9V through the Arduino, which takes up 5V, so we now have 4V going to the transistor. So would 4V be the forward Voltage to the transistor?
The collector has a current of 600mA or .006A. Correct? So do I just add that current to the current coming from the battery? What would the current from the battery be?
I know I am all over the place with these questions, I just don't know what's going on. I haven't looked at your tutorial yet, so I apologize if anything I've asked is answered there.
Basically, I want the motor to be able to get enough power for at most maybe 10 seconds, and I want nothing to be fried/ruined in the process.