Offline
Newbie
Karma: 0
Posts: 31
|
 |
« on: December 06, 2012, 10:53:34 am » |
I'm working on a little project. I have an arduino Uno (at the moment) controlling two servos that move a big Santa. The Santa moves certain ways as you get closer to him. Kinda creepy, I know...
One of the servos moves his arm, but I noticed that when the arm is in the bottom position and resting against a physical stop, if you bump the arm, the servo starts making noise. I'm assuming that the "encoder" is sensing that the servo arm is a hair off, and is attempting to compensate. It happens with my RC airplanes all the time- it goes away when you bump the control stick or it will just settle out on its own. But in this case, the servo isn't settling out unless you cause the arm to "cycle" by standing in front of the sensor that controls the whole thing. This could be dangerous if I leave it on unattended. I'm worried that the servo will "come on" and burn up, possibly catching fire.
Would it make sense to put a transistor between the voltage regulator and servo wire? Then I could have the arduino turn off the power output to the servo when it should be at rest. I have absolutly zero experience with transistors- I just read about them in my "Getting Started with Arduino" book. Are there transistors that can handle a 400ma 6V servo? Thanks!
|
|
|
|
|
Logged
|
|
|
|
|
Offline
Newbie
Karma: 0
Posts: 31
|
 |
« Reply #1 on: December 06, 2012, 10:58:27 am » |
Wow, just went to Mouser and did a search for "transistor" and got smacked in the face. I have no idea where to start...
|
|
|
|
|
Logged
|
|
|
|
|
Malaysia
Offline
Sr. Member
Karma: 7
Posts: 385
|
 |
« Reply #2 on: December 06, 2012, 11:17:03 am » |
wow you really are into hobby servos. if i am not mistaken you could do that in the software using detach function http://arduino.cc/en/Reference/ServoDetachthis function as to stop giving the servo pulse to continue holding that position. then when you want to use that servo again use the attach function again http://arduino.cc/en/Reference/ServoAttachtheres another function of servo that is attached. this is just to varify that the port is not use for servo and not other things. http://arduino.cc/en/Reference/ServoAttachedso you might not need the transistor. Hope someone could verify this but i am certain that this might do the trick
|
|
|
|
|
Logged
|
|
|
|
|
Offline
Newbie
Karma: 0
Posts: 31
|
 |
« Reply #3 on: December 06, 2012, 11:20:19 am » |
I've been into RC airplanes for a long time and have about 100 of them sitting around. Just out of curiosity, do you have a better solution? The hobby servo just seems so convenient since it's already in a complete assembly and only has three wires, power, gnd, and signal.
I'll try the detach thing and see if it works. Thanks.
|
|
|
|
|
Logged
|
|
|
|
|
Offline
Newbie
Karma: 0
Posts: 31
|
 |
« Reply #4 on: December 06, 2012, 11:30:53 am » |
I got an error for some reason when I tried it. The line of code is:
myservo.detach(9);
The Error is:
no matching function for call to 'Servo::detach(int)' Win_program_draft.ino: In function 'void loop()': Win_program_draft:128: error: no matching function for call to 'Servo::detach(int)' C:\Users\Dave\Downloads\arduino-1.0.2\libraries\Servo/Servo.h:114: note: candidates are: void Servo::detach()
|
|
|
|
« Last Edit: December 06, 2012, 11:33:23 am by c131frdave »
|
Logged
|
|
|
|
|
Malaysia
Offline
Sr. Member
Karma: 7
Posts: 385
|
 |
« Reply #5 on: December 06, 2012, 11:32:56 am » |
sorry for my remark. i just saying this cause most of your post is about hobby servo. i have no expereince with hobby servo what so ever.
|
|
|
|
|
Logged
|
|
|
|
|
Offline
Newbie
Karma: 0
Posts: 31
|
 |
« Reply #6 on: December 06, 2012, 11:35:08 am » |
No need to be sorry. If there's a better way, I'm more than eager to know it.  Can't figure out the detach thing though. 
|
|
|
|
|
Logged
|
|
|
|
|
Malaysia
Offline
Sr. Member
Karma: 7
Posts: 385
|
 |
« Reply #7 on: December 06, 2012, 11:36:05 am » |
you dont have to specify the pin you want to detach, the name if that pin is enough myservo.detach();
|
|
|
|
|
Logged
|
|
|
|
|
Offline
Newbie
Karma: 0
Posts: 31
|
 |
« Reply #8 on: December 06, 2012, 11:38:32 am » |
Awesome! Worked perfectly. Thanks!
Edit: Spoke too soon. When he moves his arm up and the servo shuts off, the arm drops. lol Nothing I can't fix in the code, but I thought it was kind of funny to watch. lol
|
|
|
|
« Last Edit: December 06, 2012, 11:40:25 am by c131frdave »
|
Logged
|
|
|
|
|
Malaysia
Offline
Sr. Member
Karma: 7
Posts: 385
|
 |
« Reply #9 on: December 06, 2012, 11:38:39 am » |
IMHO, i am more or less leaning toward Dc motor,H bridge and an encoder/ pot if the angle is kinda not need to be continuous.
|
|
|
|
|
Logged
|
|
|
|
|
Malaysia
Offline
Sr. Member
Karma: 7
Posts: 385
|
 |
« Reply #10 on: December 06, 2012, 11:40:51 am » |
welcome, just glad i could help
|
|
|
|
|
Logged
|
|
|
|
|
Offline
Newbie
Karma: 0
Posts: 31
|
 |
« Reply #11 on: December 06, 2012, 11:43:55 am » |
Got it! Works exactly like I hoped. Thanks pal!
|
|
|
|
|
Logged
|
|
|
|
|
Malaysia
Offline
Sr. Member
Karma: 7
Posts: 385
|
 |
« Reply #12 on: December 06, 2012, 11:50:54 am » |
could you post all of your code, let me see if i could help you
|
|
|
|
|
Logged
|
|
|
|
|
|