28
PyPortal Guitar Tuner Created by Ruiz Brothers Last updated on 2021-03-17 01:18:12 PM EDT

PyPortal Guitar Tuner - Adafruit Industries · 2020. 10. 28. · Build a simple Guitar Tuner with CircuitPython and Adafruit PyPortal! Use the touch screen to tap on tuning pegs and

  • Upload
    others

  • View
    4

  • Download
    0

Embed Size (px)

Citation preview

  • PyPortal Guitar TunerCreated by Ruiz Brothers

    Last updated on 2021-03-17 01:18:12 PM EDT

  • 233337777899

    101112131314151516161617202020202020212121

    2323232324242425252526262627

    Guide Contents

    Guide ContentsOverview

    CircuitPython Power!3D Printed PyPortal CaseParts

    3D PrintingParts ListCAD AssemblySlicing PartsDesign Source Files

    Install CircuitPythonSet up CircuitPython Quick Start!PyPortal Default Files

    CircuitPython LibrariesInstalling the CircuitPython Library BundleExample Files

    Copying Libraries to Your BoardExample: ImportError Due to Missing LibraryLibrary Install on Non-Express BoardsUpdating CircuitPython Libraries/Examples

    Coding the PyPortal Guitar TunerAdding LibrariesCodeAudio Files and Bitmap Graphic

    CircuitPython Code WalkthroughSetup

    CircuitPython LibrariesDisplay SetupLoading Audio FilesTouchscreen ButtonsButton State

    The LoopPlay Notes

    AssemblyHardware SetupInstall StandoffsScreen CoverInstall Screen CoverInstalled Screen CoverInstalling Plate and SpeakerConnect SpeakerInstall SpeakerSecure PyPortalInstall FrameSecure FrameFinal BuildGoing Further

    © Adafruit Industries https://learn.adafruit.com/pyportal-guitar-tuner Page 2 of 28

  • Overview

    CircuitPython Power!Build a simple Guitar Tuner with CircuitPython and Adafruit

    PyPortal! Use the touch screen to tap on tuning pegs and

    play music notes. The notes are pre-recorded wav audio files

    of guitar strings. The graphic of the head stock is a single

    bitmap. This uses the displayio library for CircuitPython and

    can be customized to make a unique sound board.

    3D Printed PyPortal CaseThe Adafruit PyPortal and a mini oval speaker are secured to

    a 3D printed enclosure using M2.5 screws and standoffs. The

    PyPortal is mounted vertically and features a built-in holder

    for a speaker.

    Parts

    © Adafruit Industries https://learn.adafruit.com/pyportal-guitar-tuner Page 3 of 28

    https://learn.adafruit.com//assets/91821https://learn.adafruit.com//assets/91823https://www.adafruit.com/product/4116https://www.adafruit.com/product/3923https://www.adafruit.com/product/4111https://www.adafruit.com/product/3299

  • Adafruit PyPortal - CircuitPython Powered Internet Display

    PyPortal, our easy-to-use IoT device that allows you to create all the things for the “Internet of Things” in

    minutes. Make custom touch screen interface...

    Out of Stock

    Mini Oval Speaker - 8 Ohm 1 Watt

    Hear the good news! This wee speaker is a great addition to any audio project where you need 8 ohm

    impedance and 1W or less of power. We particularly like...

    $1.95

    In Stock

    Out ofStock

    Add to Cart

    © Adafruit Industries https://learn.adafruit.com/pyportal-guitar-tuner Page 4 of 28

    https://www.adafruit.com/product/4116https://www.adafruit.com/product/4116https://www.adafruit.com/product/3923https://www.adafruit.com/product/3923

  • Fully Reversible Pink/Purple USB A to micro B Cable - 1m long

    This cable is not only super-fashionable, with a woven pink and purple Blinka-like pattern, it's also fully

    reversible! That's right, you will save seconds a day by...

    Out of Stock

    Out ofStock

    © Adafruit Industries https://learn.adafruit.com/pyportal-guitar-tuner Page 5 of 28

    https://www.adafruit.com/product/4111https://www.adafruit.com/product/4111

  • Black Nylon Screw and Stand-off Set – M2.5 Thread

    Totaling 380 pieces, this M2.5 Screw Set is a must-have for your workstation. You'll have enough screws,

    nuts, and hex standoffs to fuel your maker...

    $16.95

    In Stock

    Add to Cart

    © Adafruit Industries https://learn.adafruit.com/pyportal-guitar-tuner Page 6 of 28

    https://www.adafruit.com/product/3299https://www.adafruit.com/product/3299

  • 3D Printing

    Parts ListSTL files for 3D printing are oriented to print "as-is" on FDM

    style machines. Parts are designed to 3D print without any

    support material. Original design source may be downloaded

    using the links below.

    frame.stl

    screen-cover.stl

    pcb-plate.stl

    https://adafru.it/LBu

    https://adafru.it/LBv

    CAD AssemblyThe PyPortal is secured to the PCB plate using M2.5

    hardware screws and standoffs. The screen cover is press

    fitted over the PyPortal's display. The PCB plate is secured to

    the frame using M2.5 hardware screws and hex nuts. The

    speaker is press fitted into the holder in the center of the PCB

    plate.

    Slicing PartsNo supports are required. Slice with settings for PLA material.

    The parts were sliced using CURA using the slice settings

    below.

    PLA filament 220c extruder

    0.2 layer height

    10% gyroid infill

    60mm/s print speed

    60c heated bed

    https://adafru.it/LBu

    https://adafru.it/LBv

    © Adafruit Industries https://learn.adafruit.com/pyportal-guitar-tuner Page 7 of 28

    https://learn.adafruit.com//assets/91798https://a360.co/2XHthEYhttps://www.thingiverse.com/thing:4438992https://learn.adafruit.com//assets/91813https://learn.adafruit.com//assets/91815

  • Design Source FilesThe project assembly was designed in Fusion 360. This can

    be downloaded in different formats like STEP, STL and more.

    Electronic components like Adafruit's board, displays,

    connectors and more can be downloaded from the Adafruit

    CAD parts GitHub Repo (https://adafru.it/AW8).

    © Adafruit Industries https://learn.adafruit.com/pyportal-guitar-tuner Page 8 of 28

    https://learn.adafruit.com//assets/91816https://github.com/adafruit/Adafruit_CAD_Parts

  • Install CircuitPythonCircuitPython (https://adafru.it/tB7) is a derivative of MicroPython (https://adafru.it/BeZ) designed to

    simplify experimentation and education on low-cost microcontrollers. It makes it easier than ever to get

    prototyping by requiring no upfront desktop software downloads. Simply copy and edit files on the

    CIRCUITPY "flash" drive to iterate.

    The following instructions will show you how to install CircuitPython. If you've already installed

    CircuitPython but are looking to update it or reinstall it, the same steps work for that as well!

    Set up CircuitPython Quick Start!Follow this quick step-by-step for super-fast Python power :)

    https://adafru.it/Egk

    https://adafru.it/HFd

    Click the link above to download the latest version of

    CircuitPython for the PyPortal.

    Download and save it to your desktop (or wherever is handy).

    Plug your PyPortal into your computer using a known-good

    USB cable.

    A lot of people end up using charge-only USB cables and it

    is very frustrating! So make sure you have a USB cable you

    know is good for data sync.

    Double-click the Reset button on the top in the middle

    (magenta arrow) on your board, and you will see the NeoPixel

    RGB LED (green arrow) turn green. If it turns red, check the

    USB cable, try another USB port, etc. Note: The little red LED

    next to the USB connector will pulse red. That's ok!

    If double-clicking doesn't work the first time, try again.

    Sometimes it can take a few tries to get the rhythm right!

    https://adafru.it/Egk

    https://adafru.it/HFd

    © Adafruit Industries https://learn.adafruit.com/pyportal-guitar-tuner Page 9 of 28

    https://github.com/adafruit/circuitpythonhttps://micropython.orghttps://circuitpython.org/board/pyportal/https://circuitpython.org/board/pyportal_pynt/https://learn.adafruit.com//assets/73615https://learn.adafruit.com//assets/71993

  • You will see a new disk drive appear called PORTALBOOT.

    Drag the adafruit-circuitpython-pyportal-.uf2 file

    to PORTALBOOT.

    The LED will flash. Then, the PORTALBOOT drive will

    disappear and a new disk drive called CIRCUITPY will

    appear.

    If you haven't added any code to your board, the only file that

    will be present is boot_out.txt. This is absolutely normal! It's

    time for you to add your code.py and get started!

    That's it, you're done! :)

    PyPortal Default FilesClick below to download a zip of the files that shipped on the PyPortal or PyPortal Pynt.

    https://adafru.it/Env

    https://adafru.it/HFf

    https://adafru.it/Env

    https://adafru.it/HFf

    © Adafruit Industries https://learn.adafruit.com/pyportal-guitar-tuner Page 10 of 28

    https://learn.adafruit.com//assets/72029https://learn.adafruit.com//assets/72030https://learn.adafruit.com//assets/71995https://github.com/adafruit/circuitpython-default-files/tree/master/boards/pyportal/4.xhttps://github.com/adafruit/circuitpython-default-files/tree/master/boards/pyportal_pynt/5.x

  • CircuitPython Libraries� As we continue to develop CircuitPython and create new releases, we will stop supporting olderreleases. Visit https://circuitpython.org/downloads to download the latest version of CircuitPython for

    your board. You must download the CircuitPython Library Bundle that matches your version of

    CircuitPython. Please update CircuitPython and then visit https://circuitpython.org/libraries to

    download the latest Library Bundle.

    Each CircuitPython program you run needs to have a lot of information to work. The reason CircuitPython

    is so simple to use is that most of that information is stored in other files and works in the background.

    These files are called libraries. Some of them are built into CircuitPython. Others are stored on yourCIRCUITPY drive in a folder called lib. Part of what makes CircuitPython so awesome is its ability to store

    code separately from the firmware itself. Storing code separately from the firmware makes it easier to

    update both the code you write and the libraries you depend.

    Your board may ship with a lib folder already, it's in the base directory of the drive. If not, simply create the

    folder yourself. When you first install CircuitPython, an empty lib directory will be created for you.

    CircuitPython libraries work in the same way as regular Python modules so the Python

    docs (https://adafru.it/rar) are a great reference for how it all should work. In Python terms, we can place

    our library files in the lib directory because its part of the Python path by default.

    One downside of this approach of separate libraries is that they are not built in. To use them, one needs

    to copy them to the CIRCUITPY drive before they can be used. Fortunately, we provide a bundle full of

    our libraries.

    Our bundle and releases also feature optimized versions of the libraries with the .mpy file extension.

    These files take less space on the drive and have a smaller memory footprint as they are loaded.

    © Adafruit Industries https://learn.adafruit.com/pyportal-guitar-tuner Page 11 of 28

    https://circuitpython.org/downloadshttps://circuitpython.org/librarieshttps://docs.python.org/3/tutorial/modules.html

  • Installing the CircuitPython Library BundleWe're constantly updating and improving our libraries, so we don't (at this time) ship our CircuitPython

    boards with the full library bundle. Instead, you can find example code in the guides for your board that

    depends on external libraries. Some of these libraries may be available from us at Adafruit, some may be

    written by community members!

    Either way, as you start to explore CircuitPython, you'll want to know how to get libraries on board.

    You can grab the latest Adafruit CircuitPython Bundle release by clicking the button below.

    Note: Match up the bundle version with the version of CircuitPython you are running - 3.x library for

    running any version of CircuitPython 3, 4.x for running any version of CircuitPython 4, etc. If you mix

    libraries with major CircuitPython versions, you will most likely get errors due to changes in library

    interfaces possible during major version changes.

    https://adafru.it/ENC

    If you need another version, you can also visit the bundle release page (https://adafru.it/Ayy) which will let

    you select exactly what version you're looking for, as well as information about changes.

    Either way, download the version that matches your CircuitPython firmware version. If you don't know

    the version, look at the initial prompt in the CircuitPython REPL, which reports the version. For example, if

    you're running v4.0.1, download the 4.x library bundle. There's also a py bundle which contains the

    uncompressed python files, you probably don't want that unless you are doing advanced work onlibraries.

    After downloading the zip, extract its contents. This is usually done by double clicking on the zip. On Mac

    OSX, it places the file in the same directory as the zip.

    Open the bundle folder. Inside you'll find two information files, and two folders. One folder is the lib

    bundle, and the other folder is the examples bundle.

    https://adafru.it/ENC

    © Adafruit Industries https://learn.adafruit.com/pyportal-guitar-tuner Page 12 of 28

    https://circuitpython.org/librarieshttps://github.com/adafruit/Adafruit_CircuitPython_Bundle/releases/latest/

  • Now open the lib folder. When you open the folder, you'll see a large number of mpy files and folders

    Example FilesAll example files from each library are now included in the bundles, as well as an examples-only bundle.

    These are included for two main reasons:

    Allow for quick testing of devices.

    Provide an example base of code, that is easily built upon for individualized purposes.

    Copying Libraries to Your BoardFirst you'll want to create a lib folder on your CIRCUITPY drive. Open the drive, right click, choose the

    option to create a new folder, and call it lib. Then, open the lib folder you extracted from the downloaded

    zip. Inside you'll find a number of folders and .mpy files. Find the library you'd like to use, and copy it to

    the lib folder on CIRCUITPY.

    This also applies to example files. They are only supplied as raw .py files, so they may need to be

    converted to .mpy using the mpy-cross utility if you encounter MemoryErrors . This is discussed in theCircuitPython Essentials Guide (https://adafru.it/CTw). Usage is the same as described above in the

    © Adafruit Industries https://learn.adafruit.com/pyportal-guitar-tuner Page 13 of 28

    https://learn.adafruit.com/circuitpython-essentials/circuitpython-expectations#how-can-i-create-my-own-mpy-files-18-6

  • Express Boards section. Note: If you do not place examples in a separate folder, you would remove the

    examples from the import statement.

    � If a library has multiple .mpy files contained in a folder, be sure to copy the entire folder toCIRCUITPY/lib.

    Example: ImportError Due to Missing LibraryIf you choose to load libraries as you need them, you may write up code that tries to use a library you

    haven't yet loaded. We're going to demonstrate what happens when you try to utilise a library that you

    don't have loaded on your board, and cover the steps required to resolve the issue.

    This demonstration will only return an error if you do not have the required library loaded into the lib

    folder on your CIRCUITPY drive.

    Let's use a modified version of the blinky example.

    import boardimport timeimport simpleio

    led = simpleio.DigitalOut(board.D13)

    while True: led.value = True time.sleep(0.5) led.value = False time.sleep(0.5)

    Save this file. Nothing happens to your board. Let's check the serial console to see what's going on.

    We have an ImportError . It says there is no module named 'simpleio' . That's the one we just included in ourcode!

    Click the link above to download the correct bundle. Extract the lib folder from the downloaded bundle

    file. Scroll down to find simpleio.mpy. This is the library file we're looking for! Follow the steps above to

    load an individual library file.

    The LED starts blinking again! Let's check the serial console.

    © Adafruit Industries https://learn.adafruit.com/pyportal-guitar-tuner Page 14 of 28

  • No errors! Excellent. You've successfully resolved an ImportError !

    If you run into this error in the future, follow along with the steps above and choose the library that

    matches the one you're missing.

    Library Install on Non-Express BoardsIf you have a Trinket M0 or Gemma M0, you'll want to follow the same steps in the example above to

    install libraries as you need them. You don't always need to wait for an ImportError as you probably knowwhat library you added to your code. Simply open the lib folder you downloaded, find the library you

    need, and drag it to the lib folder on your CIRCUITPY drive.

    You may end up running out of space on your Trinket M0 or Gemma M0 even if you only load libraries as

    you need them. There are a number of steps you can use to try to resolve this issue. You'll find them in

    the Troubleshooting page in the Learn guides for your board.

    Updating CircuitPython Libraries/ExamplesLibraries and examples are updated from time to time, and it's important to update the files you have on

    your CIRCUITPY drive.

    To update a single library or example, follow the same steps above. When you drag the library file to your

    lib folder, it will ask if you want to replace it. Say yes. That's it!

    A new library bundle is released every time there's an update to a library. Updates include things like bug

    fixes and new features. It's important to check in every so often to see if the libraries you're using have

    been updated.

    © Adafruit Industries https://learn.adafruit.com/pyportal-guitar-tuner Page 15 of 28

  • Coding the PyPortal Guitar TunerAdding LibrariesOnce you've finished setting up your PyPortal with CircuitPython, you can add these libraries to

    the lib folder:

    adafruit_bitmap_font

    adafruit_bus_device

    adafruit_display_shapes

    adafruit_display_text

    adafruit_esp32spi

    adafruit_imageload

    adafruit_io

    adafruit_adt7410.mpy

    adafruit_button.mpy

    adafruit_pyportal.mpy

    adafruit_requests.mpy

    adafruit_sdcard.mpy

    adafruit_touchscreen.mpy

    neopixel.mpy

    Then, you can click on the Download: Project Zip link above the code to download the code file, audio

    files and bitmap file.

    CodeClick on "Copy Code" and then paste it into the Mu editor to save to your PyPortal as code.py or copy the

    code file from the Project Zip folder to the PyPortal's CIRCUITPY drive.

    You will also need the secrets.py code file from the Project Zip folder since it is required for the PyPortal

    CircuitPython library.

    © Adafruit Industries https://learn.adafruit.com/pyportal-guitar-tuner Page 16 of 28

  • import timefrom adafruit_button import Buttonfrom adafruit_pyportal import PyPortal

    pyportal = PyPortal(default_bg="/stock-pyportal.bmp")

    lowE = "/sounds/lowE.wav"A = "/sounds/A.wav"D = "/sounds/D.wav"G = "/sounds/G.wav"B = "/sounds/B.wav"highE = "/sounds/highE.wav"

    notes = [lowE, A, D, G, B, highE]

    pegs = [ {'label': "lowE", 'pos': (53, 0), 'size': (65, 90)}, {'label': "A", 'pos': (124, 0), 'size': (65, 90)}, {'label': "D", 'pos': (194, 0), 'size': (65, 90)}, {'label': "G", 'pos': (194, 150), 'size': (65, 90)}, {'label': "B", 'pos': (124, 150), 'size': (65, 90)}, {'label': "highE", 'pos': (53, 150), 'size': (65, 90)} ]

    buttons = []for peg in pegs: button = Button(x=peg['pos'][0], y=peg['pos'][1], width=peg['size'][0], height=peg['size'][1], style=Button.RECT, fill_color=None, outline_color=0x5C3C15, name=peg['label']) pyportal.splash.append(button.group) buttons.append(button)

    note_select = None

    while True: touch = pyportal.touchscreen.touch_point if not touch and note_select: note_select = False if touch: for i in range(6): tuning = notes[i] button = buttons[i] if button.contains(touch) and not note_select: print("Touched", button.name) note_select = True for z in range(3): pyportal.play_file(tuning) time.sleep(0.1)

    Audio Files and Bitmap GraphicIn addition to the lib folder, for this project you'll also have a sounds folder. The sounds folder contains

    the six audio files that are used to tune your guitar using the PyPortal. Each audio file is a quick sample of

    each string on a guitar in standard tuning (E - A - D - G - B - E).

    A.wav

    B.wav

    D.wav

    © Adafruit Industries https://learn.adafruit.com/pyportal-guitar-tuner Page 17 of 28

  • G.wav

    highE.wav

    lowE.wav

    There is also a bitmap image for the PyPortal's display that depicts a guitar's headstock. This image file,

    called stock-pyportal.bmp, will also be stored on the PyPortal.

    Copy the sounds folder and the stock-pyportal.bmp bitmap image file from the Project Zip folder to the

    PyPortal's CIRCUITPY drive.

    Your PyPortal CIRCUITPY drive should look like this after you load the libraries, audio files, bitmap and

    code files below:

    © Adafruit Industries https://learn.adafruit.com/pyportal-guitar-tuner Page 18 of 28

  • © Adafruit Industries https://learn.adafruit.com/pyportal-guitar-tuner Page 19 of 28

  • CircuitPython Code WalkthroughSetupCircuitPython LibrariesThe CircuitPython code begins by importing the libraries.

    import timefrom adafruit_button import Buttonfrom adafruit_pyportal import PyPortal

    Display SetupFirst, pyportal is setup as a PyPortal object. The PyPortal's default background is also setup to be theguitar headstock image, stock-pyportal.bmp. This means that on boot, the PyPortal will display the bitmap

    with just one line of code.

    pyportal = PyPortal(default_bg="/stock-pyportal.bmp")

    Loading Audio FilesThe audio file locations are assigned to variables so that they can be easily referenced in the code. Then,

    files are put into the notes array in order from low to high.

    lowE = "/sounds/lowE.wav"A = "/sounds/A.wav"D = "/sounds/D.wav"G = "/sounds/G.wav"B = "/sounds/B.wav"highE = "/sounds/highE.wav"

    notes = [lowE, A, D, G, B, highE]

    Touchscreen ButtonsThe PyPortal will have six buttons that sit on top of the guitar headstock image. Instead of setting each

    button up individually, their parameters are setup as a group in an array, called pegs , of dictionaryentries. This way you can easily denote the buttons' label, position and size.

    pegs = [ {'label': "lowE", 'pos': (53, 0), 'size': (65, 90)}, {'label': "A", 'pos': (124, 0), 'size': (65, 90)}, {'label': "D", 'pos': (194, 0), 'size': (65, 90)}, {'label': "G", 'pos': (194, 150), 'size': (65, 90)}, {'label': "B", 'pos': (124, 150), 'size': (65, 90)}, {'label': "highE", 'pos': (53, 150), 'size': (65, 90)} ]

    Finally, this information for the buttons are assigned as Button objects using the adafruit_buttonCircuitPython library. Using the pegs array, all of the information from the dictionaries can be pulled in tocomplete the setup for the buttons. These buttons are then added to the PyPortal's display.

    © Adafruit Industries https://learn.adafruit.com/pyportal-guitar-tuner Page 20 of 28

  • buttons = []for peg in pegs: button = Button(x=peg['pos'][0], y=peg['pos'][1], width=peg['size'][0], height=peg['size'][1], style=Button.RECT, fill_color=None, outline_color=0x5C3C15, name=peg['label']) pyportal.splash.append(button.group) buttons.append(button)

    Button StateThe note_select state will be used to debounce the touchscreen buttons.

    note_select = None

    The LoopThe loop begins with touch setup to hold the PyPortal's touchscreen functionality.

    Next, touchscreen button debouncing is setup. You only need to setup one instance rather than one for

    each individual button because you are essentially checking to see if the touchscreen is being touched in

    any location.

    while True: touch = pyportal.touchscreen.touch_point if not touch and note_select: note_select = False

    Play NotesThe final portion of the loop is how notes are played through the PyPortal. First, it checks to see if the

    touchscreen has been touched.

    This is followed by a for statement. In this for statement, tuning and button are setup to hold the arrayindex locations for the notes and buttons arrays. Since there are six indexes in each of these arrays, thisallows for the sound files to match up with the touchscreen buttons and play when pressed.

    Finally, an if statement checks if the touchscreen was touched in the proximity of the coordinates of oneof the button locations. If it was, then the name of the button is printed to the REPL. This is followed by a

    final for statement. This for statement allows for the corresponding note's audio file to play three times.

    This is followed by a delay. The length of the delay will determine the amount of time between each time

    the audio files are played. You may want to adjust it depending on your guitar tuning preferences.

    if touch: for i in range(6): tuning = notes[i] button = buttons[i] if button.contains(touch) and not note_select: print("Touched", button.name) note_select = True for z in range(3): pyportal.play_file(tuning) time.sleep(0.1)

    © Adafruit Industries https://learn.adafruit.com/pyportal-guitar-tuner Page 21 of 28

  • © Adafruit Industries https://learn.adafruit.com/pyportal-guitar-tuner Page 22 of 28

  • Assembly

    Hardware SetupUse 4x M2.5 x 6mm long FF standoffs and 4x M2.5 x 6mm

    long screws to secure the PCB plate to the PyPortal.

    Install StandoffsInsert M2.5 x 6mm screws through the top of the mounting

    tabs on PyPortal. Fasten M2.5 x 6mm long standoffs onto the

    threads of the screws.

    Screen CoverOrient the screen cover with the display on the PyPortal. Use

    the photo to reference the correct orientation.

    © Adafruit Industries https://learn.adafruit.com/pyportal-guitar-tuner Page 23 of 28

    https://learn.adafruit.com//assets/91799https://learn.adafruit.com//assets/91800https://learn.adafruit.com//assets/91801

  • Install Screen CoverFit the PyPortal display into the recess on the screen cover.

    Press the screen to fully seat into the screen cover.

    Installed Screen CoverThe screen cover helps to keep the display attached to the

    PyPortal. The viewing area is exposed and does not obstruct

    display. This also hides the screens bezel.

    Installing Plate and SpeakerThe PyPortal is secured to the PCB plate using 4x M2.5 x

    6mm screws. The mini oval speaker is press fitted onto the

    speaker holder on the PCB plate.

    Connect SpeakerPlug in the molex pico connector from the speaker to the

    speaker port on the back of the PyPortal.

    © Adafruit Industries https://learn.adafruit.com/pyportal-guitar-tuner Page 24 of 28

    https://learn.adafruit.com//assets/91802https://learn.adafruit.com//assets/91803https://learn.adafruit.com//assets/91804https://learn.adafruit.com//assets/91806

  • Install SpeakerPress fit the body of the speaker into the speaker holder in

    the center of the PCB plate. Reference the photo for best

    orientation.

    Secure PyPortalPlace the PCB plate to the back of the PyPortal with the

    mounting holes lined up with the standoffs.

    Install FrameOrient the frame with the mount tabs on the PCB plate. Line

    up the mounting holes in the frame with the mounting tabs on

    the PCB.

    Secure FrameInsert 4x M2.5 x 6mm screws into the side of the frame and

    through the mounting tabs on the PCB plate. Insert and

    fasten 4x M2.5 hex nuts onto threads of the screws and

    tighten.

    © Adafruit Industries https://learn.adafruit.com/pyportal-guitar-tuner Page 25 of 28

    https://learn.adafruit.com//assets/91805https://learn.adafruit.com//assets/91807https://learn.adafruit.com//assets/91808https://learn.adafruit.com//assets/91809

  • Final BuildAnd now we're ready for some guitar tuning!

    Going FurtherThe frame has adequate amount of space for a USB battery

    or other components.

    © Adafruit Industries https://learn.adafruit.com/pyportal-guitar-tuner Page 26 of 28

    https://learn.adafruit.com//assets/91810https://learn.adafruit.com//assets/91811

  • © Adafruit Industries https://learn.adafruit.com/pyportal-guitar-tuner Page 27 of 28

  • © Adafruit Industries Last Updated: 2021-03-17 01:18:12 PM EDT Page 28 of 28

    Guide ContentsOverviewCircuitPython Power!3D Printed PyPortal CaseParts

    3D PrintingParts ListCAD AssemblySlicing PartsDesign Source Files

    Install CircuitPythonSet up CircuitPython Quick Start!PyPortal Default Files

    CircuitPython LibrariesInstalling the CircuitPython Library BundleExample Files

    Copying Libraries to Your BoardExample: ImportError Due to Missing LibraryLibrary Install on Non-Express BoardsUpdating CircuitPython Libraries/Examples

    Coding the PyPortal Guitar TunerAdding LibrariesCodeAudio Files and Bitmap Graphic

    CircuitPython Code WalkthroughSetupCircuitPython LibrariesDisplay SetupLoading Audio FilesTouchscreen ButtonsButton State

    The LoopPlay Notes

    AssemblyHardware SetupInstall StandoffsScreen CoverInstall Screen CoverInstalled Screen CoverInstalling Plate and SpeakerConnect SpeakerInstall SpeakerSecure PyPortalInstall FrameSecure FrameFinal BuildGoing Further