Loading...
Pages: [1]   Go Down
Author Topic: Servo Working strangely  (Read 399 times)
0 Members and 1 Guest are viewing this topic.
0
Offline Offline
Newbie
*
Karma: 0
Posts: 26
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hello everyone.  I have been working on a project for a few weeks now, see http://arduino.cc/forum/index.php/topic,101231.15.html

Anyway.  I moved the entire thing over from a duemilanove to a nano, in order to put it on a pcb.  A new problem seems to have cropped up, and I am not really sure whats causing it.

The code below moves a servo to push a button.
Quote
void pushButton()
{

  
  myservo.write(122);
  delay(500);
  myservo.write(90);
  Serial.print("Button Pushed");
}


The problem is that sometimes, the servo moves to "122" and never responds back.  Also the arduino seems to hang, and no further commands, or programming is possible until a reset.  Another funny thing is that even when it works, it seems to ignore the delay completely, and instead holds the servo at "122" for at least 2 seconds before going back to "90"

This seems really odd to say the least.  I can post the rest of the code, but its pretty long and will take two posts.


**Edit**  I should probably also mention that I did not have this problem with the duemilanove.  It almost as if the nano is doing the servo move and then crashing, and is moving back to "90" as part of its reboot.  Other times its hanging.
« Last Edit: May 01, 2012, 09:09:41 pm by CaptRR » Logged

0
Offline Offline
Tesla Member
***
Karma: 58
Posts: 6780
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
It almost as if the nano is doing the servo move and then crashing, and is moving back to "90" as part of its reboot.  Other times its hanging.

Sounds like you have a less than adequate power setup.
Logged

Why I like my 2005 rio yellow Honda S2000 with the top down, and more!
GOOGLE ADVANCED FORUM SEARCH BELOW!  
Go to:  http://www.google.com/advanced_search?hl=en
put in key search words,
use site or domain:  http://arduino.cc/forum
or in a google search box put key words site:http://arduino.cc/forum

0
Offline Offline
Newbie
*
Karma: 0
Posts: 26
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I was powering the servo off the nano +5 Out.  It seems to work on the Dumnuluv, so it just came over from the breadboard.
Logged

0
Offline Offline
Tesla Member
***
Karma: 76
Posts: 6852
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Never power a servo from a logic supply, you risk damaging the delicate logic components.

A servo is a MOTOR.  It will take a lot of current from its supply and put inductive spikes on its supply if you are unlucky.  Run it from a separate supply that is capable of an amp or so.
Logged

Dubai, UAE
Offline Offline
Edison Member
*
Karma: 20
Posts: 1637
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Hi,

have a look at the two links in my signature, they illustrate and suggest solutions to your problem

Duane B
Logged


Pages: [1]   Go Up
Print
 
Jump to: