Thursday, August 15, 2019

Audio latency of various Android devices

I am interested in SDR in general, and low latency CW / SDR on portable devices while back packing in particular. I used to be active in that field around years 2007-2008, while I developed the PocketDigi application for Pocket PC platform (the Pocket PC platform has been killed by Android some five years ago), and I was hacking digital modes on an Altoids tin size transceiver

I built an Omnia basic transceiver, which is a reincarnation of the Peaberry SDR, for which I modified the firmware to support low latency CW transmit generated by the SDR board directly without any host support.

With the Omnia SDR transceiver, I was hoping to develop a lightweight back packing SDR CW setup. For CW, audio latency is important. With the help of the application, I measured the following numbers on various Android devices, sorted by decreasing latency:

Device Android Clock Audio buffer size Round trip latency
Onyx Boox C67ML (e-ink reader) 4.2.2 44100 Hz 1024 bytes 325 ms
Samsung SM-J320FN (smartphone) 5.1.1 44100 Hz 960 bytes 312 ms
Chuwi Hi8 Air (Win10/Android tablet) 5.1 48200 Hz 1152 bytes 269 ms
Nexus 7 (tablet) 4.2.2 44100 Hz 512 bytes 123 ms
Nexus 4 (smartphone) 5.1.1 4800 Hz 240 bytes 51 ms

Interestingly, the Samsung phone shows a terrible round trip latency, while otherwise I am quite in love with the device. The old Nexus 4 phone shows the lowest latency, while still not close to the 20 ms round trip latency to be considered real time from a music performance point of view.

Sunday, September 18, 2016

Analysing the BAITE USBasp_H6 AVR programmer clone

At my day job, we bought a batch of BAITE USBasp_H6 branded AVR ISP programmers.

Now it seems that from the batch of the ISP programmers we will likely use just a handful for its original purpose. Now what to do with the rest? I thought the board may make a nice low cost general purpose micro controller platform, if only a handful of I/O pins are required for the project.

The BAITE USBasp_H6 is a clone of 

On the following schematic diagram, the simplifications of the original design were marked with a red pen. The BAITE USBasp is equipped with a standard AVR SPI(ISB) 6 pin connector, which I have drawn in red as well.

The BAITE USBasp_H6 clone is equipped with an AVR ATMega8A micro controller

The ATMega8A is quite powerful. It contains 8KB FLASH, 512B EEPROM and 1KB SRAM, a hardware multiplier, 10bit A/D converter, one 16bit timer etc. When looking at the schematic, 4 general purpose pins are accessible at the programming connector and two A/D input pins are accessible at the LED terminals, if the two LEDs are removed. Another two general purpose pins are accessible at the D- and D+ pins of the USB connector, although one would likely need to remove the two Zener diodes D1,D2 and the resistor R3, and one would likely need to bridge R1 and R2.

Here is an example WinAVR project to blink one of the LEDs on the programmer board:

The cool thing about these programmers is, one may use the provided programming cable to program one programmer with the other. The programmed device needs to have the reset pin of the ATMega8A controller connected to the reset pin of the 6-pin connector. The BAITE USBasp_H6 boards provides two tiny soldering points, which need to be bridged, see the following picture.

The BAITE branded programmer was delivered flashed with a customized firmware, which I was unable to get working with avrdude. I flashed the board with the precompiled hex file usbasp.2011-05-28\bin\firmware\usbasp.atmega8.2011-05-28.hex

According to the advice of the usbasp author, I used the application ZADIG to configure the USB driver for the programmer. Surprisingly, the USBasp programmer gets a Microsoft driver installed, which does not work correctly with avrdude. With the help of ZADIG, I installed libusbK v3.0.7.0, with which the avrdude is happy.

Monday, September 14, 2015

3D printed ultra portable paddle

