Back to the future with dialup and Android

Honza Bartovský
Storyous DEV
Published in
5 min readFeb 6, 2018

It all started when we were looking for a solution that would allow us to display information to customers from our Android POS - a secondary display which would allow the customer to see the amount to be paid even when the staff has the app behind the bar while you are paying.

14" tablet with a heavy stand, our larger solution, has an HDMI input so obviously, the first thought that came to our mind was to use a standalone display.

The cheapest 10” LCD for around $50 without customs and VAT? Soon someone came up with an idea that it might be cheaper to just use another tablet as a display.

We had a few requirements to start with:

  • The USB port must be free to allow the tablet to be charged.
  • It would be nice if it could work with no internet connection.
  • It has to be easy to use — no configuration needed and even your grandmother should be able to set it up.

Soon we had a complete list of suitable technologies and their drawbacks ready:

  • USB and a virtual COM port
    USB is not free for charging.
  • Wi-Fi
    Not very useful when offline. Even a P2P solution is out when the local network fails.
  • Wi-Fi Direct
    Main device must be using two chips to communicate over Wi-Fi Direct and the classic Wi-Fi simultaneously.
  • Bluetooth
    The configuration can be a bit tricky.

I saw these two lists and I wasn’t sure it is going to work out. Then I remembered someone talking about our friend’s David Ovčačík’s bachelor thesis while we were having lunch at work. It was about the communication between Android and another device with a serial port (RS-232) over the audio cable. Memories of the nineties flooded my mind, the chirping sounds of faxes and modems, the nostalgia of eighties and listening to noises from the tape player before one could play the JetPac. But I wanted to give it a try and everyone put their thumbs up.

If the connection is supposed to work in a cafe, a pub or our office, using just sound with no cable would hardly be sufficient. What would I need? A 4 pole jack on both sides, just like on a handsfree set; the audio out from the tablet will connect to the microphone in of the secondary tablet. At that point I had neither David’s bachelor thesis, nor the Android Device Specification on hand, but I assumed the audio jack had the line level output and the signal strength had to be decreased to adjust to the microphone level. In order to make some progress, I decided to build a prototype. About my electrical engineering background: Until now, whenever I needed to solder something, it was to fix things and exclusively with a borrowed soldering iron. After some time spent googling how to adjust the signal, the smartest solution seemed to be this diagram:

I came back from the shop with the following supplies: a cable, four jack connectors, resistors, capacitors, the second cheapest soldering iron, a tin wire and some rosin. Later I found out that for the nickel coated connectors, some shouldering fluid would have been useful.

I realized later that I got lucky when I managed to connect the first cable after many failed attempts; this is where the soldering fluid would have been useful. When I plugged the connector in, an icon of a headset and a microphone appeared in the status bar. Later I realized it was caused by the resistance of a circuit and the system would not respond to plugging in just the connector alone.

Debugging and searching for bad solder joints took a little while and I really appreciated having an oscilloscope listening on the audio input and displaying the waveform. You can use just any YouTube video as a signal source and as soon as you see the waveform of a signal on both tablets you can try to communicate using one of the ready-made apps. I tried three or four of those with varying results. The last one finally communicated reliably and helped me verify that the whole thing could work.

Even though the source code is from GitHub, it could not be well adapted to our needs. But I was happy to check out how an audio modem works and how it’s affected by the parameters such as signal frequency. The major lesson learned was that Android microphone input recording does not usually return the original shape of the signal sent to the input and it is up to the device manufacturer, how the sound is altered before it reaches the AudioRecord class (gain control, noise reduction…) as a data.

Further search in the depths of the internet yielded the project Quiet. It originated as a C library. With time came quiet-js for JavaScript, QuietModemKit for iOS and also Quiet for Android. So far it’s probably the most exquisite library around. Besides several predefined profiles with a few almost inaudible frequencies, it has implemented a UDP/TCP protocol over the audio modem.

I still haven’t gotten the broadcast to work with a profile faster than audible-7k, but if 7 kbps equals 870 bytes per second and we can settle down for transferring just the price paid at the checkout, …why not? We are even going to be able to transmit a simple HTML page which deals with formatting and therefore it won’t be dependent on the customer display application.

In case you are curious about how digital data can be turned into sound and vice versa, google FSK (frequency-shift keying). It is one of the ways to convert zeros and ones into a signal using frequency modulations. It is probably the most common way to do so however, data can also be encoded among others, using amplitude modulation (ASK) or phase shifting (PSK). During decoding, the FSK signal is demodulated; Using the Fourier transformation we can find the frequencies, which can be reconverted back to ones and zeros. I will spare you further details to leave you with enough energy to read the last paragraph.

At this point, the article comes to an end. The lesson I learned is: The transfer of digital data using sound is not dead yet. At least not while we still have a headset jack. Currently, you can use it to plug in a card reader, a thermometer, a hardware button, an RC model antenna, a radiation detector or a BTC wallet. Another idea worth checking out is the project Chirp. We have a working prototype, so we can start working on the design of the stand, check how difficult it will be to manufacture the cable and look forward to the day that someone will be using it. What did I get out of this? My very own soldering iron with the training included and a great feeling every time it worked.

--

--