{"id":744,"date":"2011-06-17T11:33:58","date_gmt":"2011-06-17T11:33:58","guid":{"rendered":"https:\/\/ibex.tech\/resources\/?p=744"},"modified":"2024-06-27T16:42:12","modified_gmt":"2024-06-27T15:42:12","slug":"universal-mains-input-detect","status":"publish","type":"post","link":"https:\/\/ibex.tech\/resources\/geek-area\/electronics\/mains-power-monitoring\/universal-mains-input-detect","title":{"rendered":"Universal Mains Input Detect"},"content":{"rendered":"\n<p>The circuit below provides a simple method to detect a mains voltage input with an input range of 90 &#8211; 240V AC:<\/p>\n\n\n\n<figure class=\"wp-block-image\"><a href=\"https:\/\/ibex.tech\/resources\/wp-content\/uploads\/sites\/3\/Capture.png\"><img loading=\"lazy\" decoding=\"async\" width=\"590\" height=\"187\" src=\"https:\/\/ibex.tech\/resources\/wp-content\/uploads\/sites\/3\/Capture.png\" alt=\"\" class=\"wp-image-745\" title=\"Capture\" srcset=\"https:\/\/ibex.tech\/resources\/wp-content\/uploads\/sites\/3\/Capture.png 590w, https:\/\/ibex.tech\/resources\/wp-content\/uploads\/sites\/3\/Capture-300x95.png 300w\" sizes=\"auto, (max-width: 590px) 100vw, 590px\" \/><\/a><\/figure>\n\n\n\n<p>The output gives a low signal for around 90% of the time when a mains input is present, so you need to connect it to an edge detect input of a microcontroller (e.g. an irq or capture input), or add some circuitry to introduce a delay before the output can return high.&nbsp; The selected opto is a high safety type for over kill and a simpler model could be used where local regulations permit. Using 2off 56k resistors on the input gives a low but good enough LED drive voltage range. The opto isolator has to be AC otherwise an external diode would be needed to protect against LED reverse voltage.<\/p>\n\n\n\n<p>Output with 90VAC input:<\/p>\n\n\n\n<figure class=\"wp-block-image\"><a href=\"https:\/\/ibex.tech\/resources\/wp-content\/uploads\/sites\/3\/photo.jpg\"><img loading=\"lazy\" decoding=\"async\" width=\"150\" height=\"150\" src=\"https:\/\/ibex.tech\/resources\/wp-content\/uploads\/sites\/3\/photo-150x150.jpg\" alt=\"\" class=\"wp-image-748\" title=\"photo\"\/><\/a><\/figure>\n\n\n\n<p>Output with 240VAC input:<\/p>\n\n\n\n<figure class=\"wp-block-image\"><a href=\"https:\/\/ibex.tech\/resources\/wp-content\/uploads\/sites\/3\/photo-1.jpg\"><img loading=\"lazy\" decoding=\"async\" width=\"150\" height=\"150\" src=\"https:\/\/ibex.tech\/resources\/wp-content\/uploads\/sites\/3\/photo-1-150x150.jpg\" alt=\"\" class=\"wp-image-749\" title=\"photo (1)\"\/><\/a><\/figure>\n\n\n\n<p>The 2W resistors are overkill and are not at all hot to touch (after turning power off!) at 240VAC input. A 400mW rated resistor would do the job.<\/p>\n\n\n\n<h5 class=\"wp-block-heading\">Other optos you could consider<\/h5>\n\n\n\n<p>Selecting an opto with a low LED current requirement will avoid the resistors getting hot.<\/p>\n\n\n\n<p>H11AA1<\/p>\n","protected":false},"excerpt":{"rendered":"<p>The circuit below provides a simple method to detect a mains voltage input with an input range of 90 &#8211; 240V AC: The output gives a low signal for around 90% of the time when a mains input is present, so you need to connect it to an edge detect input of a microcontroller (e.g. [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[44],"tags":[],"class_list":["post-744","post","type-post","status-publish","format-standard","hentry","category-mains-power-monitoring"],"_links":{"self":[{"href":"https:\/\/ibex.tech\/resources\/wp-json\/wp\/v2\/posts\/744","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/ibex.tech\/resources\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/ibex.tech\/resources\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/ibex.tech\/resources\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/ibex.tech\/resources\/wp-json\/wp\/v2\/comments?post=744"}],"version-history":[{"count":9,"href":"https:\/\/ibex.tech\/resources\/wp-json\/wp\/v2\/posts\/744\/revisions"}],"predecessor-version":[{"id":2846,"href":"https:\/\/ibex.tech\/resources\/wp-json\/wp\/v2\/posts\/744\/revisions\/2846"}],"wp:attachment":[{"href":"https:\/\/ibex.tech\/resources\/wp-json\/wp\/v2\/media?parent=744"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/ibex.tech\/resources\/wp-json\/wp\/v2\/categories?post=744"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/ibex.tech\/resources\/wp-json\/wp\/v2\/tags?post=744"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}