2

Am wondering if there is some way the Arduino can automatically power itself using through the 9v port in case the USB is disconnected, and afterwards if the USB is connected again it stop feeding from the 9v Input.

1

The anwser is somewhat.

If you connect a 9V battery to Vin, I'll "take over" the power wheter if the USB is connected or not. Note tought that some problems may occur when both are connected at the same time (personnal opinion). See this link for more info.

So in conclusion, if you have a USB, remove the 9V for power efficiency. Once you include the 9V though, it will take over control of the power on the ARDUINO.

10
  • 1
    Actually the opposite is the case. The USB takes over if the 9V is removed. If 9V is there it is used for power regardless of whether USB is there or not.
    – Majenko
    Oct 21 '16 at 17:47
  • @Majenko, good point! I've modified the anwser!
    – Dat Ha
    Oct 21 '16 at 18:00
  • I need the Arduino to power itself when the USB is removed, but not use the 9V if its connected. And this need to be done automatically and not manually. Oct 23 '16 at 11:50
  • @Majenko IF I connect Both USB and Power Jack, it's going to choose the power from the power jack over 5Volts. Yet will the serial be available? Oct 23 '16 at 16:12
  • 1
    Positive. The Arduino is designed specifically to work like that.
    – Majenko
    Oct 23 '16 at 20:01
3

there is one way you can make it. you can use a temporary capacitor(with a voltage output near to 9v)(or a lipo battery) connected to arduino's voltage input pin and 9v battery connected to arduino with a transistor. whatever program you are uploading to arduino, you can add a code that reads the serial port, and if serial port is not available then it opens the transistor's gate so as the capacitor gets discharged very quickly the 9v battery takes the job.when it gets the serial port again it closes the transistor's gate and arduino stops feeding upon battery and takes power from USB port.

1
  • 1
    A lipo connected to Vin is impossible. Vin is connected to the input of the V regulator which needs a voltage more then 7V to operate proprelly.
    – Dat Ha
    Oct 23 '16 at 12:02

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.