14 Ultimate Remote Operation
Elliott Liggett edytuje tę stronę 2021-05-18 20:29:34 +00:00

Obsolete

For the most up to date information, please visit https://wfview.org/wfview-user-manual/


OLD INFORMATION

What follows is quite outdated as wfview now has a built-in audio and control server.

Basic Overview of Remote Operation

This wiki page will detail the ultimate remote operation method for the IC-7300. The wfview program will run on a computer such as a laptop in a location far from the IC-7300. Serial data from the IC-7300 will be fed over the network to a local copy of wfview. Audio data will be streamed using ffmpeg and icecast, using mpg123 or VLC as a listening client. Latency is generally under two seconds. This method assumes the user is familiar with basic linux commands and network security methods such as VPN and ssh port forwarding.

This method requires about 28KiB/sec coming in to the client computer. You can trade some audio quality in if you need lower bandwidth.

Terms:

Server = computer physically connected to the Icom IC-7300 via USB. In my case, the IP address on my lan was 10.0.0.130. Yours will be different. Make sure you know it ahead of time.

Client = computer used by the operator

Basic Directions:

  1. Use socat on server to create a serial to network gateway
  2. Use ffmpeg on server to send 7300 receive audio to icecast
  3. Use ffmpeg on the client computer to send mic audio to icecast
  4. Use mpg123 or VLC on server to playback the mic audio stream from icecast into the 7300
  5. Use VLC or mpg123 on the client to play back the IC-7300 audio from icecast to speakers
  6. Edit preferences of wfview on client computer to point to socat network to serial device
  7. Launch wfview

Details to follow.

0: Prerequisites:

Install all this on both computers. Mac users can use brew for mpg123, socat, and ffmpeg. VLC is a very nice and easy way to get things working on the server, but you don't have to use it -- you can jump right to mpg123 if you know what you're doing.

sudo apt-get install ffmpeg mpg123 vlc socat 

And only on the server, also install icecast2:

sudo apt-get install icecast2

See the Audio Streaming Wiki for details.

1: Serial port to Network:

The socat utility can connect to a serial device and forward all traffic over a network interface. As a client program, socat can create a "fake" pseudo-terminal, which connects over TCP/IP to the server socat program. The pseudo-terminal created by socat appears to be a regular serial port, except that it will not be automatically discovered by most client programs. wfview preferences can be modified to point directly to the socat interface.

  1. Run this command on the server:
socat -d tcp-l:54321,reuseaddr,fork GOPEN:/dev/ttyUSB0,b115200,raw,echo=0
  1. On the client, run this command to connect over to the server (here, the server has address 10.0.0.130):
# For linux clients: 
socat pty,link=/tmp/vmodem0,waitslave tcp:10.0.0.130:54321
# For mac clients: 
socat -t 4096 pty,link=/tmp/vmodem0,waitslave,ignoreeof tcp:10.0.0.130:54321
  1. Modify the wfview preferences to point to /tmp/vmodem0. Just change the SerialPortRadio=auto line to SerialPortRadio=/tmp/vmodem0. On linux, the configuration file is located here: ~/.config/eliggett/wfview.conf. For Mac clients, you simply run this command in the terminal: defaults write com.nodomain.wfview Radio.SerialPortRadio /tmp/vmodem0. You can verify this property using the defaults read com.nodomain.wfview Radio.SerialPortRadio command. Note, on the beta and lan-alpha branches of the code, you can simply specify a command-line argument for the port:
wfview --port /tmp/vmodem0
  1. Open wfview and verify that you can control the radio and receive the waterfall.

2: Stream the Icom audio

Make sure you have already installed and configured icecast2 per the Audio Streaming wiki. Make sure to read about how to find the audio device number.

Run ffmpeg to stream the Icom audio to the icecast server:

ffmpeg -ac 1 -f alsa -i hw:1,0  -ar 22050 -acodec libmp3lame -ab 256k -ac 1 -content_type audio/mpeg -flags low_delay -fflags nobuffer -f mp3 icecast://source:letmein@10.0.0.130:8000/icom

3: Run ffmpeg on your client computer to stream to the icecast server.

From your client computer, review the list of audio devices and find the one corresponding to your microphone:

arecord -l

Here's what my thinkpad shows:

**** List of CAPTURE Hardware Devices ****
card 0: PCH [HDA Intel PCH], device 0: ALC269VC Analog [ALC269VC Analog]
  Subdevices: 1/1
  Subdevice #0: subdevice #0

In my case, the only input I have is hw:0,0. If I had a fancy USB headset it would probably be hw:1,0. In any case, now stream to the icecast server:

ffmpeg -ac 1 -f alsa -i hw:0,0  -ar 22050 -acodec libmp3lame -ab 256k -ac 1 -content_type audio/mpeg -flags low_delay -fflags nobuffer -f mp3 icecast://source:letmein@10.0.0.130:8000/mic

On my Mac laptop client, I had to do this to find the device:

ffmpeg -f avfoundation -list_devices true -i ""

Followed by this to start the stream:

ffmpeg -ac 1 -f avfoundation -i 1:0 -audio_device_index 0  -ar 22050 -acodec libmp3lame -ab 256k -ac 1 -content_type audio/mpeg -flags low_delay -fflags nobuffer -f mp3 icecast://source:letmein@10.0.0.130:8000/mic

Note that on a mac, you can (and probably should) adjust the mic gain in the system preferences under sound, under the Input tab.

4: Play back the mic audio into the Icom

The easiest way is to walk over to the server, launch a GUI environment, and run VLC. From VLC, go into the preferences. Pres "All" or "Advanced" to show all the preferences. Now go to Streaming. Find the text box for "Stream output muxer caching (ms)" and set it to zero. You can experiment with higher values if your link has issues, but it will add to latency significantly.

Save the preferences. Now go to the Media menu and select "Open Network Stream". Type in the address of your stream: "http://10.0.0.130:8000/mic". You should be hearing the microphone audio on your server speakers. Now change the output device to the icom. Go to the Audio menu, select "Audio Device" and choose the Icom by selecting PCM2901. Your IC-7300 should then be set to take transmit audio from the USB port. Perhaps the easiest way to do this is to just put it into one of the -D modes ("DATA") which default to working this way.

5: Client stream

Launch VLC on the client, configure for 0ms caching. The stream address will be something like "http://10.0.0.130:8000/icom"

6: wfview preferences (already covered)

7: Launch wfview