{"id":8486,"date":"2014-04-21T22:14:47","date_gmt":"2014-04-22T02:14:47","guid":{"rendered":"http:\/\/embedded-lab.com\/blog\/?p=8486"},"modified":"2014-04-28T21:56:51","modified_gmt":"2014-04-29T01:56:51","slug":"chipkit-project-4-digital-light-meter","status":"publish","type":"post","link":"https:\/\/embedded-lab.com\/blog\/chipkit-project-4-digital-light-meter\/","title":{"rendered":"chipKIT Project 4: Digital light meter"},"content":{"rendered":"<p>A light meter is used to measure the intensity of illumination in a given area. It is widely used in schools, warehouses, factories, hospitals, office\u00a0buildings, museums, art-galleries, <span style=\"font-size: 0.95em; line-height: 1.6em;\">parking\u00a0garages, stadiums, and many more,\u00a0<\/span>to measure and maintain proper lighting levels. The intensity of illumination is usually expressed in Lux or foot-candles. As the 4th project in our <a href=\"http:\/\/embedded-lab.com\/blog\/?page_id=4705\" target=\"_blank\"><strong>chipKIT tutorial series<\/strong><\/a>, today we are going to build a digital light meter using the chipKIT Uno32 board and the BH1750 digital light sensor. This project uses\u00a0Digilent\u2019s <a href=\"https:\/\/digilentinc.com\/Products\/Detail.cfm?NavPath=2,892,936&amp;Prod=CHIPKIT-BASIC-IO-SHIELD\" target=\"_blank\">chipKIT Basic I\/O shield<\/a>\u00a0for displaying the measured light intensity in Lux, foot-candles, and Watts\/m^2 units.<\/p>\n<div id=\"attachment_8531\" style=\"width: 595px\" class=\"wp-caption aligncenter\"><a href=\"http:\/\/embedded-lab.com\/blog\/?attachment_id=8531\" rel=\"attachment wp-att-8531\"><img loading=\"lazy\" decoding=\"async\" aria-describedby=\"caption-attachment-8531\" class=\"size-full wp-image-8531\" alt=\"sdsd\" src=\"http:\/\/embedded-lab.com\/blog\/wp-content\/uploads\/2014\/04\/LightMeterop3.jpg\" width=\"585\" height=\"462\" srcset=\"https:\/\/embedded-lab.com\/blog\/wp-content\/uploads\/2014\/04\/LightMeterop3.jpg 585w, https:\/\/embedded-lab.com\/blog\/wp-content\/uploads\/2014\/04\/LightMeterop3-550x434.jpg 550w\" sizes=\"auto, (max-width: 585px) 100vw, 585px\" \/><\/a><p id=\"caption-attachment-8531\" class=\"wp-caption-text\">Digital light meter using chipKIT Uno32<\/p><\/div>\n<p><!--more--><br \/>\n<strong>What do we need?<\/strong><\/p>\n<p>In order to build this project, we will need the following things.<\/p>\n<ul>\n<li><a href=\"http:\/\/embedded-lab.com\/blog\/?p=4444\" target=\"_blank\">chipKIT Uno32 board<\/a><\/li>\n<li><a href=\"https:\/\/digilentinc.com\/Products\/Detail.cfm?NavPath=2,892,936&amp;Prod=CHIPKIT-BASIC-IO-SHIELD\" target=\"_blank\">chipKIT Basic I\/O Shield<\/a><\/li>\n<li><a href=\"http:\/\/www.elecrow.com\/sensor-c-111\/light-sound-c-111_125\/digital-light-sensor-p-403.html\" target=\"_blank\">BH1750FVI digital light sensor<\/a><\/li>\n<li>Breadboard with a few jumper wires<\/li>\n<\/ul>\n<p>This project uses the BH1750FVI sensor (<a href=\"http:\/\/www.elechouse.com\/elechouse\/images\/product\/Digital%20light%20Sensor\/bh1750fvi-e.pdf\" target=\"_blank\"><strong>datasheet<\/strong><\/a>) to measure the intensity of surrounding light. BH1750FVI is a calibrated digital sensor IC that converts the incident light intensity into a 16-bit digital number (0-65535). The 16-bit output can be converted to Lux by simply dividing it by 1.2. Thus it can measure the maximum ambient light intensity of 65535\/1.2 = 54612 Lux. The spectral response function of the sensor is approximately close to that of the human eye. The sensor supports the I2C interface. The 7-bit I2C address of the sensor can be set to 0\u00d723 by grounding the ADDR pin, and to 0x5C by connecting ADDR to VCC. It is grounded by default through a pull-down resistor on board.<\/p>\n<div style=\"width: 510px\" class=\"wp-caption aligncenter\"><img loading=\"lazy\" decoding=\"async\" alt=\"\" src=\"http:\/\/embedded-lab.com\/blog\/wp-content\/uploads\/2013\/06\/BH1750Sensor.jpg\" width=\"500\" height=\"410\" \/><p class=\"wp-caption-text\">BH1750FVI sensor board<\/p><\/div>\n<p><strong>Circuit setup<\/strong><\/p>\n<p>The setup for this project is very simple. The JP6 and JP8 header jumpers on the Uno32 board are placed in the RG3 and RG2 position in order to use the A4 and A5 pins pins for I2C operation. The chipKIT I\/O shield is then inserted on the top the Uno32 board.\u00a0The BH1750FVI sensor board is plugged into the breadboard and is\u00a0powered through the 3.3V power supply from the I\/O shield. The SDA and SCL signal lines are connected to the analog input pins A4 and A5, respectively.<\/p>\n<div id=\"attachment_8524\" style=\"width: 603px\" class=\"wp-caption aligncenter\"><a href=\"http:\/\/embedded-lab.com\/blog\/?attachment_id=8524\" rel=\"attachment wp-att-8524\"><img loading=\"lazy\" decoding=\"async\" aria-describedby=\"caption-attachment-8524\" class=\"size-full wp-image-8524\" alt=\"BB\" src=\"http:\/\/embedded-lab.com\/blog\/wp-content\/uploads\/2014\/04\/Sensorconnections.jpg\" width=\"593\" height=\"334\" srcset=\"https:\/\/embedded-lab.com\/blog\/wp-content\/uploads\/2014\/04\/Sensorconnections.jpg 593w, https:\/\/embedded-lab.com\/blog\/wp-content\/uploads\/2014\/04\/Sensorconnections-550x309.jpg 550w\" sizes=\"auto, (max-width: 593px) 100vw, 593px\" \/><\/a><p id=\"caption-attachment-8524\" class=\"wp-caption-text\">BH1750FVI connections<\/p><\/div>\n<p>The following picture shows the complete setup of this project.<\/p>\n<div id=\"attachment_8490\" style=\"width: 590px\" class=\"wp-caption aligncenter\"><a href=\"http:\/\/embedded-lab.com\/blog\/?attachment_id=8490\" rel=\"attachment wp-att-8490\"><img loading=\"lazy\" decoding=\"async\" aria-describedby=\"caption-attachment-8490\" class=\"size-large wp-image-8490\" alt=\"LightMeterSetup\" src=\"http:\/\/embedded-lab.com\/blog\/wp-content\/uploads\/2014\/04\/LightMeterSetup.jpg\" width=\"580\" height=\"315\" srcset=\"https:\/\/embedded-lab.com\/blog\/wp-content\/uploads\/2014\/04\/LightMeterSetup.jpg 580w, https:\/\/embedded-lab.com\/blog\/wp-content\/uploads\/2014\/04\/LightMeterSetup-550x298.jpg 550w\" sizes=\"auto, (max-width: 580px) 100vw, 580px\" \/><\/a><p id=\"caption-attachment-8490\" class=\"wp-caption-text\">Digital light meter project setup<\/p><\/div>\n<p><strong>chipKIT sketch<\/strong><\/p>\n<p>A firmware has been developed to display the measured light intensity on the OLED screen of the I\/O shield. The display portion of the sketch uses the <a href=\"https:\/\/digilentinc.com\/Data\/Products\/CHIPKIT-BASIC-IO-SHIELD\/chipKIT%20IOShield%20Library.zip\" target=\"_blank\">chipKIT I\/O Shield library<\/a>\u00a0provided by Digilent. The light intensity is displayed in Lux, foot-candles, and watts\/m^2 computed at the center of the visible spectrum, which is ~555nm. The following equations are used to convert Lux into foot-candles and watts\/m^2.<\/p>\n<p style=\"text-align: center;\"><em><strong>Foot-candles = Lux\/10.764<\/strong><\/em><\/p>\n<p style=\"text-align: center;\"><em><strong>Watts\/m^2 = Lux\/683.002 \u00a0 \u00a0(At ~555 nm wavelength)<\/strong><\/em><\/p>\n<p><a href=\"http:\/\/embedded-lab.com\/uploads\/chipKIT\/P4_LightMeter.zip\" target=\"_blank\"><strong>Download the complete project sketch<\/strong><\/a><\/p>\n<p><strong>Output<\/strong><\/p>\n<p>Upload the light meter sketch (download link provided above) to your Uno32 board and your light meter is ready to rock. Now you have your own device to check if you have a proper illumination level at your work space. You can move the sensor to face at multiple directions to see the differences in the lighting level in those directions. The measurement is set to refresh in every 3 seconds but you can modify it in the sketch to take samples at faster rates.<\/p>\n<div id=\"attachment_8489\" style=\"width: 590px\" class=\"wp-caption aligncenter\"><a href=\"http:\/\/embedded-lab.com\/blog\/?attachment_id=8489\" rel=\"attachment wp-att-8489\"><img loading=\"lazy\" decoding=\"async\" aria-describedby=\"caption-attachment-8489\" class=\"size-large wp-image-8489\" alt=\"LightMeterop2\" src=\"http:\/\/embedded-lab.com\/blog\/wp-content\/uploads\/2014\/04\/LightMeterop2.jpg\" width=\"580\" height=\"337\" srcset=\"https:\/\/embedded-lab.com\/blog\/wp-content\/uploads\/2014\/04\/LightMeterop2.jpg 580w, https:\/\/embedded-lab.com\/blog\/wp-content\/uploads\/2014\/04\/LightMeterop2-550x319.jpg 550w\" sizes=\"auto, (max-width: 580px) 100vw, 580px\" \/><\/a><p id=\"caption-attachment-8489\" class=\"wp-caption-text\">Light meter in action<\/p><\/div>\n<div id=\"attachment_8488\" style=\"width: 590px\" class=\"wp-caption aligncenter\"><a href=\"http:\/\/embedded-lab.com\/blog\/?attachment_id=8488\" rel=\"attachment wp-att-8488\"><img loading=\"lazy\" decoding=\"async\" aria-describedby=\"caption-attachment-8488\" class=\"size-full wp-image-8488\" alt=\"Digital Light Meter\" src=\"http:\/\/embedded-lab.com\/blog\/wp-content\/uploads\/2014\/04\/LightMeterop1.jpg\" width=\"580\" height=\"413\" srcset=\"https:\/\/embedded-lab.com\/blog\/wp-content\/uploads\/2014\/04\/LightMeterop1.jpg 580w, https:\/\/embedded-lab.com\/blog\/wp-content\/uploads\/2014\/04\/LightMeterop1-550x391.jpg 550w\" sizes=\"auto, (max-width: 580px) 100vw, 580px\" \/><\/a><p id=\"caption-attachment-8488\" class=\"wp-caption-text\">Closer look of the display<\/p><\/div>\n","protected":false},"excerpt":{"rendered":"<p>A light meter is used to measure the intensity of illumination in a given area. It is widely used in schools, warehouses, factories, hospitals, office\u00a0buildings, museums, art-galleries, parking\u00a0garages, stadiums, and many more,\u00a0to measure and maintain proper lighting levels. The intensity of illumination is usually expressed in Lux or foot-candles. As the 4th project in our chipKIT tutorial series, today we are going to build a digital light meter using the chipKIT Uno32 board and the BH1750 digital light sensor. This project uses\u00a0Digilent\u2019s chipKIT Basic I\/O shield\u00a0for displaying the measured light intensity in Lux, foot-candles, and Watts\/m^2 units.<\/p>\n","protected":false},"author":1,"featured_media":8487,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[401,245],"tags":[1314,756,398,435],"class_list":["post-8486","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-chipkit","category-embedded-lab-projects","tag-chipkit","tag-light-meter","tag-lux-meter","tag-uno32"],"_links":{"self":[{"href":"https:\/\/embedded-lab.com\/blog\/wp-json\/wp\/v2\/posts\/8486","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/embedded-lab.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/embedded-lab.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/embedded-lab.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/embedded-lab.com\/blog\/wp-json\/wp\/v2\/comments?post=8486"}],"version-history":[{"count":19,"href":"https:\/\/embedded-lab.com\/blog\/wp-json\/wp\/v2\/posts\/8486\/revisions"}],"predecessor-version":[{"id":8608,"href":"https:\/\/embedded-lab.com\/blog\/wp-json\/wp\/v2\/posts\/8486\/revisions\/8608"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/embedded-lab.com\/blog\/wp-json\/wp\/v2\/media\/8487"}],"wp:attachment":[{"href":"https:\/\/embedded-lab.com\/blog\/wp-json\/wp\/v2\/media?parent=8486"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/embedded-lab.com\/blog\/wp-json\/wp\/v2\/categories?post=8486"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/embedded-lab.com\/blog\/wp-json\/wp\/v2\/tags?post=8486"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}