Uno only works when plugged into USB port

It is possible your Arduino is resetting often because of low power to the MCU or problem with whatever regulator you are using (onboard or off board). Please post a schematic of your device.