I made this web application to effortlessly control certain aspects of my home entertainment ecosystem using my phone. This application is mostly hard-coded around my specific use case and hardware. See Software and Hardware sections for usage.
- Easily view, refresh, and change information about inputs at a glance
- Select between various HDMI inputs (using multi-port HDMI switch)
- Select between various USB ports for a single USB Hub input (using multi-port USB switch)
- Capture audio from HDMI devices and stream to wireless USB headset
The following image outlines the all the involved components and how the application ties in.
- Raspbian (with root access to install services)
- Node.JS server
- JavaScript (vanilla frontend, Node.JS backend)
- Python (used in backend to communicate with GPIO)
- Bash (used in backend to run services and execute scripts)
Note: Ensure hardware procedure is setup and tested first. cd
into the root of this repo.
Audio Relay Service/Script:
- Update
service/audio.sh
to point to the right input and output devices - Ensure the path to
service/audio.sh
inservice/audrelay.service
is correct - Install the service:
sudo cp service/audrelay.service /lib/systemd/system/audrelay.service
Node Application:
npm install
npm start
- The app will be running from
localhost:3000
and can be used assuming hardware is setup properly
- HDMI Switch (Five inputs, one output)
- USB Switch (One input, four outputs)
- USB sound card with line-in
- HDMI line-out extractor
- Analog-Digital Converter (ADC: MCP3008)
- Relay Board (With two or more modules)
- Raspberry Pi Model B+
- Wireless USB headset
Triggering switches:
- To control the HDMI and USB switches remotely, the button presses need to be simulated from the Pi
- I soldered wires to the leads under the buttons and connected them to the relay board
- One module for the HDMI switch and one for the USB switch
- To use the relay board with the Pi, I followed this video
- The script
python/click.py
triggers a relay module through a specified pin via command-line argument
Reading selected inputs:
- I used this guide to connect the understand the ADC pinout and connect it to the Pi.
- To tell which input is active in the switches, we can read the voltages of the leds.
- I soldered a wire to a lead of each of four of the five HDMI switch leds and three of the four USB switch leds.
- Next I soldered each wire to a separate channel in the ADC.
- The script
python/read.py
should be updated to read the right channels and have an appropriate threshold for checking the voltages
Connecting everything together:
- Connect all the HDMI devices to the HDMI switch inputs
- Connect the HDMI switch output to the HDMI line-out extractor device
- Connect the HDMI line-out extractor to the TV and USB sound card accordingly
- Connect the USB sound card to the Pi
- Connect all the USB devices to the USB switch outputs
- Connect whatever USB peripherals you wish to use between these devices to the input (in my case, the wireless USB headset)
- Provide power to all devices and
ssh
into the Pi (over wired or wireless network) to begin the software procedure.