Pages: [1]   Go Down
Author Topic: Should I use a transistor?  (Read 1013 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Jr. Member
**
Karma: 0
Posts: 93
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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 Offline
Jr. Member
**
Karma: 0
Posts: 93
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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 Offline
Sr. Member
****
Karma: 7
Posts: 393
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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/ServoDetach
this 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/ServoAttach
theres 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/ServoAttached
so you might not need the transistor. Hope someone could verify this but i am certain that this might do the trick
Logged

Offline Offline
Jr. Member
**
Karma: 0
Posts: 93
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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 Offline
Jr. Member
**
Karma: 0
Posts: 93
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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 Offline
Sr. Member
****
Karma: 7
Posts: 393
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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 Offline
Jr. Member
**
Karma: 0
Posts: 93
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

No need to be sorry.  If there's a better way, I'm more than eager to know it.   smiley-grin  Can't figure out the detach thing though. smiley-sad
Logged

Malaysia
Offline Offline
Sr. Member
****
Karma: 7
Posts: 393
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

you dont have to specify the pin you want to detach, the name if that pin is enough
Code:
myservo.detach();
Logged

Offline Offline
Jr. Member
**
Karma: 0
Posts: 93
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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 Offline
Sr. Member
****
Karma: 7
Posts: 393
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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 Offline
Sr. Member
****
Karma: 7
Posts: 393
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

welcome, just glad i could help
Logged

Offline Offline
Jr. Member
**
Karma: 0
Posts: 93
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Got it!  Works exactly like I hoped.  Thanks pal!
Logged

Malaysia
Offline Offline
Sr. Member
****
Karma: 7
Posts: 393
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

could you post all of your code, let me see if i could help you
Logged

Pages: [1]   Go Up
Jump to: