Project tutorial
ENGI_301 Project_01

ENGI_301 Project_01 © GPL3+

This is a fun beginner-level project using PocketBeagle to record and play audio recordings!

  • 98 views
  • 0 comments
  • 0 respects

Components and supplies

About this project

MY STORY:

In this course, I wanted to apply what I learned throughout the semester in a simple project that can be easily replicated. I feel like incorporating the push button in the device makes it more interactive and fun with the user, and using already existing functions of record and play audio would not be too complex.

I struggled in the beginning with using Cloud9 as the terminal window, but I got used to it and became comfortable with Python. I also found it useful to play around with Flite (text to speech command system) in the beginning to ensure that my audio inputs and outputs were working properly.

BUILD INSTRUCTIONS:

1. collect all of the needed hardware devices

2. solder the pocketbeagle pins (4 rows) and connect the UB & UI and ID & GND also by soldering them together

3. use the micro USB adapter to connect the female USB

4. add the plugable audio adapter to the USB port and attach the microphone and earphones to the respective places

5. add the push button anywhere you want

6. use the fritzing diagram to wire the breadboard (4 wires total) and add the resistors (3 total)

7. you have successfully wired build the device! (:

OPERATION INSTRUCTIONS:

1. press the push button

2. use the microphone to say what you want to record (immediately starts to record once the button is pressed, and

will continue to do so for 10 seconds)

3. then use the earphones to hear your audio file back (immediately after it records)

4. now you have a voice recorder/playback device! (:

VIDEO OF DEVICE:

https://github.com/bonnie1314/ENGI301/tree/master/project_01

^ for more information (README, code, and more) visit my github! (:


*** Also thanks to my ENGI 301 class and Professor Welsh for y'alls help!***

Code

codecodecode.pyPython
"""
--------------------------------------------------------------------------
Code for Project 01 -- ENGI 301
--------------------------------------------------------------------------
License:   Copyright 2019 Bonnie Wang

Redistribution and use in source and binary forms, with or without modification, are permitted provided that the 
following conditions are met:
    1. Redistributions of source code must retain the above copyright notice, this list of conditions and the 
    following disclaimer.
    2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the 
    following disclaimer in the documentation and/or other materials provided with the distribution.
    3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote 
    products derived from this software without specific prior written permission.
    
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, 
INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, 
STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF 
ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
--------------------------------------------------------------------------
Software API:  
* update_flite
        - need to first install flite:
            apt-get install flite
* update_alsa-utils
--------------------------------------------------------------------------
Background Information:   
* Using text to speech commands with flite:    
    - http://einsteiniumstudios.com/make-your-beaglebone-speak.html
* (No base code)
--------------------------------------------------------------------------

"""

# Import required programs
import os system
import Adafruit_BBIO.EDC as ADC
import Adafruit_BBIO.GPIO as GPIO
import Adafruit_BBIO.PWM as PWM

# Global variables:
BUTTON = "P2_2"

# Initialize Button    
GPIO.setup(BUTTON, GPIO.IN)

# Initialize voice file
flite -t "this is the voice file" -o voicefile.wav

# When the button is pressed...
if(GPIO.input(BUTTON0) == 1):
    # Immediately start recording using the microphone for 10 seconds
    os.system(arecord -d 10 -f cd voicefile.wav)
    # Then will play the audio back from the audio output
    os.system(aplay voicefile.wav)

# That's it! (:
extra soldering of pocketbeagle pins for USBPython
No preview (download only).
video of devicePython
No preview (download only).
final devicePython
No preview (download only).

Schematics

fritz diagram
this is a visual of the general breadboard setup
bonnie_jtRAZisXOQ.fzz

Comments

Similar projects you might like

Breadboard to PCB Part 1 - Making the Simon Says Game

Project tutorial by Monica Houston and Katie Kristoff

  • 8,194 views
  • 11 comments
  • 30 respects

A Simple Reflex Game

Project tutorial by rowan07

  • 1,209 views
  • 0 comments
  • 6 respects

GPS Datalogger, Spatial Analysis, and Azure IoT Hub.

Project tutorial by Shawn Cruise

  • 22,112 views
  • 4 comments
  • 81 respects

Talking Clock 2 - New Version (Bilingual: EN-PT)

Project tutorial by LAGSILVA

  • 11,813 views
  • 27 comments
  • 41 respects

Smart Door with Face Unlock

Project tutorial by Divins Mathew

  • 10,652 views
  • 4 comments
  • 21 respects
Add projectSign up / Login