{"id":12422,"date":"2021-03-09T17:31:31","date_gmt":"2021-03-09T22:31:31","guid":{"rendered":"https:\/\/courses.ideate.cmu.edu\/60-223\/s2021\/work\/?p=12422"},"modified":"2021-03-09T19:15:18","modified_gmt":"2021-03-10T00:15:18","slug":"double-transducer-light-to-orientation","status":"publish","type":"post","link":"https:\/\/courses.ideate.cmu.edu\/60-223\/s2021\/work\/double-transducer-light-to-orientation\/","title":{"rendered":"Double Transducer | Light to Orientation"},"content":{"rendered":"<p>Team Members: Kevin Bender, Nicole Yu<\/p>\n<p><strong>Tinkercad:<\/strong><\/p>\n<p><iframe title=\"tinkercad banana group\" width=\"620\" height=\"465\" src=\"https:\/\/www.youtube.com\/embed\/24SX_mCJ1EQ?feature=oembed\" frameborder=\"0\" allow=\"accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture\" allowfullscreen><\/iframe><\/p>\n<p>* the potentiometer on the left is representative of the rotary encoder. The DC motor and driver are representative of the stepper motor and driver<\/p>\n<p><strong>Overall:<\/strong><\/p>\n<div id=\"attachment_12424\" style=\"width: 540px\" class=\"wp-caption aligncenter\"><img aria-describedby=\"caption-attachment-12424\" loading=\"lazy\" class=\"wp-image-12424 \" src=\"https:\/\/courses.ideate.cmu.edu\/60-223\/s2021\/work\/wp-content\/uploads\/2021\/03\/IMG_0896-scaled.jpg\" alt=\"\" width=\"530\" height=\"398\" srcset=\"https:\/\/courses.ideate.cmu.edu\/60-223\/s2021\/work\/wp-content\/uploads\/2021\/03\/IMG_0896-scaled.jpg 2560w, https:\/\/courses.ideate.cmu.edu\/60-223\/s2021\/work\/wp-content\/uploads\/2021\/03\/IMG_0896-300x225.jpg 300w, https:\/\/courses.ideate.cmu.edu\/60-223\/s2021\/work\/wp-content\/uploads\/2021\/03\/IMG_0896-1024x768.jpg 1024w, https:\/\/courses.ideate.cmu.edu\/60-223\/s2021\/work\/wp-content\/uploads\/2021\/03\/IMG_0896-768x576.jpg 768w, https:\/\/courses.ideate.cmu.edu\/60-223\/s2021\/work\/wp-content\/uploads\/2021\/03\/IMG_0896-1536x1152.jpg 1536w, https:\/\/courses.ideate.cmu.edu\/60-223\/s2021\/work\/wp-content\/uploads\/2021\/03\/IMG_0896-2048x1536.jpg 2048w, https:\/\/courses.ideate.cmu.edu\/60-223\/s2021\/work\/wp-content\/uploads\/2021\/03\/IMG_0896-973x730.jpg 973w, https:\/\/courses.ideate.cmu.edu\/60-223\/s2021\/work\/wp-content\/uploads\/2021\/03\/IMG_0896-508x381.jpg 508w\" sizes=\"(max-width: 530px) 100vw, 530px\" \/><p id=\"caption-attachment-12424\" class=\"wp-caption-text\">Nicole&#8217;s final double transducer<\/p><\/div>\n<div id=\"attachment_12488\" style=\"width: 540px\" class=\"wp-caption aligncenter\"><img aria-describedby=\"caption-attachment-12488\" loading=\"lazy\" class=\"wp-image-12488 \" src=\"https:\/\/courses.ideate.cmu.edu\/60-223\/s2021\/work\/wp-content\/uploads\/2021\/03\/Screen-Shot-2021-03-09-at-5.29.50-PM-854x1024.jpg\" alt=\"\" width=\"530\" height=\"635\" srcset=\"https:\/\/courses.ideate.cmu.edu\/60-223\/s2021\/work\/wp-content\/uploads\/2021\/03\/Screen-Shot-2021-03-09-at-5.29.50-PM-854x1024.jpg 854w, https:\/\/courses.ideate.cmu.edu\/60-223\/s2021\/work\/wp-content\/uploads\/2021\/03\/Screen-Shot-2021-03-09-at-5.29.50-PM-250x300.jpg 250w, https:\/\/courses.ideate.cmu.edu\/60-223\/s2021\/work\/wp-content\/uploads\/2021\/03\/Screen-Shot-2021-03-09-at-5.29.50-PM-768x920.jpg 768w, https:\/\/courses.ideate.cmu.edu\/60-223\/s2021\/work\/wp-content\/uploads\/2021\/03\/Screen-Shot-2021-03-09-at-5.29.50-PM-1282x1536.jpg 1282w, https:\/\/courses.ideate.cmu.edu\/60-223\/s2021\/work\/wp-content\/uploads\/2021\/03\/Screen-Shot-2021-03-09-at-5.29.50-PM-973x1166.jpg 973w, https:\/\/courses.ideate.cmu.edu\/60-223\/s2021\/work\/wp-content\/uploads\/2021\/03\/Screen-Shot-2021-03-09-at-5.29.50-PM-508x609.jpg 508w, https:\/\/courses.ideate.cmu.edu\/60-223\/s2021\/work\/wp-content\/uploads\/2021\/03\/Screen-Shot-2021-03-09-at-5.29.50-PM.jpg 1562w\" sizes=\"(max-width: 530px) 100vw, 530px\" \/><p id=\"caption-attachment-12488\" class=\"wp-caption-text\">Kevin&#8217;s Final Double Transducer<\/p><\/div>\n<p>&nbsp;<\/p>\n<p><strong>Detail Photos:<\/strong><\/p>\n<div id=\"attachment_12425\" style=\"width: 2570px\" class=\"wp-caption alignleft\"><img aria-describedby=\"caption-attachment-12425\" loading=\"lazy\" class=\"size-full wp-image-12425\" src=\"https:\/\/courses.ideate.cmu.edu\/60-223\/s2021\/work\/wp-content\/uploads\/2021\/03\/IMG_0906-scaled.jpg\" alt=\"\" width=\"2560\" height=\"1920\" srcset=\"https:\/\/courses.ideate.cmu.edu\/60-223\/s2021\/work\/wp-content\/uploads\/2021\/03\/IMG_0906-scaled.jpg 2560w, https:\/\/courses.ideate.cmu.edu\/60-223\/s2021\/work\/wp-content\/uploads\/2021\/03\/IMG_0906-300x225.jpg 300w, https:\/\/courses.ideate.cmu.edu\/60-223\/s2021\/work\/wp-content\/uploads\/2021\/03\/IMG_0906-1024x768.jpg 1024w, https:\/\/courses.ideate.cmu.edu\/60-223\/s2021\/work\/wp-content\/uploads\/2021\/03\/IMG_0906-768x576.jpg 768w, https:\/\/courses.ideate.cmu.edu\/60-223\/s2021\/work\/wp-content\/uploads\/2021\/03\/IMG_0906-1536x1152.jpg 1536w, https:\/\/courses.ideate.cmu.edu\/60-223\/s2021\/work\/wp-content\/uploads\/2021\/03\/IMG_0906-2048x1536.jpg 2048w, https:\/\/courses.ideate.cmu.edu\/60-223\/s2021\/work\/wp-content\/uploads\/2021\/03\/IMG_0906-973x730.jpg 973w, https:\/\/courses.ideate.cmu.edu\/60-223\/s2021\/work\/wp-content\/uploads\/2021\/03\/IMG_0906-508x381.jpg 508w\" sizes=\"(max-width: 2560px) 100vw, 2560px\" \/><p id=\"caption-attachment-12425\" class=\"wp-caption-text\">LCD input\/output values<\/p><\/div>\n<div id=\"attachment_12426\" style=\"width: 2570px\" class=\"wp-caption alignright\"><img aria-describedby=\"caption-attachment-12426\" loading=\"lazy\" class=\"wp-image-12426 size-full\" src=\"https:\/\/courses.ideate.cmu.edu\/60-223\/s2021\/work\/wp-content\/uploads\/2021\/03\/IMG_0910-scaled.jpg\" alt=\"\" width=\"2560\" height=\"1920\" srcset=\"https:\/\/courses.ideate.cmu.edu\/60-223\/s2021\/work\/wp-content\/uploads\/2021\/03\/IMG_0910-scaled.jpg 2560w, https:\/\/courses.ideate.cmu.edu\/60-223\/s2021\/work\/wp-content\/uploads\/2021\/03\/IMG_0910-300x225.jpg 300w, https:\/\/courses.ideate.cmu.edu\/60-223\/s2021\/work\/wp-content\/uploads\/2021\/03\/IMG_0910-1024x768.jpg 1024w, https:\/\/courses.ideate.cmu.edu\/60-223\/s2021\/work\/wp-content\/uploads\/2021\/03\/IMG_0910-768x576.jpg 768w, https:\/\/courses.ideate.cmu.edu\/60-223\/s2021\/work\/wp-content\/uploads\/2021\/03\/IMG_0910-1536x1152.jpg 1536w, https:\/\/courses.ideate.cmu.edu\/60-223\/s2021\/work\/wp-content\/uploads\/2021\/03\/IMG_0910-2048x1536.jpg 2048w, https:\/\/courses.ideate.cmu.edu\/60-223\/s2021\/work\/wp-content\/uploads\/2021\/03\/IMG_0910-973x730.jpg 973w, https:\/\/courses.ideate.cmu.edu\/60-223\/s2021\/work\/wp-content\/uploads\/2021\/03\/IMG_0910-508x381.jpg 508w\" sizes=\"(max-width: 2560px) 100vw, 2560px\" \/><p id=\"caption-attachment-12426\" class=\"wp-caption-text\">Servo motor &#8220;dial&#8221; (from 0\u00ba &#8211; 180\u00ba)<\/p><\/div>\n<div id=\"attachment_12427\" style=\"width: 2570px\" class=\"wp-caption alignleft\"><img aria-describedby=\"caption-attachment-12427\" loading=\"lazy\" class=\"size-full wp-image-12427\" src=\"https:\/\/courses.ideate.cmu.edu\/60-223\/s2021\/work\/wp-content\/uploads\/2021\/03\/IMG_0913-scaled.jpg\" alt=\"\" width=\"2560\" height=\"1920\" srcset=\"https:\/\/courses.ideate.cmu.edu\/60-223\/s2021\/work\/wp-content\/uploads\/2021\/03\/IMG_0913-scaled.jpg 2560w, https:\/\/courses.ideate.cmu.edu\/60-223\/s2021\/work\/wp-content\/uploads\/2021\/03\/IMG_0913-300x225.jpg 300w, https:\/\/courses.ideate.cmu.edu\/60-223\/s2021\/work\/wp-content\/uploads\/2021\/03\/IMG_0913-1024x768.jpg 1024w, https:\/\/courses.ideate.cmu.edu\/60-223\/s2021\/work\/wp-content\/uploads\/2021\/03\/IMG_0913-768x576.jpg 768w, https:\/\/courses.ideate.cmu.edu\/60-223\/s2021\/work\/wp-content\/uploads\/2021\/03\/IMG_0913-1536x1152.jpg 1536w, https:\/\/courses.ideate.cmu.edu\/60-223\/s2021\/work\/wp-content\/uploads\/2021\/03\/IMG_0913-2048x1536.jpg 2048w, https:\/\/courses.ideate.cmu.edu\/60-223\/s2021\/work\/wp-content\/uploads\/2021\/03\/IMG_0913-973x730.jpg 973w, https:\/\/courses.ideate.cmu.edu\/60-223\/s2021\/work\/wp-content\/uploads\/2021\/03\/IMG_0913-508x381.jpg 508w\" sizes=\"(max-width: 2560px) 100vw, 2560px\" \/><p id=\"caption-attachment-12427\" class=\"wp-caption-text\">Close up of the connection between the stepper motor and rotary encoder<\/p><\/div>\n<div id=\"attachment_12497\" style=\"width: 2570px\" class=\"wp-caption alignright\"><img aria-describedby=\"caption-attachment-12497\" loading=\"lazy\" class=\"wp-image-12497 size-medium\" src=\"https:\/\/courses.ideate.cmu.edu\/60-223\/s2021\/work\/wp-content\/uploads\/2021\/03\/Screen-Shot-2021-03-09-at-5.46.58-PM-300x236.jpg\" alt=\"\" width=\"2560\" height=\"1920\" \/><p id=\"caption-attachment-12497\" class=\"wp-caption-text\">Final protoboard wiring<\/p><\/div>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p style=\"text-align: left\"><strong>Brief Movies:<\/strong><\/p>\n<p><iframe title=\"Double Transducer - Nicole\" width=\"620\" height=\"349\" src=\"https:\/\/www.youtube.com\/embed\/hUzwLdmh4QM?feature=oembed\" frameborder=\"0\" allow=\"accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture\" allowfullscreen><\/iframe><\/p>\n<p>&nbsp;<\/p>\n<p><iframe title=\"Double Transducer\" width=\"620\" height=\"349\" src=\"https:\/\/www.youtube.com\/embed\/9Vf7TRimNcM?feature=oembed\" frameborder=\"0\" allow=\"accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture\" allowfullscreen><\/iframe><\/p>\n<p><strong>Description:<\/strong><\/p>\n<p>This device detects the amount of light through a photoresistor, and sends that signal to the stepper motor driver and stepper motor, which turns the rotary encoder at a certain speed. The rotary encoder determines how far it was rotated, and sends that data to the servo motor, which based on the data, turns to a certain angle (orientation).<\/p>\n<p><strong>Progress Images:<\/strong><\/p>\n<p><div id=\"attachment_12428\" style=\"width: 2570px\" class=\"wp-caption alignleft\"><img aria-describedby=\"caption-attachment-12428\" loading=\"lazy\" class=\"wp-image-12428 size-full\" src=\"https:\/\/courses.ideate.cmu.edu\/60-223\/s2021\/work\/wp-content\/uploads\/2021\/03\/IMG_0813-scaled.jpg\" alt=\"\" width=\"2560\" height=\"1920\" srcset=\"https:\/\/courses.ideate.cmu.edu\/60-223\/s2021\/work\/wp-content\/uploads\/2021\/03\/IMG_0813-scaled.jpg 2560w, https:\/\/courses.ideate.cmu.edu\/60-223\/s2021\/work\/wp-content\/uploads\/2021\/03\/IMG_0813-300x225.jpg 300w, https:\/\/courses.ideate.cmu.edu\/60-223\/s2021\/work\/wp-content\/uploads\/2021\/03\/IMG_0813-1024x768.jpg 1024w, https:\/\/courses.ideate.cmu.edu\/60-223\/s2021\/work\/wp-content\/uploads\/2021\/03\/IMG_0813-768x576.jpg 768w, https:\/\/courses.ideate.cmu.edu\/60-223\/s2021\/work\/wp-content\/uploads\/2021\/03\/IMG_0813-1536x1152.jpg 1536w, https:\/\/courses.ideate.cmu.edu\/60-223\/s2021\/work\/wp-content\/uploads\/2021\/03\/IMG_0813-2048x1536.jpg 2048w, https:\/\/courses.ideate.cmu.edu\/60-223\/s2021\/work\/wp-content\/uploads\/2021\/03\/IMG_0813-973x730.jpg 973w, https:\/\/courses.ideate.cmu.edu\/60-223\/s2021\/work\/wp-content\/uploads\/2021\/03\/IMG_0813-508x381.jpg 508w\" sizes=\"(max-width: 2560px) 100vw, 2560px\" \/><p id=\"caption-attachment-12428\" class=\"wp-caption-text\">Figuring out the connection between the stepper motor and rotary encoder [Nicole]<\/p><\/div><div id=\"attachment_12429\" style=\"width: 2570px\" class=\"wp-caption alignright\"><img aria-describedby=\"caption-attachment-12429\" loading=\"lazy\" class=\"wp-image-12429 size-full\" src=\"https:\/\/courses.ideate.cmu.edu\/60-223\/s2021\/work\/wp-content\/uploads\/2021\/03\/IMG_0829-scaled.jpg\" alt=\"\" width=\"2560\" height=\"1920\" srcset=\"https:\/\/courses.ideate.cmu.edu\/60-223\/s2021\/work\/wp-content\/uploads\/2021\/03\/IMG_0829-scaled.jpg 2560w, https:\/\/courses.ideate.cmu.edu\/60-223\/s2021\/work\/wp-content\/uploads\/2021\/03\/IMG_0829-300x225.jpg 300w, https:\/\/courses.ideate.cmu.edu\/60-223\/s2021\/work\/wp-content\/uploads\/2021\/03\/IMG_0829-1024x768.jpg 1024w, https:\/\/courses.ideate.cmu.edu\/60-223\/s2021\/work\/wp-content\/uploads\/2021\/03\/IMG_0829-768x576.jpg 768w, https:\/\/courses.ideate.cmu.edu\/60-223\/s2021\/work\/wp-content\/uploads\/2021\/03\/IMG_0829-1536x1152.jpg 1536w, https:\/\/courses.ideate.cmu.edu\/60-223\/s2021\/work\/wp-content\/uploads\/2021\/03\/IMG_0829-2048x1536.jpg 2048w, https:\/\/courses.ideate.cmu.edu\/60-223\/s2021\/work\/wp-content\/uploads\/2021\/03\/IMG_0829-973x730.jpg 973w, https:\/\/courses.ideate.cmu.edu\/60-223\/s2021\/work\/wp-content\/uploads\/2021\/03\/IMG_0829-508x381.jpg 508w\" sizes=\"(max-width: 2560px) 100vw, 2560px\" \/><p id=\"caption-attachment-12429\" class=\"wp-caption-text\">An LCD that needs to be debugged [Nicole]<\/p><\/div><div id=\"attachment_12485\" style=\"width: 374px\" class=\"wp-caption alignright\"><img aria-describedby=\"caption-attachment-12485\" loading=\"lazy\" class=\"wp-image-12485 \" src=\"https:\/\/courses.ideate.cmu.edu\/60-223\/s2021\/work\/wp-content\/uploads\/2021\/03\/Screen-Shot-2021-03-09-at-5.20.31-PM-1024x765.jpg\" alt=\"\" width=\"364\" height=\"272\" srcset=\"https:\/\/courses.ideate.cmu.edu\/60-223\/s2021\/work\/wp-content\/uploads\/2021\/03\/Screen-Shot-2021-03-09-at-5.20.31-PM-1024x765.jpg 1024w, https:\/\/courses.ideate.cmu.edu\/60-223\/s2021\/work\/wp-content\/uploads\/2021\/03\/Screen-Shot-2021-03-09-at-5.20.31-PM-300x224.jpg 300w, https:\/\/courses.ideate.cmu.edu\/60-223\/s2021\/work\/wp-content\/uploads\/2021\/03\/Screen-Shot-2021-03-09-at-5.20.31-PM-768x573.jpg 768w, https:\/\/courses.ideate.cmu.edu\/60-223\/s2021\/work\/wp-content\/uploads\/2021\/03\/Screen-Shot-2021-03-09-at-5.20.31-PM-1536x1147.jpg 1536w, https:\/\/courses.ideate.cmu.edu\/60-223\/s2021\/work\/wp-content\/uploads\/2021\/03\/Screen-Shot-2021-03-09-at-5.20.31-PM-2048x1529.jpg 2048w, https:\/\/courses.ideate.cmu.edu\/60-223\/s2021\/work\/wp-content\/uploads\/2021\/03\/Screen-Shot-2021-03-09-at-5.20.31-PM-973x727.jpg 973w, https:\/\/courses.ideate.cmu.edu\/60-223\/s2021\/work\/wp-content\/uploads\/2021\/03\/Screen-Shot-2021-03-09-at-5.20.31-PM-508x379.jpg 508w\" sizes=\"(max-width: 364px) 100vw, 364px\" \/><p id=\"caption-attachment-12485\" class=\"wp-caption-text\">LCD setup with &#8220;Hello World&#8221; starter code from library [Kevin]<\/p><\/div><div id=\"attachment_12487\" style=\"width: 375px\" class=\"wp-caption alignleft\"><img aria-describedby=\"caption-attachment-12487\" loading=\"lazy\" class=\"wp-image-12487 \" src=\"https:\/\/courses.ideate.cmu.edu\/60-223\/s2021\/work\/wp-content\/uploads\/2021\/03\/Screen-Shot-2021-03-09-at-5.23.32-PM-1024x809.jpg\" alt=\"\" width=\"365\" height=\"289\" srcset=\"https:\/\/courses.ideate.cmu.edu\/60-223\/s2021\/work\/wp-content\/uploads\/2021\/03\/Screen-Shot-2021-03-09-at-5.23.32-PM-1024x809.jpg 1024w, https:\/\/courses.ideate.cmu.edu\/60-223\/s2021\/work\/wp-content\/uploads\/2021\/03\/Screen-Shot-2021-03-09-at-5.23.32-PM-300x237.jpg 300w, https:\/\/courses.ideate.cmu.edu\/60-223\/s2021\/work\/wp-content\/uploads\/2021\/03\/Screen-Shot-2021-03-09-at-5.23.32-PM-768x607.jpg 768w, https:\/\/courses.ideate.cmu.edu\/60-223\/s2021\/work\/wp-content\/uploads\/2021\/03\/Screen-Shot-2021-03-09-at-5.23.32-PM-1536x1214.jpg 1536w, https:\/\/courses.ideate.cmu.edu\/60-223\/s2021\/work\/wp-content\/uploads\/2021\/03\/Screen-Shot-2021-03-09-at-5.23.32-PM-2048x1619.jpg 2048w, https:\/\/courses.ideate.cmu.edu\/60-223\/s2021\/work\/wp-content\/uploads\/2021\/03\/Screen-Shot-2021-03-09-at-5.23.32-PM-973x769.jpg 973w, https:\/\/courses.ideate.cmu.edu\/60-223\/s2021\/work\/wp-content\/uploads\/2021\/03\/Screen-Shot-2021-03-09-at-5.23.32-PM-508x401.jpg 508w\" sizes=\"(max-width: 365px) 100vw, 365px\" \/><p id=\"caption-attachment-12487\" class=\"wp-caption-text\">In-progress picture of soldering the photoresistor and encoder circuits onto a protoboard [Kevin]<\/p><\/div>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<div id=\"attachment_12486\" style=\"width: 405px\" class=\"wp-caption aligncenter\"><img aria-describedby=\"caption-attachment-12486\" loading=\"lazy\" class=\"wp-image-12486 \" src=\"https:\/\/courses.ideate.cmu.edu\/60-223\/s2021\/work\/wp-content\/uploads\/2021\/03\/Screen-Shot-2021-03-09-at-5.23.16-PM-1024x765.jpg\" alt=\"\" width=\"395\" height=\"295\" srcset=\"https:\/\/courses.ideate.cmu.edu\/60-223\/s2021\/work\/wp-content\/uploads\/2021\/03\/Screen-Shot-2021-03-09-at-5.23.16-PM-1024x765.jpg 1024w, https:\/\/courses.ideate.cmu.edu\/60-223\/s2021\/work\/wp-content\/uploads\/2021\/03\/Screen-Shot-2021-03-09-at-5.23.16-PM-300x224.jpg 300w, https:\/\/courses.ideate.cmu.edu\/60-223\/s2021\/work\/wp-content\/uploads\/2021\/03\/Screen-Shot-2021-03-09-at-5.23.16-PM-768x573.jpg 768w, https:\/\/courses.ideate.cmu.edu\/60-223\/s2021\/work\/wp-content\/uploads\/2021\/03\/Screen-Shot-2021-03-09-at-5.23.16-PM-1536x1147.jpg 1536w, https:\/\/courses.ideate.cmu.edu\/60-223\/s2021\/work\/wp-content\/uploads\/2021\/03\/Screen-Shot-2021-03-09-at-5.23.16-PM-2048x1529.jpg 2048w, https:\/\/courses.ideate.cmu.edu\/60-223\/s2021\/work\/wp-content\/uploads\/2021\/03\/Screen-Shot-2021-03-09-at-5.23.16-PM-973x727.jpg 973w, https:\/\/courses.ideate.cmu.edu\/60-223\/s2021\/work\/wp-content\/uploads\/2021\/03\/Screen-Shot-2021-03-09-at-5.23.16-PM-508x379.jpg 508w\" sizes=\"(max-width: 395px) 100vw, 395px\" \/><p id=\"caption-attachment-12486\" class=\"wp-caption-text\">Testing all the individual components put together for the first time! [Kevin]<\/p><\/div>\n<p style=\"text-align: left\"><strong>Discussion:<\/strong><\/p>\n<p>I think one of the biggest hurdles for us was dealing with the unknown. We chose to use a rotary encoder, something that we weren&#8217;t really familiar with, causing a lot of uncertainty. We also had no idea how we were going to connect the stepper motor and rotary encoder together, so we winged that as well. In hindsight, I think we should&#8217;ve fleshed out our plan to the smallest detail before starting rather than going in with a vague idea. That would&#8217;ve saved a lot of headaches. However, on the other hand, going in with vague idea was a great way to force one to solidify their idea, since planning can only do so much.<\/p>\n<p>Nicole: Planning first would&#8217;ve also helped me with my wiring, since once the LCD Display came along with its 6 more pins, I was just sticking them wherever there was available space. Ideally, if I had planned it out, I would have the pins consecutive with each other.<\/p>\n<p>One of our challenges was that we needed 12 digital pins, meaning that we were either forced to do some challenging wiring to use something like a shift register or sacrifice one of the TX\/RX pins. At first neither of us knew exactly what the implications of that would be, but we found out that we could not upload code to the Arduino or use serial communication while using these pins. This ended up being a headache when we were debugging issues with our code and wiring as if we forgot to unplug the TX pin the code failed to upload. The wire ended up breaking inside the pin, although luckily some needle nose pliers saved the day. I will be trying my best to avoid using these pins in the future by using a shift register or investing in an Arduino board with more pins.<\/p>\n<p><strong>Diagrams:<\/strong><\/p>\n<p><strong>Functional Block Diagram<\/strong><\/p>\n<div id=\"attachment_12431\" style=\"width: 1259px\" class=\"wp-caption aligncenter\"><img aria-describedby=\"caption-attachment-12431\" loading=\"lazy\" class=\"wp-image-12431 size-full\" src=\"https:\/\/courses.ideate.cmu.edu\/60-223\/s2021\/work\/wp-content\/uploads\/2021\/03\/Flowchart.png\" alt=\"\" width=\"1249\" height=\"386\" srcset=\"https:\/\/courses.ideate.cmu.edu\/60-223\/s2021\/work\/wp-content\/uploads\/2021\/03\/Flowchart.png 1249w, https:\/\/courses.ideate.cmu.edu\/60-223\/s2021\/work\/wp-content\/uploads\/2021\/03\/Flowchart-300x93.png 300w, https:\/\/courses.ideate.cmu.edu\/60-223\/s2021\/work\/wp-content\/uploads\/2021\/03\/Flowchart-1024x316.png 1024w, https:\/\/courses.ideate.cmu.edu\/60-223\/s2021\/work\/wp-content\/uploads\/2021\/03\/Flowchart-768x237.png 768w, https:\/\/courses.ideate.cmu.edu\/60-223\/s2021\/work\/wp-content\/uploads\/2021\/03\/Flowchart-973x301.png 973w, https:\/\/courses.ideate.cmu.edu\/60-223\/s2021\/work\/wp-content\/uploads\/2021\/03\/Flowchart-508x157.png 508w\" sizes=\"(max-width: 1249px) 100vw, 1249px\" \/><p id=\"caption-attachment-12431\" class=\"wp-caption-text\">Functional Block Diagram<\/p><\/div>\n<p><strong>Schematic Diagrams<\/strong><\/p>\n<div id=\"attachment_12430\" style=\"width: 1417px\" class=\"wp-caption aligncenter\"><img aria-describedby=\"caption-attachment-12430\" loading=\"lazy\" class=\"size-full wp-image-12430\" src=\"https:\/\/courses.ideate.cmu.edu\/60-223\/s2021\/work\/wp-content\/uploads\/2021\/03\/Electrical-Diagram-Nicole.png\" alt=\"\" width=\"1407\" height=\"1335\" srcset=\"https:\/\/courses.ideate.cmu.edu\/60-223\/s2021\/work\/wp-content\/uploads\/2021\/03\/Electrical-Diagram-Nicole.png 1407w, https:\/\/courses.ideate.cmu.edu\/60-223\/s2021\/work\/wp-content\/uploads\/2021\/03\/Electrical-Diagram-Nicole-300x285.png 300w, https:\/\/courses.ideate.cmu.edu\/60-223\/s2021\/work\/wp-content\/uploads\/2021\/03\/Electrical-Diagram-Nicole-1024x972.png 1024w, https:\/\/courses.ideate.cmu.edu\/60-223\/s2021\/work\/wp-content\/uploads\/2021\/03\/Electrical-Diagram-Nicole-768x729.png 768w, https:\/\/courses.ideate.cmu.edu\/60-223\/s2021\/work\/wp-content\/uploads\/2021\/03\/Electrical-Diagram-Nicole-973x923.png 973w, https:\/\/courses.ideate.cmu.edu\/60-223\/s2021\/work\/wp-content\/uploads\/2021\/03\/Electrical-Diagram-Nicole-508x482.png 508w\" sizes=\"(max-width: 1407px) 100vw, 1407px\" \/><p id=\"caption-attachment-12430\" class=\"wp-caption-text\">Nicole&#8217;s electrical schematic<\/p><\/div>\n<p>*a few of Kevin&#8217;s pins are slightly different (see code), but the wiring is identical otherwise<\/p>\n<p>&nbsp;<\/p>\n<p><strong>Code:<\/strong><\/p>\n<p>Nicole&#8217;s Code<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"c\">\/*\r\n   60-223, Project 1: Double Transducer\r\n   Nicole Yu (nvy) Kevin Bender (kbender1)\r\n\r\n   Description:\r\n   This device detects the amount of light through a photoresistor, and\r\n   sends that signal to the stepper motor driver and stepper motor,\r\n   which turns the rotary encoder at a certain speed. The rotary encoder\r\n   determines how far it was rotated in the span of 2 seconds, and sends\r\n   that data to the servo motor, which based on the data, turns to a\r\n   certain angle (orientation).\r\n\r\n   \r\n   Pin mapping:\r\n\r\n   Arduino pin | type   | description\r\n   ------------|--------|-------------\r\n   A0            input     photoresistor\r\n   2             input     rotary encoder pin A\r\n   3             input     rotary encoder pin B\r\n   5             output    servo motor\r\n   7             input     stepper motor IN1\r\n   8             input     stepper motor IN2\r\n   9             input     stepper motor IN3\r\n   10            input     stepper motor IN4\r\n   A1            output    LCD RS\r\n   4             output    LCD Enable\r\n   6             output    LCD D4\r\n   11            output    LCD D5\r\n   12            output    LCD D6\r\n   13            output    LCD D7\r\n\r\n   Sources:\r\n   1) How to wire and program the LCD from the Elgoo website:\r\n   https:\/\/drive.google.com\/drive\/folders\/1BUe40Ibb9Bzi1JwRKywO1PCXBMzkFXm7?usp=sharing\r\n   2) I borrowed heavily from this Stepper motor library\r\n   and code: https:\/\/www.arduino.cc\/en\/Tutorial\/LibraryExamples\/StepperSpeedControl\r\n   3) I followed this tutorial and borrowed heavily its code:\r\n   https:\/\/www.seeedstudio.com\/blog\/2020\/01\/19\/rotary-encoders-how-it-works-how-to-use-with-arduino\/\r\n   4) I referenced the Canvas modules to refresh on how to wire and\r\n   code for a photoresistor and servo\r\n*\/\r\n\r\n\/\/ LIBRARIES\r\n#include &lt;Encoder.h&gt;\r\n#include &lt;Stepper.h&gt;\r\n#include &lt;Servo.h&gt;\r\n#include &lt;LiquidCrystal.h&gt;\r\n\r\n\/\/ VARIABLES\r\nconst int PHOTOPIN = A0; \/\/ photoresistor pin\r\nconst int DOORMOTORPIN = 5; \/\/ servo motor pin\r\nconst int stepsPerRevolution = 200; \/\/ stepper motor's\r\nconst int WAIT = 2000; \/\/ 2 seconds\r\nunsigned long timerVariable = 0;\r\nint orientation;\r\nlong oldPosition  = -999;\r\n\r\n\/\/ initialize library code\r\nLiquidCrystal lcd(A1, 4, 6, 11, 12, 13);\r\nStepper myStepper(stepsPerRevolution, 7, 8, 9, 10);\r\nEncoder myEnc(2, 3);\r\nServo doorMotor;\r\n\r\n\r\nvoid setup() {\r\n\r\n  \/\/ set up the LCD's number of columns and rows:\r\n  lcd.begin(16, 2);\r\n\r\n  \/\/ servo\r\n  doorMotor.attach(DOORMOTORPIN);\r\n\r\n}\r\n\r\nvoid loop() {\r\n\r\n  \/\/ PHOTORESISTOR\r\n  int photoVal = analogRead(PHOTOPIN);\r\n\r\n  \/\/ STEPPER MOTOR\r\n  int motorSpeed = map(photoVal, 0, 1023, 0, 100);\r\n  if (motorSpeed &gt; 0) {\r\n\r\n    myStepper.setSpeed(motorSpeed);\r\n    myStepper.step(stepsPerRevolution \/ 100);\r\n\r\n    \/\/ ROTARY ENCODER\r\n    long newPosition = myEnc.read();\r\n\r\n    \/\/ SERVO\r\n    int orientation = map(newPosition, 0, 17, 10, 170); \/\/ the 17 is a placeholder,\r\n    \/\/ I haven't seen the rotary encoder go past 16\r\n\r\n    \/\/ Sees at 2 seconds how far rotary encoder turned\r\n    if (millis() - timerVariable &gt; WAIT) {\r\n\r\n      doorMotor.write(orientation);\r\n      myEnc.write(0); \/\/ resets encoder to 0\r\n\r\n      \/\/ LCD\r\n      \/\/ update LCD here\r\n      lcd.setCursor(0, 0);\r\n      lcd.print(\"i:\"); \/\/ input\r\n      lcd.print(photoVal);\r\n      lcd.print(\" \"); \/\/ solution to non erasing problem\r\n\r\n      lcd.setCursor(8, 0);\r\n      lcd.print(\"m1:\"); \/\/ middle step 1\r\n      lcd.print(motorSpeed);\r\n      lcd.print(\" \");\r\n\r\n      lcd.setCursor(0, 1);\r\n      lcd.print(\"m2:\"); \/\/ middle step 2\r\n      lcd.print(newPosition);\r\n      lcd.print(\"  \");\r\n\r\n      lcd.setCursor(8, 1);\r\n      lcd.print(\"o:\"); \/\/ output\r\n      lcd.print(orientation);\r\n      lcd.print(\" \");\r\n\r\n\r\n      timerVariable = millis();\r\n\r\n    }\r\n\r\n    \/\/ not &gt; 2 seconds, update the old position\r\n    else {\r\n      if (newPosition != oldPosition) {\r\n        oldPosition = newPosition;\r\n      }\r\n\r\n    }\r\n  }\r\n}<\/pre>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"c\">\/*\r\n * 60-223, Project 1\r\n * Kevin Bender (kbender1)\r\n * time spent: ~8 hours\r\n *\r\n * Collaboration and sources: \r\n * 1) Nicole Yu and I worked together on the idea and \r\n *  electrical design, coded separately (other than tinkercad)\r\n * 2) I borrowed from the Elegoo starter kit lesson 2.3 for the \r\n *    LCD\r\n * 3) I borrowed from the Encoder library examples\r\n * 6) I borrowed from the stepper library examples\r\n * \r\n * Challenge(s): This project took a lot of learning and research\r\n *  as it combined everything we had learned so far about\r\n *  Arduino and electronics. The challenges came in the form\r\n *  of trying to figure out how to use the LCD which didn't work\r\n *  with the manufacturer-recommended wiring of 3.3v and with the \r\n *  stepper motor which was much weaker than expected. \r\n *  \r\n * Next time: I will try to learn more about potential inputs\/outputs\r\n * and possibly try them out in advance. A lot of suffering could\r\n * have been saved by doing this with the stepper motor\r\n * \r\n * Description: Object detects light level, based on how intense light is it would cause a motor to spin fast\/slow, \r\n * and that speed would then affect the orientation of the servo motor \u201cdial\u201d (from encoder)\r\n * \r\n * Pin mapping:\r\n * \r\n * Arduino pin | type   | description\r\n * ------------|--------|-------------\r\n * A0            input     Photoresistor as initial input\r\n * 1             input     rotary encoder pin A for middle step input\r\n * 13            input     rotary encoder pin B\r\n * 2             output    Stepper motor driver pin A as middle step output\r\n * 3             output    Stepper motor driver pin B \r\n * 4             output    Stepper motor driver pin C \r\n * 5             output    Stepper motor driver pin D \r\n * 6             output    servo motor for final output\r\n * 7             input     pushbutton to activate lights\r\n * 8             output    LCD pin A\r\n * 9             output    LCD pin B\r\n * 10             output    LCD pin C\r\n * 11             output    LCD pin D     \r\n * 12             output    LCD pin E\r\n *\/\r\n\r\n\/\/ include the library code:\r\n#include &lt;LiquidCrystal.h&gt;\r\n#include &lt;Encoder.h&gt;\r\n#include &lt;Stepper.h&gt;\r\n#include &lt;Servo.h&gt;\r\n\r\nconst int stepsPerRevolution = 200;\r\n\r\nconst int ENC1 = 1;\r\nconst int ENC2 = 13;\r\n\r\nconst int LCD1 = 7;\r\nconst int LCD2 = 8;\r\nconst int LCD3 = 9;\r\nconst int LCD4 = 10;\r\nconst int LCD5 = 11;\r\nconst int LCD6 = 12;\r\n\r\nconst int STEP1 = 2;\r\nconst int STEP2 = 3;\r\nconst int STEP3 = 4;\r\nconst int STEP4 = 5;\r\n\r\nconst int SERVOPIN = 6;\r\n\r\nconst int PHOTORESISTOR = A0;\r\n\/\/ initialize the library with the numbers of the interface pins\r\nLiquidCrystal lcd(LCD1, LCD2, LCD3, LCD4, LCD5, LCD6);\r\nEncoder myEnc(ENC1, ENC2);\r\nStepper myStepper(stepsPerRevolution, STEP1, STEP2, STEP3, STEP4);\r\nServo myservo; \r\n\r\nvoid setup() {\r\n  myservo.attach(SERVOPIN);\r\n  \/\/ put your setup code here, to run once:\r\n  lcd.begin(16, 2);\r\n  \/\/ Print a message to the LCD.\r\n  pinMode(PHOTORESISTOR, INPUT);\r\n\r\n}\r\n\r\n\r\nvoid loop() {\r\n  long t0 = millis();\r\n  long speed = 0;\r\n  long lastPos = myEnc.read();\r\n  while (true) {\r\n    long t = millis();\r\n    myEnc.read();\r\n     int motorSpeed = map(analogRead(PHOTORESISTOR), 0, 1023, 0, 100);\r\n    \/\/ set the motor speed:\r\n    if (motorSpeed &gt; 0) {\r\n    myStepper.setSpeed(motorSpeed);\r\n    \/\/ step 1\/100 of a revolution:\r\n    myStepper.step(stepsPerRevolution \/ 100);\r\n  }\r\n    if (t - t0 &gt; 1000) {\r\n      long curPos = myEnc.read();\r\n      speed = abs(curPos-lastPos);\r\n      long pos = map(speed,0,15,0,180);\r\n      myservo.write(pos);\r\n      lastPos = curPos;\r\n      lcd.setCursor(0, 0);\r\n      lcd.print( \"i: \" + String(map(analogRead(PHOTORESISTOR), 0, 1023, 0, 99)) + \" m: \"+String(motorSpeed));\r\n      lcd.setCursor(0, 1);\r\n\r\n      lcd.print(\"  \" + String(speed)+ \"  o: \" +  String(map(pos,0,180,0,99)));\r\n      \/\/ print the number of seconds since reset:\r\n      t0 = t;\r\n    }\r\n  }\r\n\r\n}<\/pre>\n<p>&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Team Members: Kevin Bender, Nicole Yu Tinkercad: * the potentiometer on the left is representative of the rotary encoder. The DC motor and driver are representative of the&#8230;<\/p>\n","protected":false},"author":177,"featured_media":12424,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"video","meta":[],"categories":[86],"tags":[],"_links":{"self":[{"href":"https:\/\/courses.ideate.cmu.edu\/60-223\/s2021\/work\/wp-json\/wp\/v2\/posts\/12422"}],"collection":[{"href":"https:\/\/courses.ideate.cmu.edu\/60-223\/s2021\/work\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/courses.ideate.cmu.edu\/60-223\/s2021\/work\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/courses.ideate.cmu.edu\/60-223\/s2021\/work\/wp-json\/wp\/v2\/users\/177"}],"replies":[{"embeddable":true,"href":"https:\/\/courses.ideate.cmu.edu\/60-223\/s2021\/work\/wp-json\/wp\/v2\/comments?post=12422"}],"version-history":[{"count":18,"href":"https:\/\/courses.ideate.cmu.edu\/60-223\/s2021\/work\/wp-json\/wp\/v2\/posts\/12422\/revisions"}],"predecessor-version":[{"id":12512,"href":"https:\/\/courses.ideate.cmu.edu\/60-223\/s2021\/work\/wp-json\/wp\/v2\/posts\/12422\/revisions\/12512"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/courses.ideate.cmu.edu\/60-223\/s2021\/work\/wp-json\/wp\/v2\/media\/12424"}],"wp:attachment":[{"href":"https:\/\/courses.ideate.cmu.edu\/60-223\/s2021\/work\/wp-json\/wp\/v2\/media?parent=12422"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/courses.ideate.cmu.edu\/60-223\/s2021\/work\/wp-json\/wp\/v2\/categories?post=12422"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/courses.ideate.cmu.edu\/60-223\/s2021\/work\/wp-json\/wp\/v2\/tags?post=12422"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}