I've been following a text book that has shown me how to wire up an Arduino Uno to a servo using an external 9v battery which goes through a voltage regulator to bring it down to 5v and all is working fine. But in order to put my arduino to use, I want to power the whole lot from one power source, maybe a transformer or a 9v battery. I understand that the arduino can't directly supply sufficient current, but do I really need to have 2 power sources?
I'm wondering if it's OK to connect the 9v battery to the power socket of the Arduino, as well as the voltage regulator so that it is powering both in parallel?
Also, if that is OK, is there a nice way to solder the 9v battery connector to the arduino, or do I have to get a plug?
A servo may discharge a 9v battery within a couple minutes. Servos generally need a larger power supply. If powering both the arduino and servo from the same external power supply, then you may need a diode in the supply to the arduino and a large capacitor on the arduino to prevent the arduino resetting if the servo causes a large voltage drop on the power supply when the servo is under load.
Depends on the battery - the small alkaline PP3-sized 9V batteries are no use for motors
and servos. NiMH versions at that size might fare a bit better, but the whole thing is wrong,
servos need 6V, not 9V, so go with a 6V battery back (4 or 5 good-quality NiMH AA cells).
A low-dropout regulator is needed to deliver 5V from such a battery pack, but its better
to power the Arduino from a separate supply if you can. The Servo battery
pack will experience voltage dips as it gets low, which could reset the Arduino. Unless
you monitor the servo battery voltage all the time this is likely to happen.
Thanks for the suggestions, sounds like batteries are not really the way to go with what I'm planning then. It's for a locking system on the garage door so I could use a transformer if that's any better, or will I still get issues sharing that power supply for both servo and arduino?