Skip to content

moasda/audiopi

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

AudioBox for Kids

  1. The project
  2. Shopping list
  3. Setup raspian environment (install basic software)
    • a) System configuration
    • b) Setup audio device for mocp (music over console)
    • c) Install and setup AudioPI Software
    • d) Start/Stop AudioPi service
  4. Control unit for the buttons and LEDs
  5. AudioBox case
    • a) Prepare the case
    • b) Install components
  6. Create qr code cards
  7. Information

1. The project

For my daugther I was looking for a simple device that she can play her audio stories or her music. She is almost 4 years old, so the interface have to be very simple and stable :).

Features:

  • scan qr code to play your music files or audio stories
  • creative (own) design of the case
  • sleeptimeer
  • (optional) streaming web radio or something else
  • (optional) no radiation through bluetooth or wlan (with RaspberryPi 2)

2. Shopping list

Shopping list for the AudioBox:

Object Price Link Comment
RASPBERRY PI 2 MODEL B 1 GB RAM 35,49 € Conrad -
RASPBERRY PI CAMERA V2 8MP IR 29,99 € Conrad I think another camera module for ~5-10 € is also enough! Important: It must be a model where you can adjust the focus!
Raspberry PI Netztei (original!): 6,90 € - -
Kabel: 8,99 € Amazon -
Kiste: 9,95 € Amazon -
Platinen: 6,49 € Amazon -
Netzwerk Buchse: 6,99 € Amazon -
Lautsprecher: 9,99 € Amazon -
Netzwerkkabel: 3,85 € Amazon -
Raspberry PI Gehäuse: 5,99 € Amazon -
USB-Soundkarte: 7,99 € Amazon -
SD-Karte (32 GB): 9,00 € Amazon -
Knöpfe: 9,99 € Amazon -
Total ~150 € - -

For building and testing the control unit i needed some basic equipment:

Object Price Link Comment
Abbiegevorrichtung: 2,98 € Amazon Only needed temporarily. Not needed for product.
Lötkolben: 15,99 € Amazon Only needed temporarily. Not needed for product.
HDMI-Adapter: 7,59 € Amazon Only needed temporarily. Not needed for product.
Steckbrett + Zubehör: 12,99 € Amazon Only needed temporarily. Not needed for product.
Total ~40 € - -

3. Setup raspian environment

Prepare the raspberry pi. Download and install "Raspbian Buster Lite" (without desktop) on your SD card. After booting your raspberry, do the following steps to configure it:

a) System configuration

#start raspian configuration and do the following steps
> sudo raspi-config
# --> set localization (de-de) and keyboard layout
# --> activate "camera module"
# --> activate "auto login"
# --> activate "ssh"
# --> update your system

After that, install all necessary software components.

#Systemupdate
> sudo apt update
> sudo apt upgrade

#QR-Code Software
> sudo apt-get install zbar-tools

#Audioplayer for Playlists
> sudo apt-get install moc moc-ffmpeg-plugin

#Audioplayer for commands
> sudo apt install mpg321

#Install Python Raspberry GPIO
> sudo apt-get install python3-rpi.gpio

#GitClient
> sudo apt-get install git

b) Setup audio device for mocp

Setup USB audio as default (for system)

Get number of sound card:

> aplay -l

In result search for the number of the USB audio device (here "Karte 1: Device...")

**** Liste der Hardware-Geräte (PLAYBACK) ****
Karte 0: ALSA [bcm2835 ALSA], Gerät 0: bcm2835 ALSA [bcm2835 ALSA]
  Sub-Geräte: 7/7
  Sub-Gerät #0: subdevice #0
  Sub-Gerät #1: subdevice #1
  Sub-Gerät #2: subdevice #2
  Sub-Gerät #3: subdevice #3
  Sub-Gerät #4: subdevice #4
  Sub-Gerät #5: subdevice #5
  Sub-Gerät #6: subdevice #6
Karte 0: ALSA [bcm2835 ALSA], Gerät 1: bcm2835 IEC958/HDMI [bcm2835 IEC958/HDMI]
  Sub-Geräte: 1/1
  Sub-Gerät #0: subdevice #0
Karte 0: ALSA [bcm2835 ALSA], Gerät 2: bcm2835 IEC958/HDMI1 [bcm2835 IEC958/HDMI1]
  Sub-Geräte: 1/1
  Sub-Gerät #0: subdevice #0
Karte 1: Device [USB Audio Device], Gerät 0: USB Audio [USB Audio]
  Sub-Geräte: 1/1
  Sub-Gerät #0: subdevice #0

The USB sound device can be made the default audio device by editing a system file "alsa.conf":

> sudo nano /usr/share/alsa/alsa.conf

Scroll and find the following two lines:

defaults.ctl.card 0
defaults.pcm.card 0

Change the 0 to a 1 to match the card number of the USB device :

defaults.ctl.card 1
defaults.pcm.card 1

To save the file and return to the command line use [CTRL-X], [Y], [ENTER].

Test sound card (after reboot!)

> speaker-test -c2
# or download a sample file and play
> wget https://www.kozco.com/tech/piano2.wav
> aplay piano2.wav

Setup USB audio as default audio device (for mocp only)

Do this step after c) "Install and setup AudioPi".

This step is only necessary if our cardnumber not equals 1.

#Config USB soundcard for mocp and set your card number
> nano ~/.moc/config

c) Install and setup AudioPi

#Switch to "home" (~) and checkout sources from github
> cd ~
/home/pi> git clone https://github.com/moasda/audiopi.git

#Run install script
/home/pi> chmod 755 ./audiopi/install/install.sh
/home/pi> ./audiopi/install/install.sh

d) Start/Stop AudioPi service

#Stop AudioPi service
> sudo systemctl stop audiopi.service

#Stop AudioPi service
> sudo systemctl start audiopi.service

#Check AudioPi service status
> sudo systemctl status audiopi.service

Attention: After AudioPi started, you have 15 Minutes to stop the service until automatical shutdown happens!

4. Control unit for buttons and LEDs

Create and test the setup for buttons and LEDs (see details):

The plan: Test the plan:
The finale platine:

#todo: table: Pins & GPIOs on the PI

5. AudioBox case

Empty box with holes for the buttons, speakers and qr code card. I used a metal mosquito screen to protect the speakers.

Building the photobox for the qr code cards.

6. Create qr code cards

Create the qr codes for example with the online tool "(the qrcode generator)".

Audio cards

@todo

Special cards

  • update system @todo

  • sync audio files @todo

  • timer @todo

  • commands @todo

7. Information

Other useful commands

#check camera module (for adjusting focus)
> raspistill -d -w 320 -h 240 -r

#shudown the system
> sudo shutdown -h now
> sudo halt

#reboot the system
> sudo reboot

#Rename folders and replace space with underscore
> find ~/music -type d -name '* *' -execdir bash -c 'mv "$1" "${1// /_}"' bash {} \;

Useful links

Tutorials / Examples:

Example projects: "Musikrakete" and "Quido"

Used code snippets: "Musikrakete" and "Quido"

Raspberry GPIO Pins

Setup LEDs, Buttons and develope the python code

HowTo: Powerbutton

HowTo: Power-LED

Python script as systemd daemon

Inspiration:

RPi-Jukebox-RFID

Selfmade-Phoniebox

Misc:

Convert text to MP3 for info about start/stop of some scripts, started by qr code card

Static IP for the PI

About

AudioBox for Kids

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published