I was going to crack wise about being in the dog days of summer, but I noticed that my golden retriever Leo seems to prefer stretching out on the hot brick patio at the office and has to be cajoled back into the air conditioning with a doggie treat.
Not so with the rest of the engineering staff; they prefer getting a studio tan to a sun tan any day.
During these muggy weather days, it has been a pleasant diversion to power up a Raspberry Pi to see if loading random broadcast-related software onto it creates an amusing Stupid Pi Trick. I rediscovered a copy of DTS’ (née iBiquity) Java Program Service Data (PSD) Generator from a recent cooperative project. It’s an application, written in Java, that allows the user to send an arbitrary text string to an Importer or Exporter, and has been useful for static testing the data network path to those devices. One can configure eight different addresses and ports representing individual data paths to an HD Radio Importer or Exporter. Type in a string in the application’s text box, click send and the application folds the string into the proprietary PSD message (in either the pre-version 4.0 format or the modern post-4.0 version format) and sends that blob of data to the destination address and port. The application works well on a Windows computer, but how does it work on a RasPi 3?
Fig. 1: The essential RasPi 3 setup: keyboard, mouse and monitor. Because the application requires a wired or WiFi network connection to communicate with an Importer/Exporter, the RasPi Zero wasn’t well-suited for this exercise; it lacks an onboard WiFi or Ethernet connector, and has only one USB port. Although there are several do-it-yourself USB hub designs and commercial powered USB hubs that incorporate nicely into the RasPi Zero, I wanted to keep the exercise simple, and opted to use a Raspberry Pi 3 with a freshly installed Rasbian Jessie image on a 32 GB Micro SD Card. 32 GB is about four times the drive space needed for this project, but with SD card prices dropping, a 32 GB card was a good value. Fig. 1 shows the essential RasPi 3 setup: HDMI monitor, mouse, keyboard and RasPi3 booted into the graphical interface.
I rarely use the graphical interface on a RasPi — a majority of my projects use a RasPi as a “headless,” dedicated computer, so it’s always a pleasure to work with the attractive and well-appointed GUI, with plenty of remarkable free software suites pre-installed, like Libre Office and Wolfram Mathematica. After configuring the onboard WiFi to connect to my local network, I used WinSCP on my Windows PC to copy the PSD Generator files from the PC to the RasPi 3, dropping the files into the /usr/local/src/PsdGenApp/ directory just to keep things tidy. Since the Rasbian Jessie image includes a Java installation by default, there was no fussing with an installer or browsing to the Oracle website for the latest Java version.
On the RasPi 3, I created a small Linux script in same directory as “PsdGenApp.jar” (the main PSD Generator jar file), and called this script “Run PsdGenApp”.
This script contains the following two lines:
java –jar “PsdGenApp.jar”
To run the script, it must be made executable. This can be done using the RasPi GUI or terminal. The GUI method is easy: Right click on the file icon, choose “Properties” in the dropdown list, and select Permissions | Execute: Only owner and group. If we were using a command line interface chmod 0755 RunPsdGenApp would have the same effect.
Fig. 2: Screenshot of the RasPi 3 running the iBiquity PSD Generator. Now it was test time. I double clicked on the script to execute it and a dialog box popped up asking if I wanted to execute the script in the Terminal (nothing will happen because the app requires a GUI) or just Execute it. I chose Execute and the PSD Generator app appeared, as seen in the screenshot in Fig. 2. Although mentally I know that Java apps are platform-independent, I am always surprised when I actually see a platform-independent Java app that “just runs” without modification on two different platforms with two very different processors.
So the PSD Generator runs on a RasPi 3, well and good, but will it transmit data?
I dug around in my iBiquity-provided software toolbox and found a Windows version of a command line PSD “receiver” application that displays the received PSD-formatted data on a Windows console. I wrote a short Windows command script that contained eight commands:
:: This starts instances of the PSD receiver application on
:: the Windows computer.
start “HD 1 port 11000” psdgenrx -p 11000
start “HD 2 port 10010” psdgenrx -p 10010
start “HD 3 port 10011” psdgenrx -p 10011
start “HD 4 port 10012” psdgenrx -p 10012
start “HD 5 port 10013” psdgenrx -p 10013
start “HD 6 port 10014” psdgenrx -p 10014
start “HD 7 port 10015” psdgenrx -p 10015
start “HD 8 port 10016” psdgenrx -p 10016
Each command starts a fresh instance of the PSD receiver application, but listening on a different port. The text string “HD 1 port 11000” simply puts a titles on the console window so you can tell what each window is expected to receive. When the script was executed, eight console windows appeared, each “listening” on a different port, simulating an Importer PSD port. The Windows screen display was a mess with eight windows overlapping each other. On a hunch, a right-mouse click on the Windows system tray showed a useful option “Show windows stacked” which resized every console to fit neatly on the screen. This was the first time I had needed such a stacked-display option.
Fig. 3: Screenshot of the Windows PC running 8 instances of the PSD receiver application. Back on the RasPi 3, I clicked the send button on the PSD Generator app and was rewarded with … nothing. A quick settings check showed I hadn’t configured the generator with the IP address of the Windows PC; every address was still set to “localhost” (127.0.0.1). Already in a command line mood, I opened a console in Windows and entered “ipconfig” to see the PC’s IP address, in this case, 192.168.1.212. I entered that address into each of the PSD Generator’s eight address locations on the RasPi 3. The default port numbers were kept so a typical address looked like 192.168.1.212:11000.
Another click on the send button and the PSD text automagically appeared on the Windows console that was listening for messages on port 11000. In turn, each of the eight “channels” was selected on the PSD Generator and send was clicked. Text was automagically sent from the RasPi and was successfully received in the respective Windows console, as seen in Fig. 3.
While this was a quick and enjoyable summer RasPi trick, I began wondering what other software applications I had on hand that could also run on the RasPi … perhaps something that could execute on a RasPi running the Win10 Internet of Things operating system …?
Rich Rarey is RWEE technical editor and principal of Rareworks LLC consulting. Email him email@example.com.