{"id":4822,"date":"2021-03-29T18:33:06","date_gmt":"2021-03-29T22:33:06","guid":{"rendered":"https:\/\/courses.ideate.cmu.edu\/16-376\/s2021\/?p=4822"},"modified":"2021-03-29T18:33:08","modified_gmt":"2021-03-29T22:33:08","slug":"assignment-15-team-pom-pom-%f0%9f%8e%8a","status":"publish","type":"post","link":"https:\/\/courses.ideate.cmu.edu\/16-376\/s2021\/4822\/assignment-15-team-pom-pom-%f0%9f%8e%8a\/","title":{"rendered":"Assignment 15: Team Pom Pom \ud83c\udf8a"},"content":{"rendered":"\n<p><strong>Prototyping the Wind Chime Unit<\/strong><\/p>\n\n\n\n<p>During class Elle and I began making pom poms and experimenting with different sizes and lengths while Helen continued to flesh out the code. We decided to make each wind chime unit personal to each team member using different color combinations, bells, and beads to accent the pendulums. We met with Garth &amp; Olivia to share some important concerns that Elle brought up, such as how to keep the pendulums from getting tangled together and how using different bells might be to our advantage. After class, I moved forward with creating the first wind chime unit for Helen. <\/p>\n\n\n\n<p>I experimented with different lengths and found that keeping the pom poms on the larger side helped the pendulums &#8220;bounce&#8221; off one another and make the twirling action of the wind chime unit more dynamic. By keeping three of the pendulums long and the other three short, it made the movement and sound of the bells energizing. All together, I think it proved to be an excellent and successful prototype!<\/p>\n\n\n\n<figure class=\"wp-block-embed is-type-video is-provider-youtube wp-block-embed-youtube wp-embed-aspect-16-9 wp-has-aspect-ratio\"><div class=\"wp-block-embed__wrapper\">\n<iframe loading=\"lazy\" title=\"Wind Chime Prototype for Kinetic Fabrics\" width=\"620\" height=\"349\" src=\"https:\/\/www.youtube.com\/embed\/VG0_Na7lap8?feature=oembed\" frameborder=\"0\" allow=\"accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture\" allowfullscreen><\/iframe>\n<\/div><figcaption>Testing out the wind chime unit by hand to test out movement and sound. <\/figcaption><\/figure>\n\n\n\n<p>Once the prototype proved successful, Helen and I met up and used the table top stand she created to hold the servo unit upside down.  We did some sample tests after assembling and tested the prototype again.<\/p>\n\n\n\n<figure class=\"wp-block-embed is-type-video is-provider-youtube wp-block-embed-youtube wp-embed-aspect-16-9 wp-has-aspect-ratio\"><div class=\"wp-block-embed__wrapper\">\n<iframe loading=\"lazy\" title=\"Testing of the Wind Chimes!\" width=\"620\" height=\"349\" src=\"https:\/\/www.youtube.com\/embed\/eVsnqD2KP3g?feature=oembed\" frameborder=\"0\" allow=\"accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture\" allowfullscreen><\/iframe>\n<\/div><figcaption>Attaching the wind chimes to the table top unit and sampling out code.<\/figcaption><\/figure>\n\n\n\n<p><strong>Moving Forward<\/strong><\/p>\n\n\n\n<ol><li>For Helen&#8217;s wind chimes I am going to trim down the pom poms a little bit so they have more room to twirl around.<\/li><li>For my wind chime unit I am going to experiment with different types of bells and find another way to stagger the lengths of the pendulums to add a bit of individuality and flair \ud83d\udc95<\/li><\/ol>\n\n\n\n<p><strong>Code<\/strong><\/p>\n\n\n<pre class=\"brush: python; title: ; notranslate\" title=\"\">\n&quot;&quot;&quot;\nProject 1: Ambient Proxy Body\n\nTeam Pom Pom\nHelen Yu (heleny1), Celia Kasberg (ckasberg), Elle Smith\n\nWritten by Helen Yu\nLast Updated: 3\/28\/21\n\nSummary: As your partner fidgets in their chair, your wind chimes spin \nin reaction to your partner's presence. Small and slow movements trigger \na sweeping motion in the servo. Fast and sharp movements trigger a stepping \nsweep in the servo.\n\nInputs: Accelerometer\nOutputs: Hobby Servo on SD A5\n&quot;&quot;&quot;\n\n# ----------------------------------------------------------------\n# Import any needed standard Python modules.\nimport time, math, sys\n\n# Import the board-specific input\/output library.\nfrom adafruit_circuitplayground import cp\n\n# Import the low-level hardware libraries.\nimport board\nimport digitalio\nimport analogio\nimport pwmio\n\n# Import the Adafruit helper library.\nfrom adafruit_motor import servo\n\n# Import the runtime for checking serial port status.\nimport supervisor\n\n# ----------------------------------------------------------------\n# Initialize hardware.\n\n# Create a PWMOut object on pad SDA A5 to generate control signals.\npwm = pwmio.PWMOut(board.A5, duty_cycle=0, frequency=50)\n\n# Create a Servo object which controls a hobby servo using the PWMOut.\nactuator = servo.Servo(pwm, min_pulse=50, max_pulse=3000)\n\n# ----------------------------------------------------------------\n# Initialize global variables for the main loop.\n\n# The remote move state can be updated via serial port messages.\nremote_moves = [0, 0, 0, 0, 0]\n\n# Measure the time since the last remote move message, and reset after a period without data.\nremote_moves_timer = False\n\n# Convenient time constant expressed in nanoseconds.\nsecond = 1000000000\n\n# Integer time stamp for the next console output.\nsensing_timer = time.monotonic()\n\n# Integer time stamp for next behavior activity to begin.\nnext_activity_time = time.monotonic_ns() + 2 * second\n\n# Flag to trigger motion.\nsweep_slow = False\nsweep_fast = False\n\nphase_angle = 0.0\nphase_rate  = 2*math.pi \/ 6.0  # one cycle per six seconds, in radians\/second\n\n# Integer time stamp for next servo update.\nnext_servo_update = time.monotonic_ns()\n\n# The serial port output rate is regulated using the following timer variables.\nserial_timer    = 0.0\nserial_interval = 0.5\n\n# ----------------------------------------------------------------\n# Begin the main processing loop.\nwhile True:\n\n    # Read the current integer clock.\n    now = time.monotonic()\n\n    # Measure and define local acceleration\n    x, y, z = cp.acceleration\n    l_x = abs(int(x))\n    l_y = abs(int(y))\n    l_z = abs(int(z))\n    local_moves = l_x, l_y, l_z\n\n    # Check the serial input for new line of remote data\n    if supervisor.runtime.serial_bytes_available:\n        line = sys.stdin.readline()\n        tokens = line.split()\n        if len(tokens) == 5:\n            try:\n                remote_moves = [int(token) &amp;gt; 0 for token in tokens]\n                remote_move_timer = 4.0\n            except ValueError:\n                pass\n\n    #---- periodic console output -----------------------------------\n    # Poll the time stamp to decide whether to emit console output.\n    if now &amp;gt;= sensing_timer:\n        sensing_timer += 100000000 #0.1sec\n\n    if any(local_moves):\n        remote_moves_timer = now + 4000000000 # 4 sec timeout\n\n    if now &amp;gt;= serial_timer:\n        serial_timer += serial_interval\n        moves = [&quot;1&quot; if 1 &lt; l_x &lt; 3 else &quot;0&quot;, &quot;1&quot; if l_y &amp;gt; 1 else &quot;0&quot;, &quot;1&quot; if 1 &lt; l_z &lt; 3 else &quot;0&quot;, &quot;1&quot; if l_x &amp;gt; 3 else &quot;0&quot;, &quot;1&quot; if l_z &amp;gt; 3 else &quot;0&quot;]\n        print(&quot; &quot;.join(moves))\n\n    if any(remote_moves):\n        # Check whether there was any remote movement\n        if remote_moves[0] or remote_moves[2]:\n            if remote_moves[1]:\n                sweep_slow = True\n                print(&quot;Entering slow cycle.&quot;)\n        \n        if remote_moves[3] or remote_moves[4]:\n            if remote_moves[1]:\n                sweep_fast = True\n                print(&quot;Entering fast cycle&quot;)\n        \n        # If a slow movement has been received, sweep twice at a constant speed\n        elif sweep_slow is True: #new code moves these if statements out of the if(any local_moves) statement\n            for angle in range(0, 180, 3):\n                actuator.angle = angle\n                time.sleep(0.02)\n            print(&quot;Reversing slow sweep.&quot;)\n            for angle in range(180, 0, -3):\n                actuator.angle = angle\n                time.sleep(0.02)\n            print(&quot;End of slow cycle&quot;)\n            sweep_slow = False\n        \n        # If a fast movement has been received, sweep twice in a stepping motion\n        elif sweep_fast is True:\n            for angle in range(0, 180, 10):\n                actuator.angle = angle\n                time.sleep(0.1)\n            print(&quot;Reversing fast sweep.&quot;)\n            for angle in range(180, 0, -10):\n                actuator.angle = angle\n                time.sleep(0.1)\n            print(&quot;End of fast cycle&quot;)\n            sweep_fast = False\n        \n        remote_moves = [False]*5\n\n    #---- periodic servo motion commands ----------------------------\n    # If the time has arrived to update the servo command signal:\n    if now &amp;gt;= next_servo_update:\n        next_servo_update += 20000000  # 20 msec in nanoseconds (50 Hz update)\n\n<\/pre>","protected":false},"excerpt":{"rendered":"<p>Prototyping the Wind Chime Unit During class Elle and I began making pom poms and experimenting with different sizes and lengths while Helen continued to flesh out the&#8230;<\/p>\n","protected":false},"author":79,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":[],"categories":[12],"tags":[],"_links":{"self":[{"href":"https:\/\/courses.ideate.cmu.edu\/16-376\/s2021\/wp-json\/wp\/v2\/posts\/4822"}],"collection":[{"href":"https:\/\/courses.ideate.cmu.edu\/16-376\/s2021\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/courses.ideate.cmu.edu\/16-376\/s2021\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/courses.ideate.cmu.edu\/16-376\/s2021\/wp-json\/wp\/v2\/users\/79"}],"replies":[{"embeddable":true,"href":"https:\/\/courses.ideate.cmu.edu\/16-376\/s2021\/wp-json\/wp\/v2\/comments?post=4822"}],"version-history":[{"count":9,"href":"https:\/\/courses.ideate.cmu.edu\/16-376\/s2021\/wp-json\/wp\/v2\/posts\/4822\/revisions"}],"predecessor-version":[{"id":4867,"href":"https:\/\/courses.ideate.cmu.edu\/16-376\/s2021\/wp-json\/wp\/v2\/posts\/4822\/revisions\/4867"}],"wp:attachment":[{"href":"https:\/\/courses.ideate.cmu.edu\/16-376\/s2021\/wp-json\/wp\/v2\/media?parent=4822"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/courses.ideate.cmu.edu\/16-376\/s2021\/wp-json\/wp\/v2\/categories?post=4822"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/courses.ideate.cmu.edu\/16-376\/s2021\/wp-json\/wp\/v2\/tags?post=4822"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}