<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="https://community.arm.com/utility/feedstylesheets/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>Voltage sensor for an 8051</title><link>https://community.arm.com/developer/tools-software/tools/f/keil-forum/33190/voltage-sensor-for-an-8051</link><description> I am working on a home project in which I need a cheap voltage sensor. I need an 8051 to monitor the voltage that I am getting from the wall. All I want to do is monitor whether the voltage is on or off. If it is on then I need to switch to a back up</description><dc:language>en-US</dc:language><generator>Telligent Community 10</generator><item><title>RE: Voltage sensor for an 8051</title><link>https://community.arm.com/thread/39629?ContentTypeID=1</link><pubDate>Wed, 15 Jan 2003 07:31:10 GMT</pubDate><guid isPermaLink="false">dd9e70c8-6d3c-4c71-b136-2456382a7b5c:ee07335f-2a7e-4dc4-b978-1506559661ef</guid><dc:creator>Richard Collett</dc:creator><description>&lt;p&gt;What voltage are you getting from the wall, 110VAC or 220VAC?&lt;br /&gt;
There are a few ways you could do this:&lt;br /&gt;
1) an opto-coupler in series with a resistor and high-voltage capacitor could be used to pull a pin to ground (with a pullup resistor to 5V)&lt;br /&gt;
2) a relay with a coil rated for 220/110V operation (as appropriate), with one pair of contacts used to pull a pin to ground (with a pullup resistor to 5V)&lt;br /&gt;
&lt;br /&gt;
These solutions assume nothing about what is connected to the wall socket. If this is in fact generating the primary power for your circuit, then there might be a low voltage point you could monitor.&lt;br /&gt;
Are you using a linear power supply (transformer-&amp;gt;rectifier-&amp;gt;filter caps-&amp;gt;voltage-regulator), or a switch-mode supply?&lt;br /&gt;
If it is a linear supply, then you could probably tap into the low voltage side of the transformer with a resistor divider network, to generate a pulsing waveform when AC is present. This would halt the moment power is lost, before the filter caps are discharged.&lt;br /&gt;
&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Voltage sensor for an 8051</title><link>https://community.arm.com/thread/39634?ContentTypeID=1</link><pubDate>Wed, 15 Jan 2003 03:12:26 GMT</pubDate><guid isPermaLink="false">dd9e70c8-6d3c-4c71-b136-2456382a7b5c:ee6ff14f-7577-4599-9afa-ef3b3020d642</guid><dc:creator>Armin Breitrainer</dc:creator><description>&lt;p&gt;If it is an DC Voltage, I would take an voltage divider by resistors. It should flow a current of a few mA. Then the divider isn&amp;#39;t too sensitiv. You can protect the Port by an Shottkey Diod, if there could by spikes on the monitored voltage.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>