I am creating a bubble machine which uses a small hobby servo for dipping some metal wire into a bowl of soap water and a small motor for turning a fan.
My problem is that the arduino cannot run these on its own power supply, when powered by usb.
My question is can it run these if I purchase a 9v adapter? Or is the only solution to power one of them from a battery pack?
I know this is a pretty easy question if you know something about electronics, and I am computer science educated, however mostly with focus on software not hardware.
My question is can it run these if I purchase a 9v adapter? Or is the only solution to power one of them from a battery pack?
Plugging a 9vdc wall wart adapter into the external power connector of your Arduino may not solve your problem at all. The USB power is limited to 500ma by a fuse. Any external power used via the external power connector goes to a on-board +5vdc regulator. So if you still try and wire your servo and motor from the Arduino +5vdc the current will be limited to the on-board 5vdc regulators current limit, which may be a little higher the USB 500ma, but not a lot more.
Any time you need to power external devices that require larger amounts of current in excess of the Arduinos +5vdc current limit, is best done with suitable external power supplies wired directly to the devices. You need to be sure what voltages those devices require and if they need regulated voltage or not, and of course how much current the devices require.
There is no simple answer, only specific needs for specific devices. One needs to know the voltage and maximum current requirements for all external devices before the best power management solution can be determined.
Servos are made to work on 5volt, correct me if i'm wrong.
Correct, typically 4.5 to 6vdc. That however doesn't tell us how much current they require as start-up and at full mechanical load. An Arduino can supply +5vdc for external use, but it has a limit of how much current it can provide. That is the issue the OP is looking at.
I usually recommend budgeting one amp of 5vdc current for each servo attached. Might be a little liberal, but then what would you recommend?
I usually recommend budgeting one amp of 5vdc current for each servo attached. Might be a little liberal, but then what would you recommend?
That's probably a good rule of thumb for general hobby servos. Especially if you don't have any specs. However, some servos come with (or can be obtained) datasheets that list this information, so if you have that, use it.
This is especially important if you are trying to control 1/4 scale servos, or sail-winch servos which are much larger; those likely pull way more than an amp of current.
Finally - servos and DC motors don't generally require voltage regulation, you just need to know their current requirements so you can properly size the power supply.