UNO Rev. 3: What is the LM358 for ?

What is the purpose of the LM385 in the Arduino UNO Rev. 3 ?

I see one of its output simply feeds a MOSFET (?) while the other lights a LED.

Thanks.

1/2 is used as a voltage comparator, to select whether the board is powered from USB or from Vin.
The other buffers D13, removing the load created by the L LED and its current limiting resistor.

CrossRoads:
1/2 is used as a voltage comparator, to select whether the board is powered from USB or from Vin.

Thanks, CrossRoads!

So, the 1st half of the LM358 works like an electronic jumper, automatically switching between different power sources ?

If that is so, what happens when both inputs (USB & jack) are powered?

Yes, auto power selection.

If Vin/2 is greater than 3.3V, Vin is used for the power source.

The schematics won't show the other pins for the LM358. What powers the IC? Since power source hasn't been selected yet, where does it get its power (5V, I guess) from?

AlxDroidDev:
The schematics won't show the other pins for the LM358. What powers the IC? Since power source hasn't been selected yet, where does it get its power (5V, I guess) from?

Well it's called a auto-voltage selection circuit, but in reality it operates as a auto voltage cut-off circuit. If there is external power connected via the connector (or Vin pin) of at least the minimum value then that hardwires to the on-board voltage regulator which then generates +5vdc Vcc power which is hardwired to the board's Vcc bus. The op-amp comparator seeing this valid Vin voltage then switches it's output to shut-off the mosfet switch that in turns prevents the USB's +5vdc source from being routed to the board's Vcc buss. That make sense?

Lefty

The LM358's power pins are shown to it's left with a power supply decoupling capacitor.

CrossRoads:
If Vin/2 is greater than 3.3V, Vin is used for the power source.

So while DC in is supposed to be 7-12V it is actually 6.6-12V? (well, 6.61 or whtever)

Thanks for the replies, my friends, and sorry for bothering you with even more questions!

I saw how the LM358 is being powered by a 5V source.

What I don't get is this: what selects what 5V source is to be used, since there are 3 possibilities: USB, Vin and both.

In my mind it is sounding like a chicken-and-egg paradox: the LM358 selects the power source, but in order to select a power source, it has to be powered by something that has not yet been selected.

I am here: http://arduino.cc/en/uploads/Main/Arduino_Uno_Rev3-schematic.pdf

AlxDroidDev:
Thanks for the replies, my friends, and sorry for bothering you with even more questions!

I saw how the LM358 is being powered by a 5V source.

The board's Vcc bus, the same bus that powers all the components requiring +5vdc on the board.

What I don't get is this: what selects what 5V source is to be used, since there are 3 possibilities: USB, Vin and both.

It's best to think of the two sources of +5vdc as either the USB's +5vdc or the +5vdc from the output of the on-board voltage regulator that is powered by Vin on it's input. There is really no 'switch' that select between two possible sources, but rather just a FET switch that turns off the USB's voltage if there happens to already be voltage on the board from the +5vdc and +3.3vdc as a result of their being a valid Vin voltage being applied. The purpose of the voltage selector circuit is to just prevent a situation where the on-board regulator is +5vdc and USB +5vdc are being 'wired' together.

In my mind it is sounding like a chicken-and-egg paradox: the LM358 selects the power source, but in order to select a power source, it has to be powered by something that has not yet been selected.

There in nothing on the board that can prevent the output from the on-board +5vdc regulator from powering everything on the board that is using +5vdc. Think of it as the default power that can't be switched off as long as there is power being applied via the external power connector or the Vin pin. That is why if there is both external and USB power available at the same time, the external power is the default power being used and the USB power will be turned off via the FET 'switch'.
Again a more accurate and functional name for the circuit would be to call it the 'USB auto voltage cut-off circuit'.
Lefty

I am here: http://arduino.cc/en/uploads/Main/Arduino_Uno_Rev3-schematic.pdf

Thanks!

I'll be getting a bit beyond the LM358 here, but related to the question, since it has to do with what feeds the 5V bus:

If I were to have a functionally similar behaviour in an Arduino-clone I am making, would a Dual Common-Cathode Schottky Rectifier (specifically: SBL3040PT [link for datasheet]) work?

I also have a S15D40C. Both the S15D40C and the SBL3040PT are common cathode, and were taken from old ATX PSUs or old CRT monitors. Besides those I have a few schottky diodes 1N5819.

In my case, however, instead of an USB port, I have a header for a FTDI basic breakout board.

Which option would yield the least voltage drop across the diodes?

Here's a slightly detailed explanation:

When you power the board from USB, the body diode of the FET conducts and powers the 5V rail with ~4.3V. If the Vin is absent (lower than 6.6V), then the FET is turned on and the voltage drop becomes tiny so that the 5V rail comes closer to 4.95V.

If you powered the board through the barrel jack (12V) as well, the linear regulator will then supply the 5V rail as well. In order to keep power from the Arduino from flowing back into the USB connection, the comparator turns off the FET. Its body diode is still there, so the sudden removal of 12V will allow the board to keep working at 4.3V until the FET is turned on again.

There are other ways to do power supply OR-ing, but this one is pretty cheap and simple.