So, first of all, I'm very new to all this. Started school 4 weeks ago, and we've been working with Arduino stuff for most of the time. I thought I was starting to get the hang of it, but I'm not sure anymore.
Last week, I managed to (finally) get a DC Motor to run.
Here are pictures of the setup and a breadboard view: IMGUR ALBUM
(I used digitalWrite at a later stage in our school project)
Today, at school, the motor was working for a while. But I noticed later that day, it did not. I thought maybe it was the code, and ignored it and worked on other things of the project.
When I got home, I decided to check the motor. It worked when directly applied to a power source. But not always when the power came from my breadboard.
I made an exact copy of what I did above, and it did not work. Using a LED instead of the Motor did make the LED blink on and off.
I tried to make it a bit more simple. Like these:
They did not work.
A more direct approach:
This worked.
I'm completely lost. Could something be broken, or am I missing something?
This is quite essential to our school project and I really need to know what's going on.
Please don't waste your or our time on Fritzing diagrams. Pictures that don't show all the wires, with clear paths are almost useless. A hand drawn wiring diagram is much better than either.
The diagrams do suggest that you have no common ground connection between the Arduino and the motor board, and that you have no transistor or other means to control the motor (which is required). Google "arduino dc motor" for lots of suggestions on how to wire this up.
jremington:
Please don't waste your or our time on Fritzing diagrams. Pictures that don't show all the wires, with clear paths are almost useless. A hand drawn wiring diagram is much better than either.
Like I said, I just started this whole Arduino thing and it's for school. I'd love to learn more about it but I don't have much time. That being said, I have no clue how to draw anything for this kind of thing so this is kind of all I can give for now.
The diagrams do suggest that you have no common ground connection between the Arduino and the motor board, and that you have no transistor or other means to control the motor (which is required).
weedpharma:
You have the motor directly across the battery with no means to control it.
Weedpharma
http://imgur.com/a/0avZ0
The first picture in this album shows me using a transistor. It worked in the past, but when I recreate this setup it does not. And I don't know why and I want to learn why it does not work or why it's so unstable.
Google "arduino dc motor" for lots of suggestions on how to wire this up.
I've done this countless times before, and recreated all of them to no success. I guess I can try again.
EDIT:
So I recreated this example (LINK) and ... it does not work.
I use this P2N2222A transistor. The flat side is facing the right side of the breadboard and the diode stripe is facing upwards.
I tried multiple transistors and diodes but none made it work.
EDIT 2:
Connecting it to a LED does work though. Just the motor doesn't work atm.
weedpharma:
You say it did work then stopped. This suggests a change on the way it is connected , IE, a bad connection.
Try rewiring in a different part of the board. And then try a different output port.
What transistor are you using?
Weedpharma
I'm using P2N2222A Transistors. Connecting it like this website suggests does not work for my motor. But it does work for an LED. I can power it with the Serial Monitor on my computer.
Also connecting a 9V as power source works for the LED, but still not for the motor.
Hi,
What course did you start?
You need a grounding in basic electronics, which seems this course is missing.
How does your teacher/lecturer draw circuits for you?
What are you using to power your motor/sketch?
Do you have a DMM to check voltages around your circuit?
Can you post a picture of your project please so we can see how you have assembled everything.
TomGeorge:
Hi,
What course did you start?
You need a grounding in basic electronics, which seems this course is missing.
How does your teacher/lecturer draw circuits for you?
What are you using to power your motor/sketch?
Do you have a DMM to check voltages around your circuit?
Can you post a picture of your project please so we can see how you have assembled everything.
Tom....
My study is called Creative Media and Game Technologies. It's in The Netherlands.
We were given these tools to make something out of. We are given complete freedom, and have no teacher or lecturer with extensive knowledge about these things as far as I know. When I asked how to make a Motor Controller (so the motor could turn both ways) all I got was confused looks, which was not very promising.
I'm powering everything either from USB -> Arduino -> Board or Battery -> Arduino -> Board.
I don't know what a DMM is, so I'm pretty sure I do not have it.
This one is from the website I got my design from (here). I can adjust the analog data send from pin 3 by writing a number from 0 to 255 in the Serial Monitor.
int motorPin = 3;
void setup()
{
pinMode(motorPin, OUTPUT);
Serial.begin(9600);
while (! Serial);
Serial.println("Speed 0 to 255");
}
void loop()
{
if (Serial.available())
{
int speed = Serial.parseInt();
if (speed >= 0 && speed <= 255)
{
analogWrite(motorPin, speed);
}
}
}
And there is this simple loop to open and close every second.
Directly connecting my motor with cables on the + and - strip makes it spin. So it's not broken at least.
Neither is the transistor because the LED is working fine.
Hi,
You are using P2N2222A, this has its EBC leads the other way around to a 2N2222A.
Unplug your transistor and turn it around 180Deg and see if that fixes it.
I only checked 2N2222A on google and looked at the images it showed.
TomGeorge:
Hi,
You are using P2N2222A, this has its EBC leads the other way around to a 2N2222A.
Unplug your transistor and turn it around 180Deg and see if that fixes it.
I only checked 2N2222A on google and looked at the images it showed.
hmmm didn't know that, I don't use 2N2222A's.
Ya learn sumthin everyday.
Hope it fixes it.. Tom....
The LED still works, but much brighter, when I turn it 180.
The motor still does not work.
weedpharma:
What happens if you put a 10k R from the base of your transistor to 5v? This should turn on the transistor and hence run the motor.
In the photo, it looks like you have plugged the ground into Aref though it may just be the angle.
Weedpharma
It did not turn on the motor. It did turn on the LED when I connected it.
Hi,
I think your method of connecting the jumpers to your motor is a bit dodgy, you need a good stable contact between the wires and the motor tags.
Also be careful, those jumpers are in the pictures almost shorting to the motor case.
You latest pics show the transistor still connected the way as in previous pics.
Look at the data sheet I attached to post #15, if you have P2N2222A you need to use this sheet.
You need a DMM to help you.