Saturday, February 6, 2016

KX3 Remote Control and audio streaming with Raspberry Pi 2

REMOTE CONTROL OF ELECRAFT K3

I wanted to control my Elecraft KX3 transceiver remotely using my Android Phone.  A quick Internet search yielded this site by  Andrea IU4APC.  His KX3 companion application on Android allows remote control using Raspberry Pi 2 and he has also links to an audio streaming application called Mumble.

I did a quick ham shack inventory of hardware and software and realized that I had already everything required for this project.

A short video how this works is in YouTube:



KX3, Raspberry Pi2 and Android Phone connected together over Wifi.


























HARDWARE COMPONENTS

Elecraft KX3
Elecraft KXUSB Serial Cable for KX3
Raspberry Pi 2 with Raspbian Linux. I have 32 GB SD memory card, 8 GB should also work.
Behringer UCA202 USB Audio Interface  and audio cables
Android Phone  (I have OnePlus One)


CONFIGURE RASPBERRY PI AND KX3 COMPANION APP

Following the instructions I plugged the KXUSB Serial cable to the KX3 ACC1 port and to one of the two Raspberry Pi USB ports.

I installed ser2net with following commands on command line:

sudo apt-get update 
sudo apt-get install ser2net 

then I edited the /etc/ser2net.conf file:

sudo nano /etc/ser2net.conf 

and added the following line:

 7777:raw:0:/dev/ttyUSB0:38400 8DATABITS NONE 1STOPBIT

and saved the file by pressing CTRL+X and then Y

I executed the ser2net:

ser2net 
sudo /etc/init.d/ser2net restart 

Once done with the host I downloaded the KX3 Companion app (link here) on my Android phone and opened the app.

To enable the KX3 Remote functionality you have to edit 3 options (“Remote Settings” section). Check the “Use KX3Remote/Piglet/Pigremote” option

 

Set your PC/Raspberry Pi IP address in the “KX3Remote/Piglet/Pigremote IP” option.  This below assumes that your RPI and Android phone are connected to the same Wifi network.

In my case RPI is using WLAN0 interface connected to WiFi router and IP address is 192.168.0.47.  This address depends on your local network configuration and you can get the Raspberry Pi IP address using command

ip addr show 





















Set the choosen Port number (7777) on the PC/Raspberry Pi IP address in the “KX3Remote/Piglet/Pigremote Port” option




















Now you can test the connection. By tapping "ON" button on the left top corner you can see if the connection was successful. A message "Connected to Piglet/Pigremote" should show up at the bottom - see below:




















If you are having problems with this, here are some troubleshooting ideas

  • check the Raspberry Pi IP address again
  • check that Raspberry Pi and Android Phone are on the same Wifi network
  • check that your KX3 serial port is set to 38400 bauds (this is the default in KX3 Companion App) 
If everything works, you should be able to change the frequency and the bands on KX3 by tapping  Band+/Band- and Freq+/Freq- buttons on the app. Current KX3 frequency will be updated on FREQUENCY field between buttons as you turn the VFO on KX3.


CONFIGURE RASPBERRY PI 2 FOR AUDIO 

Plug in USB Audio Interface to Raspberry Pi 2 USB port. In my case I used Behringer UCA202 but there are many other alternatives available.

The audio server is called Mumble. This is a low latency Voice over IP (VoIP) server designed for gaming community but it works well for streaming audio from  KX3 to Android Phone and back. There is a great page that describes installation in more details.

I used the following commands to install mumble VoIP server

   sudo apt-get install mumble-server
   sudo dpkg-reconfigure mumble-server


This last command will present you with a few options, set these however you would like mumble to operate.

  • Autostart: I selected Yes 
  • High Priority: I selected Yes (This ensures Mumble will always be given top priority even when the Pi is under a lot of stress) 
  • SuperUser: Set the password here. This account will have full control over the server.

You need to know your IP address on Raspberry Pi 2 when configuring the Mumble client.  Write it down as you will need it shortly. In my case it was 192.168.0.47

ip addr show

You may want to edit the server configuration file. I didn't do any changes but the installation page recommends changing welcome text and server password. You can do it using this command:

sudo nano /etc/mumble-server.ini

Finally, you need to restart the server:

sudo /etc/init.d/mumble-server restart

Now that we have the mumble server running we need to install the Mumble client on Raspberry Pi 2. This can be done with this command:

sudo apt-get install mumble

Next you start the client application by typing:

mumble

This starts the mumble client. First you need to go through some configuration windows.

You need to have USB audio interface input connected to KX3 Phones output when going though the Mumble Audio Wizard. I turned the audio volume to approximately 30.



You need to select the USB Audio device as the input device. Default device is "Default ALSA device" that is onboard audio chip. When clicking Device drop down list select SysDefault card - USB Audio Codec as shown on picture below.












The drop down list might be different depending on your hardware configuration. Select the SysDefault USB device.









Once the Input and Output devices have been selected you can move forward with Next.











Next comes device tuning. I selected the longest delay for best sound quality.












Next comes Volume tuning. Make sure that KX3 audio volume is at least 30. You should see blue bar moving in sync with KX3 audio. Follow instructions.




Next comes voice activity detection setting. Follow instructions.


Next comes quality selection. I selected high as I am testing this in local LAN network.


Audio settings are now completed.

Next comes server connect. You can "Add New..." by giving the IP address that you wrote down earlier. I gave the server label "raspberrypi" and username "pi".You don't have the change the port.










When you connect to the server you should have a view like this below.
















Next step is then download mumble client on the Android phone and configure it.


CONFIGURE ANDROID PHONE 

I downloaded free mumble client called Plumble on my Android phone. You need to configure the Mumble server running on Raspberry Pi 2 on the software. Once you open Plumble client tap the "+" sign on right top corner.





















I gave the label "KX3" and IP address of the Mumble server running on Raspberry Pi 2  - in my case the IP address is 192.168.0.47.  For username I selected my ham radio call sign.


Since I did not configure any passwords on my server I left that field empty. Once the server has been added, you can try to connect to it.

OPERATION

If everything has gone well you should be able to connect to the Mumble VoIP server and hear a sound from your mobile phone.



On Raspberry Pi 2 you should see that another client "AG1LE"  has connected to the server. See example below: 















NEXT STEPS 

If you want to extend from just listening KX3 to actually working remotely you need to configure your Wifi router to enable connection remotely over the Internet. Also, the USB audio interface need to be connected to the microphone (MIC) input of KX3 radio.  KX3 must have VOX turned on to enable audio transmit.

Documenting these steps will take a bit more time, so I leave it for the next session.

 Did you find these instructions useful?  Any comments or feedback? 

73 
Mauri AG1LE








No comments:

Post a Comment

Popular Posts