212 lines
5.4 KiB
Markdown
212 lines
5.4 KiB
Markdown
|
# 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
|
|||
|
```
|