<?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 Jake Johnson on Medium]]></title>
        <description><![CDATA[Stories by Jake Johnson on Medium]]></description>
        <link>https://medium.com/@joh12533?source=rss-a433540d1912------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*9gvQe6H1sPDgxTuL</url>
            <title>Stories by Jake Johnson on Medium</title>
            <link>https://medium.com/@joh12533?source=rss-a433540d1912------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Fri, 04 Dec 2026 20:55:56 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@joh12533/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[Creating a Self Drawing Etch A Sketch (with help from a Raspberry Pi)]]></title>
            <link>https://medium.com/@joh12533/creating-a-self-drawing-etch-a-sketch-with-help-from-a-raspberry-pi-1f4b1aacf9aa?source=rss-a433540d1912------2</link>
            <guid isPermaLink="false">https://medium.com/p/1f4b1aacf9aa</guid>
            <category><![CDATA[raspberry-pi]]></category>
            <category><![CDATA[motor]]></category>
            <category><![CDATA[computer-science]]></category>
            <category><![CDATA[python]]></category>
            <dc:creator><![CDATA[Jake Johnson]]></dc:creator>
            <pubDate>Tue, 06 Nov 2018 05:54:31 GMT</pubDate>
            <atom:updated>2018-11-06T05:54:31.123Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*8VkMomo1Q_49gaUSbktsfQ.jpeg" /><figcaption>My Implementation of the Raspberry Pi that draws on an Etch-A-Sketch !</figcaption></figure><p>Hello! Welcome to my post about how to make an Etch-A-Sketch that can draw from a Raspberry Pi!</p><p>I am an undergraduate student at the University of Minnesota, studying Computer Science. I am in a class called Embodied Computing, where we learn about and apply technology that you can interact with in a physical way.</p><p>Recently we were challenged to do a tutorial of something relating to technologies like Raspberry Pi and Arduino, and I found a neat project about creating a program that sketches an image on to the etch a sketch using Raspberry Pi.</p><p>I mainly chose the Raspberry Pi over other options like the Arduino because the Raspberry Pi came equipped with Python, which is a highly useful language with little to no limits of what it can do! I also am very much a fan of linux operating systems and a Raspberry Pi can be used as a linux terminal. The reason I chose it over other hardware and software (such as Arduino) is the balance of software and hardware that the Raspberry Pi allows and the familiarity of terminal commands and Python.</p><p>Almost any python code that can be written and executed on your desktop or laptop can also be run on the Raspberry Pi, opening a ton of doors to fun projects! The use of hardware also leads itself to be able to operate motors, lights, switches, and other things, so the possibilities are endless!</p><p><strong>This article is mainly to document my process with it and help anyone that is working on something similar!</strong></p><p>You can find the original article that I based mine off of here:</p><p><a href="http://sunnybala.com/2018/09/10/python-etch-a-sketch.html">Making Etch-a-Sketch Art With Python</a></p><p>With that said, let’s get right into it!</p><p><strong>Parts List Recipe:</strong></p><ul><li><a href="https://www.amazon.com/gp/product/B01C6FFNY4/ref=oh_aui_detailpage_o01_s01?ie=UTF8&amp;psc=1">Raspberry Pi</a></li><li><a href="https://www.amazon.com/gp/product/B01MTS465O/ref=oh_aui_detailpage_o01_s00?ie=UTF8&amp;psc=1">Etch-a-Sketch</a></li><li>Piece of Wood (To Stabilize the motor)</li><li><a href="https://www.amazon.com/gp/product/B06X982PSL/ref=oh_aui_detailpage_o00_s00?ie=UTF8&amp;psc=1">Stepper Motors (2)</a></li><li><a href="https://www.amazon.com/gp/product/B01LW5RREA/ref=oh_aui_detailpage_o01_s02?ie=UTF8&amp;psc=1">Shaft Couplers (2)</a></li><li><a href="https://www.amazon.com/gp/product/B01LZF1ZSZ/ref=oh_aui_detailpage_o01_s00?ie=UTF8&amp;psc=1">Jumper Cables (2)</a></li></ul><p>A few things to note:</p><ul><li>In order to use the Raspberry Pi, you must have a MircoSD card and some way to write to it. I recommend a MicroSD to USB converter like <a href="https://www.amazon.com/Adapter-Standard-Connector-Smartphones-Function/dp/B01BXSKPES">THIS</a> one.</li><li>It is easier to use the Raspberry Pi with a keyboard and monitor to easily access the command line. If you don’t have there however, there is a way you can SSH into the PI itself, but it is a much more complicated process. You can follow that process <a href="https://hackernoon.com/raspberry-pi-headless-install-462ccabd75d0">HERE</a>.</li><li>You can find a detailed article on how to setup a Raspberry Pi <a href="https://www.instructables.com/id/Install-and-Setup-Raspbian-Lite-on-Raspberry-Pi-3/">HERE</a>!</li></ul><p><strong>Step 0 — Raspberry Pi Setup</strong></p><p>Step 0 is setting up your Raspberry Pi! Unbox your Pi and plug it in. Next, download the Raspian Stretch Lite from this link right <a href="https://www.raspberrypi.org/downloads/raspbian/">HERE</a>. We will be using the terminal of the Raspberry Pi for our whole project!</p><p>Once that is done, download Etcher or another service to place that image onto your MicroSD card. Make sure the card is plugged in and selected to write to. After it is written, plug the SD card into the PI, turn it on, and you will have your very own raspberry PI command line!</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*yg28YSKMEJpy-1viRr2VXw.jpeg" /><figcaption>Raspberry Pi Booting up for the first time!</figcaption></figure><p><strong>Step 1— Connecting the Motor/Controller to the PI</strong></p><p>First, we need to get the motors working. To do this follow the wire mappings below. These wire mappings let the Raspberry Pi access certain pins and send signals to them. For example, we can write code that tells pin 15 what it should do when connected to the motor.</p><p>Attach the white cord coming from the motor next to the lights on the controller. See Pictures below:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*E6yf0UMHc0VFYZC4fr51XQ.jpeg" /><figcaption>Controller for stepper motor</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*iBgbbWGsHp7Y3-ppV_X-eg.jpeg" /><figcaption>Raspberry Pi Pin setup</figcaption></figure><p>Next we need to connect the Raspberry Pi and the controller. For example, use a cable to connect IN1 to Pin 7 as documented below. Below are wire mappings.</p><pre>First Controller/motor:               Second Controller/motor:</pre><pre>IN1 ➣ pin 7 on PI                      IN1 ➣ pin 31 on PI</pre><pre>IN2 ➣ pin 11 on PI .                   IN2 ➣ pin 33 on PI</pre><pre>IN3 ➣pin 13 on PI                      IN3 ➣ pin 35 on PI</pre><pre>IN4 ➣ pin 15 on PI                     IN4 ➣ pin 37 on PI</pre><pre>5V ➣ pin 6                             5V ➣ ground (?)</pre><pre>12V ➣ pin 4                            12V ➣ pin 2</pre><p>Below is a diagram of pin numbers and their function.</p><figure><img alt="" src="https://cdn-images-1.medium.com/proxy/1*-G5yFvmSpx2sqor-28FTtQ.png" /><figcaption>Image from <a href="https://www.raspberrypi-spy.co.uk/2012/06/simple-guide-to-the-rpi-gpio-header-and-pins/">https://www.raspberrypi-spy.co.uk/2012/06/simple-guide-to-the-rpi-gpio-header-and-pins/</a></figcaption></figure><p><strong>Step 3 — Etch a Sketch Modifications</strong></p><p>Next, take the white knobs off of your etch-a-sketch device. This can be done using a knife or other object as leverage to pop the little white knobs off. They are hard to get off, but trust me, they do come off!</p><p>After that attach the couplers that you have to the open knob and to the motor. The rotating part of the motor should fit right into the opening of the coupler. Tighten both the top and bottom of the coupler with a Hex Key.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*xc0t2BticI1leKA06w5MlQ.jpeg" /><figcaption>Coupler connected to the Etch-A-Sketch connected to a stepper motor</figcaption></figure><p>Stabilize the motors by using wood to ground the motor in. Use a screw to hold the motor in place (see the final product picture at the top!).</p><p><strong>Step 4 — Create and Run code!</strong></p><p>Below is a modification to GitHub code provided in the project I mentioned at the beginning.</p><p>Start by creating a file named stepperMotor.py</p><pre>Sudo nano stepperMotor.py</pre><p>And paste this code into the file.</p><pre>import RPi.GPIO as GPIO<br>import time<br>class stepperMotor(object):<br>def __init__(self, control_pins):        <br>     GPIO.setmode(GPIO.BOARD)<br>     self.control_pins = control_pins<br>     self.halfstep_seq = [<br>     [1,0,0,0],<br>     [1,1,0,0],<br>     [0,1,0,0], <br>     [0,1,1,0],                      <br>     [0,0,1,0],                      <br>     [0,0,1,1],<br>     [0,0,0,1],<br>     [1,0,0,1]<br>     ]        <br>     self.prev = 0<br>     for pin in self.control_pins:<br>            GPIO.setup(pin, GPIO.OUT)<br>            GPIO.output(pin, 0)<br>def rotate(self,n):<br>        n = int(n)<br>        if n &lt; 0:<br>            ii = -1<br>        elif n &gt; 0: <br>           ii = 1 <br>       else: <br>           return<br>       if ii != self.prev:<br>            print(&#39;re-aligning&#39;)<br>            n += 24*ii<br>        for i in range(int(abs(n))):<br>          for halfstep in range(8):<br>            for pin in range(4):<br>                   GPIO.output(self.control_pins[pin],self.halfstep_seq[::ii][halfstep[pin])<br>  time.sleep(0.002)<br>  self.prev = ii <br>           <br>def close(self):<br>        GPIO.cleanup()</pre><p>This was found on the GitHub link at: <a href="https://github.com/sunnybala/PyEtchASketch/blob/master/stepperMotor.py">https://github.com/sunnybala/PyEtchASketch/blob/master/stepperMotor.py</a></p><p>Save with the command:</p><pre>(Control + x) + y + enter</pre><p>What this code does is it tells the Raspberry Pi what pins it should use and how the stepper motors should operate.</p><p>Next create a program named spiral.py</p><pre>Sudo nano spiral.py</pre><p>Copy and paste the code below into this field and save it.</p><pre>import stepperMotor from stepperMotor<br>leftMotor = stepperMotor([7,11,13,15])<br>rightMotor = stepperMotor([31,33,35,37])<br>step = 16<br>ii = 1<br>while ii &lt; 100:<br>     leftMotor.rotate(ii*step)<br>     time.sleep(.1)<br>     rightMotor.rotate(ii*step)<br>     time.sleep(.1)<br>     ii += 1<br>     leftMotor.rotate(-ii*step)<br>     time.sleep(.1)<br>     rightMotor.rotate(-ii*step)<br>     ii += 1<br>leftMotor.close()<br>rightMotor.close()</pre><p>The code above was modified from the GitHub at: <a href="https://github.com/sunnybala/PyEtchASketch/blob/master/pictureDraw.py">https://github.com/sunnybala/PyEtchASketch/blob/master/pictureDraw.py</a></p><p>What this does is create two instances of the stepperMotor class in order to control both the left and right motors. It then uses a while loop to rotate the motors to draw a spiral on the ETCH-A-SKETCH!</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*cXeliUzvUxWFraYVUvYfqw.jpeg" /><figcaption>Spiral (to the left) mixed with a draw_grid function found at <a href="https://github.com/sunnybala/PyEtchASketch/blob/master/pictureDraw.py">https://github.com/sunnybala/PyEtchASketch/blob/master/pictureDraw.py</a></figcaption></figure><p>I hope you had fun working on the ETCH-A-SKETCH modification!</p><p>If you are up to the challenge, the GitHub linked below has a system to draw actual images given as input to the Raspberry Pi, and will draw them on the Etch-A-Sketch! Check out the GitHub at:</p><pre><a href="https://github.com/sunnybala/PyEtchASketch/blob/master/pictureDraw.py">https://github.com/sunnybala/PyEtchASketch/blob/master/pictureDraw.py</a></pre><p>Let me know if you have any questions at: Joh12533@umn.edu !</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=1f4b1aacf9aa" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>