I have noticed that when powered Mega 2560 board from USB (5.1V), there is voltage on Vin pin (4.6V).
I am not an expert on electronics, but I think voltage regulator's (NCP1117ST50T3G) out and in pins are internally connected with a diode. When there is 5.1V present at regulator output, current flows to Vin over this diode.
What confuse me; there is an op-amp (LMV358IDGKR) compares Vin to 3.3V and controls MOSFET (FDN340P) let USB to power the board. In this case, 4.6V is bigger than 3.3V and MOSFET will not pass current from USB. So the board should not work but it is working.
The way this circuit works must be different from what I think.
Where do I go wrong?
The Vin pin is an input for 7 to 12V, not a voltage source. The MOSFET blocks current from the 5V bus from back feeding to the computer USB circuits, suppose the computer's 5V USB supply, because of heavy load, fell to 4.8V, if not for the turned off MOSFET, current could flow backwards into the computer, overloading the Arduino's regulator.
Note the voltage divider on the op-amp input that reduces that 4.6V to 2.3V, Vin must be greater than 6.6V to trip the comparator.
The story is started from searching for the reason of high power usage when Mega 2560 goes to sleep. I have 2 power supplies; one from Vin pin and the other from USB. When power is lost on Vin, Mega goes to sleep. Power is suplied on USB with a powerbank during sleep. But there is a 30mA leak to external power supply from Vin. I am planning to add a diode to Vin to gain this leak.
@edgemoron; thankyou for the reply; I was writing while you post.
edgemoron:
The Vin pin is an input for 7 to 12V, not a voltage source. The MOSFET blocks current from the 5V bus from back feeding to the computer USB circuits, suppose the computer's 5V USB supply, because of heavy load, fell to 4.8V, if not for the turned off MOSFET, current could flow backwards into the computer, overloading the Arduino's regulator.
Note the voltage divider on the op-amp input that reduces that 4.6V to 2.3V, Vin must be greater than 6.6V to trip the comparator.
I totally agree with you not using the Vin as source but it is the situation, unless makers of Mega 2560 revise the board.
AZGurbuz:
I am planning to add a diode to Vin to gain this leak.
AZGurbuz:
Maybe like this
The designers already have done this for you.
There is a reverse protection diode between the DC socket and V-in.
Just connect the supply to the DC socket.
Leo..
P.S.
I think you already knew this, because the diagram is an extract from the schematic diagram.