{"id":16087,"date":"2022-09-28T21:47:50","date_gmt":"2022-09-29T01:47:50","guid":{"rendered":"https:\/\/courses.ideate.cmu.edu\/60-223\/f2022\/work\/?p=16087"},"modified":"2022-09-28T21:47:50","modified_gmt":"2022-09-29T01:47:50","slug":"double-transducer-height-to-pitch","status":"publish","type":"post","link":"https:\/\/courses.ideate.cmu.edu\/60-223\/f2022\/work\/double-transducer-height-to-pitch\/","title":{"rendered":"Double Transducer: Height to Pitch"},"content":{"rendered":"<h3><\/h3>\n<div id=\"attachment_16121\" style=\"width: 743px\" class=\"wp-caption alignnone\"><img aria-describedby=\"caption-attachment-16121\" loading=\"lazy\" class=\"wp-image-16121\" src=\"https:\/\/courses.ideate.cmu.edu\/60-223\/f2022\/work\/wp-content\/uploads\/2022\/09\/1-300x225.jpeg\" alt=\"\" width=\"733\" height=\"550\" srcset=\"https:\/\/courses.ideate.cmu.edu\/60-223\/f2022\/work\/wp-content\/uploads\/2022\/09\/1-300x225.jpeg 300w, https:\/\/courses.ideate.cmu.edu\/60-223\/f2022\/work\/wp-content\/uploads\/2022\/09\/1-1024x768.jpeg 1024w, https:\/\/courses.ideate.cmu.edu\/60-223\/f2022\/work\/wp-content\/uploads\/2022\/09\/1-768x576.jpeg 768w, https:\/\/courses.ideate.cmu.edu\/60-223\/f2022\/work\/wp-content\/uploads\/2022\/09\/1-1536x1152.jpeg 1536w, https:\/\/courses.ideate.cmu.edu\/60-223\/f2022\/work\/wp-content\/uploads\/2022\/09\/1-2048x1536.jpeg 2048w, https:\/\/courses.ideate.cmu.edu\/60-223\/f2022\/work\/wp-content\/uploads\/2022\/09\/1-973x730.jpeg 973w, https:\/\/courses.ideate.cmu.edu\/60-223\/f2022\/work\/wp-content\/uploads\/2022\/09\/1-508x381.jpeg 508w\" sizes=\"(max-width: 733px) 100vw, 733px\" \/><p id=\"caption-attachment-16121\" class=\"wp-caption-text\">Ethan&#8217;s final double transducer<\/p><\/div>\n<div id=\"attachment_16142\" style=\"width: 481px\" class=\"wp-caption alignnone\"><img aria-describedby=\"caption-attachment-16142\" loading=\"lazy\" class=\" wp-image-16142\" src=\"https:\/\/courses.ideate.cmu.edu\/60-223\/f2022\/work\/wp-content\/uploads\/2022\/09\/IMG_1430-225x300.jpg\" alt=\"\" width=\"471\" height=\"628\" srcset=\"https:\/\/courses.ideate.cmu.edu\/60-223\/f2022\/work\/wp-content\/uploads\/2022\/09\/IMG_1430-225x300.jpg 225w, https:\/\/courses.ideate.cmu.edu\/60-223\/f2022\/work\/wp-content\/uploads\/2022\/09\/IMG_1430-768x1024.jpg 768w, https:\/\/courses.ideate.cmu.edu\/60-223\/f2022\/work\/wp-content\/uploads\/2022\/09\/IMG_1430-1152x1536.jpg 1152w, https:\/\/courses.ideate.cmu.edu\/60-223\/f2022\/work\/wp-content\/uploads\/2022\/09\/IMG_1430-1536x2048.jpg 1536w, https:\/\/courses.ideate.cmu.edu\/60-223\/f2022\/work\/wp-content\/uploads\/2022\/09\/IMG_1430-973x1297.jpg 973w, https:\/\/courses.ideate.cmu.edu\/60-223\/f2022\/work\/wp-content\/uploads\/2022\/09\/IMG_1430-508x677.jpg 508w, https:\/\/courses.ideate.cmu.edu\/60-223\/f2022\/work\/wp-content\/uploads\/2022\/09\/IMG_1430-scaled.jpg 1920w\" sizes=\"(max-width: 471px) 100vw, 471px\" \/><p id=\"caption-attachment-16142\" class=\"wp-caption-text\">Harry&#8217;s final double transducer<\/p><\/div>\n<h3><span style=\"text-decoration: underline\">Process Images:<\/span><\/h3>\n<div id=\"attachment_16125\" style=\"width: 674px\" class=\"wp-caption alignnone\"><img aria-describedby=\"caption-attachment-16125\" loading=\"lazy\" class=\" wp-image-16125\" src=\"https:\/\/courses.ideate.cmu.edu\/60-223\/f2022\/work\/wp-content\/uploads\/2022\/09\/IMG_1204-300x225.jpg\" alt=\"\" width=\"664\" height=\"498\" srcset=\"https:\/\/courses.ideate.cmu.edu\/60-223\/f2022\/work\/wp-content\/uploads\/2022\/09\/IMG_1204-300x225.jpg 300w, https:\/\/courses.ideate.cmu.edu\/60-223\/f2022\/work\/wp-content\/uploads\/2022\/09\/IMG_1204-1024x768.jpg 1024w, https:\/\/courses.ideate.cmu.edu\/60-223\/f2022\/work\/wp-content\/uploads\/2022\/09\/IMG_1204-768x576.jpg 768w, https:\/\/courses.ideate.cmu.edu\/60-223\/f2022\/work\/wp-content\/uploads\/2022\/09\/IMG_1204-1536x1152.jpg 1536w, https:\/\/courses.ideate.cmu.edu\/60-223\/f2022\/work\/wp-content\/uploads\/2022\/09\/IMG_1204-2048x1536.jpg 2048w, https:\/\/courses.ideate.cmu.edu\/60-223\/f2022\/work\/wp-content\/uploads\/2022\/09\/IMG_1204-973x730.jpg 973w, https:\/\/courses.ideate.cmu.edu\/60-223\/f2022\/work\/wp-content\/uploads\/2022\/09\/IMG_1204-508x381.jpg 508w\" sizes=\"(max-width: 664px) 100vw, 664px\" \/><p id=\"caption-attachment-16125\" class=\"wp-caption-text\">Our initial layout (Harry)<\/p><\/div>\n<div id=\"attachment_16134\" style=\"width: 681px\" class=\"wp-caption alignnone\"><img aria-describedby=\"caption-attachment-16134\" loading=\"lazy\" class=\"wp-image-16134\" src=\"https:\/\/courses.ideate.cmu.edu\/60-223\/f2022\/work\/wp-content\/uploads\/2022\/09\/IMG_0985-300x225.jpeg\" alt=\"\" width=\"671\" height=\"503\" srcset=\"https:\/\/courses.ideate.cmu.edu\/60-223\/f2022\/work\/wp-content\/uploads\/2022\/09\/IMG_0985-300x225.jpeg 300w, https:\/\/courses.ideate.cmu.edu\/60-223\/f2022\/work\/wp-content\/uploads\/2022\/09\/IMG_0985-1024x768.jpeg 1024w, https:\/\/courses.ideate.cmu.edu\/60-223\/f2022\/work\/wp-content\/uploads\/2022\/09\/IMG_0985-768x576.jpeg 768w, https:\/\/courses.ideate.cmu.edu\/60-223\/f2022\/work\/wp-content\/uploads\/2022\/09\/IMG_0985-1536x1152.jpeg 1536w, https:\/\/courses.ideate.cmu.edu\/60-223\/f2022\/work\/wp-content\/uploads\/2022\/09\/IMG_0985-2048x1536.jpeg 2048w, https:\/\/courses.ideate.cmu.edu\/60-223\/f2022\/work\/wp-content\/uploads\/2022\/09\/IMG_0985-973x730.jpeg 973w, https:\/\/courses.ideate.cmu.edu\/60-223\/f2022\/work\/wp-content\/uploads\/2022\/09\/IMG_0985-508x381.jpeg 508w\" sizes=\"(max-width: 671px) 100vw, 671px\" \/><p id=\"caption-attachment-16134\" class=\"wp-caption-text\">The LCD screen working (Ethan)<\/p><\/div>\n<div id=\"attachment_16167\" style=\"width: 654px\" class=\"wp-caption alignnone\"><img aria-describedby=\"caption-attachment-16167\" loading=\"lazy\" class=\"wp-image-16167 \" src=\"https:\/\/courses.ideate.cmu.edu\/60-223\/f2022\/work\/wp-content\/uploads\/2022\/09\/IMG_0983-264x300.jpeg\" alt=\"\" width=\"644\" height=\"731\" srcset=\"https:\/\/courses.ideate.cmu.edu\/60-223\/f2022\/work\/wp-content\/uploads\/2022\/09\/IMG_0983-264x300.jpeg 264w, https:\/\/courses.ideate.cmu.edu\/60-223\/f2022\/work\/wp-content\/uploads\/2022\/09\/IMG_0983-902x1024.jpeg 902w, https:\/\/courses.ideate.cmu.edu\/60-223\/f2022\/work\/wp-content\/uploads\/2022\/09\/IMG_0983-768x872.jpeg 768w, https:\/\/courses.ideate.cmu.edu\/60-223\/f2022\/work\/wp-content\/uploads\/2022\/09\/IMG_0983-1353x1536.jpeg 1353w, https:\/\/courses.ideate.cmu.edu\/60-223\/f2022\/work\/wp-content\/uploads\/2022\/09\/IMG_0983-1804x2048.jpeg 1804w, https:\/\/courses.ideate.cmu.edu\/60-223\/f2022\/work\/wp-content\/uploads\/2022\/09\/IMG_0983-973x1104.jpeg 973w, https:\/\/courses.ideate.cmu.edu\/60-223\/f2022\/work\/wp-content\/uploads\/2022\/09\/IMG_0983-508x577.jpeg 508w\" sizes=\"(max-width: 644px) 100vw, 644px\" \/><p id=\"caption-attachment-16167\" class=\"wp-caption-text\">VL53L0X Laser Sensor working (Ethan)<\/p><\/div>\n<div id=\"attachment_16129\" style=\"width: 681px\" class=\"wp-caption alignnone\"><img aria-describedby=\"caption-attachment-16129\" loading=\"lazy\" class=\"wp-image-16129\" src=\"https:\/\/courses.ideate.cmu.edu\/60-223\/f2022\/work\/wp-content\/uploads\/2022\/09\/IMG_1305-300x225.jpg\" alt=\"\" width=\"671\" height=\"503\" srcset=\"https:\/\/courses.ideate.cmu.edu\/60-223\/f2022\/work\/wp-content\/uploads\/2022\/09\/IMG_1305-300x225.jpg 300w, https:\/\/courses.ideate.cmu.edu\/60-223\/f2022\/work\/wp-content\/uploads\/2022\/09\/IMG_1305-1024x768.jpg 1024w, https:\/\/courses.ideate.cmu.edu\/60-223\/f2022\/work\/wp-content\/uploads\/2022\/09\/IMG_1305-768x576.jpg 768w, https:\/\/courses.ideate.cmu.edu\/60-223\/f2022\/work\/wp-content\/uploads\/2022\/09\/IMG_1305-1536x1152.jpg 1536w, https:\/\/courses.ideate.cmu.edu\/60-223\/f2022\/work\/wp-content\/uploads\/2022\/09\/IMG_1305-2048x1536.jpg 2048w, https:\/\/courses.ideate.cmu.edu\/60-223\/f2022\/work\/wp-content\/uploads\/2022\/09\/IMG_1305-973x730.jpg 973w, https:\/\/courses.ideate.cmu.edu\/60-223\/f2022\/work\/wp-content\/uploads\/2022\/09\/IMG_1305-508x381.jpg 508w\" sizes=\"(max-width: 671px) 100vw, 671px\" \/><p id=\"caption-attachment-16129\" class=\"wp-caption-text\">Starting to connect each step together (Harry)<\/p><\/div>\n<div id=\"attachment_16165\" style=\"width: 536px\" class=\"wp-caption alignnone\"><img aria-describedby=\"caption-attachment-16165\" loading=\"lazy\" class=\" wp-image-16165\" src=\"https:\/\/courses.ideate.cmu.edu\/60-223\/f2022\/work\/wp-content\/uploads\/2022\/09\/IMG_1308-225x300.jpg\" alt=\"\" width=\"526\" height=\"702\" srcset=\"https:\/\/courses.ideate.cmu.edu\/60-223\/f2022\/work\/wp-content\/uploads\/2022\/09\/IMG_1308-225x300.jpg 225w, https:\/\/courses.ideate.cmu.edu\/60-223\/f2022\/work\/wp-content\/uploads\/2022\/09\/IMG_1308-768x1024.jpg 768w, https:\/\/courses.ideate.cmu.edu\/60-223\/f2022\/work\/wp-content\/uploads\/2022\/09\/IMG_1308-1152x1536.jpg 1152w, https:\/\/courses.ideate.cmu.edu\/60-223\/f2022\/work\/wp-content\/uploads\/2022\/09\/IMG_1308-1536x2048.jpg 1536w, https:\/\/courses.ideate.cmu.edu\/60-223\/f2022\/work\/wp-content\/uploads\/2022\/09\/IMG_1308-973x1297.jpg 973w, https:\/\/courses.ideate.cmu.edu\/60-223\/f2022\/work\/wp-content\/uploads\/2022\/09\/IMG_1308-508x677.jpg 508w, https:\/\/courses.ideate.cmu.edu\/60-223\/f2022\/work\/wp-content\/uploads\/2022\/09\/IMG_1308-scaled.jpg 1920w\" sizes=\"(max-width: 526px) 100vw, 526px\" \/><p id=\"caption-attachment-16165\" class=\"wp-caption-text\">Preparing to shave the hot glue stick (Harry)<\/p><\/div>\n<div id=\"attachment_16138\" style=\"width: 678px\" class=\"wp-caption alignnone\"><img aria-describedby=\"caption-attachment-16138\" loading=\"lazy\" class=\" wp-image-16138\" src=\"https:\/\/courses.ideate.cmu.edu\/60-223\/f2022\/work\/wp-content\/uploads\/2022\/09\/IMG_1014-300x225.jpeg\" alt=\"\" width=\"668\" height=\"501\" srcset=\"https:\/\/courses.ideate.cmu.edu\/60-223\/f2022\/work\/wp-content\/uploads\/2022\/09\/IMG_1014-300x225.jpeg 300w, https:\/\/courses.ideate.cmu.edu\/60-223\/f2022\/work\/wp-content\/uploads\/2022\/09\/IMG_1014-1024x768.jpeg 1024w, https:\/\/courses.ideate.cmu.edu\/60-223\/f2022\/work\/wp-content\/uploads\/2022\/09\/IMG_1014-768x576.jpeg 768w, https:\/\/courses.ideate.cmu.edu\/60-223\/f2022\/work\/wp-content\/uploads\/2022\/09\/IMG_1014-1536x1152.jpeg 1536w, https:\/\/courses.ideate.cmu.edu\/60-223\/f2022\/work\/wp-content\/uploads\/2022\/09\/IMG_1014-2048x1536.jpeg 2048w, https:\/\/courses.ideate.cmu.edu\/60-223\/f2022\/work\/wp-content\/uploads\/2022\/09\/IMG_1014-973x730.jpeg 973w, https:\/\/courses.ideate.cmu.edu\/60-223\/f2022\/work\/wp-content\/uploads\/2022\/09\/IMG_1014-508x381.jpeg 508w\" sizes=\"(max-width: 668px) 100vw, 668px\" \/><p id=\"caption-attachment-16138\" class=\"wp-caption-text\">Every step wired up together (Ethan)<\/p><\/div>\n<h3><span style=\"text-decoration: underline\">Detail Photos:<\/span><\/h3>\n<div id=\"attachment_16109\" style=\"width: 436px\" class=\"wp-caption alignnone\"><img aria-describedby=\"caption-attachment-16109\" loading=\"lazy\" class=\" wp-image-16109\" src=\"https:\/\/courses.ideate.cmu.edu\/60-223\/f2022\/work\/wp-content\/uploads\/2022\/09\/IMG_1432-225x300.jpg\" alt=\"\" width=\"426\" height=\"568\" srcset=\"https:\/\/courses.ideate.cmu.edu\/60-223\/f2022\/work\/wp-content\/uploads\/2022\/09\/IMG_1432-225x300.jpg 225w, https:\/\/courses.ideate.cmu.edu\/60-223\/f2022\/work\/wp-content\/uploads\/2022\/09\/IMG_1432-768x1024.jpg 768w, https:\/\/courses.ideate.cmu.edu\/60-223\/f2022\/work\/wp-content\/uploads\/2022\/09\/IMG_1432-1152x1536.jpg 1152w, https:\/\/courses.ideate.cmu.edu\/60-223\/f2022\/work\/wp-content\/uploads\/2022\/09\/IMG_1432-1536x2048.jpg 1536w, https:\/\/courses.ideate.cmu.edu\/60-223\/f2022\/work\/wp-content\/uploads\/2022\/09\/IMG_1432-973x1297.jpg 973w, https:\/\/courses.ideate.cmu.edu\/60-223\/f2022\/work\/wp-content\/uploads\/2022\/09\/IMG_1432-508x677.jpg 508w, https:\/\/courses.ideate.cmu.edu\/60-223\/f2022\/work\/wp-content\/uploads\/2022\/09\/IMG_1432-scaled.jpg 1920w\" sizes=\"(max-width: 426px) 100vw, 426px\" \/><p id=\"caption-attachment-16109\" class=\"wp-caption-text\">Beautiful soldering job by Harry<\/p><\/div>\n<div id=\"attachment_16113\" style=\"width: 436px\" class=\"wp-caption alignnone\"><img aria-describedby=\"caption-attachment-16113\" loading=\"lazy\" class=\"wp-image-16113\" src=\"https:\/\/courses.ideate.cmu.edu\/60-223\/f2022\/work\/wp-content\/uploads\/2022\/09\/IMG_1431-225x300.jpg\" alt=\"\" width=\"426\" height=\"568\" srcset=\"https:\/\/courses.ideate.cmu.edu\/60-223\/f2022\/work\/wp-content\/uploads\/2022\/09\/IMG_1431-225x300.jpg 225w, https:\/\/courses.ideate.cmu.edu\/60-223\/f2022\/work\/wp-content\/uploads\/2022\/09\/IMG_1431-768x1024.jpg 768w, https:\/\/courses.ideate.cmu.edu\/60-223\/f2022\/work\/wp-content\/uploads\/2022\/09\/IMG_1431-1152x1536.jpg 1152w, https:\/\/courses.ideate.cmu.edu\/60-223\/f2022\/work\/wp-content\/uploads\/2022\/09\/IMG_1431-1536x2048.jpg 1536w, https:\/\/courses.ideate.cmu.edu\/60-223\/f2022\/work\/wp-content\/uploads\/2022\/09\/IMG_1431-973x1297.jpg 973w, https:\/\/courses.ideate.cmu.edu\/60-223\/f2022\/work\/wp-content\/uploads\/2022\/09\/IMG_1431-508x677.jpg 508w, https:\/\/courses.ideate.cmu.edu\/60-223\/f2022\/work\/wp-content\/uploads\/2022\/09\/IMG_1431-scaled.jpg 1920w\" sizes=\"(max-width: 426px) 100vw, 426px\" \/><p id=\"caption-attachment-16113\" class=\"wp-caption-text\">The linear actuator is attached to slide potentiometer with a stick of hot glue<\/p><\/div>\n<h3><span style=\"text-decoration: underline\">Double Transducer in Action:<\/span><\/h3>\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-16087-1\" width=\"620\" height=\"1102\" preload=\"metadata\" controls=\"controls\"><source type=\"video\/mp4\" src=\"https:\/\/courses.ideate.cmu.edu\/60-223\/f2022\/work\/wp-content\/uploads\/2022\/09\/Untitled.mp4?_=1\" \/><a href=\"https:\/\/courses.ideate.cmu.edu\/60-223\/f2022\/work\/wp-content\/uploads\/2022\/09\/Untitled.mp4\">https:\/\/courses.ideate.cmu.edu\/60-223\/f2022\/work\/wp-content\/uploads\/2022\/09\/Untitled.mp4<\/a><\/video><\/div>\n<p>&nbsp;<\/p>\n<div style=\"width: 620px;\" class=\"wp-video\"><video class=\"wp-video-shortcode\" id=\"video-16087-2\" width=\"620\" height=\"1102\" preload=\"metadata\" controls=\"controls\"><source type=\"video\/mp4\" src=\"https:\/\/courses.ideate.cmu.edu\/60-223\/f2022\/work\/wp-content\/uploads\/2022\/09\/Untitled-1.mp4?_=2\" \/><a href=\"https:\/\/courses.ideate.cmu.edu\/60-223\/f2022\/work\/wp-content\/uploads\/2022\/09\/Untitled-1.mp4\">https:\/\/courses.ideate.cmu.edu\/60-223\/f2022\/work\/wp-content\/uploads\/2022\/09\/Untitled-1.mp4<\/a><\/video><\/div>\n<h3><span style=\"text-decoration: underline\"><strong>Narrative Description:<\/strong><\/span><\/h3>\n<p><span style=\"font-weight: 400\">\u00a0 \u00a0 When an object moves within one to four inches of the laser distance sensor, the linear actuator will either push or pull along the slide potentiometer. Based on the location of the slide potentiometer knob, a respective pitch is played.<\/span><\/p>\n<h3><span style=\"text-decoration: underline\"><strong>Discussion:<\/strong><\/span><\/h3>\n<p><span style=\"font-weight: 400\">\u00a0 \u00a0 We initially struggled with connecting the linear actuator with the other components of the project board. We were successfully able to devise a method to create a temporary connection between the knob of the slide potentiometer and the linear actuator using a slightly melted stick of hot glue. Once we had this connection it was very easy to incorporate the linear actuator with the project board \u2014 we simply just masking tape. However, this was only the beginning of our troubles with the linear actuator. Due to the nature of our double transducer, we wanted to be able to control the position of the linear actuator. Unfortunately, there were only two default motions \u2014 extend and retract. Luckily, we were cleverly able to implement a type of feedback control. Otherwise, we were going to need to scrape our entire middle step.<\/span><\/p>\n<p>&nbsp;<\/p>\n<p><span style=\"font-weight: 400\">\u00a0 \u00a0 There were technically components of this project that came easily to the both of us due to previous experience. For example, soldering the connections for the middle step and breadboard management were both emphasized in our previous coursework. Looking towards the future, a few areas of improvement are wire management and reducing the number of loops. If we were able to implement our double transducer more minimally, it would increase the quality of the project board.<\/span><\/p>\n<p>&nbsp;<\/p>\n<p><span style=\"font-weight: 400\">\u00a0 \u00a0 Throughout the project timeline, we need to make important decisions regarding how the double transducer was going to be designed. One noticeable example is how we decided to replace the ultrasonic ranger with a VL53L0X laser distance sensor. This decision was overall made because we desired a more accurate measurement for our middle step. On the software-side, we needed to make decisions regarding how each signal would behave with each other. For example, we had the resistance value of the slide potentiometer relate directly to the pitch of the speaker. This decision was born out of the desire of a more direct relationship between the potentiometer and the pitch.<\/span><\/p>\n<p>&nbsp;<\/p>\n<h3><span style=\"text-decoration: underline\">Block Diagram:<\/span><\/h3>\n<p>&nbsp;<\/p>\n<p><a href=\"https:\/\/courses.ideate.cmu.edu\/60-223\/f2022\/work\/wp-content\/uploads\/2022\/09\/A-Double-Transducer.drawio.svg\"><img loading=\"lazy\" class=\"alignnone wp-image-16231\" src=\"https:\/\/courses.ideate.cmu.edu\/60-223\/f2022\/work\/wp-content\/uploads\/2022\/09\/A-Double-Transducer.drawio.svg\" alt=\"\" width=\"784\" height=\"387\" \/><\/a><\/p>\n<h3><span style=\"text-decoration: underline\">Electric Schematic:<\/span><\/h3>\n<p>&nbsp;<\/p>\n<p><img loading=\"lazy\" class=\"alignnone wp-image-16232\" src=\"https:\/\/courses.ideate.cmu.edu\/60-223\/f2022\/work\/wp-content\/uploads\/2022\/09\/Untitled-Diagram.drawio.svg\" alt=\"\" width=\"367\" height=\"530\" \/><\/p>\n<p>&nbsp;<\/p>\n<h3><span style=\"text-decoration: underline\">Code:<\/span><\/h3>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\">\/*\r\n* @Project Title: Double Trasducer: Height to Pitch\r\n* \r\n* @Authors: Harry Schneider &amp; Ethan Lu\r\n* \r\n* @Description: \r\n* - Using a VL53L0X Laser Sensor to measure the height\r\n* of an index card (1''- 4'').\r\n* \r\n* - The measured height determines how far the linear\r\n* actuator moves, which drags the knob of the slide\r\n* potentiometer.\r\n* \r\n* - The Ardunio maps the potentiometer signal to [200, 2000]\r\n* and sends a frequency to be played by the speaker.\r\n* \r\n* @Mapping: \r\n* Arduino pin | role | description\r\n* ------------|--------|-------------\r\n* A0 INPUT Potentiometer Signal\r\n* A4 INPUT VL53L0X SDA\r\n* A5 INPUT VL53L0X SCL\r\n* SCD INPUT LCD SDA\r\n* SCL INPUT LCD SCL\r\n* 7 OUTPUT Linear Actuator INPUT\r\n* 8 OUTPUT Linear Actuator INPUT\r\n* 9 OUTPUT Speaker Signal\r\n*\/\r\n\r\n\r\n\/* import header files *\/\r\n#include &lt;Wire.h&gt;\r\n#include &lt;LiquidCrystal_I2C.h&gt;\r\n#include &lt;VL53L0X.h&gt;\r\n\r\n\/* object declaration *\/\r\nVL53L0X sensor;\r\nLiquidCrystal_I2C screen(0x27, 16, 2);\r\n\r\n\/* pin-related variables *\/\r\nconst int res_pin = A0;\r\nconst int laser_SDA = A4;\r\nconst int laser_SCL = A5;\r\nconst int act_out1 = 7;\r\nconst int act_out2 = 8;\r\nconst int pitch_out = 9;\r\n\r\nunsigned long prev_distance = 0;\r\n\r\n\/* VL530X-related varaibles*\/\r\nunsigned long lcd_timer;\r\nunsigned long count = 0;\r\n\r\n\/* unfiltered sensor variables *\/\r\nunsigned distance_val;\r\nunsigned pot_val;\r\nunsigned pitch_val;\r\n\r\n\/* filtered sensor variables *\/\r\nunsigned adjusted_distance_val;\r\nunsigned adjusted_pot_val;\r\n\r\nvoid setup() {\r\n  Wire.begin();\r\n\r\n  \/* pin setup *\/\r\n  pinMode(res_pin, INPUT);\r\n  pinMode(laser_SDA, INPUT);\r\n  pinMode(laser_SCL, INPUT);\r\n\r\n  pinMode(act_out1, OUTPUT);\r\n  pinMode(act_out2, OUTPUT);\r\n  pinMode(pitch_out, OUTPUT);\r\n  \r\n  \/* VL53L0X Sensor *\/\r\n  sensor.init();\r\n  sensor.setTimeout(500);\r\n  sensor.startContinuous();\r\n  \r\n  \/* I2C display *\/\r\n  screen.init();\r\n  screen.backlight();\r\n  screen.home();\r\n}\r\n\r\n\/* sends out the linear actuator *\/\r\nvoid extend() {\r\n  digitalWrite(act_out1, LOW);\r\n  digitalWrite(act_out2, HIGH);\r\n}\r\n\r\n\/* returns the linear actuator *\/\r\nvoid retract() {\r\n  digitalWrite(act_out1, HIGH);\r\n  digitalWrite(act_out2, LOW);\r\n}\r\n\r\nvoid loop() {\r\n  distance_val = sensor.readRangeContinuousMillimeters();\r\n\r\n  if (distance_val &lt; 154) {\r\n    pot_val = analogRead(res_pin);\r\n    pitch_val = map(pot_val, 0, 918, 200, 2000);\r\n  \r\n    \/* send signal to speaker *\/\r\n    tone(pitch_out, pitch_val);\r\n    \r\n    if (prev_distance &lt; distance_val) {\r\n      extend();  \r\n    }\r\n    else if (distance_val &lt; prev_distance) {\r\n      retract();\r\n    }\r\n  \r\n    \/* status display *\/\r\n    if (250 &lt;= millis() - lcd_timer) {\r\n      \/* safety clear *\/\r\n      if (count % 2 == 0){\r\n        screen.clear();\r\n      }\r\n \r\n      adjusted_distance_val = map(distance_val, 52, 154, 0, 99);\r\n      adjusted_pot_val = map(pot_val, 0, 1050, 0, 99);\r\n\r\n      \/* update LCD screen*\/\r\n      screen.setCursor(0, 0);\r\n      screen.print(\"i:\" + String(adjusted_distance_val));\r\n  \r\n      screen.setCursor(6, 0);\r\n      screen.print(\"m:\" + String(adjusted_distance_val));\r\n  \r\n      screen.setCursor(8, 1);\r\n      screen.print(String(adjusted_pot_val));\r\n  \r\n      screen.setCursor(12, 1);\r\n      screen.print(\"o:\" + String(pitch_val));\r\n  \r\n  \r\n      screen.home();\r\n      lcd_timer = millis();\r\n      count++;\r\n    }\r\n    \r\n    prev_distance = distance_val;\r\n  }\r\n  else {\r\n    \/* safety clear *\/\r\n    if (count % 2 == 0){\r\n        screen.clear();\r\n    }\r\n\r\n    \/* return to base LCD screen *\/\r\n    screen.setCursor(0, 0);\r\n    screen.print(\"i:\" + String(99));\r\n\r\n    screen.setCursor(6, 0);\r\n    screen.print(\"m:\" + String(99));\r\n\r\n    screen.setCursor(8, 1);\r\n    screen.print(String(99));\r\n\r\n    screen.setCursor(12, 1);\r\n    screen.print(\"o:\" + String(99));\r\n    noTone(9);\r\n    \r\n    count++;\r\n  }\r\n}<\/pre>\n<p>&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Process Images: Detail Photos: Double Transducer in Action: &nbsp; Narrative Description: \u00a0 \u00a0 When an object moves within one to four inches of the laser distance sensor, the&#8230;<\/p>\n","protected":false},"author":229,"featured_media":16121,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":[],"categories":[86],"tags":[],"_links":{"self":[{"href":"https:\/\/courses.ideate.cmu.edu\/60-223\/f2022\/work\/wp-json\/wp\/v2\/posts\/16087"}],"collection":[{"href":"https:\/\/courses.ideate.cmu.edu\/60-223\/f2022\/work\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/courses.ideate.cmu.edu\/60-223\/f2022\/work\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/courses.ideate.cmu.edu\/60-223\/f2022\/work\/wp-json\/wp\/v2\/users\/229"}],"replies":[{"embeddable":true,"href":"https:\/\/courses.ideate.cmu.edu\/60-223\/f2022\/work\/wp-json\/wp\/v2\/comments?post=16087"}],"version-history":[{"count":25,"href":"https:\/\/courses.ideate.cmu.edu\/60-223\/f2022\/work\/wp-json\/wp\/v2\/posts\/16087\/revisions"}],"predecessor-version":[{"id":16245,"href":"https:\/\/courses.ideate.cmu.edu\/60-223\/f2022\/work\/wp-json\/wp\/v2\/posts\/16087\/revisions\/16245"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/courses.ideate.cmu.edu\/60-223\/f2022\/work\/wp-json\/wp\/v2\/media\/16121"}],"wp:attachment":[{"href":"https:\/\/courses.ideate.cmu.edu\/60-223\/f2022\/work\/wp-json\/wp\/v2\/media?parent=16087"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/courses.ideate.cmu.edu\/60-223\/f2022\/work\/wp-json\/wp\/v2\/categories?post=16087"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/courses.ideate.cmu.edu\/60-223\/f2022\/work\/wp-json\/wp\/v2\/tags?post=16087"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}