SlabPi: Difference between revisions

From NURDspace
No edit summary
No edit summary
 
(65 intermediate revisions by 7 users not shown)
Line 1: Line 1:
<div class="borderc5 backgroundc2" style="padding:0; margin:0 0 0.5em 0; border-style:solid; border-width:medium">
{| width="100%" align="center" style="text-align:left; "
| style="align:left;" | [[Image:Nuvola apps important.svg|25px|Outdated]]
| style="padding-left:5px;" | '''IMPORTANT:''' This page about Slabpi is outdated. Now a days, Slabpi is only running a snapcast client and cups for the label and recipe printers.
Please see [[spacesound]] instead
|}</div>
{{Inventory
{{Inventory
|Name=SlabPi
|Name=SlabPi
|Owner=Invict
|Owner=Space
|Status=Infrastructure
|Status=Infra
|Location=Behind the printer
|Hostname=slabpi.lan.nurd.space
|Picture=Slabpi.jpg
|Location=Near the amp
|Picture=Slabpi2.jpg
|Tool=No
|Tool=No
}}
}}
SlabPi is the replacement for [[Slab]] on a Raspberry Pi 3. It has been moved, because of [[downscaling]].


It runs the MPD Server, espeak and it has a SenseHAT for measuring temperature, humidity and atmospheric pressure on Raspbian.
*** REPLACED BY [[SLABNUC]] ***
 


