Skip to content

PiPod MP3 player with a 250 × 122 e-Paper screen

Notifications You must be signed in to change notification settings

delhatch/PiPod_ePaper

Repository files navigation

PiPod_ePaper

This project takes the github.com/delhatch/PiPod project (which was derived from github.com/BramRausch/PiPod) and replaces the LCD screen with an e-Paper screen.

Motivation

The goal of this project was switching from a 2.2" 320x240 LCD screen to a 2.13" 250x122 e-Paper screen (from Waveshare) in order to extend the battery run-time.

Using the project's standard 1200 mAh battery, the continuous play time is now 4 hours, 48 minutes. Since a USB power supply is rarely far away, this seems sufficient.

In addition to using an e-paper screen, I also added a headphone amplifier based on the TP6113 IC. Note: This amplifier is rated at 40 mW, which does not sound like a lot of power, but even with inefficient headphones this equates to 108 dBSPL (equivalent to a gas lawn mower at 1m), which is far too loud for sustained listening. Watch your volume setting!

Project Derivation

This project is derived from github.com/delhatch/PiPod_Zero2W. This repository has changes to impliment the use of the e-Paper screen, along with other minor bug fixes.

Structural Changes

I have changed the OS to the "lite" version: 2024-03-15-raspios-bookworm-arm64-lite.img.xz This change reduces power consumption by ~20 mA, which is a 9% savings, so reasonably significant.

Also moved from Pygame to Pillow for the screen graphics.

Then I got rid of Pygame completely, since I was only using it for the key stroke buffer, and the Python keypad library was already taking care of that. Eliminating Pygame reduced power consumption by 9.2% when idle, and by 5.2% when playing music.

Status

28 June 2024: I built a unit with the Rev2 PCB (black PCB, see pics). It works great. The Rev3 (current) case files appear to be acceptable.

Power Savings

With the LCD screen, with the backlight on, during playback, the current draw is 266 mA.

With the LCD screen, with the backlight off, during playback, the current draw is 220 mA.

With the e-Paper screen, during playback, the current draw is 175 mA.

Having eliminated Pygame, the current draw is down to only 166 mA.

So the e-Paper screen is definitely a major improvement in battery life (playback time), and also useability because there is no anxiety about leaving an LCD backlight on.

Known Bugs

  • None.

Features TODO

  • Test "current draw vs. various refresh rates" for the top (Playing) screen. It updates every 5 seconds, which isn't bad actually, but if this can be reduced without costing too much power, it might be worth it. TBD.
  • Eliminate flashing screen on sub-menus.
  • Impliment an "Adjust Audio EQ" screen.
  • Restore playback state on power-up (restore the play list, and the currently-playing song).
  • Add the use of a GPIO to mute the headphone amp on power-up?
  • Determine if there is a need to install all of the waveshare github. Just need the 2 files in this repo?

Instructions

Completion of these instructions takes about 40 minutes, not including the time transferring the music files.

The bare PC board and case parts can be ordered via this link at PCBWay. For the case parts (top, bottom and frame parts) I specified 3D printing in Nylon: PA-12 with 35% glass fill. For the navigation and side buttons, 3D printing in any cheap white plastic will do.

PCB from PCBWay

