Challenge: Send a Fax Without a Landline or Fixed-Line Internet

A week ago, a friend approached me about sending off a fax. Despite the march of technology, this particular form had to either be mailed back (taking a few days and costing a decent amount of money) or faxed. My friend had no access to a fax machine, so the task was handed over to me.

I thought about how I was going to achieve this. Due to the sensitive nature of the document, free online fax services were out of the question. I didn’t want to have to sign-up for “virtual fax” services from a VSP either just to send it off as a one-off fax either. I decided I’d have to do it the old fashioned way, as if I was faxing it from my own landline (which I don’t have).

As much as I do love voice-band modems and fax, getting this to work in my new location is especially challenging since I have no access to fixed-line internet at the moment. As a result, the only form of internet I get is wireless – whether that be by 4G/LTE or Wi-Fi. The variability in quality of service from such services doesn’t generally play well with VoIP when carrying data rather than voice.

Still, I decided it would be worth giving it a shot just to see if it could be done.

The Setup

This one hand-drawn diagram with colour coding shows the whole set-up and the various potential issues related to it. We started with a physical document – this was scanned on a CanoScan LiDE 210 into a PDF file for transmission.

The first issue was to do with the choice of faxing software. In my experience, the most superior Windows-based faxing software would have to be Symantec WinFax Pro, which I still very much like for its halftoned image output, nice status information and support for ECM and 2D compression on send and receive. This is not something which Cheyenne Bitware or the built-in Windows Fax could do. Unfortunately, WinFax Pro doesn’t work well even with Windows XP SP3, so I decided that I’d use it under Windows 2000 Professional instead. This necessitated running it inside a VM, since I didn’t fancy going out to the garage to grab my Windows 2000 laptop to do the fax.

Because Windows 2000 was running inside a VM, I had to inject the PDF file into the vmdk disk. No big issue – mount it read-write and copy it in. The next step was to get something to open it – so I went trawling the internet to download an old version of Acrobat Reader 9 that would run. That was fine.

Next thing I needed was a modem. I had plenty of external serial modems with Rockwell chipsets that play well with the software. Unfortunately VMWare serial pass-through does strange things to the timing of the handshaking signals, so I had to instead use an FTDI USB to Serial cable and use VMWare USB pass-through. This allowed me to install the FTDI drivers under the VM to get a serial port working well-enough to fax. The modem power supply then decided to promptly die … so I had to substitute another 9V AC power adapter at the last moment.

Now I had the modem operational, the modem expects to talk to a phone line. I have no landline here – so I have to emulate one using my Grandstream HandyTone HT702 ATA. This was then connected with my SIP account with myNetFone, so I could route calls to the PSTN via my internet connection.

Therein, lies the crux of the problem. The internet connection is a Vodafone LTE mobile connection out of my Xiaomi Redmi Note 4X. This connection varies quite a lot for speed and reliability despite being a 5-bar signal and carrier-aggregated because the area I’m in has poor fixed line services and many people use LTE instead. The way Vodafone’s network works is that all of the data sessions go through their carrier grade NAT. The phone itself, when operating USB-tethered to my router also has its own local NAT (192.168.42.0/24). Both of these have no facility to do any port forwarding. Finally, my router is configured to further NAT this connection, because the phone only supports around 12 devices directly connected to its tethering. At least I’m not going over Wi-Fi tethering, otherwise I’d have Wi-Fi interference to deal with in addition. To ensure SIP works properly over a triple NAT connection is pretty hard … but somehow, it seems that regular keep-alive packets did the trick well enough.

After emerging from Vodafone’s CGN, the data has to traverse a further 9 hops over the internet to reach myNetFone‘s gateway, where the call could then be patched through to the PSTN. This adds even more latency, jitter and packet loss possibilities.

To test whether this would even be feasible, I attempted a few test calls to try and establish a voice-band modem connection to a known-good V.90/V.92 endpoint. Using G.711a passthrough, no calls were successful in establishing a V.90 connection, with a V.34bis connection at 26.4kbit/s symmetrical being the best that could be established but not sustained over long periods owing to the packet loss causing continuous retraining.

I had my doubts this was going to work. That’s when I decided to abandon the concept of G.711a passthrough and exploit the T.38 capabilities of the ATA and the VSP. By using T.38, instead of passing the call as packets of voice, the packets contain the demodulated data instead along with a back-up copy of the previous packet. This allows the stream to be better buffered without violating fax signal timing requirements and the signal to be regenerated in a “sensible” way even if some loss were to affect the call. Further to this, I decided to enable ECM and 2D compression to minimise the transmission size and allow for errored blocks to be re-requested, providing the recipient machine is capable of it.

