AGC for uBITx controlled by I2C via Software

Nick VK4PLN admits he has tried just two AGC approaches on BITx rigs: the VK3YE AGC (which is shall we say very illuminating) and the ADAFRUIT TPA2016 I2C module.

Nick found the VK3YE solution messed with the audio quality, made it all scratchy, and still didnt handle local 100w stations well …

Now after playing with the TPA for a few days he is very happy with the results.  Audio has good depth and AGC is responsive, and the unit also gives a nice increase in gain.

One trick for others who want to implement this,  is that you will need to add some code to the Adafruit library to implement the enableNoiseGate(false); function.    We need to turn the NoiseGate off or else the AGC will not ramp up with only background noise and you will not hear anything until a loud signal comes on.  [EDITOR notes that this could be used as a kind of SQUELCH function].

Also the speaker output is NOT grounded, you need to isolate your SPEAKER jack so that the – ve line from the TPA2016 is direct to the speaker with no chassis grounding…   Output from the amplifier can’t be fed into another amplifier.

The Best part in Nick’s opinion is that all of the AGC related settings are customisable if you want.  If not, just use the voice settings from the datasheet.   Nick says the defaults work great!

Stereo 2.8W Class D Audio Amplifier – I2C Control AGC – TPA2016

Nick says he will post the code to the list along with a few pics… This extra info should appear here shortly.


And the board installed in Nick’s uBITx can be seen below.  It looks a real tidy build!


Nik has now shared his software:

VK4PLN’s AGC Code. Adafruit TPA2016
Add call to setupTPA2016(); to main code setup() in ubitx_20 after initOscillators();

#include <Wire.h>
#include “Adafruit_TPA2016.h”

Adafruit_TPA2016 audioamp = Adafruit_TPA2016();

