I'm building a 3D printer and I'm using an ATmega2560 + RAMPS board.

The whole thing is powered by an ATX PSU (12v for motors and stuff, 5v for the Arduino), but when I plug in my USB cable, I can't shut the printer down, as it switches over to USB power.

Is there a way to make the Arduino never use the USB power, only the external power source?


  • Or create a USB adapter that does not connect the power line. Feb 19, 2018 at 13:50

3 Answers 3


The best way of doing this, if you want your USB connection to still work, is to remove the P-channel MOSFET T1 from the board.

enter image description here

You can't just disconnect the power from the USB port since that power connection goes directly to UVCC on the ATMega16U2 chip. That is used to power the internal USB peripheral (it goes to a 3.3V regulator inside the chip) and without it the USB interface won't have power.

The USB power is connected to the main 5V rail through that transistor, so if you remove that transistor the 5V from the USB remains connected to the ATMega16U2, but is no longer connected to the rest of the circuit.

  • Or the big fuse next to it :)
    – filo
    Feb 19, 2018 at 21:16
  • 1
    No. That would be the same as cutting the power from the USB. The USB socket goes first to the fuse, then to both the transistor and the ATMega16U2.
    – Majenko
    Feb 19, 2018 at 21:17

you could do this if you cut the trace for the 5V line from the USB connector to the rest of the board. if you place the mega underside up on a bench in front of you, with the USB facing towards you, i believe it should be the top left pin of the 4 USB pins, but you should double check that first.

  • 3
    you probably can't see it but your answer has 1 down and 1 up vote. I didn't down vote you - but suspect the person who did may not have liked that your answer requires "double checking". Perhaps if you verify your answer is correct and re-word it, the person who down voted it may remove the down vote.
    – st2000
    Feb 19, 2018 at 14:38
  • 3
    Personally I don't like the idea of a permanent modification such as cutting a trace. Once it's done you are pretty much out of options and alternatives. I'm not the down voter either, just throwing my two cents into this post. Feb 19, 2018 at 14:40
  • 1
    Well, it's what I looked for, if I want a non permanent thing I'd put in a switch but this is what I want. Thanks!
    – Valmond
    Feb 19, 2018 at 15:23
  • 5
    This method may be counter-productive. You need the power from the USB port to run the ATMega16U2's USB hardware. Without that you won't get a USB connection...
    – Majenko
    Feb 19, 2018 at 16:19
  • 4
    @Valmond the answer posted by Majenko is what you want, mine is incorrect.
    – James Kent
    Feb 19, 2018 at 16:30

Just modify your UBS cable to not provide power.

  • read the accepted answer. the USB chip would not be powered
    – Juraj
    Jan 5, 2020 at 10:29

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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