Introduction: Capacitive Touch Cassette Player With LCD Display

This is a project that I made for my Physical Computing class at Boston College with Professor Gallaugher.

My childhood memories of listening to audiobooks on cassettes and my love for music inspired me to build this project. This cassette player uses a capacitive touchpad to detect when a cassette is inserted and displays the title and artist on the LCD display.

How to operate:

  1. Start the cassette player by pressing the red square button, a welcome message and short introduction will be displayed on the LCD screen
  2. Choose one of the cassettes
  3. Open the cassette compartment and insert the cassette with the copper taped side up
  4. Touch the top of the cassette until the title and artist's name is displayed
  5. Close the cassette compartment
  6. Song will start playing
  7. To stop the song, press the yellow button
  8. Either flip the cassette 180° and insert it again (with the copper taped side up). This way a new song will be played or choose any of the other ones.

Explaining Step 4:

On the bottom of the cassettes are copper connection points that are in a certain position that corresponds to another position at the bottom of the cassette compartment. When a cassette is inserted the copper connection points of the compartment and the ones at the bottom of the cassette touch. To activate the touch and send a signal to the touchpad, the copper taped top of the cassette needs to be touched. This way, the touch is sensed and "sent through" the wires within the cassette, through the connection points and to the touchpads.

As long as the combinations on the bottom of the cassettes are not symmetrical, they change once you flip it around. This way, the touchpad will detect a different combination and a different song will be played.

Example: Cassette 1 (0 indicates no connection point and 1 indicates a connection)
Side 1: 001010
Side 2: 010100

Supplies

Material:

  • 1/8" Baltic Birch wood
  • 1/8" board of clear acrylic

Machines:

  • Trotec Laser Cutter
  • Soldering equipment

Electronics:

  • Raspberry Pi Pico W
  • MPR121 Capacitive Touchpad
  • 2 Buttons
  • LCD Display 20x4
  • I2C Backpack for LCD Display
  • Hamburger Mini Speaker (or any other with an audio jack)
  • 2 Jumper Wire with Aligator clip
  • Jumper Wires
  • SD card (32 GB)
  • Micro SD Card Breakout Board

Other supplies:

  • Electrical Tape
  • Copper Tape
  • Superglue
  • Woodglue
  • Metal hinge

Step 1: Design and Laser Cutting

Starting off, I created the cassette player (box) and cassette file by using the MakerCase Basic Box design. The box includes a cut out for the two buttons and a cut out for the LCD display. To ensure that all of the elements fit into the cut outs I used a digital caliper and measured my buttons and LCD display. To design the cassette compartment I used the Slantedtray design by Boxes.py. In Adobe Illustrator, I added all oy my cut outs and added design elements to make the cassettes and the cassette player design more "authentic". I also added an acrylic piece to the front of the cassette compartment. This way you can see the cassette that is inserted in the player. All files that I've used are attached below.

Next, I laser cut all of my pieces out 1/8" Baltic Birch wood. The only piece that I used 1/8" clear acrylic for is the front square in the cassette compartment mentioned earlier.

Feel free to use other material for the box or cassettes such as colored acrylic. The only thing you need to make sure of is that my designs are all designed for 1/8" thickness in material. When you would prefer another material with a different thickness you would need to adjust for it while creating the templates in Makercase and Boxexs.py.

Creating different cassettes:

Since the combinations at the bottom on the cassettes correlate to a song that will be played, you need to design new combinations for each new cassette. The attached design only includes one cassette.

Step 2: 3D Printing

To connect the touchpad to the cassette compartment and connect the wires within the cassettes, I designed small connection parts. These parts are used in the next step to build the cassettes and compartments.

Cassette Connections

Step 3: Assembling the Cassette Connections

To build the cassette connections I used the 3D printed connection pieces, small jumper wires and copper tape. I cut small squares of copper tape and cut half way done one side of the tape (creating some sort of fringe). After playing the connection piece on the wire you can wrap the fringe copper tape around it and press the ends flat against the flat surface of the connector. To create an even copper layer, I taped more copper tape on the top. This should create a stable connection but feel free to use superglue to ensure that the tape sticks to the sides.

This step has to be repeated for all of the inside cassette wires and 6 longer jumper wires that are connected to the cassette compartment.

Step 4: Cassette

After creating the wires for the cassette, the rest can be assembled. I superglued the connectors to the top and bottom wood pieces. To assemble the rest of the box, I used woodglue. I added two strips of copper wire on the top to create a bigger surface area that can sense the touch, when connected to the touchpad. I repeated this step for all of my three cassettes.

Step 5: Soldering

The next step is to solder the button connections, and the capacitive touchpad connections. For the button connections I clipped off the two metal pieces of one side and soldered two jumper wires on the other one. To stabilize the connection, I used electrical tape and taped it around the soldered part.

Next, I soldered the jumper wires (with the connections on the other side) to the capacitive touchpad. I bend the jumper wires so that they can easily be connected to the touchpads. After soldering one side I flipped the touchpad around and soldered the other side.

To ensure that all of the connections are still working I connected the touchpad to the Pico W and tested out whether the touch was still detected.

Step 6: Cassette Compartment and Box

Using woodglue, I glued the slanted box together and also assembled the big box. To be able to attach the display and have easier access to the electronics, I left the back of the box open. To attach the acrylic piece on the front of the cassette compartment, I used superglue. After assembling the parts, I glued the connection pieces to the holes that are cut out in the bottom of the drawer. Next, I superglued the metal hinge (feel free to use screws to attach the metal hinge). The other side of the hinge is attached inside of the big box.

Step 7: Electronics and Wiring