void setupTPA2016() {

// See Datasheet page 22 for value -> dBV conversion table
// Serial.println(“Right off, Left On,”);
audioamp.enableChannel(false, true);

// Noise Gate Threshold: Below this value, the AGC holds the gain to prevent breathing effects.
//Select the threshold of the noise gate (1,4,10,20mV) (0-3)
// Serial.println(“Noise Gate Threshold,”);
//Disable NoiseGate, we want to hear everything, even weak signals….

// Fixed Gain: The normal gain of the device when the AGC is inactive.
// The fixed gain is also the initial gain when the device comes out of shutdown mode or when the AGC is disabled.
// value 6 seems to work ok… based on datasheet. Where gain is from -28 (dB) to 30 (dB)
// Serial.println(“Setting Fixed Gain”);
audioamp.setGain(-12); //-27 is ok? -12 is too high local stations arnt clipped…

// Compression Ratio: The relation between input and output voltage.
// AGC can be TPA2016_AGC_OFF (no AGC) or
// TPA2016_AGC_2 (1:2 compression)
// TPA2016_AGC_4 (1:4 compression) * Datasheet – Voice
// TPA2016_AGC_8 (1:8 compression)
// Serial.println(“Setting AGC Compression”);

// Limiter Level: The value that sets the maximum allowed output amplitude.
// Serial.println(“Setting Limit Level”);
// or turn off with
audioamp.setLimitLevel(30); // range from 0 (-6.5dBv) to 31 (9dBV) (8.5dBv(30) as per datasheet)

//Maximum Gain: The gain at the lower end of the compression region
// Serial.println(“Setting AGC Max Gain (18-30db – (0-12)”);

* For voice systems the attack time should be in the 2-ms region, with a hang time of about 0.3 sec,
* followed by a gradual recovery time of up to 1 sec.

// See Datasheet page 23 for value -> ms conversion table
// Serial.println(“Setting AGC Attack (0.1-6.7ms – (0-63))”);

// See Datasheet page 24 for value -> ms conversion table
// Serial.println(“Setting AGC Hold (0.0137-0.8631ms – (1-63))”);

// See Datasheet page 24 for value -> ms conversion table
// Serial.println(“Setting AGC Release (0.0137-0.8631ms – (0-63))”);


Also, need to add this new function to Adafuit library after the existing enableChannel function:

// Turn on/off Noise Gate
void Adafruit_TPA2016::enableNoiseGate(boolean ng) {

uint8_t setup = read8(TPA2016_SETUP);
if (ng)
setup &= ~TPA2016_SETUP_NOISEGATE;

write8(TPA2016_SETUP, setup);

And the line for the header file:

void enableNoiseGate(boolean ng);

in .h file:
void setNoiseGateThreshold(uint8_t thresh);

in .cpp file

void Adafruit_TPA2016::setNoiseGateThreshold(uint8_t thresh){ //Added by VK4PLN
if (thresh > 3) return; // max threshold is 3 (20mV)
uint8_t agc = read8(TPA2016_AGCLIMIT);
  agc &= ~(0x20);  // mask off bottom 5 bits
  agc |= thresh;        // set the limit level.
  write8(TPA2016_AGCLIMIT, agc);

Pelican and Ammo box style enclosures

Wishbone_aaa spotted in his  workshop a Harbor Freight plastic ammo box that looks like it will do the job. With the lid open, the box is 6 inches deep,9 3/4 wide and 4 1/2inches high. Price $6.99


Meanwhile, Ken, N2VIP suggests that Harbor Freight’s ‘pelican-style’ case is also nice:

uBITX Mic Audio

Dave WI6R thinks that the rig only needs slightly more gain than the existing Mic PreAmp and that adjusting values to add gain is really all that is needed.  He doesn’t think it needs 40 dB of extra gain.

He has resurrected a Mic Pre-amp design used 50 years ago in the SBE SB-33 SF-1 solid state rig that first used bilateral amplifiers.   Bilateral amplifiers are used, of course, in the BITx transceivers.
This design had plenty of gain and worked with a Dynamic Mic with significantly lower output than any of the typical Electret-Condenser Microphones used today.   Also note that the Mic PreAmp was powered only when the rig was in TX and a simple diode was used to shut off the Mic PreAmp in RX with the same TX voltage.
Dave used this rig in the ’60s and doesn’t recall any “pop” when going from RX to TX or vice-versa. The “Signal Splitter” was used to isolate the TX and RX Audio.

Raj, VU2ZAP responded suggesting that simply decreasing the value of R63 would give you more gain!

Sunil VU3SUA kits and enclosures

Those who have constructed BITx40 or BITx20 kits will probably be aware of Sunil Lakhani’s website    Sunil is known for his metal cases, but he sells other products as well.   His new uBITx case will be released shortly, and can be pre-ordered now by emailing the store with a colour preference.

The website has been made to take orders from customers in India only.  This website is still not fully populated with products and some sections have still to be added.

Sunil VU3SUA says his main website for world wide customers will continue to be:

Sunil is also constructing a new website for the uBITx.  This is under construction, but keep an eye out for it on: aims to provide complete info and updates about the uBITx, sharing information with all ubitx builders.

Sunil says that “it will be similar to other group websites like  promoting ubitx info”.   No doubt it will have a different slant and fill a distinct niche in the uBITx ecosystem.

BITx AGC kit

David N8DAH has assembled AGC kits for BITx transceivers.  These were designed for the BITx20 and BITx40, but should work fine in the uBITx.

The AGC design was posted on DuWayne KV4QB’s site found here and used with permission. All kits will come with:

  • PCB x 1
  • Parts placement layout x 1
  • 2N3904 x 1
  • 2N7000 x 1
  • 47uf x 2
  • 1N4148 x 1
  • 100R x 3
  • 100k x 3
  • 10k x 1 this is extra for the user to play with attack or input values.
  • 2k2 x 1
  • .1uf x 2 unmarked tan

Missing parts will be replaced.   

This is the 3rd run of the boards.  Many group members have this AGC already in use.

Cost and options:

#1 – Kits 13$ shipped

#2 – Pre-built OT service 15$ shipped and tested

Write to David if you want to reserve a kit.


NB these are sold out as of 29 January 2018.

Another audio pop mod

Joe VE1BWV provides another audio pop mod:

You probably will want to install a pop click fix to eliminate a loud pop whenever TX is turned on and off.   This circuit uses a 1N4148 diode, a 470k  or 300k resistor, a .22 or .44uF cap and a 2n7000 MOSFET.  Joe says this works amazingly well and mounts on the rear of the volume pot as indicated below (ignore the 0.1 uF capacitor).

The first TFT display for uBITx

The first uBITx has appeared with a 2.8” TFT display.  The hardware is from Joe VE1BWV and the software from VU2SPF.

The display provides full touch control along with physical optional buttons.  100 memory channels come standard, along with a tunable BFO, selection of VFO A, B or M. All bands are selectable from the front display which is a cheap 2.8” TFT touch display.  Joe uses an AT Mega 2560 processor for lots of pins and better performance and an Si5351 for DDS.


Further details were given subsequently by Joe VE1BWV …

We have already done this for the Bitx40 and released software, videos etc.
Under youtube vu2spf and facebook as well as in the [BITX20] io group.
They are for the Bitx40 but the new code for ubitx has all the same features.I have 2 of my 3 Bitx running the basic same code. They work and look great.

See http://

This has info on the code, features, hardware, etc.  The full UBITX info will be posted soon, including the arduino sketch, hardware options, where to source parts.   An article in QRP magazine has just been released to subscribers.

 Joe recommends the Elegoo 2.8 inch  TFT Display with pen from  He has ordered 4 over time and the quality has been consistent, resulting in all of them working with clear, clean, crisp displays.
The price is  around $15.00 shipped within the USA. Note that the vendor does not ship outside of North America.
The Elegoo 2.8″ display with ATMega 2560 mounted behind it in the uBITx
Arduino Module : Joe uses the AT Mega 2560 and suggests Ebay is the cheapest source at less then $10.00 with any AT mega 2560 working.
DDS module –  SI5351  module (not just the chip)- available from Ebay or Adafruit direct or from for around $11.00.
Joe uses female single jacks to solder to the rear of the At Mega. Access to the pins is from the rear of the atmega 2560 as the front is facing the front radio panel with the TFT display plugged directly into it.  There is no room to get access to the pins after assembly.   This method minimizes the wires from AT Mega to the ubitx board.
You can also use an interface board which VU2SPF has developed – he has the pictures, but no pcb for sale at present.
Jumper cables are as follows:
  • 1 Jumper cable (2 pin) – male to female for connection of SDA and SDC lines from AT Mega to the Si5351 DDS.
  • 1 Jumper female to female 8 pin from atmaga to ubitx board
  • 3 cables for the clocks from Si5351 to the Ubitx.  – shielded cable is best
Joe feeds the rig with 13.5 volts – using a well filtered non switching power supply.   He also uses 2 “buck” converters (around $1.50 each on Ebay).
  • The first of these gets fed the 13.5 volt, and reduces the voltage to 9v to feed the AT Mega 2560.  This keeps it cooler than running full input voltage. He also adds 2  filter caps –  one 2000 mfd capacitor on the input side, and the other on the output side, along  with a 2- 10 ohm resistor on the output in series to act as a hash isolation filter.
  • The second converter is used to feed the SI 5351 module, adjusted to 5 volts. This uses the same filtering system as above.

Joe says this results in a very quiet rig with everything nice and cool.


New: µBitx CW keying fix

John AD0RW who has studied the CW keying issue has determined that the primary problem is that the analogue to digital conversion in the µBitx was having trouble distinguishing between “manual key down” and “dit”.  This causes keying errors.   For example, an ‘I’ becomes an ‘N’ when the dit paddle is held closed.

John incorporated the keyer code from W0EB and W2CTX into his personal software build, but he was determined to save the last analog input for S/power metering.  So he kept the single input that detects four different levels. Actually, he doesn’t care much about straight keying so he left out the manual key resistor.

When  looking at the nominal voltage levels with the provided resistors, he observed that there was only around 0.22 volts between the “dit” and “manual key” levels (1.60 vs 1.38 V). On the other hand, there is 1.8 volts between “dit” and “dah”. Errors due to fluctuations would be much more likely between “dit” and “manual key” levels.

He investigated options for resistor replacement, and in the end, replaced the 2.2k resistor with a 5.1k one. Now the nominal levels are 3.4 V for “dah”, 2.6 V for “dit”, and 2.1 V for “both”.   The boundary ADC values were adjusted in the software.

He has found the results to be favourable so far in his testing, including sending a fair amount of practice code at speeds up to 25 wpm.  The iambic action seems flawless and smooth.

He notes that “I might actually get good at sending iambic style someday…”.  Some of us need to try this solution.  Saving ports is a good idea on an Arduino Nano!  It would also be helpful to know what values folk are using for the thresholds for the boundary points in the sketch.


Removing the audio pop on T/R

A mod developed by Gary N3GO (and required for Full QSK) also mitigates the Tx and Rx pop/thump noises in SSB mode.   This mod should work fine with the existing relays and with or without other mods, but has yet to be verified by others.