In the end, it worked gloriously. Four pages were sent in eight minutes at fine resolution, ECM and 2D compression (MMR) was active and no blocks were re-requested at any time throughout the transmission. Who would’ve guessed that T.38 could work this well?

Conclusion

Against all odds and much to my surprise, the document was delivered successfully despite the very complicated setup and the limitations of the connectivity available. All bets are off as to whether I could do it twice, or at a different time of day, but at least it worked when I needed it to. That’s what counts in the end.

I suppose another option would be to use something like a software T.38 modem that emulates a fax modem on one side and communicates with a VSP using SIP and T.38 to send the fax, although this might not be quite the same for reliability and flexibility and is not something I’ve tried.

I just hope I don’t need to send any more faxes …

Posted in Computing, Telecommunications | Tagged , , , , , , | Leave a comment

Analysis: Mains Power Quality – Voltage, Frequency & Crest Factor (10-19 May 2018)

A little more than two weeks ago, I was sitting at home in front of my computer going about my business as usual, when suddenly … the lights flicker, everything around me made an intermittent 50Hz buzz like morse code and the computer stops functioning entirely. Less than two seconds later, the computer’s automatically restarting and everything seems to be back to normal, aside from some lost work.

Whatever it was, it seems that something somewhere nearby has faulted rather spectacularly. After checking that none of our own breakers had tripped and none of our equipment had spontaneously exploded or vapourized, I took a peek outside and nothing seemed untoward.

If I was living in a neighbourhood with overhead wiring, this might not be unusual – a tree branch falling across wires, a car into a power pole, wire clashes in extreme wind or wildlife getting cooked between the lines causing some arcing would cause the symptoms experienced. But in this case, we have underground wiring throughout the whole neighbourhood, so maybe someone dug through a cable somewhere nearby? Could be a possibility with some level of housing construction nearby as well as NBN underground HFC network preparation going on at the moment.

That got me thinking – I haven’t analyzed the mains power in my present location, so what is the mains here like anyway? Would there be any interesting time-based patterns, especially with local solar generation? Or would there be any interesting cross-correlation patterns? I was curious.

Methodology

Throughout the period of 10/05/2018 through to 19/05/2018, I connected my Tektronix PA1000 Power Analyzer to the incoming mains from an ordinary GPO inside the house, which is served by Endeavour Energy. Using PWRVIEW running on a Windows 10 computer, I recorded the Voltage (Volts RMS), Frequency (Hz) and Crest Factor at maximum resolution approximately one second intervals throughout this period. The data was exported to an Excel spreadsheet for further analysis.

A total of 842,198 data points were recorded in this time, resulting in an Excel workbook of about 130MiB. A 604,616 data point subset comprising of the readings between 11/05/2018 to 17/05/2018 was used for weekly average trend analysis. Further graphs were made on 10-minute averaging which were based on taking the mean of 600 consecutive readings.

Based on the datasheet, the PA1000 is specified for a worst case (in this scenario) voltage error of about 0.43V and frequency error of 0.05Hz. No accuracy figures were available for crest factor. The operating temperature throughout the experiment was maintained within instrument limits.

Results and Analysis

General Statistics

Overall, the general statistics on the recorded data were as follows.

      VOLTAGE  FREQUENCY CREST FACTOR
MEAN  245.4681 50.00089  1.377924
STDEV 1.753048 0.061127  0.0051
MAX   253.96   50.285    1.8858
MIN   236.90   49.758    1.3642
RANGE 17.06    0.527     0.5216

The mean voltage can be seen to be about 245.5V, which is a little higher than the 240V which was the official nominal voltage prior to the 230V harmonization, but still below the 253V (230V+10%) high limit. With a standard deviation of just 1.75V, the voltage regulation is quite good, although in its maximum, it did hit the high limit.

Frequency was pretty much spot-on, with quite a bit of range reflecting network operating responses and one-off measurement errors possibly due to noise around the zero-crossing.

Crest factor was lower than the ideal 1.414, reflecting the common trend towards flattening of the peaks of sine waves thanks to the widespread use of switch-mode converters. The range for crest factor was also quite high, suggesting many potential high spike readings due to noise.

All Data Graphs

One of the first questions I had was whether there was a correlation between locally observed voltage and frequency. While frequency can be measured and reflects the energy balance between generation and load, voltage also reflects the load to some degree but in a more localized way (primarily resistive losses in the local distribution network). As a result of regulating devices (e.g. tap-changing transformers), I didn’t expect that there would be any relation and the data seems to support this with a very low R^2 value, implying only a very slight correlation.

