update readme, separate manual installation

This commit is contained in:
Lurkars 2022-02-08 20:54:13 +01:00
parent 02dadda58f
commit 43a270f4e4
2 changed files with 257 additions and 253 deletions

211
INSTALL.md Normal file
View File

@ -0,0 +1,211 @@
# Manual installation
Manual installation of your **luniebox**. If you haven't read, please go back to the [README](README.md) for hardware requirements, prerequisites and setup.
## Software
- go to home directory
```
cd /home/pi
```
- install `git`, `python3-venv` and `python3-pip`
```
sudo apt install -y git python3-venv python3-pip
```
- clone repository `https://git.bstly.de/Lurkars/luniebox.git` with sources and config:
```
git clone https://git.bstly.de/Lurkars/luniebox.git luniebox
```
### **luniebox** application and daemon
- setup application by building python venv and configure systemd service
```
cd /home/pi/luniebox/application
python -m venv venv
source venv/bin/activate
export CFLAGS=-fcommon
pip install -r requirements.txt
deactivate
mkdir /home/pi/luniebox/config
cp /home/pi/luniebox/contrib/config/luniebox.cfg /home/pi/luniebox/config/luniebox.cfg
sudo cp /home/pi/luniebox/contrib/service/luniebox-app.service /etc/systemd/system/
sudo cp /home/pi/luniebox/contrib/service/luniebox-daemon.service /etc/systemd/system/
sudo systemctl daemon-reload
sudo systemctl enable luniebox-app luniebox-daemon
```
### Spotify
For Spotify support, spofiyd is required.
- get spotifyd binary and configure systemd service
```
mkdir /home/pi/luniebox/bin`
wget -c https://github.com/Spotifyd/spotifyd/releases/download/v0.3.3/spotifyd-linux-armv6-slim.tar.gz -O - | tar -xz -C /home/pi/luniebox/bin
cp /home/pi/luniebox/contrib/config/spotifyd.cfg /home/pi/luniebox/config/spotifyd.cfg
sudo cp /home/pi/luniebox/contrib/service/spotifyd.service /etc/systemd/system/`
sudo systemctl daemon-reload`
sudo systemctl enable spotifyd
```
> If you use other audio hardware, you may need to adjust the `backend` and `device` property in `/home/pi/luniebox/config/spotifyd.cfg` to your needs!
### Music Player Daemon
for offline file support install [Music Player Daemon](https://www.musicpd.org/) (mpd)
- create library folder and install `mpd`
```
mkdir /home/pi/luniebox/library
sudo apt install -y mpd
sudo cp /home/pi/luniebox/contrib/config/mpd.conf /etc/mpd.conf
```
> If you use other audio hardware, you may need to adjust the `audio_output` in `/etc/mpc.conf` section to your needs!
### ClSpotify
for Spotify offline support install [ClSpotify](https://github.com/agent255/clspotify.git) (requires [spotify](#spotify) and [mpd](#music-player-daemon)!).
- get code, install pythen venv and update config
```
git clone https://github.com/agent255/clspotify.git /home/pi/clspotify
cd /home/pi/clspotify
python -m venv venv
source venv/bin/activate
pip install -r requirements.txt
deactivate
sed -i "s/^zspotify_path =.*$/zspotify_path = \/home\/pi\/clspotify\//" /home/pi/luniebox/config/luniebox.cfg
```
## Hardware
### RC522 RFID Reader
- uncomment `dtparam=spi=on` in `/boot/config.txt` tp enable SPI for RC522
```
sudo sed -i "/dtparam=spi=on/s/^#//g" /boot/config.txt
```
- connect RC522
- SDA to Pin 24 \[GPIO 8 / SPI0 CE0\]
- SCK to Pin 23 \[GPIO 11 / SPI0 SCLK / CLK\]
- MOSI to Pin 19 \[GPIO 10 / SPI0 MOSI\]
- MISO to Pin 21 \[GPIO 9 / SPI0 MISO\]
- GND to Pin 20 \[Ground\]
- RST to Pin 22 \[GPIO 25\]
- 3.3v to Pin 1 \[3v3 Power\]
### Pimoroni Amp or DAC
- disable onboard audio comment out `dtparam=audio=on` in `/boot/config.txt`
```
sudo sed -i "/dtparam=audio=on/s/^/#/g" /boot/config.txt
```
- setup hifiberry-dac by adding following content to `/boot/config.txt`
> ```
> # setup hifiberry for Pimoroni Shim
> dtoverlay=hifiberry-dac
> gpio=25=op,dh
> ```
```
printf "\n# setup hifiberry for Pimoroni Shim\ndtoverlay=hifiberry-dac\ngpio=25=op,dh\n" | sudo tee -a /boot/config.txt
```
### Adafruit Speaker Bonnet for Raspberry Pi
- disable onboard audio comment out `dtparam=audio=on` in `/boot/config.txt`
```
sudo sed -i "/dtparam=audio=on/s/^/#/g" /boot/config.txt
```
- setup hifiberry-dac and i2s by adding following content to `/boot/config.txt`
> ```
> # setup hifiberry and i2s for Adafruit Speaker Bonnet
> dtoverlay=hifiberry-dac
> dtoverlay=i2s-mmap
> ```
```
printf "\n# setup hifiberry and i2s for Adafruit Speaker Bonnet\ndtoverlay=hifiberry-dac\ndtoverlay=i2s-mmap\n" | sudo tee -a /boot/config.txt
```
- copy [contrib/config/asound.conf](contrib/config/asound.conf) to `/etc/asound.conf`.
```
cat /home/pi/luniebox/contrib/config/asound.conf | sudo tee /etc/asound.conf
```
- copy [contrib/config/.asoundrc](contrib/config/.asoundrc) to `/home/pi/.asoundrc`.
```
cat /home/pi/luniebox/contrib/config/.asoundrc | tee /home/pi/.asoundrc
```
### MPU9250 9-axis sensor
- install `i2c-tools` and `python3-smbus`
```
sudo apt install -y i2c-tools python3-smbus
```
- uncomment `dtparam=i2c_arm=on` in `/boot/config.txt` to enable I2C for MPU9250
```
sudo sed -i "/dtparam=i2c_arm=on/s/^#//g" /boot/config.txt
```
- setup i2c bus 4 for MPU9250 by adding following content to `/boot/config.txt`
> ```
> # setup ic2 bus 4 for mpu
> dtoverlay=i2c-gpio,bus=4,i2c_gpio_delay_us=1,i2c_gpio_sda=23,i2c_gpio_scl=24
> ```
```
printf "\n# setup i2c bus 4 for mpu\ndtoverlay=i2c-gpio,bus=4,i2c_gpio_delay_us=1,i2c_gpio_sda=23,i2c_gpio_scl=24\n" | sudo tee -a /boot/config.txt
```
## Finish installation
- reboot system.
```
sudo reboot
```

297
README.md
View File

@ -1,6 +1,6 @@
# luniebox # luniebox
lunibox is a RFID jukebox based on a Raspberry Pi. It is similar to the [Phoniebox](https://www.phoniebox.de) \[[GitHub](https://github.com/MiczFlor/RPi-Jukebox-RFID)\] and an upgrade of the [TonUINO (de)](https://www.voss.earth/tonuino/) which both are DIY versions of the popular Toniebox©. The main focus for now is to play Spotify© content and playing local files (also supports Spotify© download for offline use). Other sources will be integrated later. **luniebox** is a RFID jukebox based on a Raspberry Pi. It is similar to the [Phoniebox](https://www.phoniebox.de) \[[GitHub](https://github.com/MiczFlor/RPi-Jukebox-RFID)\] and an upgrade of the [TonUINO (de)](https://www.voss.earth/tonuino/) which both are DIY versions of the popular Toniebox©. The main focus for now is to play Spotify© content and playing local files (also supports Spotify© download for offline use). Other sources will be integrated later.
## Prerequisites ## Prerequisites
@ -60,271 +60,64 @@ Open terminal on your pi or establish a ssh connection to your Pi:
> **⚠️ Warning: you should change the default password by executing `passwd` after login** > **⚠️ Warning: you should change the default password by executing `passwd` after login**
### Automatic setup ### Hardware connection
> **⚠️ Warning: executing scripts from the internet without checking is bad. This is only done to get things done fast. In any doubts you can perform the [Manual setup](#manual-setup) and execute all commands step-by-step to understand what's going on.** For a detailed Raspberry Pi pinout take a look at [https://pinout.xyz](https://pinout.xyz).
Download and execute the `luniebox.sh` script to go trough an interactive setup process. You can also pass the `-a` argument to skip any prompts. Use the `-h` argument for detailed parameter to configure automatic setup directly. #### Connect RC522 RFID Reader
- download and excecute setup script from web - SDA to Pin 24 \[GPIO 8 / SPI0 CE0\]
- SCK to Pin 23 \[GPIO 11 / SPI0 SCLK / CLK\]
- MOSI to Pin 19 \[GPIO 10 / SPI0 MOSI\]
- MISO to Pin 21 \[GPIO 9 / SPI0 MISO\]
- GND to Pin 20 \[Ground\]
- RST to Pin 22 \[GPIO 25\]
- 3.3v to Pin 1 \[3v3 Power\]
- interactive #### Connect Push Buttons
``` - first push button (volume down)
bash <(curl -s https://git.bstly.de/Lurkars/luniebox/raw/branch/main/luniebox.sh) 1. Pin 8 \[GPIO 14\]
``` 2. Pin 6 \[Ground\]
- full automatic - second push button (volume up)
1. Pin 7 \[GPIO 4\]
2. Pin 9 \[Ground\]
``` #### Connect MPU9250 9-axis sensor
bash <(curl -s https://git.bstly.de/Lurkars/luniebox/raw/branch/main/luniebox.sh) -a
```
- Alternative first download script, take a look and then execute - SDA to Pin 16 \[GPIO 23\]
- SCL to Pin 18 \[GPIO 24\]
- GND to Pin 14 \[Ground\]
- 3V3 to Pin 17 \[3v3 Power\]
### Installation
By downloading and executing the [luniebox.sh](luniebox.sh) script you go trough an interactive installation process. You can also pass the `-a` argument to skip any prompts. Use the `-h` argument for detailed parameter to configure automatic installation directly to choose for example your audio device.
> **⚠️ Warning: executing scripts from the internet without checking is bad. This is only done to get things done fast. In any doubts you can perform the installation manually and execute all commands step-by-step to understand what's going on. For a detailed instruction got to the [INSTALL](INSTALL.md) document**
- interactive
```
bash <(curl -s https://git.bstly.de/Lurkars/luniebox/raw/branch/main/luniebox.sh)
```
- full automatic
```
bash <(curl -s https://git.bstly.de/Lurkars/luniebox/raw/branch/main/luniebox.sh) -a
```
- alternative first download script, take a look and then execute
``` ```
curl https://git.bstly.de/Lurkars/luniebox/raw/branch/main/luniebox.sh -o luniebox.sh curl https://git.bstly.de/Lurkars/luniebox/raw/branch/main/luniebox.sh -o luniebox.sh
chmod +x luniebox.sh chmod +x luniebox.sh
```
- interactive ./luniebox.sh
```
./luniebox.sh
```
- full automatic
```
./luniebox.sh -a
```
### Manual setup
#### Software setup
- go to home directory
```
cd /home/pi
```
- install `git`, `python3-venv` and `python3-pip`
```
sudo apt install -y git python3-venv python3-pip
```
- clone repository `https://git.bstly.de/Lurkars/luniebox.git` with sources and config:
```
git clone https://git.bstly.de/Lurkars/luniebox.git luniebox
```
##### Setup luniebox application and daemon
- setup application by building python venv and setup systemd service
```
cd /home/pi/luniebox/application
python -m venv venv
source venv/bin/activate
export CFLAGS=-fcommon
pip install -r requirements.txt
deactivate
mkdir /home/pi/luniebox/config
cp /home/pi/luniebox/contrib/config/luniebox.cfg /home/pi/luniebox/config/luniebox.cfg
sudo cp /home/pi/luniebox/contrib/service/luniebox-app.service /etc/systemd/system/
sudo cp /home/pi/luniebox/contrib/service/luniebox-daemon.service /etc/systemd/system/
sudo systemctl daemon-reload
sudo systemctl enable luniebox-app luniebox-daemon
```
##### Setup spotify
For Spotify support, spofiyd is required.
- get spotifyd binary and setup systemd service
```
mkdir /home/pi/luniebox/bin`
wget -c https://github.com/Spotifyd/spotifyd/releases/download/v0.3.3/spotifyd-linux-armv6-slim.tar.gz -O - | tar -xz -C /home/pi/luniebox/bin
cp /home/pi/luniebox/contrib/config/spotifyd.cfg /home/pi/luniebox/config/spotifyd.cfg
sudo cp /home/pi/luniebox/contrib/service/spotifyd.service /etc/systemd/system/`
sudo systemctl daemon-reload`
sudo systemctl enable spotifyd
```
> If you use other audio hardware, you may need to adjust the `backend` and `device` property in `/home/pi/luniebox/config/spotifyd.cfg` to your needs!
##### Setup Music Player Daemon
for offline file support setup [Music Player Daemon](https://www.musicpd.org/) (mpd)
- create library folder and install `mpd`
```
mkdir /home/pi/luniebox/library
sudo apt install -y mpd
sudo cp /home/pi/luniebox/contrib/config/mpd.conf /etc/mpd.conf
```
> If you use other audio hardware, you may need to adjust the `audio_output` in `/etc/mpc.conf` section to your needs!
##### Setup ClSpotify
for Spotify offline support setup [ClSpotify](https://github.com/agent255/clspotify.git) (requires [spotify](#setup-spotify) and [mpd](#setup-music-player-daemon)!).
- get code, install pythen venv and update config
```
git clone https://github.com/agent255/clspotify.git /home/pi/clspotify
cd /home/pi/clspotify
python -m venv venv
source venv/bin/activate
pip install -r requirements.txt
deactivate
sed -i "s/^zspotify_path =.*$/zspotify_path = \/home\/pi\/clspotify\//" /home/pi/luniebox/config/luniebox.cfg
```
#### Hardware Setup
For a detailed Raspberry Pi pinout take a look at [https://pinout.xyz](https://pinout.xyz).
##### Setup RC522 RFID Reader
- uncomment `dtparam=spi=on` in `/boot/config.txt` tp enable SPI for RC522
```
sudo sed -i "/dtparam=spi=on/s/^#//g" /boot/config.txt
```
- connect RC522
- SDA to Pin 24 \[GPIO 8 / SPI0 CE0\]
- SCK to Pin 23 \[GPIO 11 / SPI0 SCLK / CLK\]
- MOSI to Pin 19 \[GPIO 10 / SPI0 MOSI\]
- MISO to Pin 21 \[GPIO 9 / SPI0 MISO\]
- GND to Pin 20 \[Ground\]
- RST to Pin 22 \[GPIO 25\]
- 3.3v to Pin 1 \[3v3 Power\]
##### Setup Pimoroni Amp or DAC
- disable onboard audio comment out `dtparam=audio=on` in `/boot/config.txt`
```
sudo sed -i "/dtparam=audio=on/s/^/#/g" /boot/config.txt
```
- setup hifiberry-dac by adding following content to `/boot/config.txt`
> ```
> # setup hifiberry for Pimoroni Shim
> dtoverlay=hifiberry-dac
> gpio=25=op,dh
> ```
```
printf "\n# setup hifiberry for Pimoroni Shim\ndtoverlay=hifiberry-dac\ngpio=25=op,dh\n" | sudo tee -a /boot/config.txt
```
##### Setup Adafruit Speaker Bonnet for Raspberry Pi
- disable onboard audio comment out `dtparam=audio=on` in `/boot/config.txt`
```
sudo sed -i "/dtparam=audio=on/s/^/#/g" /boot/config.txt
```
- setup hifiberry-dac and i2s by adding following content to `/boot/config.txt`
> ```
> # setup hifiberry and i2s for Adafruit Speaker Bonnet
> dtoverlay=hifiberry-dac
> dtoverlay=i2s-mmap
> ```
```
printf "\n# setup hifiberry and i2s for Adafruit Speaker Bonnet\ndtoverlay=hifiberry-dac\ndtoverlay=i2s-mmap\n" | sudo tee -a /boot/config.txt
```
- copy [contrib/config/asound.conf](contrib/config/asound.conf) to `/etc/asound.conf`.
```
cat /home/pi/luniebox/contrib/config/asound.conf | sudo tee /etc/asound.conf
```
- copy [contrib/config/.asoundrc](contrib/config/.asoundrc) to `/home/pi/.asoundrc`.
```
cat /home/pi/luniebox/contrib/config/.asoundrc | tee /home/pi/.asoundrc
```
##### Setup Push Buttons
- connect first push button (volume down)
1. Pin 8 \[GPIO 14\]
2. Pin 6 \[Ground\]
- connect second push button (volume up)
1. Pin 7 \[GPIO 4\]
2. Pin 9 \[Ground\]
##### Setup MPU9250 9-axis sensor
- install `i2c-tools` and `python3-smbus`
```
sudo apt install -y i2c-tools python3-smbus
```
- uncomment `dtparam=i2c_arm=on` in `/boot/config.txt` to enable I2C for MPU9250
```
sudo sed -i "/dtparam=i2c_arm=on/s/^#//g" /boot/config.txt
```
- setup i2c bus 4 for MPU9250 by adding following content to `/boot/config.txt`
> ```
> # setup ic2 bus 4 for mpu
> dtoverlay=i2c-gpio,bus=4,i2c_gpio_delay_us=1,i2c_gpio_sda=23,i2c_gpio_scl=24
> ```
```
printf "\n# setup i2c bus 4 for mpu\ndtoverlay=i2c-gpio,bus=4,i2c_gpio_delay_us=1,i2c_gpio_sda=23,i2c_gpio_scl=24\n" | sudo tee -a /boot/config.txt
```
- connect MPU9250
- SDA to Pin 16 \[GPIO 23\]
- SCL to Pin 18 \[GPIO 24\]
- GND to Pin 14 \[Ground\]
- 3V3 to Pin 17 \[3v3 Power\]
#### Finish Setup
- After setup, reboot system.
```
sudo reboot
``` ```
## Planned features ## Planned features