A first version of an ultra portable 3D printed paddle using a minimum of metal parts. The paddle mimics a wonderful design by OK1QO, which is the black anodized aluminium paddle. The printed paddle weights 22g only, while the OK1QO weights 40g. The printed paddle feels OK, but it makes less audible clicks when operated.

Tuesday, January 28, 2014

Comments on "2xIRF520 amplifier evaluation on 40m"

Hi Scott KB0KFX,

Usually one inserts about 3dB attenuator before the input transformer to tame the input SWR. The 3dB attenuator assures, that the transceiver sees at worse 1:2 SWR. I am not an RF engineer, so please take my comments with a grain of salt. I am a software engineer with the specialization on computer graphics.

My understanding is, the input SWR is not much a problem for the PA, but more for the driving transceiver. The FET gate is strongly reactive and the only resistive load there is the gate dumping resistor, in the case of the WA2EBY amplifier it is the the bias resistor, which also dumps the input RF energy into the decoupling capacitor at the bias potentiometer.

I will measure the amplifier on higher bands once I make the low pass filters. I did measure the amplifier on higher bands without the low pass filter, but the results are difficult to interpret. Without the low pass filter, the amplifier generates a lot of harmonics. With the low pass filter, the harmonics are reflected back to the amplifier and this has a positive effect on DC efficiency and on the maximum output power at the base frequency. The drain curves on the higher bands were not that square as on 40m or 80m. On 80m I bet the amplifier will work as well as on 40m. The square wave at the 50Ohm load has the same voltage on 80m as on 40m and the output transformer does not overheat, therefore the single turn primary of the output transformer has sufficient inductance and coupling. On higher bands the efficiency will likely suffer a bit. I did not test the amplifier on 160m and I do not plan to. The output transformer may not provide enough impedance on 160m. My main goal are the usual SOTA bands - 40m to 15m and I do not shoot at higher frequencies at this time of the solar cycle.

Regarding the input transformer, I built the transformer of the NM0S 50W linear amp with 2xIRF520 push pull FETs. If it is good for NM0S, then it will be good for me. The HF Packer amp input transformer transforms from 50 Ohm to 2x 100 Ohm (2x the same voltage, but half the power at each secondary winding). The transformer of NM0S amp transforms from 50 Ohm to 2x 25 Ohm (half the voltage, half the power at each secondary winding). It is logical to drive the 2x higher input capacitance of the IRF520 with lower impedance.

A very efficient yet simple way to build the output transformer is 1:4 or 1:9 impedance ratio (1:2 or 1:3 turns ratio) with primary made of copper or brass tubing, secondary going through the tubing. Secondary wound inside the tubing increases coupling. Increasing the impedance ratio increases PA power, but also increases heat strain on the FETs and on the output transformer. There is also chance, that the transformer will not have sufficient inductance on low bands therefore producing insufficient coupling. The 1 turn primary may have insufficient inductance on 160m. Loading the FETs with a too high impedance ratio will magnify the effects of the FETs on resistance, therefore increasing thermal losses. The 1:4 impedance ratio seems to be a good compromise for the 2xIRF520 on 13.8V. It may be interesting to use 2x two IRF510s in parallel instead of the IRF510 to improve thermal coupling, as electrically 2xIRF510 is roughly equivalent to 1xIRF520. This setup would likely be all right at 100W.

WA2EBY wrote, that he experimented a lot before achieving reasonably flat gain on all HF bands. I did not do that (yet). There is really not much one could do. One has two means to control the self oscillations. Loading the gates with resistors and inserting resistors between RF source transformer and gate. Those two methods may be frequency controlled by a series inductance at the gate load resistor and parallel capacitance at the gate series resistor. WA2EBY reduced gain losses at higher bands by the gate bias inductances. I will likely try the same.

I am curious how long it will take for me to burn the 2nd set of FETs. The first set died of insufficient thermal coupling to the heat sink. I found following article enlightening:

At another place, I read that the silicon thermal pads are not as good as they are supposed to be if the heat sink surface is not sufficiently flat and polished, where the greased mica is supposed to work better.

