Remote Ham Radio HTML5 Audio Node.js Server Raspberry Pi

The Experiment: In this experiment were going to prove that it is possible to develop a Ham Radio Remote Base using HTML5 Microphone/Speaker Audio and a Node.js Serial Server.  All the servers will be hosted on a Raspberry Pi. The  Node2Serial Server will receive command from the Browser, sends them to the radio, in-turn it will  return any reply’s from the radio back to the Browser. The Mic2Speaker server will stream Microphone audio from Browser to the server speaker, then though the audio interface to the radio Microphone input.

Table of Contents
1. Progress
2. Software/npm Packages
3. Directory structure
4. Hardware
5. Notes
6. Conclusion
7. Reference Links

Progress

Well been working on this for the last four weeks, had to solve a lot of issues with HTML5 audio, but finally have them resolved. Now have a working remote base application working  through a web page using HTML5 Audio for the Microphone/Speaker, and Node.js Serial Server controlling the radio all from a Raspberry Pi.

html5-nodejs-reaspberry-pi-remote-base

To change the frequency: Use mouse wheel to change the frequency digest or left mouse click buttons below the frequency to increase/decrease in  1, 10, 100, 1000 steps. The other controls are self explanatory. Left clicking the TX button  will mutes the speaker audio, and the VOX will tigers  the PTT on the remote transceiver.

Have tested this on iPhone, could control the radio without any issues, but HTML5 audio not working on iPhone, possibly because mobile devices don’t allow automatic back ground audio streaming. iPhone requires  the users to start the audio stream. Tried some hacks to emulate a user click on the iPhone but still no audio stream.  Will do some more research on this later.

So far things are working well on Linux Debian / Windows PC. Used the my remote base interface, built in a previous remote base experiment to send commands to the radio, and all is working well.

On 11/10/2016 updated the Ham Radio Web Remote Base to a Raspberry Pi3 Model B with Raspbian Jessie Lite. The addition of the on board  802.11n Wireless LAN, add wireless access to the Web Remote Base via a hot-spot on the Raspberry Pi. The hot-spot is a very nice addition can now access the Remote Base anywhere around the property. The hot-spot allow access to the Web Remote Base via the phone, no problems controlling the radio on the phone, but there are issues with HTML5 audio on the phone.

^Top


Software:

  1. Raspbian Jessie Lite
  2. Node.js
  3. NPM

NPM Dependencies:

  1. binaryjs
  2. express
  3. express-device
  4. http
  5. serialport
  6. sleep
  7. socket.io
  8. speaker

^Top


Directory structure:

/home/pi
onOffswitchInt.py

/home/icremote
app.js
index.html
mobile.html
package.json
streamin.js
streamout.js
psChecker
psStart
usr.ini
web

/home/icremote/node_modules
binaryjs
express
express-device
http
serialport
sleep
socket.io
speaker

/home/icremote/pub
audio.js
binary.min.js
mobile.css
recorder.js
socket.io.js
style.css

^Top


Hardware:

  1. Raspberry Pi
  2. USB Sound Card
  3. Micro USB 5V AC Adapters
  4. Serial Level Converter here
  5. Audio Interface here here

^Top


Notes:

The biggest issue getting low latency  HTML5 Audio, most of the time  spent  was getting except-able HTML5 low latency audio from server microphone to the browser, then from browser  microphone to the server speaker.

One problem which has not been completely resolved, Win7 microphone AGC level control, unable to disable this in windows, so have a work around script which reset mic AGC every 5 seconds, this is not best solution, because still getting some crackling on microphone audio.

1/9/2016 Solved the microphone AGC problem in Win7, the problem was not the AGC, but the microphone gain control in the JavaScript was set to the wrong  destination, fixed that and now have nice clean except-able low latency microphone audio streaming from the browser to the server speaker. Now have no need to disable Win7 microphone AGC. Also limited Mic gain control to only 50% this stop the microphone audio from being over-driven and eliminates a lot of the audio crackling.

1/9/2016 Tried to add a low-pass filter to the browser HTML5 player audio tag, but found out that Firefox currently has a problem with createMediaElementSource.

1/11/2016 Finally figured out why createMediaElementSource would not play the audio stream. Like always a security problem, createMediaElementSource won’t cross domain, had to add  ‘Access-Control-Allow-Origin’ : ‘*’ to the header to play the audio stream, but createMediaElementSource buffered the stream so audio latency is really bad.

And another problem: After updating Firefox from v33.1 to v43.0.4, the audio stream stops playing when left clicking the title bar.  After a small delay the audio comes back buffered with a 15 second delay. To return the audio back to low latency  audio stream it has to be reloaded.

1/13/2016 Well after trying everything to stop Firefoxv43.0.4  from buffering the audio stream when left clicked the title bar in any open Firefox browser. I down-graded back to Firefox v33.1. It also has the same problem but only buffers the audio stream for 2 seconds.

1/17/2016 Solved a lot off the HTML5 issues and now have been using the remote base every daily.

11/23/2016 Finally have a stable Node.js serial port  connection to the transceiver, found that the CIV – RS232 selection switch had some cross talk causing the CIV option on the remote inter face board to work sporadically.  On the new remote PCB ill just use  jumpers to select the CIV or RS232 input.

One issue with ICOM Cat commands: unable to figure out the command to select the band-registers to switch bands and there is no On/Off command on older ICOM HF transceivers. Yause / Kenwood / Elecraft have a lot better CAT commands then ICOM.

11/27/2016 Working on the phone audio issue, and a new Raspberry Pi Ham Radio Web Remote Base inter-face board.

——————————————————————————————————————

At this time HTML5 audio not the best quality, but will probably  get better in the future.  Adding filter to the audio stream definitely improve the audio quality.

Node.js Serial has a problem with the  serial.close() command. If the serial port isn’t closed after processing  a command it will freeze the serial port .

It’s  a lot easier to remote  a Kenwood/Yaesu transceiver,   ICOM 756 PROIII civ commands are  difficult to use and there is also no On/OFF radio command. Will code a second version for Yeasu FT950/FT2000.
^Top


Conclusion:

It is totally possible to develop a web based Remote Base application using HTML5 Audio with Node.js Serial server on a Raspberry Pi. With future Html5 audio improvements it will be really easy to write a web application to control your Ham Radio station though a web page.

^Top


Reference Links:

1. Raspberry Pi Download
2. Node.js
3. npm

^Top

Advertisements