diff --git a/broadcaster-software.md b/broadcaster-software.md new file mode 100644 index 0000000..1b84563 --- /dev/null +++ b/broadcaster-software.md @@ -0,0 +1,96 @@ +# Broadcaster Software (icecast and darkice) +## Summary +User: grace +Hostname: portal.local +Password: emergence +Running icecast and darkice. See icecast-darkice.md for setup instructions. + +## Bill of Materials +* Raspberry pi 4b (1 gig ram) - https://www.sparkfun.com/raspberry-pi-4-model-b-1gb.html +* 3 x USB to XLR sound card cable - https://www.amazon.com/dp/B089WFYZ5R?ref=ppx_yo2ov_dt_b_fed_asin_title&th=1 +* 3 x XLR microphones - +* Raspberry pi 4 Power supply - https://www.waveshare.com/pi-psu-us-w.htm +* ethernet cable - https://hosatech.com/products/data/network-cable/cat-500/ +* micro hdmi to regular hdmi cable- https://www.waveshare.com/pi-official-micro-hdmi-cable-1m.htm + +## Hardware setup +* Plug the mic into the the usb cable +* Plug the usb cable into the pi +* Plug the pi into the wall + +## Pre work +1. install raspian lite 64 for raspi model 4b +2. configure user and wifi and turn on ssh services when you install +3. boot +4. find the ip address of the pi and ssh to it + +## Setup instructions +### Creature comforts +sudo apt update && install git vim zsh +sh -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)" + +### Icecast2 and Darkice installation +Follow this tutorial: https://dev.to/shilleh/stream-audio-from-raspberry-pi-to-local-computer-1a1c + + +#### Install icecast2 +sudo apt install icecast2 + +It will ask you for three passwords. Set them all as emergence. + + +#### Install darkice +sudo apt install darkice + +sudo vim /etc/darkice.cfg + +``` +[general] +duration = 0 # Stream indefinitely +bufferSecs = 5 # Buffer for the input, in seconds +reconnect = yes # Reconnect to the server if disconnected + +[input] +device = plughw:1,0 # Your audio capture device +sampleRate = 44100 +bitsPerSample = 16 # Bits per sample +channel = 1 # 2 = stereo, 1 = mono + +[icecast2-0] +bitrateMode = cbr # Constant bit rate +format = mp3 # Audio format +bitrate = 128 # Bitrate in kbps +server = localhost # Server name or IP +port = 8000 # Port number +password=emergence # Your Icecast password +mountPoint = portal # Mount point to stream to +name = Black Portal # Name of the stream +description = Black Portal Project # Description of the stream +url = http://blackportaldetroit.com # URL related to the stream +genre = politics # Genre of the stream +public = no # Do not list on public lists +``` + +#### Daemonize darkice + +sudo vim /lib/systemd/system/darkice.service + +[Unit] +Description=Darkice Service +[Service] +User=root +Type=simple +Restart=on-failure +RestartSec=5 +WorkingDirectory=/home/grace +ExecStart=/usr/bin/darkice -c /etc/darkice.cfg +[Install] +WantedBy=multi-user.target + + +sudo systemctl daemon-reload + +sudo systemctl enable icecast2 + +sudo systemctl enable darkice + diff --git a/icecast-darkice.md b/icecast-darkice.md deleted file mode 100644 index 4227c3e..0000000 --- a/icecast-darkice.md +++ /dev/null @@ -1,52 +0,0 @@ -https://dev.to/shilleh/stream-audio-from-raspberry-pi-to-local-computer-1a1c -icecast/darkice - -sudo apt install icecast2 -sudo apt install darkice - -sudo vim /etc/darkice.cfg - -``` -[general] -duration = 0 # Stream indefinitely -bufferSecs = 5 # Buffer for the input, in seconds -reconnect = yes # Reconnect to the server if disconnected - -[input] -device = plughw:1,0 # Your audio capture device -sampleRate = 44100 -bitsPerSample = 16 # Bits per sample -channel = 1 # 2 = stereo, 1 = mono - -[icecast2-0] -bitrateMode = cbr # Constant bit rate -format = mp3 # Audio format -bitrate = 128 # Bitrate in kbps -server = localhost # Server name or IP -port = 8000 # Port number -password=emergence # Your Icecast password -mountPoint = portal # Mount point to stream to -name = Black Portal # Name of the stream -description = Black Portal Project # Description of the stream -url = http://192.168.0.203 # URL related to the stream -genre = politics # Genre of the stream -public = no # Do not list on public lists -``` - -sudo vim /lib/systemd/system/owncast.service - -[Unit] -Description=Darkice Service -[Service] -User=root -Type=simple -Restart=on-failure -RestartSec=5 -WorkingDirectory=/home/grace -ExecStart=/usr/bin/darkice -c /etc/darkice.cfg -[Install] -WantedBy=multi-user.target - - -sudo systemctl daemon-reload - diff --git a/listener-software.md b/listener-software.md new file mode 100644 index 0000000..956e757 --- /dev/null +++ b/listener-software.md @@ -0,0 +1,83 @@ +# Listener software (Mplayer + drivers) +## Summary +User: grace +Hostname: listener.local +Password: emergence +Running mplayer, soundcard library, lcd graphics library, and custom python code for text printing logic. + +## Bill of Materials +* Raspberry pi zero wh - https://www.waveshare.com/product/raspberry-pi/boards-kits/raspberry-pi-zero-2-w-cat/raspberry-pi-zero-2-w.htm?sku=21038 +* Waveshare UPS with 1000mah battery - https://www.waveshare.com/ups-hat-c.htm +* Waveshare sound card hat with speakers- https://www.waveshare.com/wm8960-audio-hat.htm +* 1602 LCD screen - https://www.waveshare.com/lcd1602-i2c-module-blue.htm?sku=30496 +* Jumper wires - https://www.waveshare.com/product/accessories/adapters-cables-antennas/jumper-wires.htm +* mini HDMI to hdmi cable - https://hosatech.com/products/video/hdmi/hdmc-400/ +* micro USB male to usb a femail adapter - https://www.amazon.com/dp/B01C6032G0 +* Keyboard with usb a cable - https://www.amazon.com/AmazonBasics-Matte-Keyboard-QWERTY-Layout/dp/B07WJ5D3H4/ + +## Hardware assembly +* Solder header to the pi if not pre-soldered +* Plug the battery into the UPS board +* Screw the UPS to the pi +* Screw a next level of standoffs to the pi +* Put the audio hat on the pi's headers, and screw it to the standoffs +* Plug in the speakers +* Plug the jumper wires into the screen and the pi according to the [screen-wiring.png](screen-wiring.png) file (via https://peppe8o.com/1602-lcd-raspberry-pi-display/). + +## Pre work +1. install raspian lite 64 for raspi zero +2. configure user and wifi and turn on ssh services when you install +3. boot +4. find the ip address of the pi and ssh to it + +## Setup instructions +### Creature comforts +sudo apt update && install git vim zsh +sh -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)" + +### Waveshare soud card drivers +Follw instructions at https://www.waveshare.com/wiki/WM8960_Audio_HAT + + +#### Install drivers +git clone https://github.com/waveshare/WM8960-Audio-HAT +cd WM8960-Audio-HAT +sudo ./install.sh +sudo reboot +sudo dkms status + +Check for drivers installed + +#### Test drivers +sudo apt install mplayer +mplayer -playlist http://blackportaldetroit.com:1313/portal.m3u + +#### Daemonize radio +sudo vim /lib/systemd/system/listener.service +``` +[Unit] +Description=Listenign Service +[Service] +User=root +Type=simple +Restart=on-failure +RestartSec=5 +WorkingDirectory=/home/grace +ExecStart=mplayer -playlist http://108.204.128.201:1313/portal.m3u + +[Install] +WantedBy=multi-user.target +``` + +sudo systemctl daemon-reload +sudo systemctl enable listener + +sudo reboot + +#### Raise volume +alsamixer +sudo alsactl store + +### LCD Screen +Follow https://peppe8o.com/1602-lcd-raspberry-pi-display/ + diff --git a/listener.md b/listener.md deleted file mode 100644 index f2ec227..0000000 --- a/listener.md +++ /dev/null @@ -1,13 +0,0 @@ -1. install raspian -2. boot -3. configure default sound card - -c -alsamixer - -arecord -l - -arecord -f cd -D plughw:0,0 | ffmpeg -i - -acodec libmp3lame -ab 128k -ac 1 -f rtp rtp://127.0.0.1:3000 - -sudo apt install git nginx vim zsh -sh -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)" diff --git a/readme.md b/readme.md index 3cf3e76..697a5a5 100644 --- a/readme.md +++ b/readme.md @@ -1,14 +1,38 @@ -# Black Portal Detroit +# Black Portal Detroit internet radio electronics https://blackportaldetroit.com -## Broadcaster -user: grace -hostname: portal.local -Running icecast and darkice. See icecast-darkice.md for setup instructions. +This repo contains documentation for how to buy and setup the electronics for Black Portal Detroit. This readme contains insructions for plugging in the system and turning it on. Full software setup documentation is in the broadcaster-software.md and listener-software.md files. +## Hardware setup instructions +Make sure to do the following steps in the order they are listed: -## Listener -user: grace -hostname: listener.local +### Turn on broadcaster +1. plug the usb mic cable into a microphone +2. plug the usb mic cable into the top right (blue colored) usb port on the broadcaster (raspberry pi 4b) +4. plug the ethernet cable into the broadcaster and the router +5. plug the power into the broadcaster (this is how you turn it on) + +### Networking +1. Log into the router. +2. Find the ip address of the broadcaster (hostname portal) - usually in the advanced > network > dhcp. +3. Navigate to the NAT forwarding section of the router admin. +4. Set your router to forward all traffic coming in on port "80" to port "8000" at the local ip address of the broadcaster. + +### Turn on listener +1. turn on the listener (raspberry pi zero). plug it into a monitor and keyboard. when it boots, type sudo raspi-config. navigate to system settings and change the wifi settings so it can access the internet. +2. type sudo vim /lib/systemd/system/listener.service and edit the line that says "ExecStart=mplayer -playlist http://" changing the http:// part to the static ip address of the router. +3. type esc, w, q, enter +4. type sudo systemctl restart listener +5. mic check + +### Important notes +* the microphone must always be plugged into the broadcaster before the broadcaster is on +* the broadcaster must always be on when the listener is turned on. if it is not, then the listener needs to be restarted once the broadcaster is on. + +## Software setup instructions +* Broadcaster software setup instructions in broadcaster-software.md +* Listener software setup instructions in listener-software.md + +Prior research that didn't work in `research-` md files. \ No newline at end of file diff --git a/nginx-rtmp.md b/research-broadcaster-nginx-rtmp.md similarity index 98% rename from nginx-rtmp.md rename to research-broadcaster-nginx-rtmp.md index 532bcb5..a723438 100644 --- a/nginx-rtmp.md +++ b/research-broadcaster-nginx-rtmp.md @@ -1,3 +1,5 @@ +# Broadcaster nginx rtmp + 1. install raspian 2. boot 3. configure default sound card diff --git a/owncast.md b/research-broadcaster-owncast.md similarity index 97% rename from owncast.md rename to research-broadcaster-owncast.md index a6ac0e7..513373a 100644 --- a/owncast.md +++ b/research-broadcaster-owncast.md @@ -1,4 +1,4 @@ -owncast +# Broadcaster owncast curl -s https://owncast.online/install.sh | bash cd owncast ./owncast diff --git a/research-listener-mopidy.md b/research-listener-mopidy.md new file mode 100644 index 0000000..160087c --- /dev/null +++ b/research-listener-mopidy.md @@ -0,0 +1,81 @@ +# Listener mopidy + +1. install raspian lite 64 +2. boot +3. configure default sound card + +sudo apt install git vim zsh +sh -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)" + + + +* sudo apt install mpd mpc +* sudo raspi-config and enable spi +* wget -q -O - https://apt.mopidy.com/mopidy.gpg | sudo apt-key add - +* sudo wget -q -O /etc/apt/sources.list.d/mopidy.list https://apt.mopidy.com/buster.list +* sudo apt update +* sudo apt install mopidy python3-rpi.gpio python3-spidev python3-pip python3-pil python3-numpy +* python3 -m venv ./ +* sudo apt install cmake libcairo2-dev +* sudo bin/pip3 install Mopidy-PiDi pidi-display-pil pidi-display-st7789 mopidy-raspberry-gpio pillow image ST7789 +* sudo touch /etc/mopidy/mopidy.conf + +``` +[raspberry-gpio] +enabled = true +bcm5 = play_pause,active_low,150 +bcm6 = volume_down,active_low,150 +bcm16 = next,active_low,150 +bcm20 = volume_up,active_low,150 + +[pidi] +enabled = true +display = st7789 + +[mpd] +hostname = 0.0.0.0 + +[http] +hostname = 0.0.0.0 + +[audio] +mixer_volume = 40 +output = alsasink + +[stream] +enabled = true +protocols = + http + https + mms + rtmp + rtmps + rtsp +timeout = 5000 +metadata_blacklist = + +``` + +* sudo usermod -a -G spi,i2c,gpio,video mopidy +* sudo systemctl enable mopidy +* sudo systemctl start mopidy + + +* sudo vim /var/lib/mopidy/portal.m3u + +``` +#EXTM3U +#EXTINF:0,Portal + http://108.204.128.201:1313/portal.m3u +``` + +* sudo apt install ncmpcpp + +* sudo systemctl stop mopidy +* sudo systemctl start mpd +* mpc add http://108.204.128.201:1313/portal.m3u +* mpc play + +* sudo vim /etc/mpd.conf + * configure audio output +* sudo systemctl restart mpd diff --git a/screen-wiring.png b/screen-wiring.png new file mode 100644 index 0000000..76e666e Binary files /dev/null and b/screen-wiring.png differ