Rod Elliot warns of the low quality of mica pads. Indeed, I measured the thickness of the mica pad I bought in a local "drug store" in Prague, conveniently placed on my commute way to work. The thickness varied from 0.1 to 0.15. Advised by Rod Elliot, I chipped one mica pad to two or three, with the thickness of 0.04mm. With the fan on the heat sink running, I was surprised how cool the FETs stayed at >100W RF output with 40W disspated.

73, Vojtech OK1IAK

Sunday, January 26, 2014

2xIRF520 amplifier evaluation on 40m

I posted couple of pictures of my 2xIRF520 push-pull HF amplifier prototype. This time I measured its performance on 40m. I will continue with other bands once I build the appropriate low pass filters.

My prototype is derived from the famous article by Mike Kossor, WA2EBY, "A Broadband HF Amplifier Using Low-Cost Power MOSFETs". My prototype differs in couple of details:
  • Instead of two IRF510 MOSFETs I am using two IRF520. These have 2x higher input and output capacitances, 2x lower on resistance and somehow higher maximum power dissipation and lower thermal resistance than the IRF510, which everyone uses.
  • I am using an input transformer ratio 12t:2x6t wound on FT50-2 bifilar. This drives the FET gate harder, but requires twice the input power.
  • I increased the gate bias resistors to 330 Ohm with the hope to decrease the drive power requirements. The amplifier was stable with the 1:1 input transformer, but not with the 1:2 input transformer. I inserted 4.7 Ohm resistors between the input transformer secondaries and gate capacitors.
  • I made the output transformer with the same ferrite core, but the primary is a single turn made of silver plated brass tubing. The secondary is made of 2 turns of 22AWG silver plated teflon coated wire.
The amplifier of WA2EBY was wound with 2t primary and 3t secondary, which leads to 4:9 impedance ratio. My otput transformer has 1:4 impedance ratio. In ideal case the output power of my amplifier shall be around 1.8x higher at the same DC voltage. It would certainly not be the case if I just changed the output transformer ratio by keeping the 2xIRF510. But with half the on resistance of the IRF520 it may work.

Performance of the 2xIRF520 push-pull amplifier on 40m
The efficiency is very good when driving the amplifier very hard. The output power is sufficient for a backpacker operation and compared to the HF packer amp, the DC-DC converter to 28V is not required to achieve the same output power. The HF packer amp DC-DC converter regulates the PA voltage while the battery voltage drops keeping the output power constant, but the DC-DC converter increases power losses somehow.

The RF gain has been measured by setting the input power with a step attenuator and measuring the RF voltage on a 50 Ohm dummy load after the 40m low pass filter with a 1:10 scope probe, reading the voltage from an analog Tektronix scope. One clearly sees the compression at high drive levels. Driving the amplifier hard brings great power efficiency, but the amplifier is not linear enough even for morse code. The CW envelope shaping disappears, leading to key clicks. I am driving the amp with an ATS-3b transceiver, where I integrated a switch controlling the roundness or slowness of the CW envelope. Setting the switch to a "slow" position keeps the output envelope sufficiently round with 3dB RF input attenuator and power efficiency of 69%.

There is a dent in the RF gain curve around 16dBm RF input power. When looking at the drain curves at 7MHz loading the amplifier with 50 Ohm dummy without the low pass filter, I see a square wave. That's what I would expect. But there is a high voltage spike at the beginning of the square. Likely it is the effect of the drain/source capacitance of the FETs and one cannot do much about it with AB, C or D class amplifiers. One could eliminate the unwanted effect of the drain/source capacitance with the Class-E amplifier. If one decreases the RF input power level, there is another interesting effect. The high drain/gate capacitance causes the drain peak to influence the gate threshold voltage. This may switch the FET off until the input RF voltage increases again. If driving the amplifier hard, the slope of the input voltage is so high that the effect is negligible. But when driving the amplifier at low power levels, the effect causes ugly ripples of the drain voltage. Those oscillations are removed by the output low pass filter, but they harm the transistor linearity, as visible from the RF gain curve, and they may harm amplifier power output and efficiency on higher bands. The IRF520 with its drain / source capacitance twice of the IRF510 will likely not be usable on 10m band.