After all of the assembling is done, I had to wire up all of the electronics and attach them inside the box. I attached the Pico W upside down on the top part of the big box. I attached the LCD using masking tape and superglued the buttons in the cut outs. In the code below, I commented the connection points for all of my electronics.

The LCD code is based on this library and github post by Dan Halbert.

Step 8: Last Step

Now that the whole build is assembled, the last thing that needs to be done is finding songs in a .mp3 format. If the songs are in a different format you can easily use a converter and convert them to the right format. You also need to make sure that you are converting them from stereo to mono. Then, the song files need to be dragged to the SD card. After that step is done, I inserted the SD card in the breakout board that is attached to the Pico W. To be able to display the title and artist's name, I printed the string on the LCD and inserted either spaces or new line characters (\n) to make sure that the text is legible.

If you have any questions, feel free to ask me in the comments and I will try my best to help out!

Thank you for reading my instructable! :)

Step 9: Code

# CASSETTE PLAYER
# All Import Statements
import board, time
# Statements Audio
from audiopwmio import PWMAudioOut as AudioOut
from audiocore import WaveFile
from audiomp3 import MP3Decoder
# Statements SD Card
import sdcardio, storage
# Statements Display
from lcd.lcd import LCD
from lcd.i2c_pcf8574_interface import I2CPCF8574Interface
from lcd.lcd import CursorMode
import busio
# Statements Touchpad
import adafruit_mpr121
# Statements Button
import digitalio
from adafruit_debouncer import Button


# All Set Ups
# Set up SD Card
sck = board.GP10
si = board.GP11
so = board.GP12
cs = board.GP13
spi = busio.SPI(sck, si, so)
sdcard = sdcardio.SDCard(spi, cs)
vfs = storage.VfsFat(sdcard)
storage.mount(vfs, "/sd")


# Set up Display
i2c = busio.I2C(scl=board.GP1, sda=board.GP0)
lcd = LCD(I2CPCF8574Interface(i2c, 0x27), num_rows=4, num_cols=20)


# Set up Touchpad
touch_pad = adafruit_mpr121.MPR121(i2c)


# Set up Audio
audio = AudioOut(board.GP16)  # Wired to GP16
path = "/sd/"  # Include SD connection!
filename = "scrubs.mp3"  # Name of a sound file
mp3_file = open(path + filename, "rb")
decoder = MP3Decoder(mp3_file)


# Call this function passing in a String for the full filename with extension.
def play_mp3(filename):
    stop = False
    decoder.file = open(path + filename, "rb")
    audio.play(decoder)
    while audio.playing:
        if button_B.value == False:
           stop = True
        if stop:
            audio.stop()
            lcd.clear()


# Set up Button
# On and Off Button
button_input_A = digitalio.DigitalInOut(board.GP15)  # Wired to GP15
button_input_A.switch_to_input(digitalio.Pull.UP)
button_A = Button(button_input_A)


# STOP Button
button_B = digitalio.DigitalInOut(board.GP9)  # Wired to GP9
button_B.switch_to_input(pull=digitalio.Pull.UP)


# Songs and their Combinations
# 2 und 4: Dancing in the Moonlight by Toploader
# 1 und 3: No Scrubs by TLC
# 0 und 4: Whatever It Takes by Imagine Dragons
# 1 und 5: Dilemma by Nelly
# 0 und 1: Great Adventures by Boldy James and The Alchemist
# 4 und 5: All I Need by Wiki feat. Earl Sweatshirt


on = False
play = False
name_displayed = False


lcd.clear()


while True:
    button_A.update()
    if button_A.pressed: # ON Button
        on = True
        lcd.print("Welcome!\nChoose a tape to\nlisten to :)")
        time.sleep(3)
        lcd.clear()
        lcd.print("Insert tape and\ntouch top until the\nname of the tape\nappears.")
        time.sleep(5)
        lcd.clear()
    if on: # Insert cassette and touch copper tape
        # Detects Combinations -> Song starts playing
        if touch_pad[2].value and touch_pad[4].value:
            if not name_displayed:
                lcd.print("Dancing in the\nMoonlight\n-\nToploader")
                name_displayed = True
                time.sleep(2)
                play_mp3("moonlight.mp3")
                name_displayed = False
                time.sleep(5)
        if touch_pad[1].value and touch_pad[3].value:
            if not name_displayed:
                lcd.print("No Scrubs\n-\nTLC")
                time.sleep(2)
                name_displayed = True
                play_mp3("scrubs.mp3")
                name_displayed = False
                time.sleep(5)
        if touch_pad[0].value and touch_pad[4].value:
            if not name_displayed:
                lcd.print("Whatever It Takes\n-\nImagine Dragons")
                time.sleep(2)
                name_displayed = True
                play_mp3("whatever.mp3")
                name_displayed = False
                time.sleep(5)
        if touch_pad[1].value and touch_pad[5].value:
            if not name_displayed:
                lcd.print("Dilemma\n-\nNelly")
                time.sleep(2)
                name_displayed = True
                play_mp3("dilemma.mp3")
                name_displayed = False
                time.sleep(5)
        if touch_pad[0].value and touch_pad[1].value:
            if not name_displayed:
                lcd.print("Great Adventures\n-\nBoldy James &\nThe Alchemist")
                time.sleep(2)
                name_displayed = True
                play_mp3("great.mp3")
                name_displayed = False
                time.sleep(5)
        if touch_pad[4].value and touch_pad[5].value:
            if not name_displayed:
                lcd.print("All I Need\n-\nWiki feat.\nEarl Sweatshirt")
                time.sleep(2)
                name_displayed = True
                play_mp3("all.mp3")
                name_displayed = False
                time.sleep(5)

For the Home Contest

Participated in the
For the Home Contest