servo works when connected with usb but not with 9v reg power supply

... And make sure the grounds are connected.