{"id":12644,"date":"2021-03-10T09:07:34","date_gmt":"2021-03-10T14:07:34","guid":{"rendered":"https:\/\/courses.ideate.cmu.edu\/60-223\/s2021\/work\/?p=12644"},"modified":"2021-03-10T20:29:39","modified_gmt":"2021-03-11T01:29:39","slug":"double-transducer-the-convoluted-potentiometer-orientation-light","status":"publish","type":"post","link":"https:\/\/courses.ideate.cmu.edu\/60-223\/s2021\/work\/double-transducer-the-convoluted-potentiometer-orientation-light\/","title":{"rendered":"Double Transducer: The Convoluted Potentiometer (Orientation &#8211;&gt; Light)"},"content":{"rendered":"<p><img loading=\"lazy\" class=\"alignnone wp-image-12650 size-full\" src=\"https:\/\/courses.ideate.cmu.edu\/60-223\/s2021\/work\/wp-content\/uploads\/2021\/03\/IMG_3249-scaled.jpg\" alt=\"\" width=\"2560\" height=\"2274\" srcset=\"https:\/\/courses.ideate.cmu.edu\/60-223\/s2021\/work\/wp-content\/uploads\/2021\/03\/IMG_3249-scaled.jpg 2560w, https:\/\/courses.ideate.cmu.edu\/60-223\/s2021\/work\/wp-content\/uploads\/2021\/03\/IMG_3249-300x266.jpg 300w, https:\/\/courses.ideate.cmu.edu\/60-223\/s2021\/work\/wp-content\/uploads\/2021\/03\/IMG_3249-1024x910.jpg 1024w, https:\/\/courses.ideate.cmu.edu\/60-223\/s2021\/work\/wp-content\/uploads\/2021\/03\/IMG_3249-768x682.jpg 768w, https:\/\/courses.ideate.cmu.edu\/60-223\/s2021\/work\/wp-content\/uploads\/2021\/03\/IMG_3249-1536x1364.jpg 1536w, https:\/\/courses.ideate.cmu.edu\/60-223\/s2021\/work\/wp-content\/uploads\/2021\/03\/IMG_3249-2048x1819.jpg 2048w, https:\/\/courses.ideate.cmu.edu\/60-223\/s2021\/work\/wp-content\/uploads\/2021\/03\/IMG_3249-973x864.jpg 973w, https:\/\/courses.ideate.cmu.edu\/60-223\/s2021\/work\/wp-content\/uploads\/2021\/03\/IMG_3249-508x451.jpg 508w\" sizes=\"(max-width: 2560px) 100vw, 2560px\" \/><\/p>\n<div style=\"width: 620px;\" class=\"wp-video\"><!--[if lt IE 9]><script>document.createElement('video');<\/script><![endif]-->\n<video class=\"wp-video-shortcode\" id=\"video-12644-1\" width=\"620\" height=\"447\" preload=\"metadata\" controls=\"controls\"><source type=\"video\/mp4\" src=\"https:\/\/courses.ideate.cmu.edu\/60-223\/s2021\/work\/wp-content\/uploads\/2021\/03\/Tinkercad-LCD-working.mp4?_=1\" \/><a href=\"https:\/\/courses.ideate.cmu.edu\/60-223\/s2021\/work\/wp-content\/uploads\/2021\/03\/Tinkercad-LCD-working.mp4\">https:\/\/courses.ideate.cmu.edu\/60-223\/s2021\/work\/wp-content\/uploads\/2021\/03\/Tinkercad-LCD-working.mp4<\/a><\/video><\/div>\n<p>The most successful Tinkercad circuit we built, for testing and learning the LCD screen and the LiquidCrystal library. See below for our full Tinkercad circuit and why it didn&#8217;t work.<\/p>\n<p>To begin this assignment,\u00a0 we discussed various ideas of how we could transduce orientation to light.\u00a0 After a couple hours of excited general brainstorming, we found it very helpful to use then maker cards to narrow down our conversation in terms of input and output.\u00a0 This focus allowed us to see what was necessary in the middle steps of the operation , and what parts may lend themselves well to working together.<\/p>\n<div id=\"attachment_12687\" style=\"width: 177px\" class=\"wp-caption alignleft\"><img aria-describedby=\"caption-attachment-12687\" loading=\"lazy\" class=\"wp-image-12687 size-medium\" src=\"https:\/\/courses.ideate.cmu.edu\/60-223\/s2021\/work\/wp-content\/uploads\/2021\/03\/Screen-Shot-2021-03-10-at-8.55.58-AM-167x300.jpg\" alt=\"\" width=\"167\" height=\"300\" srcset=\"https:\/\/courses.ideate.cmu.edu\/60-223\/s2021\/work\/wp-content\/uploads\/2021\/03\/Screen-Shot-2021-03-10-at-8.55.58-AM-167x300.jpg 167w, https:\/\/courses.ideate.cmu.edu\/60-223\/s2021\/work\/wp-content\/uploads\/2021\/03\/Screen-Shot-2021-03-10-at-8.55.58-AM-570x1024.jpg 570w, https:\/\/courses.ideate.cmu.edu\/60-223\/s2021\/work\/wp-content\/uploads\/2021\/03\/Screen-Shot-2021-03-10-at-8.55.58-AM-508x912.jpg 508w, https:\/\/courses.ideate.cmu.edu\/60-223\/s2021\/work\/wp-content\/uploads\/2021\/03\/Screen-Shot-2021-03-10-at-8.55.58-AM.jpg 578w\" sizes=\"(max-width: 167px) 100vw, 167px\" \/><p id=\"caption-attachment-12687\" class=\"wp-caption-text\">An overview of our 3 more refined ideas<\/p><\/div>\n<p>Our favorite of the 0ur 3 more refined ideas\u00a0 was the following:<\/p>\n<p>&nbsp;<\/p>\n<p>A potentiometer sets the angle for a servo for a stepper motor. A cable sticking out from the motor turns with the motor and glides on a layer of graphite drawn around the motor. A current is always flowing through the graphite, and depending on the position of the cable along the graphite trail, it\u2019ll measure more or less current. Essentially like a homemade potentiometer whose position is determined by a stepper motor. Depending on the current read by the cable, an LED lights up more or less.<\/p>\n<p>&nbsp;<\/p>\n<div id=\"attachment_12646\" style=\"width: 750px\" class=\"wp-caption alignnone\"><img aria-describedby=\"caption-attachment-12646\" loading=\"lazy\" class=\"wp-image-12646\" src=\"https:\/\/courses.ideate.cmu.edu\/60-223\/s2021\/work\/wp-content\/uploads\/2021\/03\/IMG_2801-2.jpg\" alt=\"\" width=\"740\" height=\"562\" srcset=\"https:\/\/courses.ideate.cmu.edu\/60-223\/s2021\/work\/wp-content\/uploads\/2021\/03\/IMG_2801-2.jpg 2494w, https:\/\/courses.ideate.cmu.edu\/60-223\/s2021\/work\/wp-content\/uploads\/2021\/03\/IMG_2801-2-300x228.jpg 300w, https:\/\/courses.ideate.cmu.edu\/60-223\/s2021\/work\/wp-content\/uploads\/2021\/03\/IMG_2801-2-1024x778.jpg 1024w, https:\/\/courses.ideate.cmu.edu\/60-223\/s2021\/work\/wp-content\/uploads\/2021\/03\/IMG_2801-2-768x583.jpg 768w, https:\/\/courses.ideate.cmu.edu\/60-223\/s2021\/work\/wp-content\/uploads\/2021\/03\/IMG_2801-2-1536x1166.jpg 1536w, https:\/\/courses.ideate.cmu.edu\/60-223\/s2021\/work\/wp-content\/uploads\/2021\/03\/IMG_2801-2-2048x1555.jpg 2048w, https:\/\/courses.ideate.cmu.edu\/60-223\/s2021\/work\/wp-content\/uploads\/2021\/03\/IMG_2801-2-973x739.jpg 973w, https:\/\/courses.ideate.cmu.edu\/60-223\/s2021\/work\/wp-content\/uploads\/2021\/03\/IMG_2801-2-508x386.jpg 508w\" sizes=\"(max-width: 740px) 100vw, 740px\" \/><p id=\"caption-attachment-12646\" class=\"wp-caption-text\">Jubbies&#8217; concept sketch for our idea<\/p><\/div>\n<p>We had gotten some good feedback from\u00a0 our professor as well, since this idea seemed to be a good balance between exciting and feasible.\u00a0 To proceed forward,\u00a0 we broke down our problem into several steps so we could focus on individual components before be assembled them together .\u00a0 The first step we needed to confirm was working\u00a0 independently was the one that was most unfamiliar &#8211; using a graphite resistor.\u00a0 To learn how to do this,\u00a0 Jubbies used YouTube\u00a0 to find a concise demonstration of this idea.<\/p>\n<p>The following video was very helpful\u00a0 as it demonstrated\u00a0 some of the affordances of using graphite circuit .<\/p>\n<p><iframe title=\"Paper Circuit!\" width=\"620\" height=\"349\" src=\"https:\/\/www.youtube.com\/embed\/BwKQ9Idq9FM?feature=oembed\" frameborder=\"0\" allow=\"accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture\" allowfullscreen><\/iframe><\/p>\n<p>Using this video as guidance,\u00a0 Jubbies recreated this graphite circuit with alligator clips in a 9-volt battery.\u00a0 This demonstration proved successful, although there was not as much variance in the light as was desired. We found that this issue was resolved as we eventually used a longer graphite resistor.<\/p>\n<p>&nbsp;<\/p>\n<div id=\"attachment_12652\" style=\"width: 510px\" class=\"wp-caption alignnone\"><img aria-describedby=\"caption-attachment-12652\" loading=\"lazy\" class=\"wp-image-12652 size-full\" src=\"https:\/\/courses.ideate.cmu.edu\/60-223\/s2021\/work\/wp-content\/uploads\/2021\/03\/Image.gif\" alt=\"\" width=\"500\" height=\"282\" \/><p id=\"caption-attachment-12652\" class=\"wp-caption-text\">Demonstration of the graphite circuit<\/p><\/div>\n<p>After proving that the graphite circuit could work,\u00a0 the next issue to tackle was\u00a0 controlling the stepper motor accurately with a potentiometer. This pursuit proved to be far more difficult than we first predicted. A huge barrier that we had to figure out how to overcome\u00a0 Rose\u00a0 making the\u00a0 stepper motor turn the correct direction. For some reason the stepper motor seems to only cumulatively turn to the right no matter the direction that the potentiometer was turned.\u00a0 \u00a0it was as if the stepper motor turn only two\u00a0 the amount\u00a0 that was equivalent to the total value that the potentiometer was turned , regardless of whether that value was left or right.\u00a0 We tried editing the code and\u00a0 checking our wiring for hours,\u00a0 but none of this seemed to help.<\/p>\n<p>&nbsp;<\/p>\n<div id=\"attachment_12667\" style=\"width: 510px\" class=\"wp-caption alignnone\"><img aria-describedby=\"caption-attachment-12667\" loading=\"lazy\" class=\"wp-image-12667 size-full\" src=\"https:\/\/courses.ideate.cmu.edu\/60-223\/s2021\/work\/wp-content\/uploads\/2021\/03\/Image-2.gif\" alt=\"\" width=\"500\" height=\"282\" \/><p id=\"caption-attachment-12667\" class=\"wp-caption-text\">here&#8217;s an example of the potentiometer moving to stepper motor only to the right depsite the direction that the potentiometer turned.<\/p><\/div>\n<p>&nbsp;<\/p>\n<p>It wasn&#8217;t until receiving help directly from our professor that we were able to proceed forward.\u00a0 The thing that fixed this issue\u00a0 was in the end, simply replacing both the stepper motor and a stepper motor driver.\u00a0 We have not yet identified what the issue was particularly, but using\u00a0 the new parts with the same code achieve the results that we had wanted.<\/p>\n<div id=\"attachment_12693\" style=\"width: 510px\" class=\"wp-caption alignnone\"><img aria-describedby=\"caption-attachment-12693\" loading=\"lazy\" class=\"wp-image-12693 size-full\" src=\"https:\/\/courses.ideate.cmu.edu\/60-223\/s2021\/work\/wp-content\/uploads\/2021\/03\/Image-4.gif\" alt=\"\" width=\"500\" height=\"282\" \/><p id=\"caption-attachment-12693\" class=\"wp-caption-text\">finally our stepper motor turned right AND left!!<\/p><\/div>\n<p>While this issue was frustrating and strange,\u00a0 it did allow us to use a stepper motor that was far more robust than the one we were using before.\u00a0 This helped\u00a0 with the construction\u00a0 of our circuit\u00a0 since we did not have to worry that the arm would not move quick enough.\u00a0 however\u00a0 oh, I believe the use of outside power source led to\u00a0 the following image &#8211; Jubbies accidentally blew up an LED while accidentally connecting the power and ground of the LED without the graphite circuit in-between. This was a good lesson, as it reminded her to be very conscientous of these wires not connecting again.<\/p>\n<p><img loading=\"lazy\" class=\"alignnone wp-image-12649 \" src=\"https:\/\/courses.ideate.cmu.edu\/60-223\/s2021\/work\/wp-content\/uploads\/2021\/03\/63644061213__27919460-10C9-4A1C-8A71-E9C611B14181-scaled.jpg\" alt=\"\" width=\"427\" height=\"569\" srcset=\"https:\/\/courses.ideate.cmu.edu\/60-223\/s2021\/work\/wp-content\/uploads\/2021\/03\/63644061213__27919460-10C9-4A1C-8A71-E9C611B14181-scaled.jpg 1920w, https:\/\/courses.ideate.cmu.edu\/60-223\/s2021\/work\/wp-content\/uploads\/2021\/03\/63644061213__27919460-10C9-4A1C-8A71-E9C611B14181-225x300.jpg 225w, https:\/\/courses.ideate.cmu.edu\/60-223\/s2021\/work\/wp-content\/uploads\/2021\/03\/63644061213__27919460-10C9-4A1C-8A71-E9C611B14181-768x1024.jpg 768w, https:\/\/courses.ideate.cmu.edu\/60-223\/s2021\/work\/wp-content\/uploads\/2021\/03\/63644061213__27919460-10C9-4A1C-8A71-E9C611B14181-1152x1536.jpg 1152w, https:\/\/courses.ideate.cmu.edu\/60-223\/s2021\/work\/wp-content\/uploads\/2021\/03\/63644061213__27919460-10C9-4A1C-8A71-E9C611B14181-1536x2048.jpg 1536w, https:\/\/courses.ideate.cmu.edu\/60-223\/s2021\/work\/wp-content\/uploads\/2021\/03\/63644061213__27919460-10C9-4A1C-8A71-E9C611B14181-973x1297.jpg 973w, https:\/\/courses.ideate.cmu.edu\/60-223\/s2021\/work\/wp-content\/uploads\/2021\/03\/63644061213__27919460-10C9-4A1C-8A71-E9C611B14181-508x677.jpg 508w\" sizes=\"(max-width: 427px) 100vw, 427px\" \/><\/p>\n<p>Another strange issue that was not ideal but did not hinder the intended mechanism was an ever present jitter in the stepper motor arm. This jitter was likely due to analog interference and could be resolved in the future with a threshold or other tool to smooth the data recieved by the potentiomenter. I had considered using a rotary encoder mid-project over the potentiometer as I heard that it was less susceptible to analog interference, but I was unable to quickly implement this and ended up just using the potentiometer.<\/p>\n<p>Bonus: I strapped a pen onto the stepper motor arm and found this jitter made for an interesting drawing tool to be explored further in the future &#8211; Jubbies<\/p>\n<p><img loading=\"lazy\" class=\"alignnone wp-image-12692 size-full\" src=\"https:\/\/courses.ideate.cmu.edu\/60-223\/s2021\/work\/wp-content\/uploads\/2021\/03\/Image-2-1.gif\" alt=\"\" width=\"500\" height=\"282\" \/><\/p>\n<p>&nbsp;<\/p>\n<p><strong>Carlos&#8217;s progress<\/strong><\/p>\n<div id=\"attachment_12698\" style=\"width: 1355px\" class=\"wp-caption alignnone\"><img aria-describedby=\"caption-attachment-12698\" loading=\"lazy\" class=\"wp-image-12698 \" src=\"https:\/\/courses.ideate.cmu.edu\/60-223\/s2021\/work\/wp-content\/uploads\/2021\/03\/Tinkercad-Demo.png\" alt=\"\" width=\"1345\" height=\"669\" srcset=\"https:\/\/courses.ideate.cmu.edu\/60-223\/s2021\/work\/wp-content\/uploads\/2021\/03\/Tinkercad-Demo.png 1842w, https:\/\/courses.ideate.cmu.edu\/60-223\/s2021\/work\/wp-content\/uploads\/2021\/03\/Tinkercad-Demo-300x149.png 300w, https:\/\/courses.ideate.cmu.edu\/60-223\/s2021\/work\/wp-content\/uploads\/2021\/03\/Tinkercad-Demo-1024x509.png 1024w, https:\/\/courses.ideate.cmu.edu\/60-223\/s2021\/work\/wp-content\/uploads\/2021\/03\/Tinkercad-Demo-768x382.png 768w, https:\/\/courses.ideate.cmu.edu\/60-223\/s2021\/work\/wp-content\/uploads\/2021\/03\/Tinkercad-Demo-1536x764.png 1536w, https:\/\/courses.ideate.cmu.edu\/60-223\/s2021\/work\/wp-content\/uploads\/2021\/03\/Tinkercad-Demo-973x484.png 973w, https:\/\/courses.ideate.cmu.edu\/60-223\/s2021\/work\/wp-content\/uploads\/2021\/03\/Tinkercad-Demo-508x253.png 508w\" sizes=\"(max-width: 1345px) 100vw, 1345px\" \/><p id=\"caption-attachment-12698\" class=\"wp-caption-text\">My (Carlos&#8217;s) Tinkercad code somehow became ridden with invisible special characters \\302 and \\240, maybe after copying and pasting the code from iMessage. They were nearly impossible to remove without retyping those lines word for word all over again. Because of this, the code wouldn&#8217;t compile, and I couldn&#8217;t check if the rest of the code was correct.<\/p><\/div>\n<div id=\"attachment_12699\" style=\"width: 256px\" class=\"wp-caption alignnone\"><img aria-describedby=\"caption-attachment-12699\" loading=\"lazy\" class=\"wp-image-12699 \" src=\"https:\/\/courses.ideate.cmu.edu\/60-223\/s2021\/work\/wp-content\/uploads\/2021\/03\/Tinkercad-No-Stepper-Motor.png\" alt=\"\" width=\"246\" height=\"748\" srcset=\"https:\/\/courses.ideate.cmu.edu\/60-223\/s2021\/work\/wp-content\/uploads\/2021\/03\/Tinkercad-No-Stepper-Motor.png 279w, https:\/\/courses.ideate.cmu.edu\/60-223\/s2021\/work\/wp-content\/uploads\/2021\/03\/Tinkercad-No-Stepper-Motor-99x300.png 99w\" sizes=\"(max-width: 246px) 100vw, 246px\" \/><p id=\"caption-attachment-12699\" class=\"wp-caption-text\">Tinkercad does not have a stepper motor, so I used the larger, grey DC Motor with Encoder as a mere placeholder, not even connected to anything.<\/p><\/div>\n<p>Block Diagram &amp; Schematic:<\/p>\n<p><img loading=\"lazy\" class=\"alignnone wp-image-12694 size-full\" src=\"https:\/\/courses.ideate.cmu.edu\/60-223\/s2021\/work\/wp-content\/uploads\/2021\/03\/Screen-Shot-2021-03-10-at-10.20.14-AM.png\" alt=\"\" width=\"891\" height=\"1057\" srcset=\"https:\/\/courses.ideate.cmu.edu\/60-223\/s2021\/work\/wp-content\/uploads\/2021\/03\/Screen-Shot-2021-03-10-at-10.20.14-AM.png 891w, https:\/\/courses.ideate.cmu.edu\/60-223\/s2021\/work\/wp-content\/uploads\/2021\/03\/Screen-Shot-2021-03-10-at-10.20.14-AM-253x300.png 253w, https:\/\/courses.ideate.cmu.edu\/60-223\/s2021\/work\/wp-content\/uploads\/2021\/03\/Screen-Shot-2021-03-10-at-10.20.14-AM-863x1024.png 863w, https:\/\/courses.ideate.cmu.edu\/60-223\/s2021\/work\/wp-content\/uploads\/2021\/03\/Screen-Shot-2021-03-10-at-10.20.14-AM-768x911.png 768w, https:\/\/courses.ideate.cmu.edu\/60-223\/s2021\/work\/wp-content\/uploads\/2021\/03\/Screen-Shot-2021-03-10-at-10.20.14-AM-508x603.png 508w\" sizes=\"(max-width: 891px) 100vw, 891px\" \/><\/p>\n<p>&nbsp;<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\">\/*\r\n  60-223, Double Transducer: The Convoluted Potentiometer\r\n  Jubbies Steinweh-Adler\r\n  Carlos Ortega\r\n\r\n  Collaboration and sources:\r\n  1) I collaborated with Carlos to figure out the order of the code\r\n  2) Referenced heavily Circuit Digest stepper motor with Potentiometer\r\n  https:\/\/circuitdigest.com\/microcontroller-projects\/stepper-motor-control-with-potentiometer-arduino\r\n  3) The maker cards really helped me understand the parts\r\n  https:\/\/nsfsmartmakerspaces.github.io\/physcomp\/parts\/4005\/#starter-code--connection\r\n  4) I referenced Household Hacker's youtube video about paper and graphite\r\n  circuits to get started with this idea.\r\n  <iframe title=\"Paper Circuit!\" width=\"620\" height=\"349\" src=\"https:\/\/www.youtube.com\/embed\/BwKQ9Idq9FM?start=1&#038;feature=oembed\" frameborder=\"0\" allow=\"accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture\" allowfullscreen><\/iframe>\r\n  5) Tate gave me some advice on how to use the LCD display since I could \r\n  not figure it out.\r\n\r\n  Challenge(s): Remote collaboration was difficult, as was\r\n  working through unknown bugs with the Stepper Motor. The\r\n  stepper motor and driver did not work and simply had to be\r\n  replaced. Additionally, I could not get the LCD working in\r\n  time. \r\n\r\n  Next time: It was extremely helpful to segment the process\r\n  of solving this code, proving that each mechanism works\r\n  independently of the whole rig. I will certainly do this again\r\n  as it really sped things up and made them less stressful.\r\n  In terms of issues, I think I should have given more time\r\n  to the physical assembly of all the parts, since this took\r\n  way longer than I thought. I spent a lot of time trying to\r\n  fashion non-destructive mounts. It was hard to physically arrange\r\n  the parts together in a semi-elegant way. I also want to give\r\n  more time to the small final details, like resolving the\r\n  stepper motor jitter.\r\n\r\n  Another thing I want to take forward from this project was using\r\n  a clearly understood visual indicator of the process like the\r\n  graphite semicircle, since I found this helped people make sense\r\n  of this project quickly.\r\n\r\n  Description:\r\n\r\n  Pin mapping:\r\n\r\n  Arduino pin | type       | description\r\n  ------------|------------|-------------\r\n  A0            Input       Potentiometer input\r\n  12            LCD Pin     Used for the LiquidCrystal Library\r\n  11            LCD Pin     Used for the LiquidCrystal Library\r\n\r\n  2             Input       Stepper Motor driver\r\n  3             Input       Stepper motor driver, direction\r\n\r\n   7            LCD Pin     used for the LCD\r\n   6            LCD Pin     used for the LCD\r\n   5            LCD Pin     used for the LCD\r\n   4            LCD Pin     used for the LCD\r\n\r\n\r\n*\/\r\n\/\/Initialize the LCD\r\n#include &lt;LiquidCrystal.h&gt; \/\/include the LCD library code\r\n\r\n\r\n\/\/ initialize the library by associating any needed LCD interface pin\r\n\/\/ with the arduino pin number it is connected to\r\nconst int rs = 12, en = 11, d4 = 7, d5 = 6, d6 = 5, d7 = 4;\r\nLiquidCrystal lcd(rs, en, d4, d5, d6, d7);\r\n\r\n\r\n\/\/Initialize the Stepper\r\n\r\n#include &lt;AccelStepper.h&gt; \/\/ including the accelstepper library for more control of motor\r\n\r\n\r\nconst int POTPIN = A0; \/\/potentiometer input pin\r\n\r\nconst int STEP_PIN = 2; \/\/ A4988 \"STEP\" pin wired to Arduino pin 2 (you can change this)\r\nconst int DIR_PIN = 3; \/\/ A4988 \"DIRECTION\" pin wired to Arduino pin 3 (you can change this)\r\n\r\nint pos = 100; \/\/ variable to store motor position instruction, 100 is half rotation\r\n\r\n\/\/ Modified from:\r\n\/\/https:\/\/courses.ideate.cmu.edu\/60-223\/s2021\/tutorials\/stepper\r\n\r\nAccelStepper stepper(1, STEP_PIN, DIR_PIN);\r\n\r\n\/\/ Will compare this to currStepMotPos later, inside loop.\r\nint prevStepMotPos = 0;\r\n\r\nunsigned long timerVar = 0;\r\nconst int WAIT = 200; \/\/does not change\r\n\r\nint LCDupdate = 0;\r\n\r\nvoid setup() {\r\n  int BAUD = 9600; \/\/serial comm value\r\n  int maxSpeedVar = 100; \/\/measured in steps per second\r\n  int accel = 500; \/\/measured in steps per second\r\n  Serial.begin(BAUD); \/\/begin serial communication\r\n\r\n  \/\/---LCD Setup---\r\n  lcd.begin(16, 2);\r\n\r\n  \/\/ Modified from:\r\n  \/\/ https:\/\/nsfsmartmakerspaces.github.io\/physcomp\/parts\/4005\/#starter-code--connection\r\n\r\n  \/\/---Stepper Motor setup---\r\n\r\n  stepper.setMaxSpeed(maxSpeedVar);    \/\/ measured in steps per second\r\n  stepper.setAcceleration(accel); \/\/ measured in steps per second squared\r\n\r\n  \/\/ while there is still a distance to go,\r\n  stepper.run(); \/\/ make the motor run\r\n  \r\n\r\n}\r\n\r\n\r\nvoid loop() {\r\n  unsigned long currentTime = millis();\r\n  unsigned long previousTime = 0;\r\n\r\n  \r\n  }\r\n\r\n  int inLo = 0; \/\/lowest value of potentiometer range\r\n  int inHi = 1023; \/\/max value of potentiometer range\r\n  int outLo = 0; \/\/lowest value of stepper motor range\r\n  int outHi = 100; \/\/200 per rev, so half revolution\r\n\r\n\r\n\r\n  int potPos = analogRead(POTPIN); \/\/potPos assigned position of potentiometer\r\n\r\n  \/\/map pot pos range to stepper motor range\r\n  int long currStepMotPos = map(potPos, inHi, inLo, outLo, outHi);\r\n\r\n\r\n  \/\/Change destination of stepper to potentiometer input\r\n  stepper.moveTo(currStepMotPos); \/\/tell motor to go to new position\r\n\r\n  prevStepMotPos = currStepMotPos; \/\/save current value into previous value\r\n  stepper.run();\r\n\r\n  \/\/Serial.println(prevStepMotPos); \/\/for debugging\r\n\r\n  LCDPotVal = \r\n  LCDStepperVal = \r\n\r\n\/\/LCD Update \r\n  \/*if (currentTime - timerVar &gt;= WAIT) {\r\n    lcd.clear();\r\n    lcd.home();\r\n    lcd.print(\"i:\");\r\n    lcd.print(LCDPotVal0;\r\n    lcd.setCursor(6, 0);\r\n    lcd.print(\"m:\");\r\n   *\/\r\n    previousTime = currentTime;\r\n  \r\n\r\n\r\n}<\/pre>\n<p>&nbsp;<\/p>\n<p>Discussion:<\/p>\n<p>This project was an exciting introduction to many new concepts\u00a0 such as assembling separate components into one\u00a0 operation, using\u00a0 graphite as a resistor,\u00a0 \u00a0learning how to debug in context,\u00a0 soldering,\u00a0 and collaborating remotely.\u00a0 Since we were both excited about this idea, it was easier to push through these bugs.\u00a0 \u00a0Learning hands-on was a great experience , since somebody can tell you what it&#8217;s like to explode an LED, but before you actually do it,\u00a0 I would argue that it is far less likely to sticks with you.<\/p>\n<p>The biggest barriers we faced had to do with\u00a0 significant bugs and remote collaboration.\u00a0 The stepper motor\/ stepper motor driver bug , although\u00a0 circumnavigated, was never resolved. Only with the help of our professors are we able to\u00a0 move on from that point through replacing our parts.<\/p>\n<p>Additionally, since Carlos is studying remotely and never received his Arduino kit\u00a0 from customs,\u00a0 there was simply not an option to collaborate on the hardware issues.\u00a0 Since the software and hardware are delicately intertwined, this also made it extremely difficult to collaboratively resolve software issues as well.\u00a0 While on paper, tinkercad seems to be a good option\u00a0 to ease this situation,\u00a0 the lack of a stepper motor, stepper motor driver, and\u00a0 graphite resistor on the platform, as well as the inability to import libraries, made this tool unhelpful.<\/p>\n<p>That being said, we were able to have rewarding discussions about\u00a0 conceptual development and enjoyed the process of translating our idea to a real tangible thing.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>The most successful Tinkercad circuit we built, for testing and learning the LCD screen and the LiquidCrystal library. See below for our full Tinkercad circuit and why it&#8230;<\/p>\n","protected":false},"author":184,"featured_media":12650,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":[],"categories":[100,159,86,1],"tags":[],"_links":{"self":[{"href":"https:\/\/courses.ideate.cmu.edu\/60-223\/s2021\/work\/wp-json\/wp\/v2\/posts\/12644"}],"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\/184"}],"replies":[{"embeddable":true,"href":"https:\/\/courses.ideate.cmu.edu\/60-223\/s2021\/work\/wp-json\/wp\/v2\/comments?post=12644"}],"version-history":[{"count":11,"href":"https:\/\/courses.ideate.cmu.edu\/60-223\/s2021\/work\/wp-json\/wp\/v2\/posts\/12644\/revisions"}],"predecessor-version":[{"id":12697,"href":"https:\/\/courses.ideate.cmu.edu\/60-223\/s2021\/work\/wp-json\/wp\/v2\/posts\/12644\/revisions\/12697"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/courses.ideate.cmu.edu\/60-223\/s2021\/work\/wp-json\/wp\/v2\/media\/12650"}],"wp:attachment":[{"href":"https:\/\/courses.ideate.cmu.edu\/60-223\/s2021\/work\/wp-json\/wp\/v2\/media?parent=12644"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/courses.ideate.cmu.edu\/60-223\/s2021\/work\/wp-json\/wp\/v2\/categories?post=12644"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/courses.ideate.cmu.edu\/60-223\/s2021\/work\/wp-json\/wp\/v2\/tags?post=12644"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}