{"id":154,"date":"2012-02-14T13:39:51","date_gmt":"2012-02-14T18:39:51","guid":{"rendered":"https:\/\/gamadiyo.com\/blog\/?p=154"},"modified":"2012-02-14T14:23:12","modified_gmt":"2012-02-14T19:23:12","slug":"arduino-photoresistor-motor-stepper-motor","status":"publish","type":"post","link":"https:\/\/gamadiyo.com\/blog\/?p=154","title":{"rendered":"Arduino: PhotoResistor Motor &#038; Stepper Motor"},"content":{"rendered":"<p>I bought a bunch of CdS photo resistors from ebay. The basic use of these is to change resistance depending on the\u00c2\u00a0ambient\u00c2\u00a0light it detects. More light = less resistance and less light = more resistance. You can set it up in a circuit with a DC motor to make it spin faster or slower. See attached image for the circuit. Basically when the transistor gets more ground on the base, it flows more current through, making the motor spin faster.<\/p>\n<p>For Stepper Motor, I used the arduino code and information available <a title=\"photoresistor\" href=\"http:\/\/www.ladyada.net\/learn\/sensors\/cds.html\" target=\"_blank\">here<\/a>\u00c2\u00a0to setup the photo resistor with an Arduino Uno board. The resistance from the photo resistor is converted into an analog signal which in turn is converted to a integer value. This value can be used to turn something on\/off. In this case, I used a stepper motor connected to a group of gears that I removed from an old HP laser printer. The stepper motor is connect to a motor shield and set to turn on when the &#8220;int&#8221; value of the photo resistor is 900 or higher. See attached Arduino code.<\/p>\n<p><a href=\"https:\/\/gamadiyo.com\/blog\/wp-content\/uploads\/2012\/02\/PhotoStepper.txt\">PhotoStepper<\/a>\u00c2\u00a0(copy to .pde\u00c2\u00a0file)<\/p>\n\n<div class=\"youtube-embed\" itemprop=\"video\" itemscope itemtype=\"https:\/\/schema.org\/VideoObject\">\n\t<meta itemprop=\"url\" content=\"https:\/\/www.youtube.com\/v\/dfd-kjFj-kQ\" \/>\n\t<meta itemprop=\"name\" content=\"Arduino: PhotoResistor Motor &#038; Stepper Motor\" \/>\n\t<meta itemprop=\"description\" content=\"Arduino: PhotoResistor Motor &#038; Stepper Motor\" \/>\n\t<meta itemprop=\"uploadDate\" content=\"2012-02-14T13:39:51-05:00\" \/>\n\t<meta itemprop=\"thumbnailUrl\" content=\"https:\/\/i.ytimg.com\/vi\/dfd-kjFj-kQ\/default.jpg\" \/>\n\t<meta itemprop=\"embedUrl\" content=\"https:\/\/www.youtube.com\/embed\/dfd-kjFj-kQ\" \/>\n\t<meta itemprop=\"height\" content=\"276\" \/>\n\t<meta itemprop=\"width\" content=\"490\" \/>\n\t<iframe loading=\"lazy\" style=\"border: 0;\" class=\"youtube-player\" width=\"490\" height=\"276\" src=\"https:\/\/www.youtube.com\/embed\/dfd-kjFj-kQ?modestbranding=1&fs=0&rel=0\"><\/iframe>\n<\/div>\n\n<p>&nbsp;<\/p>\n\n\t\t<style>\n\t\t\t#gallery-1 {\n\t\t\t\tmargin: auto;\n\t\t\t}\n\t\t\t#gallery-1 .gallery-item {\n\t\t\t\tfloat: left;\n\t\t\t\tmargin-top: 10px;\n\t\t\t\ttext-align: center;\n\t\t\t\twidth: 33%;\n\t\t\t}\n\t\t\t#gallery-1 img {\n\t\t\t\tborder: 2px solid #cfcfcf;\n\t\t\t}\n\t\t\t#gallery-1 .gallery-caption {\n\t\t\t\tmargin-left: 0;\n\t\t\t}\n\t\t\t\/* see gallery_shortcode() in wp-includes\/media.php *\/\n\t\t<\/style>\n\t\t<div id='gallery-1' class='gallery galleryid-154 gallery-columns-3 gallery-size-thumbnail'><dl class='gallery-item'>\n\t\t\t<dt class='gallery-icon portrait'>\n\t\t\t\t<a href='https:\/\/gamadiyo.com\/blog\/?attachment_id=155'><img loading=\"lazy\" decoding=\"async\" width=\"150\" height=\"150\" src=\"https:\/\/gamadiyo.com\/blog\/wp-content\/uploads\/2012\/02\/images-150x150.jpg\" class=\"attachment-thumbnail size-thumbnail\" alt=\"\" \/><\/a>\n\t\t\t<\/dt><\/dl><dl class='gallery-item'>\n\t\t\t<dt class='gallery-icon landscape'>\n\t\t\t\t<a href='https:\/\/gamadiyo.com\/blog\/?attachment_id=156'><img loading=\"lazy\" decoding=\"async\" width=\"150\" height=\"150\" src=\"https:\/\/gamadiyo.com\/blog\/wp-content\/uploads\/2012\/02\/IMG_1093-150x150.jpg\" class=\"attachment-thumbnail size-thumbnail\" alt=\"\" \/><\/a>\n\t\t\t<\/dt><\/dl><dl class='gallery-item'>\n\t\t\t<dt class='gallery-icon landscape'>\n\t\t\t\t<a href='https:\/\/gamadiyo.com\/blog\/?attachment_id=157'><img loading=\"lazy\" decoding=\"async\" width=\"150\" height=\"150\" src=\"https:\/\/gamadiyo.com\/blog\/wp-content\/uploads\/2012\/02\/IMG_1094-150x150.jpg\" class=\"attachment-thumbnail size-thumbnail\" alt=\"\" \/><\/a>\n\t\t\t<\/dt><\/dl><br style=\"clear: both\" \/><dl class='gallery-item'>\n\t\t\t<dt class='gallery-icon landscape'>\n\t\t\t\t<a href='https:\/\/gamadiyo.com\/blog\/?attachment_id=158'><img loading=\"lazy\" decoding=\"async\" width=\"150\" height=\"150\" src=\"https:\/\/gamadiyo.com\/blog\/wp-content\/uploads\/2012\/02\/IMG_1095-150x150.jpg\" class=\"attachment-thumbnail size-thumbnail\" alt=\"\" \/><\/a>\n\t\t\t<\/dt><\/dl><dl class='gallery-item'>\n\t\t\t<dt class='gallery-icon landscape'>\n\t\t\t\t<a href='https:\/\/gamadiyo.com\/blog\/?attachment_id=159'><img loading=\"lazy\" decoding=\"async\" width=\"150\" height=\"150\" src=\"https:\/\/gamadiyo.com\/blog\/wp-content\/uploads\/2012\/02\/IMG_1097-150x150.jpg\" class=\"attachment-thumbnail size-thumbnail\" alt=\"\" \/><\/a>\n\t\t\t<\/dt><\/dl><dl class='gallery-item'>\n\t\t\t<dt class='gallery-icon landscape'>\n\t\t\t\t<a href='https:\/\/gamadiyo.com\/blog\/?attachment_id=160'><img loading=\"lazy\" decoding=\"async\" width=\"150\" height=\"150\" src=\"https:\/\/gamadiyo.com\/blog\/wp-content\/uploads\/2012\/02\/IMG_1098-150x150.jpg\" class=\"attachment-thumbnail size-thumbnail\" alt=\"\" \/><\/a>\n\t\t\t<\/dt><\/dl><br style=\"clear: both\" \/><dl class='gallery-item'>\n\t\t\t<dt class='gallery-icon landscape'>\n\t\t\t\t<a href='https:\/\/gamadiyo.com\/blog\/?attachment_id=161'><img loading=\"lazy\" decoding=\"async\" width=\"150\" height=\"150\" src=\"https:\/\/gamadiyo.com\/blog\/wp-content\/uploads\/2012\/02\/IMG_1099-150x150.jpg\" class=\"attachment-thumbnail size-thumbnail\" alt=\"\" \/><\/a>\n\t\t\t<\/dt><\/dl><dl class='gallery-item'>\n\t\t\t<dt class='gallery-icon landscape'>\n\t\t\t\t<a href='https:\/\/gamadiyo.com\/blog\/?attachment_id=162'><img loading=\"lazy\" decoding=\"async\" width=\"150\" height=\"150\" src=\"https:\/\/gamadiyo.com\/blog\/wp-content\/uploads\/2012\/02\/IMG_1113-150x150.jpg\" class=\"attachment-thumbnail size-thumbnail\" alt=\"\" \/><\/a>\n\t\t\t<\/dt><\/dl><dl class='gallery-item'>\n\t\t\t<dt class='gallery-icon landscape'>\n\t\t\t\t<a href='https:\/\/gamadiyo.com\/blog\/?attachment_id=163'><img loading=\"lazy\" decoding=\"async\" width=\"150\" height=\"150\" src=\"https:\/\/gamadiyo.com\/blog\/wp-content\/uploads\/2012\/02\/IMG_1114-150x150.jpg\" class=\"attachment-thumbnail size-thumbnail\" alt=\"\" \/><\/a>\n\t\t\t<\/dt><\/dl><br style=\"clear: both\" \/><dl class='gallery-item'>\n\t\t\t<dt class='gallery-icon landscape'>\n\t\t\t\t<a href='https:\/\/gamadiyo.com\/blog\/?attachment_id=164'><img loading=\"lazy\" decoding=\"async\" width=\"150\" height=\"150\" src=\"https:\/\/gamadiyo.com\/blog\/wp-content\/uploads\/2012\/02\/IMG_1115-150x150.jpg\" class=\"attachment-thumbnail size-thumbnail\" alt=\"\" \/><\/a>\n\t\t\t<\/dt><\/dl><dl class='gallery-item'>\n\t\t\t<dt class='gallery-icon landscape'>\n\t\t\t\t<a href='https:\/\/gamadiyo.com\/blog\/?attachment_id=165'><img loading=\"lazy\" decoding=\"async\" width=\"150\" height=\"150\" src=\"https:\/\/gamadiyo.com\/blog\/wp-content\/uploads\/2012\/02\/IMG_1116-150x150.jpg\" class=\"attachment-thumbnail size-thumbnail\" alt=\"\" \/><\/a>\n\t\t\t<\/dt><\/dl>\n\t\t\t<br style='clear: both' \/>\n\t\t<\/div>\n\n","protected":false},"excerpt":{"rendered":"<p>I bought a bunch of CdS photo resistors from ebay. The basic use of these is to change resistance depending on the\u00c2\u00a0ambient\u00c2\u00a0light it detects. More light = less resistance and less light = more resistance. You can set it up in a circuit with a DC motor to make it spin faster or slower. See [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[12],"tags":[],"class_list":["post-154","post","type-post","status-publish","format-standard","hentry","category-arduino-2"],"_links":{"self":[{"href":"https:\/\/gamadiyo.com\/blog\/index.php?rest_route=\/wp\/v2\/posts\/154","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/gamadiyo.com\/blog\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/gamadiyo.com\/blog\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/gamadiyo.com\/blog\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/gamadiyo.com\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=154"}],"version-history":[{"count":0,"href":"https:\/\/gamadiyo.com\/blog\/index.php?rest_route=\/wp\/v2\/posts\/154\/revisions"}],"wp:attachment":[{"href":"https:\/\/gamadiyo.com\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=154"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/gamadiyo.com\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=154"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/gamadiyo.com\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=154"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}