I have a little school knowledge of circuits, and some programming knowledge in real time systems, so I am not a complete noob. But this is probably a noob type of question. I have searched google, and not found a straightforward answer, so I am posting here in hopes that I can get some guidance before I fry my first UNO....
I wish to sense the environment in the server room, temperature and 110 A/C power, then shutdown servers (via USB comm) if the temp gets too hot or the power fails. The temperature I got, thanks to a great example sketch and affordable parts.
My simple solution for the power question is:
Can I just purchase/scavange a 5 VDC wall wart, and plug it into an unprotected (no UPS) outlet, and wire directly to the arduino digital pins? When the power fails, the wall wart will drop the pin from +5 to 0, and I can take action as I choose. My question is should I use a current limiting resistor in the circuit? Perhaps a 4.7K ohm? Should I use an optoisolator even if my voltage is only 5VDC?
As an alternative, I thought I could just connect an external 9VDC wall wart to the arduino. Is there a register I could test in the arduino that would tell me if I am running on USB or external power? Does plugging in an external adapter to the arduino physically disconnect the USB power? I see that the arduino power conector has 3 connections, does it disconnect USB power when you use the external connector? Ideally, I would like the arduino to switch power sorce to USB when the external power fails.
Finally, if there is no register, and the USB power is not physically disconnected, I am thinking of using a voltage divider to drop the 9VDC to 4.5 VDC and sense on an analog pin. Would this work?
Thanks for your help. I hope this is not too noob or covered elsewhere.