source code of /projects/light-sensor/index.html

Last modified
Lines 139

Parent directory Download CGIread sitemap Main page

Quick links: contact content footer navigation title

  1. <!DOCTYPE html>
  2. <html lang="en" xmlns="http://www.w3.org/1999/xhtml">
  3.     <head>
  4.         <meta charset="utf-8"/>
  5.         <meta name="viewport" content="width=device-width, initial-scale=1"/>
  6.         <link rel="stylesheet" href="https://oskog97.com/style.css" type="text/css"/>
  7.         <link rel="icon" type="image/png" href="/favicon.png"/>
  8.         <link rel="canonical" href="https://oskog97.com/projects/light-sensor/"/>
  9. <!-- End html5 macro. -->
  10.         <title>Bloody light sensor</title>
  11.         <meta name="description" content="Analog light sensor"/>
  12.     </head>
  13.     <body>
  14. <!-- BEGIN autogenerated navigation -->
  15. <nav><div id="navigation"><div id="nav_inner">
  16. <p><a href="#content" class="textonly">Skip navigation</a></p>
  17. <p class="row">
  18. <span class="textonly" translate="no">[</span><a class="head" href="/">Home</a><span class="textonly" translate="no">]</span>
  19. &gt;&gt;
  20. <span class="textonly" translate="no">[</span><a class="sub" href="/projects/anonymine/">Anonymine</a><span class="textonly" translate="no">]</span>
  21. <span class="textonly" translate="no">]</span><span class="sub active">Analog light sensor</span><span class="textonly" translate="no">[</span>
  22. <span class="textonly" translate="no">[</span><a class="sub" href="/projects/PLLM-M702A/">Reverse-engineered schematics for PLLM-M702A</a><span class="textonly" translate="no">]</span>
  23. <span class="textonly" translate="no">[</span><a class="sub" href="/small-scripts/">Small scripts</a><span class="textonly" translate="no">]</span>
  24. <span class="textonly" translate="no">[</span><a class="sub" href="/thinkpad/">-&gt; My IBM thinkpad</a><span class="textonly" translate="no">]</span>
  25. </p>
  26. <p class="row">
  27. <span class="textonly" translate="no">[</span><a class="sub" href="/sitemap.py">Sitemap</a><span class="textonly" translate="no">]</span>
  28. </p>
  29. <hr class="textonly"/>
  30. </div></div></nav>
  31. <!-- END autogenerated navigation -->
  32. <main><div id="content">
  33.     <h1 id="title">Analog light sensor</h1>
  34.     <p>This is a report on an assignment for a course in process measurement
  35.         technology at Novia UAS. The task is to design, simulate, construct,
  36.         test and calibrate an analog illuminance sensor based on an LDR.</p>
  37.     <ul>
  38.         <li><a href="light-sensor-part-1-design.pdf"
  39.             >Report part 1: Design</a></li>
  40.         <li><a href="light-sensor-part-2-testing.lowres.pdf"
  41.             >Report part 2: Construction, testing, and calibration</a>
  42.             <a download="" href="light-sensor-part-2-testing.pdf"
  43.             >(Download high quality version)</a></li>
  44.         <li><a href="https://gitlab.com/osksko-novia/light-sensor"
  45.             >Browse the project files on GitLab</a> or
  46.             <a href="/archive/light-sensor/light-sensor.tar.xz" download=""
  47.             >download entire project as compressed tape archive</a></li>
  48.     </ul>
  49.     (Downloads are throttled, go make a cup of coffee)
  50.     <h2>Sneak peek at the schematic</h2>
  51.     <img src="schematic.png" alt="(Picture of schematic)"/>
  52.     <h2>LDR characteristic curve</h2>
  53.     <p>It's surprisingly difficult to find any information about
  54.         resistance/illuminance characteristics for photoresistors/LDRs.
  55.         At best you get a straight line on a log-log graph which looks
  56.         too good to be true considering that datasheets specify at which
  57.         illuminance the gamma value is measured.</p>
  58.     <p><var>R = R<sub>10</sub>*(10/E)<sup>gamma</sup></var></p>
  59.     <p><var>R</var> is the resistance, <var>R<sub>10</sub></var> is the
  60.         resistance at 10 lux, <var>E</var> is the illuminance and gamma is a
  61.         "constant"</p>
  62.     <p>Datasheets tend to define
  63.         <var>gamma = log<sub>10</sub>(R<sub>10</sub>/R<sub>100</sub>)</var></p>
  64.     <p>
  65.         Adafruit is the only source I've found with <a class="print"
  66. href="https://cdn-learn.adafruit.com/downloads/pdf/photocells.pdf#page=6"
  67.         >more detailed information about typical characteristics of LDRs:</a>
  68.         slightly curvy traces on a log-log plot.  I meant to add this as a
  69.         reference in part 2, but unfortunately I forgot about and I don't feel
  70.         like making any more late ammendments.</p>
  71.     <h3>Own "research"</h3>
  72.     <p>The sensor is designed to translate conductance (the inverse of
  73.         resistance) directly into a voltage: <var>U = k/R</var></p>
  74.     <p>Approximate model:
  75.        <var>log<sub>10</sub>(U) = a*log<sub>10</sub>(E)<sup>2</sup>
  76.                                 + b*log<sub>10</sub>(E) + c</var></p>
  77.     <img src="curve.svg" alt=""/>
  78.     <p>A lot more details are in the second PDF</p>
  79.     <p>The inverse formula is a bit more funny:</p>
  80.     <img src="formula.svg"
  81.         alt="Sprechen Sie LaTeX?
  82.         $$ E = 10^(\frac{0.789-\sqrt{0.488-0.124 log_{10}(U)}}{0.0621}) $$
  83.         E is the illuminance in lux, U is the voltage in volts. $E \pm 9.4\%$"
  84.     />
  85.     <p>I like to call this "unevenly engineered". If it was over-engineered
  86.         it wouldn't use a sucky LDR and have a sucky 10% accuracy.</p>
  87.     <h2>Copyright</h2>
  88.     <p>I won't bother cluttering the reports any further with explicit
  89.     permissions unless someone actually wants permission to use them.
  90.     If you do please send me a message and I'll do something about it.</p>
  91.     <p>I also may have to do something about one of the images, I'd rather
  92.     make an equivalent myself than trusting fair use if I were to open source
  93.     this project.</p>
  94. </div></main>
  95. <!-- INCLUDED FOOTER -->
  96.     <hr class="textonly"/>
  97.     <p>
  98.         Copyright © Oskar Skog<br/>
  99.         Website content released under the <a
  100.         href="https://creativecommons.org/licenses/by/4.0/" rel="license noopener"
  101.         target="_blank">Creative Commons Attribution (CC-BY 4.0)</a> license
  102.         and my software usually under the <span class="a"><a target="_blank"
  103.         rel="noopener"
  104.         href="https://opensource.org/licenses/BSD-2-Clause">FreeBSD license
  105.         (2-clause)</a>.</span>
  106.         <br/>
  107.         Images may be from other sites, I should have cited useful sources
  108.         somewhere on the page.
  109.         <span class="notprint">Contact me if I haven't.</span>
  110.     </p>
  111.     <p id="contact" class="notprint">
  112.         You can contact me at: <a href="mailto:oskar@oskog97.com"
  113.         rel="noopener" target="_blank">oskar@oskog97.com</a>
  114.         <span class="a">(<a href="/pgp-pub/oskar.asc"
  115.                             >PGP public key</a>)</span>
  116.     </p>
  117.     <p> <a class="notprint" href="https://oskog97.com/read/?path=/style.css">
  118.             CSS Stylesheet
  119.         </a>
  120.         <a href="https://validator.w3.org/check/referrer" rel="nofollow noopener"
  121.             target="_blank" class="notprint"><span
  122.             class="img">Valid HTML5</span
  123.         ></a><br/>
  124.     </p>
  125. </div></footer>
  126. <!-- END OF INCLUDED FOOTER -->
  127.     </body>
  128. </html>