{"id":1697,"date":"2018-07-16T10:11:27","date_gmt":"2018-07-16T17:11:27","guid":{"rendered":"http:\/\/www.donluc.com\/?p=1697"},"modified":"2018-07-16T10:11:27","modified_gmt":"2018-07-16T17:11:27","slug":"project-7-rgb-lcd-shield-ir-emitters-and-detectors-mk04","status":"publish","type":"post","link":"https:\/\/www.donluc.com\/?p=1697","title":{"rendered":"Project #7: RGB LCD Shield \u2013 IR Emitters and Detectors \u2013 Mk04"},"content":{"rendered":"<p><a href=\"https:\/\/www.donluc.com\/wp-content\/uploads\/2018\/07\/DonLuc1807Mk08a.png\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/www.donluc.com\/wp-content\/uploads\/2018\/07\/DonLuc1807Mk08a.png\" alt=\"\" width=\"720\" height=\"562\" class=\"alignnone size-full wp-image-1698\" srcset=\"https:\/\/www.donluc.com\/wp-content\/uploads\/2018\/07\/DonLuc1807Mk08a.png 720w, https:\/\/www.donluc.com\/wp-content\/uploads\/2018\/07\/DonLuc1807Mk08a-300x234.png 300w\" sizes=\"auto, (max-width: 720px) 100vw, 720px\" \/><\/a><\/p>\n<p><a href=\"https:\/\/www.donluc.com\/wp-content\/uploads\/2018\/07\/DonLuc1807Mk08b.png\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/www.donluc.com\/wp-content\/uploads\/2018\/07\/DonLuc1807Mk08b.png\" alt=\"\" width=\"720\" height=\"561\" class=\"alignnone size-full wp-image-1699\" srcset=\"https:\/\/www.donluc.com\/wp-content\/uploads\/2018\/07\/DonLuc1807Mk08b.png 720w, https:\/\/www.donluc.com\/wp-content\/uploads\/2018\/07\/DonLuc1807Mk08b-300x234.png 300w\" sizes=\"auto, (max-width: 720px) 100vw, 720px\" \/><\/a><\/p>\n<p><a href=\"https:\/\/www.donluc.com\/wp-content\/uploads\/2018\/07\/DonLuc1807Mk08c.png\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/www.donluc.com\/wp-content\/uploads\/2018\/07\/DonLuc1807Mk08c.png\" alt=\"\" width=\"720\" height=\"540\" class=\"alignnone size-full wp-image-1700\" srcset=\"https:\/\/www.donluc.com\/wp-content\/uploads\/2018\/07\/DonLuc1807Mk08c.png 720w, https:\/\/www.donluc.com\/wp-content\/uploads\/2018\/07\/DonLuc1807Mk08c-300x225.png 300w\" sizes=\"auto, (max-width: 720px) 100vw, 720px\" \/><\/a><\/p>\n<p><a href=\"https:\/\/www.donluc.com\/wp-content\/uploads\/2018\/07\/DonLuc1807Mk08d.png\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/www.donluc.com\/wp-content\/uploads\/2018\/07\/DonLuc1807Mk08d.png\" alt=\"\" width=\"720\" height=\"540\" class=\"alignnone size-full wp-image-1701\" srcset=\"https:\/\/www.donluc.com\/wp-content\/uploads\/2018\/07\/DonLuc1807Mk08d.png 720w, https:\/\/www.donluc.com\/wp-content\/uploads\/2018\/07\/DonLuc1807Mk08d-300x225.png 300w\" sizes=\"auto, (max-width: 720px) 100vw, 720px\" \/><\/a><\/p>\n<p><a href=\"https:\/\/www.donluc.com\/wp-content\/uploads\/2018\/07\/DonLuc1807Mk08e.png\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/www.donluc.com\/wp-content\/uploads\/2018\/07\/DonLuc1807Mk08e.png\" alt=\"\" width=\"720\" height=\"540\" class=\"alignnone size-full wp-image-1702\" srcset=\"https:\/\/www.donluc.com\/wp-content\/uploads\/2018\/07\/DonLuc1807Mk08e.png 720w, https:\/\/www.donluc.com\/wp-content\/uploads\/2018\/07\/DonLuc1807Mk08e-300x225.png 300w\" sizes=\"auto, (max-width: 720px) 100vw, 720px\" \/><\/a><\/p>\n<div style=\"width: 720px;\" class=\"wp-video\"><video class=\"wp-video-shortcode\" id=\"video-1697-1\" width=\"720\" height=\"406\" preload=\"metadata\" controls=\"controls\"><source type=\"video\/mp4\" src=\"https:\/\/www.donluc.com\/wp-content\/uploads\/2018\/07\/DonLuc1807Mk08.mp4?_=1\" \/><a href=\"https:\/\/www.donluc.com\/wp-content\/uploads\/2018\/07\/DonLuc1807Mk08.mp4\">https:\/\/www.donluc.com\/wp-content\/uploads\/2018\/07\/DonLuc1807Mk08.mp4<\/a><\/video><\/div>\n<p><strong>Infrared Emitters and Detectors<\/strong><\/p>\n<p>Side-looking Infrared Emitters and IR Detectors. These simple devices operate at 940nm and work well for generic IR systems including remote control and touch-less object sensing. Using a simple ADC on any microcontroller will allow variable readings to be collected from the detector. The emitter is driven up to 50mA with a current limiting resistor as with any LED device. The detect is a NPN transistor that is biased by incoming IR light.<\/p>\n<p>Sold as a pair, with one Emitter and one Detector.<\/p>\n<p><strong>IR Emitter<\/strong><\/p>\n<p>Connect IR LED using a 270 ohm series resistor to the +5 supply (or to an Arduino pin if you want to switch the source on and off). Current draw is about 11 mA with a 270 ohm resistor. Current runs from anode to cathode. Flat on the case marks the cathode. To determine if the IR LED is the right way around.<\/p>\n<p><strong>IR Detector<\/strong><\/p>\n<p>A IR Detector is just like a regular transistor except the base lead is disabled or absent and light activates base current. The flat on the case marks the collector, the other lead is the emitter. Connect the collector to one end of a 10K ohm resistor and connect the other end of the resistor to a +5V supply (you can use the +5 pin on the Arduino). Connect the emitter to ground. The voltage should start out at +5V. When pointing the IR Detector, the voltage should drop down to near zero. To interface with the Arduino, make a second connection from the collector to an Arduino pin.<\/p>\n<p><strong>DonLuc1807Mk08<\/strong><\/p>\n<p>1 x RGB LCD Shield 16\u00d72 Character Display<br \/>\n1 x Arduino UNO &#8211; R3<br \/>\n1 x ProtoScrewShield<br \/>\n1 x IR Emitter<br \/>\n1 x IR Detector<br \/>\n1 x 270 ohm resistor<br \/>\n1 x 10k ohm resistor<br \/>\n3 x Jumper Wires 3&#8243; M\/M<br \/>\n4 x Jumper Wires 6&#8243; M\/M<br \/>\n1 x Half-Size Breadboard<\/p>\n<p><strong>Arduino UNO<\/strong><\/p>\n<p>Det &#8211; Analog A0<br \/>\nEmi &#8211; Digital 2<br \/>\nVIN &#8211; +5V<br \/>\nGND &#8211; GND<\/p>\n<p><strong>DonLuc1807Mk08p.ino<\/strong><\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"default\" data-enlighter-title=\"DonLuc1807Mk08p.ino\">\r\n\/\/ ***** Don Luc *****\r\n\/\/ Software Version Information\r\n\/\/ Project #7: RGB LCD Shield \u2013 IR Emitters and Detectors \u2013 Mk04\r\n\/\/ 7-8\r\n\/\/ DonLuc1807Mk08p 7-8\r\n\/\/ RGB LCD Shield\r\n\/\/ IR Emitters and Detectors\r\n\r\n\/\/ include the library code:\r\n#include &lt;Adafruit_MCP23017.h&gt;\r\n#include &lt;Adafruit_RGBLCDShield.h&gt;\r\n\r\nAdafruit_RGBLCDShield RGBLCDShield = Adafruit_RGBLCDShield();\r\n#define GREEN 0x2\r\n\r\n\/\/ IR Emitters and Detectors\r\nint iDet = 2;\r\nint iSense = A0;\r\nint iVal;\r\n\r\nvoid loop() \r\n{\r\n\r\n  \/\/ Display\r\n  \/\/ Set the cursor to column 0, line 0  \r\n  RGBLCDShield.setCursor(0,0);\r\n  RGBLCDShield.print(&quot;IR Emi - Det&quot;);     \/\/ IR Emitters and Detectors\r\n  \r\n  \/\/ IR Emitters and Detectors\r\n  iVal = analogRead(iSense);\r\n  \r\n  \/\/ Set the cursor to column 0, line 1\r\n  RGBLCDShield.setCursor(0, 1);\r\n  if ( iVal &gt;= 1005 ) \r\n  {\r\n     RGBLCDShield.print(&quot;Alarm&quot;);         \/\/ Alarm    \r\n  }\r\n  else\r\n  {\r\n     RGBLCDShield.print(&quot;No&quot;);            \/\/ No\r\n  }\r\n  \r\n  delay(1000);\r\n  \r\n  \/\/ Clear\r\n  RGBLCDShield.clear();\r\n  \r\n}\r\n<\/pre>\n<p><strong>setup.ino<\/strong><\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"default\" data-enlighter-title=\"setup.ino\">\r\n\/\/ Setup\r\nvoid setup() \r\n{\r\n\r\n  \/\/ set up the LCD&#039;s number of columns and rows: \r\n  RGBLCDShield.begin(16, 2);\r\n  RGBLCDShield.setBacklight(GREEN);\r\n  \r\n  \/\/ Display\r\n  \/\/ Set the cursor to column 0, line 0  \r\n  RGBLCDShield.setCursor(0,0);  \r\n  RGBLCDShield.print(&quot;Don Luc&quot;);         \/\/ Don luc\r\n  \/\/ Set the cursor to column 0, line 1\r\n  RGBLCDShield.setCursor(0, 1);\r\n  RGBLCDShield.print(&quot;IR Emi - Det&quot;);    \/\/ IR Emitters and Detectors\r\n\r\n  delay(5000);\r\n\r\n  \/\/ Clear\r\n  RGBLCDShield.clear();\r\n\r\n  \/\/ IR Emitters and Detectors\r\n  pinMode(iDet, OUTPUT);\r\n  pinMode(iSense, INPUT);\r\n  digitalWrite(iDet,HIGH);\r\n\r\n}\r\n<\/pre>\n<p><strong>Don Luc<\/strong><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Infrared Emitters and Detectors Side-looking Infrared Emitters and IR Detectors. These simple devices operate at 940nm and work well for generic IR systems including remote control and touch-less object sensing. Using a simple ADC on any microcontroller will allow variable readings to be collected from the detector. The emitter is driven up to 50mA with &#8230; <a title=\"Project #7: RGB LCD Shield \u2013 IR Emitters and Detectors \u2013 Mk04\" class=\"read-more\" href=\"https:\/\/www.donluc.com\/?p=1697\" aria-label=\"Read more about Project #7: RGB LCD Shield \u2013 IR Emitters and Detectors \u2013 Mk04\">Read more<\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[71,47,50,38,59,5,58,10,43],"tags":[],"class_list":["post-1697","post","type-post","status-publish","format-standard","hentry","category-rgb-lcd-shield","category-adafruit","category-arduino","category-digitalelectronics","category-fritzing","category-microcontrollers","category-arduino-programming","category-projects","category-sparkfun"],"_links":{"self":[{"href":"https:\/\/www.donluc.com\/index.php?rest_route=\/wp\/v2\/posts\/1697","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.donluc.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.donluc.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.donluc.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.donluc.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=1697"}],"version-history":[{"count":1,"href":"https:\/\/www.donluc.com\/index.php?rest_route=\/wp\/v2\/posts\/1697\/revisions"}],"predecessor-version":[{"id":1704,"href":"https:\/\/www.donluc.com\/index.php?rest_route=\/wp\/v2\/posts\/1697\/revisions\/1704"}],"wp:attachment":[{"href":"https:\/\/www.donluc.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=1697"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.donluc.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=1697"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.donluc.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=1697"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}