I'm going to use a servo as a locking mechanism for a project. I've got a couple of basic questions that my googling skills seem to be inadequate for.
While the servo has power, must I always pulse the control line? In other words, if I want the servo to do nothing (and, most importantly, consume no power), must I switch off the power supply line? I assume that when I do so I need not do anything to the control line at all. But what would a servo do if I left the control line grounded, but still supplied power? Ideally in my mind, it would behave as if it was not powered (and therefore draw very little power), but I'm guessing it's not that easy.
If the servo is connected to a power supply it will consume energy even if there is no signal. If there is no load on it the amount of energy consumed will be much smaller.
You could save energy by using the Arduino to control a relay or a transistor to switch off the power supply.
I don't know if it might harm a servo to provide a signal when the servo power is disconnected. If you use servo.detach() the Arduino will stop sending the signal, but I'm not sure if the signal pin will be HIGH or LOW - maybe you would need to set it LOW with digitalWrite().
There can be problems if you power up a servo without a signal. Depending on the model it may move to one or other end of its travel. Connecting a 4k7 resistor between signal and ground might stop that.
Servos are not designed to be powered up but with no control system, so the manufacture will not give you a behavior in that state, so you can only test to see what happens. Also you need to make sure the arduino servo output pin is set to LOW output so current won't try and flow to the servo when it's powered off. And most likely a jitter will happen when you attempt to re-power and re-attach.
Try it & see, be sure to report back, there is another topic ongoing about the same thing, looking for ways to conserve power.
@Crossroads,
They're probably in the same class...
@retrolefty,
I agree, but it is easy to modify the scheme to add a switch to switch the control signal as well. There are many ways to do it not the least of which is an analog switch. In this case I would have to say that is too exotic for this application and would be wasted on such a simple task. Maybe a small relay to connect the signal to the servo or mosfet switch.
I'm not in a class. I was just hoping to get design pointers before I tried it. Yes, "try and see" is the next step in the process.
Based on what folks have said I will indeed use a second digital pin to switch the servo supply on and off (I may even switch the display and GPS off when the servo is on, just to make sure there's enough current - an NCP1402 is driving the whole thing).
FWIW, this is going to be a "canned" reverse geocache product. It's a single 80x36 board intended to be a "backpack" on a 2x16 LCD. It'll take battery input (2 AA, C or D cells, depending on how long you need it to keep working), a single pushbutton, a GPS module, and have a servo output intended to be used as a lock.
The controller has control over the display and GPS power, and will turn them off (the GPS module will get backup power straight from the battery so it can warm-start every time) before it puts itself to sleep. When you push the button it wakes up. It will turn on and reinitialize the display and GPS, do whatever the rules of the game are (TBD), possibly open the servo and then go back to sleep.
retrolefty:
Servos are not designed to be powered up but with no control system, so the manufacture will not give you a behavior in that state, so you can only test to see what happens. Also you need to make sure the arduino servo output pin is set to LOW output so current won't try and flow to the servo when it's powered off. And most likely a jitter will happen when you attempt to re-power and re-attach.
I am also making one of these reverse geocache boxes and using a servo (TowerPro SG-90) as a locking pin driver.
I currently have the servo power supplied from a main 5V power bus (off the VCC pin of my Sparkfun Pro Micro). When the whole box is powered up, currently, the servo gets power too.
My issue is that the servo jitters when power is supplied, enough so that the locking pin becomes momentarily 'unlocked' ... kind of defeating the point. I've tried delaying the 'attach'ment of the servo, or immediately giving it a location to go to, or trying to manually set the signal pin low or high .... no luck.
Is my only option to put in a relay or transistor and only power the servo when I absolutely need it to move?
A guru at my local RC shop tells a story about a guy who 'thought' he was having slow servo action in flight. Guru asks if he has enough batteries/BEC behind the servos. Guy says sure. Guru say are you SURE. Guy says, well I don't really -know- for sure. Guru puts a flight data recorder in the guy's plane. He was flabbergasted to find that at peak the servos were drawing 90A, overdrawing the batteries and the BEC.
The point being that without actually -measuring- what's going on I wouldn't trust an Arduino board to drive more than 1 or -maybe- 2 of even these tiny micro servos. It's not worth the potential overheating/brownout issues. ('Potential' - no pun intended. ) I'm using a separate PS because it's absolutely required as I'll have eventually a dozen of these servos running at the same time.
My issue is that the servo jitters when power is supplied, enough so that the locking pin becomes momentarily 'unlocked' ... kind of defeating the point.
I'm going to look into the 4.7K resistor mentioned. Same as you, for me it is absolutely required that there be no motion on power-up.
The main reason for my replying is to suggest taking a look at these little widgets whose purpose -is- 'car door lock actuators': Uneeksupply | eBay Stores Yeah they're 12V but that -might- only mean that they'd operate 'slowly' at 5V. For my purpose I happen to have plenty of 12V lying around so if the resistor doesn't work I'm going to seriously consider these actuators. Yeah in small quantities they're about 50% more than the servo but if it's easier then it's worth it. Yeah they're much larger too, that's another consideration, but easier is always easier.
If you organize your mechanical arrangements so that when locked the lock pin can't exert any torque on the servo arm then there is no need to have power on the servo.
One way would be to ensure that in the locked position the lock pin. the servo arm and the servo spindle are all in a straight line.
A better way would be for the servo to go a little past that centre position to a fixed abutment. Then all the force from the lock pin would be taken by the abutment.
I'm leaving the mechanical design to my brother, but I will stress the need to minimize mechanical load on the servo.
My own recommendation to him will be to place a mechanical latch on the outside of the box to take incidental mechanical handling stress and only use the servo to prevent intentional attempts to open the box (and, again, this is only a game, not a true security application - it'll undoubtedly be easy to destroy the whole thing and get in the box if you wanted to).
The NCP1402 can do 200 mA. My design has a power transistor to control power to the LCD and GPS module. The plan is to turn both off before engaging the servo. With no load on the servo, and with the ATMega having a reasonably wide voltage tolerance, it ought to be able to make a go of it.
Connecting a 4k7 resistor between signal and ground might stop that.
Sounds like me before I discovered electronics..
"4k7" is electronics representation for 4.7 k ohm . The "k" identifies the decimal point place and the also that it is 1000x the given value so 1000 x 4.7 = 4700 ohms. "OHM" is the unit of measurement for resistance , named after the scientist who discovered it. You can learn more about it by googling OHM'S LAW. FYI, in case you are REALLY REALLY REALLY NOT an electronics guy, resistance is the opposition to the flow of current , that is the electrons (which are negatively charged) are doing their damndest to get to the + terminal by jumping from one copper atom to the next but when they get to the + terminal the attraction of the nearest atom supercedes other forces and they must jump onto other atoms that have lost their electrons due to the same process. The result is that once the connection is made the electrons are flowing. That "flow" has been given the name "current ", so we say "current is flowing " because nobody gives a damn about some stupid electrons jumping around. What gets interesting is that if the Electromotive Force is great enough (voltage is HIGH enough) and the current is great enough, when you try to switch off the power , like with a relay, the electrons leap in masse from the relay contacts in such large quantities that it creates a plasma arc , spot welding the contacts together. When dealing with very high voltages , copper can vaporize and generate a plasma (called arc flash) 10,000 time brighter than the sun, capable of blinding a person permanently from eye damage and the molten copper vapor is propelled in all directions , burning clothes and melting skin on contact. Well, I think that's enough for the primer... Enjoy electronics....!
Perhaps but I prefer this representation:
Arduino servo signal pin----------------.--------------[ servo]
|
|
[4.7 kohm resistor]
|
|
GND
Perhaps but I prefer this representation:
Why ?
Because in schematics we like to see power above, ground below and everything else to the left and right. so if you are switching a motor , the motor power is above, then below that is the motor and below that is the transistor and below that is ground so if you trace the path of the current it appears to flow from above (power) to below (ground). You can scramble it up nine ways from sunday and still have it electrically correct but we are used to seeing it a certain way and we prefer to keep it that way. uC on the left, peripherals on the right (why ? no reason other than that's what we are used to ) HERE IS THE SERVO (IT HAS THREE WIRES (RED , BLK, ORN (OR WHITE))
The first two are power (4.5-6Vdc)
Let's forget about the red & blk power wires and just talk about the orange (or white or yellow) signal wire) Robin2 suggest the 4700 ohm resistor from this signal wire to GND (ground) to BLEED off any excess voltage that might cause the servo to move. You can think of it as a cork in a faucet to keep it from dripping, (crude analogy) but basically if guarantees 0V on the servo PWM input . Without a PWM signal , the servo can't move because it only responds to PWM signals . The BLEED resistor which in our world we call a "pullDOWN " resistor, consists of a resistance value low enough to pull the signal down but high enough to not prevent the arduino I/O signal from working when it is present.
raschemmel:
The BLEED resistor which in our world we call a "pullDOWN " resistor ...
Sure, a pull-down resistor. Didn't my stick diagram up there resemble this?
OK, I'll give this a go.
Just an FYI for jbarchuk -- for now, I've managed another workaround, which is to simply extend the locking pin further than before. When the servo jitters on power-up, it doesn't move far enough anymore to momentarily unlock the box. So, I have a half-ass solution that at least works for the moment.
YES, it RESEMBLED that but I explained we we prefer the way my stick diagram represented it. Electrically the same. It's a matter of using standard schematic representation convention that's all.
I assume the pull down is for when the uC isn't driving the pin, say, before the sketch starts and does pinMode().
For me, I'm going to have active servo power control and won't assert that until after the servo library is attached and the angle set. That should keep the servo from any mischief.