==MPD==
==What==
SlabPi is the replacement for [[Slab]] on a [https://www.raspberrypi.org/products/raspberry-pi-4-model-b/ Raspberry Pi 4]. It has been moved, because of [[downscaling]]. And recently got upgraded from a rpi3 to a rpi4, it has a DAC+ Hat for better audio quality.


Fixed an issue where MPD hangs on song change. Fix it by uncommenting "device" option in the "audio_output" block (in my case ALSA) in mpd.conf. This is a common error.
*OS: [https://wiki.ubuntu.com/ARM/RaspberryPi Ubuntu 20.04 aarch64]
*Rpi: Raspberry pi 4 4GB
*SD: 32GB


== Setup ==


Connection through client.
=== Disabled/removed services ===
* disabled unattented-upgrades
* disabled wpa_supplicant
* disabled accounts-daemon
* disabled multipathd
* ubuntu motd spam
* removed snapd


=== Networking ===
It is hooked up with UTP. WLAN has been disabled.
===DAC+===
[https://www.itead.cc/hifi-dac-for-raspberry-pi.html PiFi HIFI DAC+] for better audio quality.
Installation:
Edit /boot/config.txt
Disable the line
#dtparam=audio=on
add
dtoverlay=hifiberry-dacplus
===MPD===


Host: slabpi.dhcp.nurd.space
Host: slabpi.dhcp.nurd.space


Port: 6600
Port: 6600 (Technically 6005, see the mpd proxy service)
 
It is integrated with Home Assistant view on [[Jarvis]].
 
HTTPD outputs:
* port 6666 (8000:16:1) used by the VOIP system
* port 7777 (44100:16:2) used by Audiophiles


==SenseHAT==
===PulseAudio===
All pulseaudio changes need to be made in /etc/pulse/system.pa (default.pa isn't used)


The measurements are locally readable on a Node-RED dashboard here. http://slabpi.dhcp.nurd.space:1880/ui/#/0 and public on https://metrics.nurd.space/dashboard/db/space-dash?refresh=1m&orgId=1
Pulseaudio is running as a system-wide daemon, it's default sample rate is set to 48Khz and priority has been set to real time.


==Eco button as mpd skip button==
===Icecast===
We have this cute usb Eco Button lying around, which is meant to put your computer in sleep mode in order to save energy. It would be nice if we could use it as an mpd next button.
There is an icecast server on port 8000. It's a direct feed from Pulseaudio so all sounds (Entrance themes, speak commands) will be heard on the stream.


Button gets recognized as shown in dmesg:
Mount point(s):
<pre>[ 1856.485618] hid-generic 0003:0C50:1010.0003: hiddev0,hidraw0:
* /nurds (Pulseaudio)
USB HID v1.10 Device [One small click One big change One small click One big change]
on usb-0000:00:1d.1-2/input0</pre>
After reading [http://www.greygreen.org/blog/code/python/ecobutton-linux] I was hoping this would be easy, but it seems this particular button does not generate keypresses in X.


So over to [https://github.com/s-leroux/hid_mapper], and more info on [https://forum.kodi.tv/showthread.php?tid=88560]. Got an error similar to [https://github.com/Claudio-Sjo/HID_linux_xbmc_driver/issues/1]. After editing hid.c it compiles.
== MPD Control ==
For those not wanting to install a MPD client, there's a stand alone MPD web interface running called [https://github.com/jcorporation/myMPD Mympd] on port 80


And it does stuff too \o/:
==Labelprinter implementation==


<pre>
Labelprinter is up and running.
dell@zeekoe:~/nizzle/hid_mapper$ sudo ./hid_mapper --learn --manufacturer 'One small click One big change' --product 'One small click One big change' --map
See [[Labelprinter]].
Found HID device
Opened HID interface on /dev/hidraw0
02 19 01 8f 92 11 00 a8
02 80 24 08 36 20 08 88
02 19 01 8f 92 11 00 a8
02 80 24 08 36 20 08 88
02 19 01 8f 92 11 00 a8
02 80 24 08 36 20 08 88
02 19 01 8f 92 11 00 a8
02 80 24 08 36 20 08 88
02 19 01 8f 92 11 00 a8
02 80 24 08 36 20 08 88
02 19 01 8f 92 11 00 a8
02 80 24 08 36 20 08 88
02 19 01 8f 92 11 00 a8
02 80 24 08 36 20 08 88
02 19 01 8f 92 11 00 a8
02 80 24 08 36 20 08 88
02 19 01 8f 92 11 00 a8
02 80 24 08 36 20 08 88
02 19 01 8f 92 11 00 a8
</pre>


So it seems that after the button is pressed, a sequence of two events is repeated X times (seems to depend on how long button is pressed).
== Services ==
I'm having trouble feeding it the correct map file. With a map file like this:


<pre>
===Entrance Themes===
0219018f921100a80280240836200888:KEY_UP
* Location: /home/pi/scripts/theme_songs.py
</pre>
* Systemd-service: themesongs.service
or this:
* Programmer: [[User:Melan]]


<pre>
A script which plays a part of a song for each individual member entering the space. See [[Entrance themes]].
0219018f921100a8:KEY_DOWN
0280240836200888:KEY_UP
</pre>


it spits out this error:
=== MPD Icecast update ===
<pre>
* Location: /home/pi/scripts/mpd_icecast_update.py
dell@zeekoe:~/nizzle/hid_mapper$ sudo ./hid_mapper --manufacturer 'One small click One big change' --product 'One small click One big change' --map 'eco.map'
* Systemd-service: mpdicecastupdate.service
Loading eco.map
* Programmer: [[User:Melan]]


Error loading map file eco.map
Updates the current now playing song from MPD to the icecast mount /nurds
[ MapReader ] Unknown key name at line 1
</pre>


==espeak==
=== Vu Meter ===
* Location: /opt/vu
* Systemd-service: vu.service
* Programmer: [[User:Zarya]]


Possible solution for current espeak problem here. https://raspberrypi.stackexchange.com/questions/3412/errors-with-espeak
https://gist.github.com/zarya/3d5447556296d6923bee232e4cc7fca1


==WiP==
=== LedFX ===
* Location: /home/pi/.ledfx.sh
To do:
* Systemd-service: ledfx.service
* Sensor measurement implementation on [[Nurdbot]]
* http://slabpi:8888/dashboard
* espeak usage generates an error.
 
* SenseHAT died. Check on what's up.
=== Pixelvloed FFT ===
* SenseHAT is now directly above the Raspberry Pi 3 board, need to connect a 40 pin cable for better temperature measurement
* Location: /opt/pulse-pixelvloed-fft
* Systemd-service: fft.service
* Programmer: [[User:Zarya]]
 
=== Pixelvloed waterfall ===
* Location: /opt/pulse-pixelvloed-fft
* Systemd-service: waterfall.service
* Programmer: [[User:Zarya]]
 
=== hass-systemd-manager ===
* Location: /opt/hass-systemd-manager
* Systemd-service: manager.service
* Programmer: [[User:Zarya]]
* git: https://github.com/NURDspace/hass-systemd-manager
 
A python tool for starting and stopping systemd services via mqtt using homeassistant (ledfx, waterfall etc)
 
=== Soundboard ===
* Location: /home/pi/soundboard
* Systemd-service: soundboard.service
* Programmer: [[User:Melan]]
 
Allows samples to be triggered through MQTT, also handles the doorbell sound.
 
Als 't niet werkt, dan even inloggen op coherence en vanaf daar op vm 107 en daar proces 'python main.py' afschieten. Dat helpt soms na 1 of meer keer.
 
===  MPD Vol Proxy ===
* Location: /home/pi/mpdVolProxy
* Systemd-service: mpdvolproxy.service
* Programmer: [[User:Melan]]
 
A small script that intercepts all the clients connecting to MPD on port 6000 and intercepts all setvol commands and instead delegates it to Pulseaudio, meaning that any volume command will not adjust MPD's output, but the output to the amplifier instead.
 
=== MPDTube ===
* Location: /home/pi/mpdtube
* Systemd-service: mpdtube.service
* Programmer: [[User:Melan]]
* Git: https://github.com/NURDspace/MPDTube
 
This project has its own wiki page, [[MPDTube]]
 
=== PulseControl ===
* Location: /home/pi/pulseControl
* Programmer: [[User:Melan]]
 
Part of the multi-room audio setup, it will ping if any of the defined hosts are up and once they are it will add their pulseaudio instance to the output.

Latest revision as of 17:53, 25 March 2024

Outdated IMPORTANT: This page about Slabpi is outdated. Now a days, Slabpi is only running a snapcast client and cups for the label and recipe printers.

Please see spacesound instead


SlabPi
Slabpi2.jpg
Owner Space
Status Infra
Hostname slabpi.lan.nurd.space
Location Near the amp
Tool No
Tool category

SlabPi

Slabpi2.jpg {{{InventoryOwner}}}Property "Tool Owner" (as page type) with input value "{{{InventoryOwner}}}" contains invalid characters or is incomplete and therefore can cause unexpected results during a query or annotation process. Near the amp


What

SlabPi is the replacement for Slab on a Raspberry Pi 4. It has been moved, because of downscaling. And recently got upgraded from a rpi3 to a rpi4, it has a DAC+ Hat for better audio quality.

Setup

Disabled/removed services

  • disabled unattented-upgrades
  • disabled wpa_supplicant
  • disabled accounts-daemon
  • disabled multipathd
  • ubuntu motd spam
  • removed snapd

Networking

It is hooked up with UTP. WLAN has been disabled.

DAC+

PiFi HIFI DAC+ for better audio quality.

Installation:

Edit /boot/config.txt

Disable the line

#dtparam=audio=on

add

dtoverlay=hifiberry-dacplus

MPD

Host: slabpi.dhcp.nurd.space

Port: 6600 (Technically 6005, see the mpd proxy service)

It is integrated with Home Assistant view on Jarvis.

HTTPD outputs:

  • port 6666 (8000:16:1) used by the VOIP system
  • port 7777 (44100:16:2) used by Audiophiles

PulseAudio

All pulseaudio changes need to be made in /etc/pulse/system.pa (default.pa isn't used)

Pulseaudio is running as a system-wide daemon, it's default sample rate is set to 48Khz and priority has been set to real time.

Icecast

There is an icecast server on port 8000. It's a direct feed from Pulseaudio so all sounds (Entrance themes, speak commands) will be heard on the stream.

Mount point(s):

  • /nurds (Pulseaudio)

MPD Control

For those not wanting to install a MPD client, there's a stand alone MPD web interface running called Mympd on port 80

Labelprinter implementation

Labelprinter is up and running. See Labelprinter.

Services

Entrance Themes

  • Location: /home/pi/scripts/theme_songs.py
  • Systemd-service: themesongs.service
  • Programmer: User:Melan

A script which plays a part of a song for each individual member entering the space. See Entrance themes.

MPD Icecast update

  • Location: /home/pi/scripts/mpd_icecast_update.py
  • Systemd-service: mpdicecastupdate.service
  • Programmer: User:Melan

Updates the current now playing song from MPD to the icecast mount /nurds

Vu Meter

  • Location: /opt/vu
  • Systemd-service: vu.service
  • Programmer: User:Zarya

https://gist.github.com/zarya/3d5447556296d6923bee232e4cc7fca1

LedFX

Pixelvloed FFT

  • Location: /opt/pulse-pixelvloed-fft
  • Systemd-service: fft.service
  • Programmer: User:Zarya

Pixelvloed waterfall

  • Location: /opt/pulse-pixelvloed-fft
  • Systemd-service: waterfall.service
  • Programmer: User:Zarya

hass-systemd-manager

A python tool for starting and stopping systemd services via mqtt using homeassistant (ledfx, waterfall etc)

Soundboard

  • Location: /home/pi/soundboard
  • Systemd-service: soundboard.service
  • Programmer: User:Melan

Allows samples to be triggered through MQTT, also handles the doorbell sound.

Als 't niet werkt, dan even inloggen op coherence en vanaf daar op vm 107 en daar proces 'python main.py' afschieten. Dat helpt soms na 1 of meer keer.

MPD Vol Proxy

  • Location: /home/pi/mpdVolProxy
  • Systemd-service: mpdvolproxy.service
  • Programmer: User:Melan

A small script that intercepts all the clients connecting to MPD on port 6000 and intercepts all setvol commands and instead delegates it to Pulseaudio, meaning that any volume command will not adjust MPD's output, but the output to the amplifier instead.

MPDTube

This project has its own wiki page, MPDTube

PulseControl

  • Location: /home/pi/pulseControl
  • Programmer: User:Melan

Part of the multi-room audio setup, it will ping if any of the defined hosts are up and once they are it will add their pulseaudio instance to the output.