Forgive me, while I'm familiar with software, I'm an embarrassing novice when it comes to hardware.
I'd like to use an arduino to control 2 servos. The servos need to do very simple movements (either "up" or "down" essentially). I have found a few links describing the servos and they are a good start:
(well, seems the forum won't let me post links until I post 1 message..hmph)
... but I need a little extra push.
How do I connect 2 servos to the arduino? The example above that connects a single servo makes some sense to me, as the arduino provides power from its 5V pin. But if I'm connecting 2 servos, do I need to provide extra external power? What changes from the above example?
I've been searching the internet for a simple servo to use. I've leaning towards these because they are cheap and I don't think I need much torque..(I don't think at least)
I would power the servos from the power supply directly 6v is fine 7.2 is probably tops. Hook the grounds together and provide one pin to each signal lead on the servo.
clifdweller - thanks for the correction on the motor. I understand the difference now (after some reading).
So, if I can feasibly hook up 2 servos, still a bit fuzzy on the how part. I'm reading up as much as I can on electronics - looks like unless I want to solder I need to get a breadboard. Hook up ground/power to the breadboard from the arduino, and then hook up the two servos appropriately on the breadboard. This right?
clifdweller , you must be using some very efficient servos
All the servos I have come across use more than 100ma when loaded, and the servo linked by the OP uses 160ma without load. My experience is that common 'standard' hobby servos like the one linked draw too much current to be reliably powered by the Arduino. That HS-311 servo draws around 400ma at 1.5kg/cm (half its rated maximum torque).
I recommend using an external power supply for servos.
I realize now I can design what I want with a single servo, but I still I don't really understand the hardware requirements. The arduino spec:
refers to the current per IO/pin which is 40mA and the DC Current for 3.3V Pin which is 50 mA.
The servo specifications say:
Current Drain (4.8V): 7.4mA/idle, 160mA no load operating
Current Drain (6.0V): 7.7mA/idle, 180mA no load operating
The operating voltage on the servo is 4.8-6.0 Volts
You power the servo +/- with 4.8 to 6 volts and that DOES NOT come from the arduino. The servo and the arduino have their grounds tied together for communications then the PWM pin is tied to the signal pin on the servo which draws only a small current.
Servos have three wires, power, signal and ground. The arduino digital pins drive the signal and there is no problem directly connecting arduino pins to drive the servo signal. The specs indicate the current the servo will draw through the power line. You probably want to use the same 5 volts power source as the arduino (like in the servo example) so the 4.8 spec number is the one that matters. The spec says that current taken by the servo power line should be around 160ma with no mechanical load (nothing physically attached to the servo output arm (or wheel).
You may be ok powering a single HS-311 using USB power (as in the servo example) if the mechanical load is light.
But if your power goes through the onboard regulator or if your servo is driving a significant mechanical load close to its full capacity then you may need to power the servo from a separate power supply.
Note that although a servo signal is fed with variable pulse widths to control its position, it is not technically PWM (pulse width modulation) and should not be used with the arduino PWM (analogWrite) outputs.
The mechanical load will be light. I am just going to use it to raise a light toy flag of some kind.
I will also be powering the arduino via USB, so seems I'm ok there as well.
Your assertion that the "although a servo signal is fed with variable pulse widths to control its position, it is not technically PWM..." is confusing to me but I guess maybe I won't ask ... (I have seen some servo examples use pins 9 & 10 which are PWM outputs ...)
Thanks for all your help on this. I have been reading up on basic electronics, but it can often be hard to understand how to apply the concepts from these tutorials to the arduino/servo. For example, one of the first tutorials I read (Beginning Embedded Electronics - 1 - SparkFun Electronics) was about regulating an unregulated 9V 'wall wart' to power a 5V chip (the ATmega168, same one on the arduino). So, then .. does all power need to be regulated? Would I need to follow a similar procedure to power a servo (externally)? That is, regulate a 9V wall wart to a clean 6 Volt signal? Or do I just buy a regulated 6V power supply (if such things exist)? Thanks for humoring me...
A regulated supply ensures that the voltage stays within a very limited range, something the arduino chip needs, but not as critical for servo power. You could use a decent 6v wall wart for your servo, it doesn't need to be regulated but should have sufficient capacity so that the fluctuations under load are well under a volt.
If your servo load is light then you may be ok powering the servo from USB. Try it and see.
But if you do need an external supply for your servo, a good 6 volt 500ma or greater dc wall wart should be ok. Don't forget to connect the power supply, servo and Arduino grounds together.
PWM vs PPM - what's in a name?
Servos use Pulse Position Modulation (PPM), which is not the same thing as PWM. Both PPM and PWM convey information by changing pulse width, but they differ in important ways. The significant difference is that for hobby servos like yours the PPM signal always has a gap of around 20ms between pulses – a PWM signal may have little or no gap between pulses.
It is possible to configure PWM to emulate PPM and as pointed out above, that is how some servo libraries work. But PWM can damage a servo if its not controlled to ensure that the pulses are within an acceptable range. Using the PWM output from AnalogWrite to drive a servo could damage it.
Because Pulse Position modulation is performed by changing the width of the control pulses, it's not uncommon to see it referred to as PWM. But whatever one wants to call it, its important to know that servos should not be driven by the standard Arduino PWM analog outputs.