What I need to do in order is servo to 180 degrees -> servo to 90 degrees -> turn motor on for 3 seconds.
I turn on my motor via a relay. What happens is whenever the motor turns on, it causes my servo to go whack. I'm certain the motor is the culprit because when I tried to comment the lines with the relay control, the servo positions perfectly fine. I'm wondering what would be a way to isolate the two?
wildbill:
It sounds like you have a power issue - are you trying to power the servo and the motor from the arduino?
Yes. I powered this motor from the arduino and it was ok. I thought that since the motor would not be running whenever I changed the positions, it would be ok to add a servo. I guess I am wrong.
You shouldn't be running either from Arduino 5V supply anyway, that's a logic supply that isn't
wanting spikes and drop-outs imposed on it. Separate supply for power from logic is the normal
way.
A small servo needs about 1A, larger ones and high torque ones need a lot more. USB can supply
0.5A tops.
Hello, I still need help. So I decided to power the small motor (it's the common ones inside toys) with a few external AA batteries. It's still interfering with the micro servo signal whenever it powers on. I connected the red wire to the relay, and the negative to the Arduino uno ground. I thought since the motor would draw from the external battery pack, the micro servo would become stable and the power source would be independent... I don't think the motor draws from the arduino either because the power of the motor is not connected to the Arduino power pins.
Now your relay is probably drawing too much.
Since you haven't shown how things are actually connected, it's hard to give you any advise on how to improve.
But i'm sure that if you use your favourite search engine to find 'Arduino', 'motor', 'relay' and so on, you'll find a lot of tips on how to do things the correct way.
MAS3:
Now your relay is probably drawing too much.
Since you haven't shown how things are actually connected, it's hard to give you any advise on how to improve.
But i'm sure that if you use your favourite search engine to find 'Arduino', 'motor', 'relay' and so on, you'll find a lot of tips on how to do things the correct way.
Thank you for the response. I attempted to search prior to posting, but I cannot find a specific case, so I used a starter kit pdf for my reference for relay connections, and a youtube video for the external power connection, and tried to apply it into my case. I apologize, this is my first project.
Let me rephrase my other post, I do not understand how the relay can draw too much power to affect the micro servo if they are connected to different power sources, there is something I am misunderstanding from how this works. Here is a drawing Imgur: The magic of the Internet . Arduino is connected via USB quick charge.
Putting your link to an image host in the correct tags will show your picture in your post.
Doing this: [img]http://i.imgur.com/G6u2f9N.jpg[/img], results in this:
I'm sure that host will help you with retrieving that link (it differs from what you posted, but it is the exact same source).
I'm assuming the IR receiver and the relay are on a breadboard, and the Arduino isn't mounted to anything.
If you are powering the relay through Arduino pin 3, you are in real danger of doing severe damage to your Arduino.
It can lead to all kinds of trouble next to the damage.
Even if you did some tests with the different parts in a separate setup and didn't see any trouble then.
A search for Arduino and relay should result in you finding descriptions on how to use a transistor to power the relay and by doing that relieve the relay's strain from the Arduino (that will be at the transistor now).
Your servo should also be powered by an external source, as stated before.
The GND's all tied to each other are the right thing to do, but your drawing doesn't ensure me that you did do that.
Don't be put down by straight forward (aka blunt) answers to your questions.
And apologies for being new to this are needless.
No transistor to drive the relay? How much current does it take?
And I don't see a free-wheel diode across the relay coil, so unless its a relay with a built-in
diode you are splatting inductive kick-back through your Arduino pin and damaging it.