{"id":103,"date":"2009-05-06T23:26:01","date_gmt":"2009-05-06T22:26:01","guid":{"rendered":"http:\/\/stigern.net\/blog\/?p=103"},"modified":"2011-12-16T06:16:22","modified_gmt":"2011-12-16T05:16:22","slug":"how-to-make-a-light-tracker-using-photoresistors","status":"publish","type":"post","link":"https:\/\/stigern.net\/blog\/how-to-make-a-light-tracker-using-photoresistors\/","title":{"rendered":"How to make a light tracker using arduino &#038; photoresistors!"},"content":{"rendered":"<p>[youtube=http:\/\/www.youtube.com\/watch?v=iEhX27ahreI&#038;w=480&#038;h=385]<\/p>\n<p>This is how to make a simple light tracker\/follower with the Arduino. The components you need apart from the Arduino is:<\/p>\n<p><a href=\"http:\/\/www.futurlec.com\/Photocells.shtml\" target=\"_blank\">2x Photoresistors<\/a>: &#8220;PHOTOCELL2 Miniature Photocell&#8221;.<br \/>\n<a href=\"http:\/\/www.futurlec.com\/Res14W.shtml\" target=\"_blank\">2x 470 Ohms resistors<\/a>.<br \/>\n<a href=\"http:\/\/www.dealextreme.com\/details.dx\/sku.20023\" target=\"_blank\">1x Servo.<\/a><\/p>\n<p>And of course some <a href=\"http:\/\/www.seeedstudio.com\/depot\/breadborad-jumper-wire-75pcs-pack-p-234.html\" target=\"_blank\">wires<\/a>, and a <a href=\"http:\/\/www.seeedstudio.com\/depot\/mini-bread-board-45x35cmwhite-p-309.html\" target=\"_blank\">breadboard <\/a>or two :). Next step is to wire it all up, I&#8217;ve made a drawing in Fritzing that you can follow. Basically each photoresistor is wired likes this:<\/p>\n<p>PhotoR\u00a0\u00a0\u00a0 \u00a0\u00a0 470Ohms<br \/>\n+5\u00a0\u00a0\u00a0 o&#8212;\/\/\/&#8211;.&#8211;\/\/\/&#8212;o GND<br \/>\n|<br \/>\nPin 0 &amp; 1 o&#8212;&#8212;-<\/p>\n<p><a href=\"http:\/\/stigern.net\/arduino\/LightTracker.jpg\" target=\"_blank\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone\" src=\"http:\/\/stigern.net\/arduino\/lighttracker.th.jpg\" alt=\"\" width=\"150\" height=\"118\" \/><\/a><\/p>\n<p><a href=\"http:\/\/pastebin.com\/f238c7f29\" target=\"_blank\"><\/a><\/p>\n<p>Program Code:<\/p>\n<blockquote><p>#include &lt;Servo.h&gt;<\/p>\n<p>Servo myservo;<\/p>\n<p>int pos = 0;\u00a0 \/\/ Variable to store the servo position.<br \/>\nint inputPhotoLeft = 1; \/\/ Easier to read, instead of just 1 or 0.<br \/>\nint inputPhotoRight = 0;<\/p>\n<p>int Left = 0; \/\/ Store readings from the photoresistors.<br \/>\nint Right = 0; \/\/ Store readings from the photoresistors.<\/p>\n<p>void setup()<br \/>\n{<br \/>\nmyservo.attach(9); \/\/ Attach servo to pin 9.<br \/>\n}<\/p>\n<p>void loop()<br \/>\n{<br \/>\n\/\/ Reads the values from the photoresistors to the Left and Right variables.<br \/>\nLeft = analogRead(inputPhotoLeft);<br \/>\nRight = analogRead(inputPhotoRight);<\/p>\n<p>\/\/ Checks if right is greater than left, if so move to right.<br \/>\nif (Left &gt; (Right +20))<br \/>\n\/\/ +20 is the deadzone, so it wont jiggle back and forth.<br \/>\n{<br \/>\nif (pos &lt; 179)<br \/>\npos++;<br \/>\nmyservo.write(pos);<br \/>\n}<\/p>\n<p>\/\/ Checks if left is greater than right, if so move to left.<br \/>\nif (Right &gt; (Left +20))<br \/>\n\/\/ +20 is the deadzone, so it wont jiggle back and forth.<br \/>\n{<br \/>\nif (pos &gt; 1)<br \/>\npos -= 1;<br \/>\nmyservo.write(pos);<br \/>\n}<\/p>\n<p>\/\/ Added some delay, increase or decrease if you want less or more speed.<br \/>\ndelay(10);<br \/>\n}<\/p><\/blockquote>\n<p><strong>PS. If you got any questions etc, please take it in my <a href=\"..\/..\/forum\/viewtopic.php?f=24&amp;t=458\" target=\"_blank\">forums post here.<\/a><\/strong><\/p>\n","protected":false},"excerpt":{"rendered":"<p>[youtube=http:\/\/www.youtube.com\/watch?v=iEhX27ahreI&#038;w=480&#038;h=385] This is how to make a simple light tracker\/follower with the Arduino. The components you need apart from the Arduino is: 2x Photoresistors: &#8220;PHOTOCELL2 Miniature Photocell&#8221;. 2x 470 Ohms resistors. 1x Servo. And of course some wires, and a breadboard or two :). Next step is to wire it all up, I&#8217;ve made a [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_monsterinsights_skip_tracking":false,"_monsterinsights_sitenote_active":false,"_monsterinsights_sitenote_note":"","_monsterinsights_sitenote_category":0,"footnotes":""},"categories":[14,4],"tags":[16,178,172,176,26,95,111,174,179,177,175,61],"class_list":["post-103","post","type-post","status-publish","format-standard","hentry","category-arduino-electronics","category-electronics","tag-arduino","tag-avdvanced","tag-boarduino","tag-follower","tag-guide","tag-how","tag-ldr","tag-light","tag-make","tag-resistor","tag-tracker","tag-tutorial"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v24.5 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>How to make a light tracker using arduino &amp; photoresistors! - Stigern.Net<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/stigern.net\/blog\/how-to-make-a-light-tracker-using-photoresistors\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"How to make a light tracker using arduino &amp; photoresistors! - Stigern.Net\" \/>\n<meta property=\"og:description\" content=\"[youtube=http:\/\/www.youtube.com\/watch?v=iEhX27ahreI&#038;w=480&#038;h=385] This is how to make a simple light tracker\/follower with the Arduino. The components you need apart from the Arduino is: 2x Photoresistors: &#8220;PHOTOCELL2 Miniature Photocell&#8221;. 2x 470 Ohms resistors. 1x Servo. And of course some wires, and a breadboard or two :). Next step is to wire it all up, I&#8217;ve made a [&hellip;]\" \/>\n<meta property=\"og:url\" content=\"https:\/\/stigern.net\/blog\/how-to-make-a-light-tracker-using-photoresistors\/\" \/>\n<meta property=\"og:site_name\" content=\"Stigern.Net\" \/>\n<meta property=\"article:published_time\" content=\"2009-05-06T22:26:01+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2011-12-16T05:16:22+00:00\" \/>\n<meta property=\"og:image\" content=\"http:\/\/stigern.net\/arduino\/lighttracker.th.jpg\" \/>\n<meta name=\"author\" content=\"Stigern\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Stigern\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"1 minute\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/stigern.net\/blog\/how-to-make-a-light-tracker-using-photoresistors\/\",\"url\":\"https:\/\/stigern.net\/blog\/how-to-make-a-light-tracker-using-photoresistors\/\",\"name\":\"How to make a light tracker using arduino & photoresistors! - Stigern.Net\",\"isPartOf\":{\"@id\":\"https:\/\/stigern.net\/blog\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/stigern.net\/blog\/how-to-make-a-light-tracker-using-photoresistors\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/stigern.net\/blog\/how-to-make-a-light-tracker-using-photoresistors\/#primaryimage\"},\"thumbnailUrl\":\"http:\/\/stigern.net\/arduino\/lighttracker.th.jpg\",\"datePublished\":\"2009-05-06T22:26:01+00:00\",\"dateModified\":\"2011-12-16T05:16:22+00:00\",\"author\":{\"@id\":\"https:\/\/stigern.net\/blog\/#\/schema\/person\/a2a77157fa1facae3c843032fbc1ad3c\"},\"breadcrumb\":{\"@id\":\"https:\/\/stigern.net\/blog\/how-to-make-a-light-tracker-using-photoresistors\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/stigern.net\/blog\/how-to-make-a-light-tracker-using-photoresistors\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/stigern.net\/blog\/how-to-make-a-light-tracker-using-photoresistors\/#primaryimage\",\"url\":\"http:\/\/stigern.net\/arduino\/lighttracker.th.jpg\",\"contentUrl\":\"http:\/\/stigern.net\/arduino\/lighttracker.th.jpg\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/stigern.net\/blog\/how-to-make-a-light-tracker-using-photoresistors\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/stigern.net\/blog\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"How to make a light tracker using arduino &#038; photoresistors!\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/stigern.net\/blog\/#website\",\"url\":\"https:\/\/stigern.net\/blog\/\",\"name\":\"Stigern.Net\",\"description\":\"my little blog\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/stigern.net\/blog\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Person\",\"@id\":\"https:\/\/stigern.net\/blog\/#\/schema\/person\/a2a77157fa1facae3c843032fbc1ad3c\",\"name\":\"Stigern\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/stigern.net\/blog\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/305d159d64fe4a9ee434aed8ee639410?s=96&d=mm&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/305d159d64fe4a9ee434aed8ee639410?s=96&d=mm&r=g\",\"caption\":\"Stigern\"},\"sameAs\":[\"http:\/\/www.stigern.net\"],\"url\":\"https:\/\/stigern.net\/blog\/author\/admin\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"How to make a light tracker using arduino & photoresistors! - Stigern.Net","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/stigern.net\/blog\/how-to-make-a-light-tracker-using-photoresistors\/","og_locale":"en_US","og_type":"article","og_title":"How to make a light tracker using arduino & photoresistors! - Stigern.Net","og_description":"[youtube=http:\/\/www.youtube.com\/watch?v=iEhX27ahreI&#038;w=480&#038;h=385] This is how to make a simple light tracker\/follower with the Arduino. The components you need apart from the Arduino is: 2x Photoresistors: &#8220;PHOTOCELL2 Miniature Photocell&#8221;. 2x 470 Ohms resistors. 1x Servo. And of course some wires, and a breadboard or two :). Next step is to wire it all up, I&#8217;ve made a [&hellip;]","og_url":"https:\/\/stigern.net\/blog\/how-to-make-a-light-tracker-using-photoresistors\/","og_site_name":"Stigern.Net","article_published_time":"2009-05-06T22:26:01+00:00","article_modified_time":"2011-12-16T05:16:22+00:00","og_image":[{"url":"http:\/\/stigern.net\/arduino\/lighttracker.th.jpg","type":"","width":"","height":""}],"author":"Stigern","twitter_misc":{"Written by":"Stigern","Est. reading time":"1 minute"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/stigern.net\/blog\/how-to-make-a-light-tracker-using-photoresistors\/","url":"https:\/\/stigern.net\/blog\/how-to-make-a-light-tracker-using-photoresistors\/","name":"How to make a light tracker using arduino & photoresistors! - Stigern.Net","isPartOf":{"@id":"https:\/\/stigern.net\/blog\/#website"},"primaryImageOfPage":{"@id":"https:\/\/stigern.net\/blog\/how-to-make-a-light-tracker-using-photoresistors\/#primaryimage"},"image":{"@id":"https:\/\/stigern.net\/blog\/how-to-make-a-light-tracker-using-photoresistors\/#primaryimage"},"thumbnailUrl":"http:\/\/stigern.net\/arduino\/lighttracker.th.jpg","datePublished":"2009-05-06T22:26:01+00:00","dateModified":"2011-12-16T05:16:22+00:00","author":{"@id":"https:\/\/stigern.net\/blog\/#\/schema\/person\/a2a77157fa1facae3c843032fbc1ad3c"},"breadcrumb":{"@id":"https:\/\/stigern.net\/blog\/how-to-make-a-light-tracker-using-photoresistors\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/stigern.net\/blog\/how-to-make-a-light-tracker-using-photoresistors\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/stigern.net\/blog\/how-to-make-a-light-tracker-using-photoresistors\/#primaryimage","url":"http:\/\/stigern.net\/arduino\/lighttracker.th.jpg","contentUrl":"http:\/\/stigern.net\/arduino\/lighttracker.th.jpg"},{"@type":"BreadcrumbList","@id":"https:\/\/stigern.net\/blog\/how-to-make-a-light-tracker-using-photoresistors\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/stigern.net\/blog\/"},{"@type":"ListItem","position":2,"name":"How to make a light tracker using arduino &#038; photoresistors!"}]},{"@type":"WebSite","@id":"https:\/\/stigern.net\/blog\/#website","url":"https:\/\/stigern.net\/blog\/","name":"Stigern.Net","description":"my little blog","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/stigern.net\/blog\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Person","@id":"https:\/\/stigern.net\/blog\/#\/schema\/person\/a2a77157fa1facae3c843032fbc1ad3c","name":"Stigern","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/stigern.net\/blog\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/305d159d64fe4a9ee434aed8ee639410?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/305d159d64fe4a9ee434aed8ee639410?s=96&d=mm&r=g","caption":"Stigern"},"sameAs":["http:\/\/www.stigern.net"],"url":"https:\/\/stigern.net\/blog\/author\/admin\/"}]}},"_links":{"self":[{"href":"https:\/\/stigern.net\/blog\/wp-json\/wp\/v2\/posts\/103","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/stigern.net\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/stigern.net\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/stigern.net\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/stigern.net\/blog\/wp-json\/wp\/v2\/comments?post=103"}],"version-history":[{"count":1,"href":"https:\/\/stigern.net\/blog\/wp-json\/wp\/v2\/posts\/103\/revisions"}],"predecessor-version":[{"id":306,"href":"https:\/\/stigern.net\/blog\/wp-json\/wp\/v2\/posts\/103\/revisions\/306"}],"wp:attachment":[{"href":"https:\/\/stigern.net\/blog\/wp-json\/wp\/v2\/media?parent=103"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/stigern.net\/blog\/wp-json\/wp\/v2\/categories?post=103"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/stigern.net\/blog\/wp-json\/wp\/v2\/tags?post=103"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}