# Hardware setup instructions

This readme contains instructions for plugging in the system and turning it on. Full software setup documentation is in the broadcaster-software.md and listener-software.md files.

Make sure to do the following steps in the order they are listed:

## Requirements

- Modem and internet plan (no static IP required - uses Cloudflare Tunnel)
- Provisioned [broadcaster](broadcaster.md) with Cloudflare Tunnel configured
- Provisioned [listener](listener.md)
- Domain transferred to Cloudflare (blackportaldetroit.com)

## Steps

### 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)
3. Plug the ethernet cable into the broadcaster and the router
4. Plug the power into the broadcaster (this is how you turn it on)

### Networking

1. Either configure cloudlfare tunnel, ddns or setup a static ip and forward from your router

### 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. The listener is pre-configured to stream from http://blackportaldetroit.com/portal.m3u - no manual configuration needed.
3. Type sudo systemctl restart listener
4. 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.
- SSL certificates are handled automatically by Cloudflare
- Stream will be accessible at https://blackportaldetroit.com/portal
- No router configuration or port forwarding needed

## Troubleshooting Cloudflare Tunnel

### Setup Steps:

1. Transfer blackportaldetroit.com to Cloudflare (change nameservers)
2. Run `./cloudflare-tunnel-setup.sh` on the Pi
3. Follow the authentication prompts
4. Create CNAME record in Cloudflare dashboard

### Common Issues:

- **Domain not on Cloudflare**: Transfer nameservers first
- **Authentication failed**: Run `cloudflared tunnel login` manually
- **Tunnel not connecting**: Check `sudo systemctl status cloudflared`

### Test Commands:

```bash
# Check tunnel status
sudo systemctl status cloudflared

# View tunnel logs
sudo journalctl -u cloudflared -f

# Test local connectivity
curl -I http://localhost:80
```