Instructions:

  • Download the OS file "2024-03-15-raspios-bookworm-arm64-lite.img.xz" or newer.
  • Using rufus-3.22.exe (or similar), burn the image to a 128GB micro-SD card.
  • Assuming you have a fully-assembled PiPod hardware: Connect an HDMI monitor to the Pi Zero 2 W. Also connect a USB expander hub such as the SmartQ H302S to the Pi Zero usb connector. Connect a USB keyboard to the hub.
  • Insert the SD card into the Pi Zero 2 W slot.
  • Apply power (from a plug-in USB power supply) to the USB connector at the bottom of the PiPod.
  • Power-up and go through the configuration screens. Create the user "pi" with a password of your choosing. Reboot and log in.
  • At the prompt: sudo raspi-config
    • Go into Menu Item #1, then select S1. Enter the SSID and passphrase for your wi-fi.
    • Select menu item #1, then select S5 (Boot/Auto-login) select and enable "Console Autologin".
    • From the top menu, select #3 "Interface Options" then select and enable I1 "Enable SSH".
    • From the top menu, select #3 "Interface Options" then select and enable I4 "Enable I2C".
    • Select "Back" to top screen, then "Finish" and then reboot.
  • Type: sudo nano /boot/firmware/config.txt and make the following changes:
    • If necessary, un-comment dtparam=spi=on (to turn on the SPI port)
    • comment-out the dtparam=audio=on line
    • If necessary, un-comment the line dtparam=12c_arm=on
    • At the end of the file, add a line: dtoverlay=hifiberry-dac
    • CTRL-O and ENTER and CTRL-X to save and exit.
  • sudo reboot
  • Enter the following lines to install the required packages:
    • sudo apt install python3
    • sudo apt install build-essential python3-dev python3-smbus -y
    • sudo apt install git -y
    • sudo apt install python3-vlc -y
    • sudo apt install python3-alsaaudio -y
    • sudo apt install pulseaudio -y
    • sudo apt install python3-taglib -y
    • sudo apt install python3-spidev -y
    • sudo apt install python3-gpiozero -y
    • sudo apt install python3-pip -y
    • sudo apt install python3-pil -y
    • sudo apt install python3-numpy -y
  • sudo reboot
  • Verify that the audio is working. Plug headphones into the PiPod and type:
    • sudo raspi-config
    • Select line #1, then #2 "Audio"
    • Select snd_rpi_hifiberry_dac then Finish
    • type: amixer set Master 50%
    • type: speaker-test -c2
    • Verify that audio is coming from the headphones and not the HDMI monitor.
    • CTRL-C to finish and quit.
  • Install the Adafruit_GPIO library:
    • from the home directory (~/) type: git clone https://github.com/adafruit/Adafruit_Python_GPIO.git
    • cd Adafruit_Python_GPIO
    • sudo python3 setup.py install
  • Install the Adafruit Blinka library:
    • cd ~/
    • sudo pip3 install --break-system-packages Adafruit-Blinka
  • Install the waveshare e-Paper libraries:
    • cd ~/
    • git clone https://github.com/waveshare/e-Paper.git
    • sudo pip3 install --break-system-packages waveshare-epaper epd-library
  • sudo reboot
  • Now fetch the e-Paper MP3 player software from this repository:
    • cd ~/ then type: git clone https://github.com/delhatch/PiPod_ePaper.git
    • cd PiPod_ePaper
    • mv launch.sh ~/.
    • cd ~/
    • chmod 777 launch.sh
    • mkdir .config/systemd
    • mkdir .config/systemd/user
    • cd PiPod_ePaper
    • mv pipod.service ~/.config/systemd/user/.
    • mv -f epd2in13_V4.py ~/e-Paper/RaspberryPi_JetsonNano/python/lib/waveshare_epd/.
    • mv -f epdconfig.py ~/e-Paper/RaspberryPi_JetsonNano/python/lib/waveshare_epd/.
  • Create the directory: mkdir ~/Music
  • Move your music files into this Music directory. You can do this two ways:
    • Method 1: Insert a USB Flash stick into the USB hub, and cp the files over.
      • sudo mount /dev/sda1 /mnt/usb (You'll need to sudo mkdir the /mnt/usb directory)
      • After copying, sudo umount /mnt/usb then remove the USB stick.
    • Method 2: Type: ifconfig and note the IP address. Use the application WinSCP, and use the SFTP protocol, to copy media files from a Windows computer to the PiPod.
  • You should now be able to launch the PiPod software, with everything working.
    • cd into the directory: cd ~/PiPod_ePaper/Software
    • Type: python3 main.py
    • Note that when launching for the first time, it will scan the music files and create an index file. This may take a minute or two.
  • To have the PiPod automatically run the player automatically on power-on:
    • To activate the pipod.service file, at the prompt, type: systemctl --user enable pipod.service
    • Reboot. If there are problems, type: systemctl --user status pipod.service to see if the service launched.
  • To minimize battery power consumption: disable wifi, bluetooth, and reduce the CPU clock speed.
    • sudo nano /boot/firmware/config.txt
    • After the line "dtparam=spi=on add these new lines:
      • dtoverlay=disable-wifi
      • dtoverlay=disable-bt
    • Under the line "Enable DRM VC4 V3D driver", comment out the 2 lines that follow.
    • Comment out the line display_auto_detect=1
    • Under the line "Run as fast as firmware board allows"
      • comment out arm_boost=1
      • add the lines:
        • arm_freq=150
        • core_freq=150
        • over_voltage=-4

    Operating Procedure

    To charge the battery, slide the top power switch to the left. Connect a USB power supply to the USB jack at the bottom of the PiPod. Applying power will start charging the battery, and will also boot the PiPod.

    To shutdown the PiPod, press the up arrow to get into the menu tree. Press the down arrow to "Shutdown". Press the middle button.

    To operate from battery power, you MUST start with the ePiPod in the shutdown state. Do not run from USB power (power switch to the left) and then slide the power switch to the right (battery power). This causes a power glitch. Simply start with an ePiPod in the shutdown state, and slide the power switch to the right. Wait for it to boot.

    While operating from battery power, you can plug (and unplug) the bottom USB jack into a power source to charge the battery.

    To shutdown from battery power, find and press the "Shutdown" command as above. After 5 seconds (and with the bottom USB jack NOT connected to a power source), slide the top power switch to the left.