The One Button Audiobook Player

This little Raspberry Pi based project is a gift for my wife's grandmother for her 90th birthday. Being visually impaired, she is hard to entertain but loves to listen to audiobooks. The problem is, that she isn't able to handle a ghetto blaster or MP3 player.

The solution to this problem was – tadaaaah – a one button audiobook player 🙂

It basically consists of:

The following software has been used:

The features are the following:

Some pics and a video:

image

image

(The audiobook used in this video is a free version of Cory Doctorows „Little Brother“ from Fabian Neidhardt)

If you like to build your own one button audio book player, here are the super simple schematics:

image

And last but not least – the python script. The code might be crappy, please comment if you have improvements (especially regarding loadMusic). You can find it here:

https://codeberg.org/mclemens/theonebuttonaudiobookplayer

Update (2013-11-26)

Here's what Russel wrote in a comment to this post:

Install the following packages:
sudo apt-get install mpd
sudo apt-get install mpc
sudo apt-get install python-mpd
sudo apt-get install python-pyudev

(below assumes using defaults for /etc/mpd.conf)
sudo mkdir -p /music/usb
sudo ln -s /var/lib/mpd /music/mpd
sudo ln -s /var/lib/mpd/music /music/mp3

Copy the tobabp.py script to /home/pi
nano /home/pi/tobabp.py

Change these in the script or flip the connections in wiring diagram.
BUTTON = 17
LED = 24

Testing

Rename a USB stick to “1GB”
Copy 1 MP3 onto the stick

Insert the stick into pi
sudo mount /dev/sda1 /music/usb
sudo /etc/init.d/mpd stop
sudo rm /music/mp3/*
sudo cp /music/usb/* /music/mp3/
sudo umount /music/usb

Remove the USB stick
sudo rm /music/mpd/tag_cache
sudo /etc/init.d/mpd start
mpc clear
mpc ls
mpc ls | mpc add
sudo /etc/init.d/mpd restart
mpc play

Plug in earphones
You should hear audio

Next try the python script:
sudo python /home/pi/tobabp.py

Insert USB stick
the LED should flash and the USB file copy to /music/mp3/
the LED should flash again. Remove the Stick and LED flashes again.
Press button to start playing
Press button again to stop
Press & hold button to rewind to beginning.
sudo crontab -e
Add following line run at startup
@reboot python /home/pi/tobabp.py &
sudo reboot

Then retest again to be sure all is well.

#raspberrypi #code #audiobook