I tried to run the amplifier from a linear 24V power supply. The voltage dropped to 23.6V while producing 115W RF out with 197W DC in. That is 58% efficiency and 41W power dissipation at each IRF520. With forced air cooling I was able to keep the temperature of the heat sink around 40oC with brick on the key, but because of the high temperature resistance of the FETs the chip temperature likely raised over the maximum 175oC allowed. With the forced air cooling, the hottest part on touch was the output transformer core. I would not recommend to run the amplifier at these power levels, but running the amplifier at 18-20V sounds safe, if I only had such a power supply.

I set the bias current to 100mA per MOSFET. When the temperature of the heat sink rises, the bias current increases to around 150mA per MOSFET. With the ventilator running, the FETs are kept cool and the bias current stays at 100mA. This shows the efficiency of the Pentium heat sink. Passive heat sinks are designed differently from the forced air heat sinks and the Pentium heat sink has to be cooled if a significant power is to be dissipated.

My first prototype had 3 turns secondary on the output transformer. That lead to very much the same effects as running the amplifier from 24V. The input / output power increased by 9/4=2.25x. I expect the efficiency to drop a bit because of the higher saturation voltage at higher output currents. It would likely be a reasonable solution, when running the amplifier from 9-12V DC, producing 40-70W output RF power.

I am curious how will the amplifier perform on higher bands. I studied the low pass filter designs of the Juma amp, HF packer amp and the HardRock amplifier. The silver mica capacitors are very expensive and the Juma and HardRock amplifiers use 100V NP0 SMD ceramic capacitors. I will likely try those.

73, Vojtech OK1IAK

Sunday, October 27, 2013

Active Ferrite Rod Antenna by OH7SV / OH2NLT

I built an active ferrite rod antenna designed by OH7SV, modified by OH2NLT. The circuit provides ample of signal from 80m to 20m. The efficiency of the ferrite rod used is questionable above 30m. The antenna is a perfect accessory for spending lonely evenings on a hotel with my ATS-3b transceiver. The antenna has sharp nulls on vertically polarized magnetic fields and is quite insensitive to near electric fields. Contrary to the common belief , its directionality is poor for signals reflected by the ionosphere.

Original source:
Active Ferrite Rod Antenna for HF, 08.10.2005 OH7SV
Active Ferrite Rod Antenna OH2NLT

The ferrite rod made by Pramet Sumperk during the Iron Curtain era may be sourced cheaply from
The rod is not as good as the Amidon 61 material counterpart, namely the Pramet N2 material has 2x higher permeability than the Amidon 61 material and it has lower Q and higher losses on HF than the Amidon material. But you cannot beat the price, the rod is about $1.50. If there is enough interest, I may organize a group buy. I may also source the boxes and pieces of the PVC tube.

Tuning control, power off switch, power indicator LED and BNC output on the front side. The ferrite rod is fixed in the PVC tube by injecting hot melt glue at both sides.
Old Russian made polyvaricon placed above the ferrite rod, because the box standoffs would stay in way if the rod was positioned at the top. The box has a convenient 9V battery compartment.

Tiny amplifier board made on a double sided blank board by cutting traces with a needle file. Using two BFR93 low noise transistors as OH2NLT. The output is coupled to the BNC connector by a voltage balun wound on a tiny Amidon 43 material binocular core.
The antenna works well as an accessory to a QRP radio for direction radio finding. It would be cool to add the whip antenna input and 8/cardioid switch. For a single band, I could imagine wiring the amplifier on a additional plug-in board for the ATS-3b.