How Does This Circuit Work?

Hello. In Arduino 2560 Referance Design chart there is a circuit that i can not understand how it works. Do you have any idea about that? Thanks in advance!

This circuit basically selects USB 5v or 5v from the power jack/voltage regulator.

If Vin ‘is’ present, the on board regulator powers the Arduino over USB 5v.

  1. Voltage divider (with 0.1uf decoupling cap)
  2. Op Am Comparator (vref = 3.3V) (half voltage divider input value)
  3. P-Channel Mosfet High side switch

(supplies +5V from USB to board and input voltage to 3.3V regulator.)

Bottom line: When you supply 3.3V 6.6V + to the board from Vin , it detects it uses and DISABLES the USBVcc to the board (turns ON the mosfet). (if Vin is LESS THAN 3.3V 6.6V + it (turns ON the mosfet) uses USBVcc, if it is >3.3V 6.6V + it uses Vin to power the onboard regulators.)

If Vin is present do we need usb supply? Opamp output is always non negative (5v or 0v). So p channel mosfet is never in conduction. What is wrong here??

perhaps you should read what it says here about depletion mode mosfets:

"P-Channel MOSFET Basics"

How to Turn on a P-Channel Depletion Type MOSFET
To turn on a P-Channel Depletion-Type MOSFET, for maximum operation, the gate voltage feeding the gate terminal should be 0V. With the gate voltage being 0V, the drain current is at is largest value and the transistor is in the active 'ON' region of conduction.

As I read it:
"If Vin > 6.6V turn off T2; turn it on otherwise"

Of course the T2 can only block backfeeding current from "5V" to USBVCC. It does not block the other way: "5V" will be always at least (USBVCC - one diode drop) enabling the whole thing to start up when powered from the USB only.

"If Vin > 6.6V turn off T2; turn it on otherwise

Correct. My bad. Forgot the Vref is half the voltage divider input. (corrected the error)

It's a nice novelty, but not very useful. :roll_eyes:

In practice, the on-board regulator is only adequate - due to lack of heatsinking - to power the chips on the UNO board and a few indicator LEDs. If you want to power other things at 5 V, you need a proper regulated (switchmode) 5 V supply to the "5V" pin and all other 5 V devices but are advised to disconnect it from the "5V" pin when you plug the USB into a PC for programming.

The LM358 is a poor choice here as its output voltage range is limited (not rail-to-rail),
and might allow the pFET to remain half-on when it should be off.

An actual comparator is the best way to do voltage comparison, and most are open
collector output which would require a pull-up on the pFET gate.

Using an opamp as a comparator is kludgey at best, and not all opamps will do this
at all.

How does Vin get to the regulator? Is Vin the same as USBVCC?

“ How does Vin get to the regulator? Is Vin the same as USBVCC?”

The power jack connects to a power diode.

The cathode of this diode is called Vin.

Vin is connected to the voltage regulator input.

The output of the voltage regulator is called +5v.

+5v is connected to the Source of the P channel MOSFET.

‘USB 5 volts’ connects to the MOSFET Drain.

When there is ‘no’ voltage at the power jack, Vin is missing, the MOSFET is turned ‘ON’ and USB 5 volts (USBVCC ) then supplies power to the Arduino.

raschemmel:
perhaps you should read what it says here about depletion mode mosfets:

Not sure what depletion mode MOSFETs have to do with anything here - they are certainly not
common beasts nor relevant to this circuit.

Normal MOSFETs for switching loads are enhancement mode, and for very good reason
that you don't want your circuit to power up with everything switched full-on.

It's relevant because it says it turns ON with
zero volts , which the OP said it did not.
The pointbis that the circuit operation isthe same for this circuit: OFF=+5V, ON= 0V on the gate.
Do you deny that ?

larryd:
“ How does Vin get to the regulator? Is Vin the same as USBVCC?”

The power jack connects to a power diode.

The cathode of this diode is called Vin.

Vin is connected to the voltage regulator input.

If we're talking about the schematic in the OP's first post, it looks different to me. I see no such connection. The only thing Vin is connected to is a resistor divider. The input of the voltage regulator is 5V.

The output of the voltage regulator is called +5v.

The output of the voltage regulator is called 3.3V.

+5v is connected to the Source of the P channel MOSFET.

‘USB 5 volts’ connects to the MOSFET Drain.

When there is ‘no’ voltage at the power jack, Vin is missing, the MOSFET is turned ‘ON’ and USB 5 volts (USBVCC ) then supplies power to the Arduino.

The mosfet's body diode can provide power to the regulator from USBVCC whether the mosfet is turned on or not.

Well, the circuit does switch between 5V and USBVCC as the source for the regulator, and the mosfet is oriented correctly to prevent current from flowing back into USB from the 5V source. I don't know where 5V comes from. Maybe Vin is the upstream source for 5V, but just not shown.

“ The mosfet's body diode can provide power to the regulator from USBVCC whether the mosfet is turned on or not.”

Wrong.

When the USBVCC is present, and the power jack has ‘lets say 9v’ feeding it, the output of the Arduino 5v regulator will be 5v.

With 5v on the body diode anode and 5v on the body diode cathode, there can be no current flow through the diode!

You need to look at the full schematic Arduino 2560 to see the rest of the connections. :wink:

You need to look at the full schematic Arduino 2560 to see the rest of the connections. :wink:

to wit, upper left corner of full schematic, you will see a diode and "Vin " and to the right of that a 5v regulator.

As Larry pointed out, if Vin >6.6V, then the 5V regulator is already supplying 5V to the board so the CATHODE of the mosfet body diode has +5V on it. If you plug in a USB cable, the USBVcc is +5V on the
ANODE of the mosfet body diode. By Ohm's law (and common sense) for current to flow there must be
a 'Potential Difference' . No potential difference, no current flow.

ATMega2560.png

ATMega2560.png

To understand the circuit you must understand the "ideal diode" concept.
Watch this video.
Leo..

However this is NOT an ideal diode circuit.

Smajdalf:
However this is NOT an ideal diode circuit.

Didn't say that.
Call it whatever you want, but the P-channel mosfet principle is the same.

It's a common USB back-flow protection diode (mosfet body diode) when V-in is >=6.6volt,
and the opamp switches it to an "ideal diode" (short circuit) when V-in is <=6.6volt.
Leo..