The next question I had was to do with the line voltage – what is the probability of observing a given voltage on the line. By grouping into 0.2V bins and plotting a probability density function, it seems that it roughly follows a symmetrical bell curve, although with two closely spaced peaks. Given this result, I think plotting a cumulative density function might be more instructive.

With the CDF, it seems that the middle probability corresponds to 245.25V, with the voltage staying between 243.0V and 247.5V in 90% of the time.

Repeating the same thing with frequency instead, grouped in 0.01Hz bins shows again something quite close to a symmetrical bell curve, with a slight left skew and a few spikes.

We operate at 50Hz in Australia, and the middle probability seems to correspond to 49.992Hz or thereabouts which is extremely close – the difference is less than the instrument’s guaranteed error margin! The frequency seems to stay between 49.91Hz and 50.072Hz for 90% of the time.

This got me curious as to what the crest factor (which describes the peak-to-average ratio of the waveform) was doing in relation to the two variables of voltage and frequency. The plot seems to show that the crest factors are mostly in a big blob towards 1.38, but in the middle, seems to exhibit some pockets of higher crest factor values. This plot itself is deceptive, as you might see later, as there are quite a lot more points towards the centre of the plot where a given voltage occurs more frequently – so to see a larger spread in crest factor values towards the middle could be expected.

Crest factor versus frequency was quite a surprise too – it shows clustering again with some banding due to the limited resolution in the frequency axis, but there are now three distinct “pillars” where crest factors increase – one at low frequency, one at high frequency and one around nominal frequency. This all becomes reasonable when we consider the weekly trend graphs presented in the following section.

Weekly Trend Graphs

Using a seven day subset of the data, it was possible to overlay all seven days into a single graph to try and identify daily recurring patterns.

Looking at voltage, it seems every day has its own pattern, and while there are ups and downs, it’s not clear exactly that there is any significant trend. There is, however, a strange occurrence on the 15th, where in the evening, the voltage seemed anomalously high for a few hours.

The overlay frequency graph shows that there is just about no great pattern at all – every day shows very similar variance.

The crest factor graph, however, shows a few clear temporal patterns of interest. Notably the spikes in crest factor are distributed around the day, but generally lie at 28 minutes and 58 minutes past the hour. This gives us a clear sign that the crest factor spikes seem to be a response to off-peak power switching, commanded by K22/Decabit switches. This matches what is known from measuring the schedule in the past. But outside those spikes, there is a sort of “wave” going on which repeats each day.

Noting that the graphs are a bit haphazard overlaid, I decided to average the results from each second across all days of the week and plot the averaged data instead. On top of this, I added a three-minute running average trend-line to the data to see if any trends could be made clearer.

The voltage trend graph only shows a subtle voltage depression in the middle of the day, but hardly anything significant. In the morning at about 6:10am, the voltage falls, and just before 7am, it peaks again, which seems to be one of the major voltage excursions of the day. This happens in reverse around 6pm, but even then, the change is only about 3V. In the evenings, the voltage recovers at around 8pm.

The spikes go up and down, but on the whole, it’s practically balanced around 50Hz, so nothing particularly interesting here.

The crest factor graph confirms the overlay results – there is a nice “wave” pattern going on, with spikes at the off-peak switching times. The range of variation in crest factor at each time is actually quite low compared to the other measured parameters. I suppose the three-legged scatter plot with frequency can be explained by the idea that this off-peak switching is scheduled to power up devices when the grid has excess energy at night for storage (i.e. when frequency is high), or turn them off at times of high loading (i.e. when frequency is low), with other times switching occurring at neutral frequency purely due to timing requirements.

I decided to take it one step further and average into 10-minute time intervals to see what the resulting graph might look like.

The subtle voltage trend has been slightly clarified with the dip around 6am remaining, but also new dips near 10am, 4:30pm, 6pm appearing. A noticeable upward movement is seen around 8pm.

Frequency remains rather random in its trend, but with a more noticeable rise in frequency around 6:30am-7:00am.

For crest factor, this had the effect of smoothing out most of the day-time spikes, giving us a nice look at the “roller coaster” type curve. I suppose it correlates well with the productive daytime power usage – e.g. all those computers being used, along with industrial processes may be responsible for the crest factor reduction.

Conclusion

