user785: I am a new Arduino user. I am not sure whether I can connect both USB and external supply through power adaptor to Arduino simultaneously. Would this burn the controller?
Basically, I want to automatically shut down the computer after saving all open documents before my UPS battery goes out whenever I am not there to manually shut it down. I am trying to notify the computer about the power failures of main supply - AC 220V 50 Hz (notification/signal sent when power goes out) via USB using Arduino. I am thinking that this can be done by using the external voltage power supply pin. Whenever power goes out in the mains, the external voltage power supply pin will drop to 0 V from 7 V. The value of the voltage can be read using software ( I am unclear about this: Can it be done? If yes, how?). The Arduino will still be powered up as it is connected to USB of computer and thereby communicates to the computer about the power failure.

user368: From arduinoBoardUno:

Power
The Arduino Uno can be powered via the USB connection or with an external power supply. The power source is selected automatically.

Put the external power through a voltage divider or transistor-based inverter and into an analog (divider) or digital (inverter) pin and check the appropriate value from the pin. Note that this does not require powering the Uno from external power, only connecting the grounds.

user470: 
I am a novice user of Arduino. I am not sure whether I can connect both USB and external supply through power adaptor to Arduino simultaneously. Would this burn the controller?

Lets study the schematic of Arduino UNO R3
The input from the power supply plug (PWRIN, the power jack) goes through a diode D1 (to prevent reverse polarity), and feeds a NCP1117 regulator that down converts it to the 5v supply that feeds the 5v parts. 

The alternative supply comes from the USB plug (USBVCC). The relevant circuit is shown below

The USB power lines goes through a P-mosfet (T1) that operates as a switch and then goes to the +5V node (that is the +5v regulator output as shown in the first schematic).
The mosfet is controlled by an LMV358 operational amplifier (OPAMP) that operates as a comparator.
The negative input of the opamp is tied to 3.3V and the positive one fed through a voltage divider with half the Vin supply level.

When Vin >6.6V then the + input of the opamp become higher than the - input and the opamp turns the mosfet off.
When Vin <6.6V then the + input of the opamp become lower than the - input and the opamp turns the mosfet on.

Note that Vin is after the input diode so it's about 0.6V lower than the external connected power supply level. So when there is power supply connected to the power input that is higher than 6.6V+0.6V (where 0.6V is the diode D1 voltage drop), then the USB supply line is cutoff (because the mosfet turns off) and the power is provided from the power plug. Connecting or disconnecting the USB supply in this case will not make a difference, so you can have both power supplies connected simultaneously, only when the power input drops below the specified level (about 6.6V+0.6V=7.2V), the USB will start powering the board.

785: <p>I am a new Arduino user. I am not sure whether I can connect both USB and external supply through power adaptor to Arduino simultaneously. Would this burn the controller?</p>

<p>Basically, I want to automatically shut down the computer after saving all open documents before my UPS battery goes out whenever I am not there to manually shut it down. I am trying to notify the computer about the power failures of main supply - AC 220V 50 Hz (notification/signal sent when power goes out) via USB using Arduino. I am thinking that this can be done by using the external voltage power supply pin. Whenever power goes out in the mains, the external voltage power supply pin will drop to 0 V from 7 V. The value of the voltage can be read using software ( I am unclear about this: Can it be done? If yes, how?). The Arduino will still be powered up as it is connected to USB of computer and thereby communicates to the computer about the power failure.</p>
 368: <p>From <a href="http://arduino.cc/en/Main/arduinoBoardUno" rel="noreferrer">arduinoBoardUno</a>:</p>
<blockquote>
<h1>Power</h1>
<p>The Arduino Uno can be powered via the USB connection or with an external power supply. The power source is selected automatically.</p>
</blockquote>
<p>Put the external power through a voltage divider or transistor-based inverter and into an analog (divider) or digital (inverter) pin and check the appropriate value from the pin. Note that this does not require powering the Uno from external power, only connecting the grounds.</p>
 470: <blockquote>
  <p>I am a novice user of Arduino. I am not sure whether I can connect both USB and external supply through power adaptor to Arduino simultaneously. Would this burn the controller?</p>
</blockquote>

<p>Lets study the schematic of <a href="http://arduino.cc/en/uploads/Main/Arduino_Uno_Rev3-schematic.pdf" rel="noreferrer">Arduino UNO R3</a></p>

<p>The input from the power supply plug (PWRIN, the power jack) goes through a diode D1 (to prevent reverse polarity), and feeds a <a href="http://www.onsemi.com/pub/Collateral/NCP1117-D.PDF" rel="noreferrer">NCP1117</a> regulator that down converts it to the 5v supply that feeds the 5v parts. </p>

<p><img src="https://i.stack.imgur.com/bNsoC.jpg" alt="Power input"></p>

<p>The alternative supply comes from the USB plug (USBVCC). The relevant circuit is shown below</p>

<p><img src="https://i.stack.imgur.com/r9NgC.gif" alt="enter image description here"></p>

<p>The USB power lines goes through a P-mosfet (T1) that operates as a switch and then goes to the +5V node (that is the +5v regulator output as shown in the first schematic).</p>

<p>The mosfet is controlled by an <a href="http://www.onsemi.com/pub/Collateral/LMV321-LMV358-LMV324-D.PDF" rel="noreferrer">LMV358</a> operational amplifier (OPAMP) that operates as a comparator.<br>
The negative input of the opamp is tied to 3.3V and the positive one fed through a voltage divider with half the Vin supply level.</p>

<ul>
<li><p>When Vin >6.6V then the + input of the opamp become higher than the - input and the opamp turns the mosfet off.</p></li>
<li><p>When Vin &lt;6.6V then the + input of the opamp become lower than the - input and the opamp turns the mosfet on.</p></li>
</ul>

<p>Note that Vin is after the input diode so it's about 0.6V lower than the external connected power supply level. So when there is power supply connected to the power input that is higher than 6.6V+0.6V (where 0.6V is the diode D1 voltage drop), then the USB supply line is cutoff (because the mosfet turns off) and the power is provided from the power plug. Connecting or disconnecting the USB supply in this case will not make a difference, so you can have both power supplies connected simultaneously, only when the power input drops below the specified level (about 6.6V+0.6V=7.2V), the USB will start powering the board.</p>
