<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Melanie Chow on Medium]]></title>
        <description><![CDATA[Stories by Melanie Chow on Medium]]></description>
        <link>https://medium.com/@melaniechow?source=rss-95bfe7208c42------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*sv_p6YE_yIXdUJKGtAZwOA.jpeg</url>
            <title>Stories by Melanie Chow on Medium</title>
            <link>https://medium.com/@melaniechow?source=rss-95bfe7208c42------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Tue, 09 Jun 2026 04:56:44 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@melaniechow/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com" rel="hub"/>
        <item>
            <title><![CDATA[Embossing for beginners]]></title>
            <link>https://medium.com/@melaniechow/embossing-for-beginners-9c57a44e46f7?source=rss-95bfe7208c42------2</link>
            <guid isPermaLink="false">https://medium.com/p/9c57a44e46f7</guid>
            <category><![CDATA[card-making]]></category>
            <category><![CDATA[design]]></category>
            <category><![CDATA[craft]]></category>
            <category><![CDATA[embossing]]></category>
            <category><![CDATA[crafting]]></category>
            <dc:creator><![CDATA[Melanie Chow]]></dc:creator>
            <pubDate>Tue, 03 Sep 2019 23:29:54 GMT</pubDate>
            <atom:updated>2019-09-04T19:53:48.072Z</atom:updated>
            <content:encoded><![CDATA[<h4>Materials, how to get started, what to expect</h4><p>Have you ever seen those Instagram or Youtube videos of powder magically changing color after being heated? Don’t know what I mean? See below.</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fgiphy.com%2Fembed%2FUqZ20js4InXYKoyd43%2Ftwitter%2Fiframe&amp;url=https%3A%2F%2Fgiphy.com%2Fgifs%2FUqZ20js4InXYKoyd43&amp;image=https%3A%2F%2Fmedia.giphy.com%2Fmedia%2FUqZ20js4InXYKoyd43%2Fgiphy.gif&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=giphy" width="435" height="244" frameborder="0" scrolling="no"><a href="https://medium.com/media/55ae74a345311155ea4e90e963270e48/href">https://medium.com/media/55ae74a345311155ea4e90e963270e48/href</a></iframe><p>Well, that’s something is called<strong> embossing</strong>. I stumbled upon it years ago back in high school, as I was starting to get into making cards that were more than just copy paper folded in half. I figured that embossing would take my cards to the next level —as it reminded me of the colorful, textured letterings you find on professional Hallmark cards. But you know what’s even better? You can emboss almost anything — glass, clay pots, acrylic, stone, and more…meaning, endless possibilities of customized gifts!</p><p>So how can you get started? Luckily, I was actually embossing something recently, and realized I would love to share my process for those who were in my position. Here’s what you’ll need to get started, along with my product recommendations. (Bear in mind, I’m in no way a <em>professional </em>embosser/crafter, I just make cool cards as a hobby)</p><h4>Materials:</h4><ol><li>Embossing powder <br>(<a href="https://amzn.to/2ksQmtV">Ranger Embossing Powder</a>)</li><li>Embossing Ink/Pen <br>(<a href="https://amzn.to/2kswiI9">Ranger Embossing pen clear + black two pack</a>)</li><li>Heat gun<br>(Can’t find my one anymore, but here is a low price <a href="https://amzn.to/2lAahYo">one</a> )</li><li>Cardstock/Paper/Material to emboss<br>(The green cardstock I use here is part of <a href="https://amzn.to/2kgwYk5">this collection</a>)</li><li>Powder bag (optional)<br>(<a href="https://amzn.to/2ke2GhP">Inkadinko Powder Tool</a>)</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*K3koeFVOZ3paPa1vlx9sRA.jpeg" /><figcaption>Embossing Materials</figcaption></figure><h4>How to emboss (step by step)</h4><ol><li><strong>Optional Step</strong>: First, powder the material you will be embossing on. This removes static and prevents stray powders on your surface.</li></ol><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fgiphy.com%2Fembed%2FSsIKjI9BZwYEXWkMtw%2Ftwitter%2Fiframe&amp;url=https%3A%2F%2Fgiphy.com%2Fgifs%2FSsIKjI9BZwYEXWkMtw&amp;image=https%3A%2F%2Fmedia.giphy.com%2Fmedia%2FSsIKjI9BZwYEXWkMtw%2Fgiphy.gif&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=giphy" width="435" height="244" frameborder="0" scrolling="no"><a href="https://medium.com/media/399f0280eeff8a30df6a5c8a38ed1bcd/href">https://medium.com/media/399f0280eeff8a30df6a5c8a38ed1bcd/href</a></iframe><p>2. Now, using your embossing ink, or pen, draw out the design you want to emboss.</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fgiphy.com%2Fembed%2FjoYkpKWF9c5eHTdZvS%2Ftwitter%2Fiframe&amp;url=https%3A%2F%2Fmedia.giphy.com%2Fmedia%2FjoYkpKWF9c5eHTdZvS%2Fgiphy.gif&amp;image=https%3A%2F%2Fi.giphy.com%2Fmedia%2FjoYkpKWF9c5eHTdZvS%2Fgiphy.gif&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=giphy" width="435" height="244" frameborder="0" scrolling="no"><a href="https://medium.com/media/328761693efb442f9a76b6ff2c3dd5ce/href">https://medium.com/media/328761693efb442f9a76b6ff2c3dd5ce/href</a></iframe><p>3. Once you’re done, pour the powder onto the design. Like glitter, pour the remaining powder back into the bottle.</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fgiphy.com%2Fembed%2FW4ccdo5wEQ09gmLBQK%2Ftwitter%2Fiframe&amp;url=https%3A%2F%2Fmedia.giphy.com%2Fmedia%2FW4ccdo5wEQ09gmLBQK%2Fgiphy.gif&amp;image=https%3A%2F%2Fi.giphy.com%2Fmedia%2FW4ccdo5wEQ09gmLBQK%2Fgiphy.gif&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=giphy" width="435" height="244" frameborder="0" scrolling="no"><a href="https://medium.com/media/46ac141fda1d8d188c11f487163e3cf8/href">https://medium.com/media/46ac141fda1d8d188c11f487163e3cf8/href</a></iframe><p>4. To remove any excess material, try tapping the back of the surface or blowing at the powder to remove loose pieces.</p><p>5. <strong>Optional Step</strong>: Remove flecks of unwanted powder using a dry brush/toothpick/q-tip/blunt edge.</p><p>6. Plug in your heat gun, making sure no unwanted powder is nearby. Make sure to twist the cap on the embossing powder bottle tightly.</p><p>7. Turn on the heat gun and wait a few seconds for it to warm up before facing it towards the powdered design.</p><p>8. Watch as the powder melts! Make sure not to overheat it, as it may cause crumbling.</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fgiphy.com%2Fembed%2FY3A4nbRaObu1wRm9y6%2Ftwitter%2Fiframe&amp;url=https%3A%2F%2Fgiphy.com%2Fgifs%2FY3A4nbRaObu1wRm9y6&amp;image=https%3A%2F%2Fmedia.giphy.com%2Fmedia%2FY3A4nbRaObu1wRm9y6%2Fgiphy.gif&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=giphy" width="435" height="244" frameborder="0" scrolling="no"><a href="https://medium.com/media/a98d2a7422fc6c579d2fa0419bb2b555/href">https://medium.com/media/a98d2a7422fc6c579d2fa0419bb2b555/href</a></iframe><p>That’s it! Practice, practice, practice. Try to figure out how long you need to emboss your powder, the type of powders you want to get, the type of pen nib, and the materials you like!</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fgiphy.com%2Fembed%2FQuDDtmscAhJQBBfxUH%2Ftwitter%2Fiframe&amp;url=https%3A%2F%2Fmedia.giphy.com%2Fmedia%2FQuDDtmscAhJQBBfxUH%2Fgiphy.gif&amp;image=https%3A%2F%2Fi.giphy.com%2Fmedia%2FQuDDtmscAhJQBBfxUH%2Fgiphy.gif&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=giphy" width="435" height="244" frameborder="0" scrolling="no"><a href="https://medium.com/media/4269a73cbc79547cfcfe93f3ee425d76/href">https://medium.com/media/4269a73cbc79547cfcfe93f3ee425d76/href</a></iframe><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=9c57a44e46f7" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[3D-printed Wearable Button]]></title>
            <link>https://medium.com/@melaniechow/3d-printed-wearable-button-bdae2b5273ef?source=rss-95bfe7208c42------2</link>
            <guid isPermaLink="false">https://medium.com/p/bdae2b5273ef</guid>
            <category><![CDATA[3d-printing]]></category>
            <category><![CDATA[wearables]]></category>
            <category><![CDATA[button-design]]></category>
            <category><![CDATA[circuit]]></category>
            <category><![CDATA[user-experience]]></category>
            <dc:creator><![CDATA[Melanie Chow]]></dc:creator>
            <pubDate>Tue, 18 Jun 2019 06:20:19 GMT</pubDate>
            <atom:updated>2019-06-18T13:56:24.295Z</atom:updated>
            <content:encoded><![CDATA[<h4>Building and designing a 3D printed button and wearable</h4><p>This week, our paper bag contained three items: copper tape, a battery, and a LED pin. Our prompt? To use our 3D printers and create a wearable that lit up an LED as a button was pressed. The task seemed simple, but there was a twist — we would have to create our own button, and design our wearable such that it would be easy to replace and remove the battery.</p><p><strong>Materials given:</strong></p><ol><li>Copper tape</li><li>3V Lithium Coin Battery</li><li>LED</li></ol><p><strong>The Prompt:</strong></p><p>A 3D printed wearable that lights up an LED with a push of a button.</p><p><strong>Our End Result:</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/720/1*McQwbKPcr_80sQ2ALuB8ug.gif" /><figcaption>Final Wearable Product</figcaption></figure><h3>Designing our Button</h3><p>Our first step was designing our button. We had many ideas on how to do this — and they all involved making a spring buttons, since these were buttons we dealt with on a daily basis. The only issue was printing a spring <em>flexible </em>enough to support the button without snapping or being too stiff. We had PLA and Flashforge printers to our disposal, but our resources could not easily handle the flexibility and subsequent resolution we needed. We ended up printing many different springs, and limited by the material and quality of our printer, as well as time, we decided to go an entirely different route.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*92WUNZz5i0JuhjXPei6XqQ.gif" /><figcaption>Spring button design</figcaption></figure><p>We figured — all our button needed to be able to do was move down, and go back up.</p><ol><li><strong>Manual Push Pin</strong>: Our first alternative idea was a “push pin” where the user would push the button pin down into a hole and would have to pull it back up in order to push it again. Therefore, the button would go back up by using manual labor, instead of a spring.</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*JJYAk_DaBz4fAmZfIvFywQ.jpeg" /><figcaption>“Push pin” mechanism</figcaption></figure><p>Nevertheless, we thought this idea was too simple. We still had over 24 hours left before the deadline, so we kept this idea as our last resort and went back to the drawing table. That’s when we thought about flexible plastic items, and one in particular was a <strong>ruler.</strong> We discussed how plastic rulers are still able to move up and down even though they are not thin pieces of plastic. When anchored at one side, with the other side of the ruler dangling, a ruler bounces up and down when the dangling side is pressed, similar to a diving board. Using that, we figured that by experimenting with different proportions, we could implement our “button.”</p><p>2. <strong>Diving Board: </strong>We though of many different ways to implement the diving-board like button as shown below. We played with many different proportions of thickness and sizes, as our “button” either kept breaking off at the base, or rarely budged. We also thought of ways we could reduce the amount of force needed to press the button by extending the end of the button, as shown below.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/358/1*ZgJZx9272X3hjenrn7zR4w.png" /><figcaption>“Diving-board” mechanism</figcaption></figure><p>Yet, we realized we could reduce our button even further. Our button didn’t need to protrude outward like a diving board — it could be like a “ruler” cut out of our base.</p><p>3. <strong>Press Button: </strong>We then decided to make the shape a circle to make it more button-like, and we realized that we had seen buttons like this before in real life products.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/818/1*E4NnktsMR98fGE8kvXr7wg.png" /><figcaption>Press Button</figcaption></figure><p>In the end, we also decided to add a handle to our button since it was a bonus to make a “latched” button — one that stayed down when pressed down. Therefore, we made it so that the handle was the right length in order to make it somewhat “stiff ”when pressed down. The handle would then be used to raise it back up.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*XG_98oj3Qi7DxEES78G2tw.png" /><figcaption>Final Button Design: CAD model of Press button with handle</figcaption></figure><h3>Designing the wearable</h3><p>Our next step was designing the wearable. The first thing that came to our mind was a watch, with circles to fit the wrist. We decided to make a rectangular shape to hold the different compartments that we needed, which was a battery, a LED, and a resistor. We also needed a place to implement our button — we decided to incorporate our button into a lid. We designed a slide-in lid in order to make the battery easily replaceable, but also out of sight.</p><p>We decided to use press fits to fit the button, so we measured our items and in created a <strong>divider</strong> that would separate the battery and LED. We also thought this would be nice as the divider would serve as the<strong> elevated platform </strong>that the button would touch. We decided to use an elevated platform in order to reduce the amount of force needed to push the button down. For the divider, we also decided to leave space on one side in order to have a place to put the resistor.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*xCT3MqVes4SQ9yxYLpMDUg.jpeg" /><figcaption>Hand drawn sketch of wearable</figcaption></figure><p>Since our primary objective was to make an LED light up, we also thought it would be nice to have the LED be poking out of the wearable. Since our lid was detachable, we decided to make it poke out of the side instead of from the top. Lastly, we added ridges in order to implement our sliding mechanism for our lid.</p><p>After sketching our compartments, we then created our 3D model.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*0iUYyvw2L5SD9rEFeCWhMg.png" /><figcaption>CAD model of wearable</figcaption></figure><h3>Connecting our circuit</h3><p>Lastly, we needed to connect our circuit. We first wanted to put tape on the sides of the wearable, in order to have a clean look, but our copper tape did not conduct electricity well. We discovered that not all tape is created equal, as some parts of the tape worked, while others didn’t. We rethought our tape design and came up with this:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*zTo4T1VI3Bzvw5oMxNQyQw.jpeg" /><figcaption>Circuit design. The red parts are the tape.</figcaption></figure><p>We wanted to reduce the amount of tape we needed to rely on by using the tape to stick the ends of the resistor to the short end of the LED and the positive side of the battery, as shown above.</p><p>Yet, even implementing this design was long. After grabbing our tweezers and placing the tape on carefully, making sure every part of the tape was touching other parts, our circuit still wasn’t working. We knew this wasn’t our button as even putting tape to complete the circuit didn’t work. Something deceptively simple turned into hours of mindless re-taping.</p><p>With just a few hours left, and no voltmeter or soldering available to us, we grabbed our tweezers and dissected the board methodically. With our hands we connected the metals together and placed the other ends at different parts of the circuit to determine when connection was being lost. After hours of fiddling and trying out different pieces of tape and different orientations, we managed to pull it all together.</p><p>Our advice — get better tape, or just use metal. Also, always have a voltmeter on hand to do continuity tests.</p><h3>End Result</h3><p>This was the end result of our wearable!</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/400/1*PzLFVyHyoGBIVbKcJ5s_kA.jpeg" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/400/1*StfrG5SoSc64EJlKlf0SIA.jpeg" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/400/1*3_P8PxWTV-sf6HZIZD36eg.jpeg" /></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=bdae2b5273ef" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Using a rotary encoder on an Arduino]]></title>
            <link>https://medium.com/@melaniechow/using-a-rotary-encoder-on-an-arduino-18f543ae7f78?source=rss-95bfe7208c42------2</link>
            <guid isPermaLink="false">https://medium.com/p/18f543ae7f78</guid>
            <category><![CDATA[rotary]]></category>
            <category><![CDATA[arduino]]></category>
            <category><![CDATA[tutorial]]></category>
            <category><![CDATA[potentiometer]]></category>
            <category><![CDATA[demo]]></category>
            <dc:creator><![CDATA[Melanie Chow]]></dc:creator>
            <pubDate>Tue, 18 Jun 2019 00:05:47 GMT</pubDate>
            <atom:updated>2019-06-18T07:11:39.073Z</atom:updated>
            <content:encoded><![CDATA[<h4>How it works, and how to connect and use it on an Arduino</h4><p>For class I was given two mystery sensors, and was given the vague instructions to figure them out and create a demo. One of the sensors was a rotary encoder, and I thought I would share the demo. Our other sensor was a joystick, and the tutorial can be found <a href="https://medium.com/@melaniechow/using-a-joystick-sensor-on-an-arduino-3498d7399464">here</a>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/600/1*aUp42GaXn2h8s2aFmMiMPw.jpeg" /><figcaption>Rotary Encoder Sensor. Image Credits to Addicore</figcaption></figure><h4>The following article is structured like so:</h4><ol><li><strong>Overview</strong>:<em> Input &amp; Output pins of the rotary encoder</em></li><li><strong>Understanding a Rotary Encoder: </strong><em>How a rotary encoder works</em></li><li><strong>Connecting it to an Arduino:</strong> S<em>tep-by-step wiring</em></li><li><strong>Demo + How to Code:</strong> C<em>reating the demo</em></li></ol><p><em>(</em><strong><em>Disclaimer</em></strong><em>: These tutorials were made by my wonderful team and I. The following has been edited slightly for sharing.)</em></p><h3>Overview</h3><p>A rotary encoder is a sensor used for determining the angular position of a shaft, similar to a potentiometer.</p><p><strong>Pins and what they mean:</strong></p><ul><li>CLK: Output A (Digital)</li><li>DT: Output B (Digital)</li><li>SW: button press (Digital)</li><li>+: VCC — Voltage supply</li><li>GND: Ground</li></ul><h3><strong>Understanding a Rotary Encoder</strong></h3><p>A rotary encoder can essentially be used for the same purpose as the potentiometer. However, a potentiometer typically has a default point past which the shaft cannot rotate, while a rotary encoder can rotate in one direction for as long as we want. To reset the position reading, we can push the shaft down to press the reset button. The rotary encoder we have produces digital signals.</p><iframe src="https://cdn.embedly.com/widgets/media.html?url=https%3A%2F%2Fthumbs.gfycat.com%2FRecentSilentHyracotherium-small.gif&amp;src=https%3A%2F%2Fgfycat.com%2Fifr%2FRecentSilentHyracotherium&amp;type=text%2Fhtml&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;schema=gfycat" width="1280" height="720" frameborder="0" scrolling="no"><a href="https://medium.com/media/82cbe6f2d1def6a36dfa4913d77e938a/href">https://medium.com/media/82cbe6f2d1def6a36dfa4913d77e938a/href</a></iframe><p>The rotary encoder determines the angular position of a rotating shaft through a series of <strong>square wave pulses.</strong> It essentially has evenly spaced contact zones connected to a common pin, as well as two contact pins called A and B that are 90 degrees out of phase. When the rotary encoder is manually rotated, pins A and B make contact with the common pin, and generate the pulse. <strong>By counting the amount of pulses (or square waves) of either of these outputs, we can determine the rotary position. </strong>To determine direction and check if the pin is rotating clockwise or counterclockwise, we do the following:</p><p>If the rotary encoder is moving <strong>clockwise</strong>, output A is ahead of output B. As a result, at the same points in time, A and B will be on opposite parts of the square wave function (when A is being activated, B is inactive, and vice versa).</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/595/1*1mCRgpb4eGJgCHHXeW0XJQ.jpeg" /><figcaption>clockwise square wave movement</figcaption></figure><p>If the rotary encoder is moving <strong>counterclockwise</strong>, Output B is ahead of output A. As a result, at the same points in time, because it is moving 90 degrees ahead, A and B will both be activated and deactivated at the same time, albeit B will be ahead by those 90 degrees.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/553/1*vM1W35gfS5x-HBb3hghdyw.jpeg" /><figcaption>counter clockwise square wave movement</figcaption></figure><h3><strong>Connecting it to an Arduino</strong></h3><p>Here are what the 5 pins for the rotary encoder mean:</p><ul><li>CLK: Output A (digital)</li><li>DT: Output B (digital)</li><li>SW: button press (digital)</li><li>+: VCC — Voltage supply</li><li>GND: Ground</li></ul><p>CLK, DT, and SW should be connected to <strong>digital pins</strong> on the Arduino, + should be connected to the 5V and GND, like always, to ground.</p><p><strong>Step by Step Instructions</strong></p><p>1. <strong>CLK: </strong>Place one end of a wire at the CLK pin on the rotary encoder to any digital pin on the Arduino (O<em>range wire — </em>)</p><p>2. <strong>DT:</strong> Place one end of a wire at the DT source pin on the rotary encoder to any digital pin on the Arduino (Y<em>ellow wire — </em>)</p><p>3. <strong>SW:</strong> Place one end of a wire at the SW pin on the rotary encoder to any digital pin on the Arduino (S<em>ky Blue wire — </em>)</p><p>4. <strong>+:</strong> Place one end of a wire at the + pin on the rotary encoder to the +5V pin on the Arduino (R<em>ed wire — </em>)</p><p>5. <strong>GND:</strong> Place one end of a wire at the GND pin on the rotary encoder to the GND pin on the Arduino. (B<em>lack wire — </em>)</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/525/1*KQjNFPqXnt_3DWpBz1rcTg.jpeg" /><figcaption>Vertical view of Arduino Setup</figcaption></figure><h3>Demo + How to Code</h3><p>This code alters pitch based on which direction the encoder is turned. When it is turned counter-clockwise we decrease the pitch, and when it is turned clockwise, we increase it.</p><p>Here is a<strong> demo video</strong> for reference:</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fwww.youtube.com%2Fembed%2FC6_aAOiRPq4%3Ffeature%3Doembed&amp;url=http%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3DC6_aAOiRPq4&amp;image=https%3A%2F%2Fi.ytimg.com%2Fvi%2FC6_aAOiRPq4%2Fhqdefault.jpg&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=youtube" width="854" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/b5c2402c1515932cfcd851fa2bdaf79c/href">https://medium.com/media/b5c2402c1515932cfcd851fa2bdaf79c/href</a></iframe><p><strong>What you will need:</strong></p><ul><li>Rotary Encoder sensor</li><li>Arduino</li><li>Piezo</li><li>Wires</li></ul><pre>int buzzer_pin = 3;<br>int pinA = 7;<br>int pinB = 6;<br>int pinC = 5;<br>int pitch = 956;<br>int aState;<br>int aLastState;  </pre><pre>void setup() { <br>   pinMode (pinA,INPUT);<br>   pinMode (pinB,INPUT);<br>   //pinMode (pinC,INPUT);<br>   //digitalWrite(pinC, HIGH);<br>   pinMode(buzzer_pin, OUTPUT);<br>   Serial.begin (9600);<br>   // Starts output<br>   aLastState = digitalRead(pinA);   <br>} </pre><pre>void loop() { <br>   aState = digitalRead(pinA); </pre><pre>   if (aState != aLastState){     <br>     // outputB != outputA state, encoder is rotating clockwise<br>     if (digitalRead(pinB) != aState) { <br>      movedClockwise();<br>       //counter ++;<br>     } <br>     else {<br>       //counter --;<br>       movedCounterClockwise();<br>     }<br>     play_specific_pitch(pitch);<br>   } <br>   aLastState = aState;<br>}</pre><pre>void movedClockwise() {<br>  if ((pitch) &lt; 3000) {<br>    pitch = pitch + 100;<br>  }<br>}</pre><pre>void movedCounterClockwise() {<br>  if ((pitch) &gt; 100) {<br>    pitch = pitch - 100;<br>  }<br>}</pre><pre>void play_specific_pitch(int pitch) {<br>  for (long i = 0; i &lt; 300000L; i += pitch * 2) {<br>    digitalWrite(buzzer_pin, HIGH);<br>    delayMicroseconds(pitch);<br>    digitalWrite(buzzer_pin, LOW);<br>    delayMicroseconds(pitch);<br>  }<br>  Serial.println(pitch);<br>}</pre><p>I hope you enjoyed this tutorial and found it thorough and useful!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=18f543ae7f78" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Using a joystick sensor on an Arduino]]></title>
            <link>https://medium.com/@melaniechow/using-a-joystick-sensor-on-an-arduino-3498d7399464?source=rss-95bfe7208c42------2</link>
            <guid isPermaLink="false">https://medium.com/p/3498d7399464</guid>
            <category><![CDATA[tutorial]]></category>
            <category><![CDATA[demo]]></category>
            <category><![CDATA[arduino]]></category>
            <category><![CDATA[servo]]></category>
            <category><![CDATA[joystick]]></category>
            <dc:creator><![CDATA[Melanie Chow]]></dc:creator>
            <pubDate>Mon, 17 Jun 2019 23:32:29 GMT</pubDate>
            <atom:updated>2019-06-18T13:43:04.758Z</atom:updated>
            <content:encoded><![CDATA[<h4>How it works, and how to connect and use it on an Arduino</h4><p>For class I was handed two mystery sensors, and was given the vague instructions to figure them out and create a demo. One of the sensors that I easily recognized was a joystick, and I thought I would share the demo and tutorial here. (Our other sensor was a rotary encoder, and that tutorial can be found <a href="https://medium.com/@melaniechow/using-a-rotary-encoder-on-an-arduino-18f543ae7f78?postPublishedType=initial">here.</a>)</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/700/1*2z3TeZRDG0o-INUJ5bhR-w.jpeg" /><figcaption>Analog Joystick Sensor: Image credit to MakerFabs</figcaption></figure><h4>The following article is structured like so:</h4><ol><li><strong>Overview</strong>:<em> Input &amp; Output pins of the joystick</em></li><li><strong>Understanding a Joystick: </strong><em>How a joystick works</em></li><li><strong>Connecting it to an Arduino:</strong> S<em>tep-by-step wiring</em></li><li><strong>Demo + How to Code:</strong> C<em>reating the demo</em></li></ol><p><em>(</em><strong><em>Disclaimer</em></strong><em>: These tutorials were made by my wonderful team and I. The following has been edited slightly for sharing.)</em></p><h3>Overview</h3><p>The joystick is useful for reading and interpreting 2D motion through two analog variables, which represent the position of the sensor on a 2D plane. The joystick can also be pressed inwards like a button, which is useful for functions such as selecting items in menus.</p><ul><li><strong>Input 1</strong>: Moving the stick</li><li><strong>Output 1</strong>: position of handle relative to its center, X and Y axis</li><li><strong>Input 2</strong>: Pressing the button</li><li><strong>Output 2</strong>: Whether the button is pressed or not</li></ul><h3>Understanding a Joystick</h3><p>Before we go in to how to connect a sensor and use it in code, it is important to understand how a joystick works internally.</p><p>The analog joystick has a handle and two slotted shafts around the handle (along the x-axis and y-axis). The handle can be pushed to any point in a plane, which will cause one or both of the slotted shafts to pivot. <strong>Each slotted shaft is attached to a potentiometer on the side, which converts the angular displacement of the shaft to an analog signal.</strong></p><p>The data for each axis is determined in analog using a potentiometer, <strong>communicating position in the form of voltage.</strong> This is possible because the shaft is connected to a wiper and resistive strip inside the potentiometer.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/400/1*FYUFvjGfpNyu30J2ip4aog.png" /><figcaption>Resistive strip controlling output voltage</figcaption></figure><p>As the wiper moves further along the resistive strip, more current passes through the strip to complete the circuit, thereby increasing the total resistance of the circuit.</p><p>Therefore, twisting the potentiometer will change the voltage of its output. In its default position along an axis, the joystick will output half the voltage input. As we move along an axis, the voltage of the output will move either to the maximum inputted voltage, or to zero, signaling how far we have moved the shaft of the joystick.</p><h3><strong>Connecting it to an Arduino</strong></h3><p>Here are what the 5 pins of the analog joystick mean:</p><ul><li><strong>GND: </strong>Ground</li><li><strong>+5V:</strong> 5V power source</li><li><strong>VRx:</strong> X-direction reading (Analog)</li><li><strong>VRy:</strong> Y-direction reading (Analog)</li><li><strong>SW: </strong>Button press (Digital)</li></ul><p>VRx and VRy should be connected to <strong>analog pins</strong> on the Arduino, and SW should be connected to a <strong>digital pin</strong>. As usual, +5V should be connected to 5V, and the GND pin should be connected to GND.</p><p><strong>Step by Step Instructions</strong></p><p>1.<strong> GND:</strong> Place one end of a wire at the GND pin on the joystick to the GND pin on the arduino (<em>Black Wire</em>)</p><p>2. <strong>+5V:</strong> Place one end of a wire at the 5V source pin on the joystick (+5V) to the 5V pin on the arduino (<em>Red Wire</em>)</p><p>3. <strong>VRx:</strong> Place one end of a wire at the VRx pin on the joystick to any analog pin on the arduino (Orange<em> Wire — We connected it to pin A3)</em></p><p>4. <strong>VRy:</strong> Place one end of a wire at the VRy pin on the joystick to any analog pin on the arduino (<em>Yellow Wire — We connected it to pin A1)</em></p><p>5. <strong>SW:</strong> Place one end of a wire at the SW pin on the joystick to any digital pin on the arduino. (S<em>ky Blue Wire — We connected it to pin D5</em>)</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/400/1*WVDrXKttBsG1tOdUW1_huA.jpeg" /><figcaption>Vertical view of the arduino setup</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*P70up8mXk2TZHwb1V-t6mg.jpeg" /><figcaption>Side angle of the arduino setup</figcaption></figure><h3>Demo + How to Code</h3><p>This code moves the servo hand in X degree intervals based on Joystick positioning. For example, if joystick is held to the left continuously, the servo hand will move in 180 degree intervals.</p><p>Here is a<strong> demo video</strong> where I describe how it works:</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fwww.youtube.com%2Fembed%2FDCHC5luDY2E%3Ffeature%3Doembed&amp;url=http%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3DDCHC5luDY2E&amp;image=https%3A%2F%2Fi.ytimg.com%2Fvi%2FDCHC5luDY2E%2Fhqdefault.jpg&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=youtube" width="854" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/a30c7e0c69aaa6f50deec9fee99c8198/href">https://medium.com/media/a30c7e0c69aaa6f50deec9fee99c8198/href</a></iframe><p><strong>What you will need:</strong></p><ul><li>Analog joystick sensor</li><li>Arduino</li><li>LED pin</li><li>Continuous servo motor</li><li>Wires</li></ul><p>For this demo, we used a continuous servo motor. <em>Ideally </em>we would use a non-continuous servo motor for this demo since it works with degree coordinates. However, since we only had a continuous servo, we had to use delays in the code to control movement. <em>Although a delay of 500ms may theoretically be correct based on the speed of servo movement, 600ms worked better after experimentation.</em></p><pre>/* Setup */<br>#include &lt;math.h&gt;<br>#include &lt;Servo.h&gt;</pre><pre>/* Pins */<br>int servo_pin = 3; <br>int joyPin1 = 1;  // slider variable connected to analog pin 1<br>int joyPin2 = 3;  // slider variable connected to analog pin 3<br>int led = 2;      // led light connected to digital pin 2<br> <br>int SW_pin = 5;  // digital pin connected to switch output<br>int y = 0;       // variable to read the value from the analog pin 0<br>int x = 0;       // variable to read the value from the analog pin 1</pre><pre>Servo servo_motor;</pre><pre>void setup() {<br>  pinMode(SW_pin, INPUT);<br>  digitalWrite(SW_pin, HIGH);<br>  Serial.begin(9600); //Start printing to the console<br>  servo_motor.attach(servo_pin); <br>  pinMode(led, OUTPUT);<br> }</pre><pre>int getDegree(int raw_x, int raw_y) {<br>  raw_x = (raw_x - 2457);<br>  raw_y = (raw_y - 2541);<br>  <br>  /* Convert Raw Values to Degree */</pre><pre>//convert radians to degree<br>  double val = atan2(raw_y, raw_x) * 180/3.14159265358979; <br>  if (val &lt; 0) {<br>    val += 360;<br>  }<br>  <br>  //convert to a double<br>  double new_x = raw_x / 100.0;<br>  double new_y = raw_y / 100.0;<br>  double distance = sqrt((new_x * new_x) + (new_y * new_y));<br>  <br>  //15 is a distance threshold that determines when to move the servo<br>  if (distance &gt; 15) { <br>    return val;<br>  }<br>  return -1; // joystick has not moved far enough to move servo<br>}</pre><pre>void loop() {</pre><pre>  /* Get x and y raw values*/<br>  y = (analogRead(joyPin1) * 4.9);   <br>  delay(50); // small pause needed between reading<br>  x = (analogRead(joyPin2) * 4.9 );  <br>  delay(50);    <br>  <br>  /* Print Raw Coordinates */<br>  Serial.print(y);<br>  Serial.print(&#39;-&#39;);<br>  Serial.print(x);<br>  Serial.print(&quot;-&quot;);<br>  Serial.println(digitalRead(SW_pin));<br>  <br>  /* If pressed down, light up pin */<br>  if (digitalRead(SW_pin) == 0) { // when pressed, SW_pin returns 0<br>    digitalWrite(led, HIGH); <br>  }<br>  else {<br>    digitalWrite(led, LOW);<br>  }<br>  <br>  /* Translate x and y into a degree */<br>  int deg = getDegree(x, y);<br>  Serial.print(&quot;Degree&quot;);<br>  Serial.println(deg);<br>  <br>  /* If deg is -1, don&#39;t move */<br>  if (deg == -1) {<br>    servo_motor.write(90);<br>  }<br>  /* If deg is not -1, move that # of degrees*/<br>  else {<br>    Serial.println(&quot;move&quot;);<br>    servo_motor.write(0); //Move servo at maximum speed<br>    delay(600 * (deg/360.0)); //Experimental value<br>    servo_motor.write(90); //Stop servo movement after delaying a certain amount of time<br>  }<br>}</pre><p>I hope you enjoyed this tutorial and found it thorough and useful!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=3498d7399464" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>