Through leaving my Tektronix PA1000 to continuously sample the mains supply, I discovered that the voltage here is actually quite stable, and slightly on the high side (as seems to be the norm). There is only a very subtle daily voltage trend, whereas the frequency seems to be largely uncorrelated with voltage or time, implying good local voltage regulation. The crest factor measurements were most surprising, showing spikes around off-peak power switching events and having a noticeable trend throughout the day with the crest factor dipping in the middle of the day and again towards midnight and 4am. The crest factor seems to peak around 7am and again at about 6pm, which may reflect a difference in types of loads connected to the grid.

Posted in Electronics | Tagged , , , | 1 Comment

Satellite Signal Analysis: What if you have no loop-out port?

A number of people had expressed interest in the past in examining satellite signals from broadcast satellites using SDRs. While my normal advice is to use a regular satellite card to power the LNB and do the DiSEqC selection duties and take the signal from the loop-out port. This has been quite a handy trick, as the loop-out port is normally DC-blocked and buffered so as not to cause impedance problems or consume any RF signal. Unfortunately, it seems that most cards nowadays do not have a loop-out port.

So if you want to analyze satellite signals, what do you do?

The Hard Way

The hard way would be to build your own LNB power injector or inserter or purchase one. These units usually have either fixed or switchable voltage output for the LNB to change polarity and some even have 22khz tone injection switches to change the band of “universal” Ku LNBs. They generally don’t have provisions for DiSEqC injection, so you’re likely going to need an inserter per-LNB. The output is normally DC-blocked, with only the RF which you can use with an SDR or spectrum analyzer. This would give you the whole output dedicated to your equipment.

To design your own with good isolation and a pass-band of 950Mhz through to 2150Mhz without significant impedance mismatches is not a trivial task, so I’d advise against it unless you are adventurous or have the equipment and expertise to do it. While you can purchase a commercially-available solution, they’re not cheap depending on where you are. The lack of DiSEqC may make cabling a little more messy too.

The Easier Way

The easier way would be to split the signal from the LNB before it gets to the single port on the satellite card. To do this properly requires a bit of care – you can’t just wire things in parallel otherwise you’re going to have horrendous impedance mismatch!

Splitters can be found on eBay fairly cheaply, but not just any splitter will do! Many of the splitters are intended for terrestrial use and do not cover the satellite band of 950Mhz to 2150Mhz, resulting in high attenuation. Another issue is that many of the splitters are all ports power pass, on the premise that “more is better”. The downside is that many of these splitters with this feature expose the LNB power to the split ports which may fry your RF equipment if it doesn’t expect to see DC bias of up to 18V + a relatively strong 0.65V 22khz tone signal.

As a result, you’re best to look for a two port splitter with DC blocking on one leg. These too, have become somewhat rare. Otherwise, you could use an all-ports-power-pass splitter with a DC block for safety, but these aren’t that widely available here.

Luckily for me, I found the Matchmaster 07MM-GM02. This is exactly the type of splitter I describe – suitable for terrestrial and satellite with just one-port power pass.

They’re a fairly respected brand here, although the part is Made in China, possibly from the same place as many others.

The unit comes bagged, with ports covered, mounting screws and a grounding screw.

While the unit seems to be soldered shut, it’s not made for outdoor installation. The batch number suggests that it was made in May 2017.

F-connector ports, as usual, and a QC label round out everything about the splitter. The downside of using this technique is that the splitter’s insertion loss is up to 5dB on each leg, so the output signal will be reduced. However, this is probably not enough to prevent locking or decoding of the signal as many LNBs can push out -40 to -50dBm of signal and cards are happy even down to -75dBm at times.

One thing to watch out for is that the order of the ports matter – the power pass port must be connected to the satellite card otherwise the LNB would be unpowered (and the splitter could be damaged). Another thing to watch out for is that if you don’t use the other port, and don’t want to disconnect the splitter, you must terminate the port with a 75 ohm terminator or risk having impedance mismatches cause standing wave effects.

There is also another caveat – TV reception equipment is generally made for 75 ohm characteristic impedance, whereas amateur radio, spectrum analyzers and SDRs have a 50 ohm characteristic impedance. The mismatch is not particularly problematic in the case of signal reception and shouldn’t cause any damage, but it makes getting absolute figures a little difficult.

Unfortunately, while there are some in-line amplifiers, they seem to make things worse with a non-adjustable (and often excessive) level of gain which can cause overdriving and intermodulation which degrades the signal to noise ratio rather than improving it.

Conclusion

No loop out port? No problems, as long as you can find either an LNB power inserter with the features you need or an F-connector splitter with all-ports-power-pass and a DC-block or an F-connector splitter that only has power pass on one leg. Each of these options has their own advantages and disadvantages, but it means that not having a loop-out-port on a satellite card isn’t such a big pain after all.

Posted in Satellite | Tagged , , | Leave a comment