Control External Speakers Using a Pi Zero

Pi Zero control external speakers!

UPDATE: Now with Pi Zero W (W = on board wifi), you can eliminate the need for the wifi adapter and the 4 way usb hub!

Using a Pi Zero to control external speakers, remotely from your couch!

(sorry about my redundant wording, it’s for google search engine stuff)

pi zero control external speakersFor a while now, I have had these Creative SBS powered PC speakers, connected as external speakers, to my TV. It sounds great, especially when watching movies!  It’s really amazing how much these little speakers can enhance the TV’s sound quality, especially the bass.

But, to turn the volume up or down on these speakers, used as external speaker on my TV, you have to get up and physically turn the volume nob. Not too much trouble, but if you didn’t turn them down before or after you shut the TV off, you might get blasted the next time you turn on the TV. Not good when you can’t sleep at 3am in the morning, so you try watching a little TV to pass the time. Then you turn it on and it blasts noise into the still of the night, waking up the whole house!

pi zero controlled external speakersAnyway, so recently I bought a Raspberry Pi Zero and have been wondering what to do with it. I have lots of ideas like building a robot car, a portable retro game console or maybe use it as a spare desktop or printer server. But then I thought, why not set it up to control the volume on the external speakers connected to the TV!

For this to work though, the Zero has to have a few things that it doesn’t. An audio source to get sound in and out (except out from HDMI). And a way to connect remotely to the Zero to control the sound, like over a WiFi or Ethernet connection.

Things You Will Need to Control External Speakers with a Pi Zero

But the Pi Zero does offer support for sound through a USB connected sound card adapter that has a line-in and out port, and an internet connection with a WiFi adapter / Ethernet adapter. And with an OTG cable and USB hub, you can connect both!

usb sound adapter usb hubusb wifi adapter

 

From the audio out on the TV, I have connected a male RCA Y adapter cable (red and white) to 3.5mm male round pin jack, to the line-in port on the USB sound card.

male rca y adapter to male 3.5mm jack
And the green wire from the PC speakers, connected to the line-out on the Zero.

connection setup pi zero control external speakers

Then I installed the latest version of Raspbian Jessie OS on an SD card, inserted it into the Pi Zero. Connected the HDMI to the TV and power and booted it up, and installed the OS. I also did an update and upgrade through the terminal (sudo apt-get updated, sudo apt-get upgrade) on the Pi. And, enabled ssh and VNC through the Raspberry configuration menu.

enable vnc and ssh on raspberry pi

Now To Get The Sound Card Working to Control External Speakers

To enable sound on the USB sound card, you have to right click on the speaker icon to bring up the audio properties, and click on the sound card, to put a check by it.

enable usb sound

Then go into the USB Device Settings and enable the volume controls.

control external speakers set up

enable volume slidersCheck the boxes to enable the speakers/headphones, microphone or line-in (not the capture). Also enable the auto gain control. But once you enable everything, close the box and then go to the Switching tab and uncheck the auto gain control. This may remove some of the distortion from your sound card. Also, be sure and enable the mic/line-in levels, if they are marked with a red X, grayed or blacked out.

uncheck gain control external speakers

For now, just leave these boxes up and then turn the TV input to a TV station. If everything is connected correctly, there may be a slight delay and some pop noises, but then you should hear sound.

Once everything was installed and running, I was able to disconnect the Pi Zero from the HDMI on the TV and used the VNC viewer installed on my computer, to control the desktop on the Pi (more about this below).

How to Setup the Pi Zero to Control the Volume Remotely, From Your Couch!

With the VNC server enabled and setup on the Raspbian desktop. You should be able to control your Pi Zero from any computer with the VNC viewer. Check out these instructions here, to learn how to set up and use VNC on your Raspberry Pi.

It will be easier to control the Pi with a laptop. You can carry it into the room with your TV, so you can hear and adjust the sliders where you want them. Then tap OK to close the settings boxes on the Audio Device Settings.

If you have an iphone or android smart phone, you can go to the app store and download the VNC viewer. You can then bring up the Pi Zero in the viewer. Move around the screen until you get the pointer on the speaker icon. Tap on the speaker icon to bring up the volume slider. It’s a little tricky, but tap the slider nob with the pointer on it and then tap, hold and drag the nob, to move the slider up and down.

Control Volume with SSH

You can also download an ssh app on your phone and ssh into the Zero to control the volume. Type alsamixer at the prompt and this brings up the mixer control. To raise and lower the volume, use the 1-9 keys on the keyboard. Or use the plus and minus keys.

alsamixer controls

And there you go! That’s how you control external speakers with the Pi Zero! And, you can probably use this same setup for many audio devices you may have external speakers connected to.

Author: Robby

I am just another goofy computer nerd who likes to tinker with tech, watch NFL football, cook and make people laugh if I can.

1 thought on “Control External Speakers Using a Pi Zero”

Leave a Reply