Topics

uBITX AGC - Adafruit TPA2016, A Success! #ubitx

Jim Sheldon
 

I don't know. Check the T_DO and T_CS pins on the test set and see if one of the connected to the same input pin on the Teensy as the encoder SW.

On Nov 8, 2018, at 1:23 PM, John Scherer <jrsphoto@...> wrote:

Wow, just found this thread.  I currently use the nd6t AGC and as playing around with controlling the hang-time digitally, but it takes 6 pins.  I just placed an order for the TPA2016 so I'll be playing with this for sure.  It would be really awesome if KD8CEC (or anyone) could add a config page for this to the Nextion display and support for it CEC firmware!  I'd take a stab at it but after looking at the graphics editor for the Nextion display, I'll pass.  It'd take me weeks to figure that hot mess out ;-)

John - N0CTL 

Curt
 

Joe

I am contemplating same thing. Note the  nd6t website shows 2 different agc designs, and note the link to adding an RF gain control. This is one candidate location for the mosfet attenuator,  even without installing an RF gain control that so far I don't need. I also thought about it at the front of the audio chain. I wonder if the agc bias could be injected into the existing TR mosfet, if not easy to add a second mosfet there. Worth some experiments to see what works well.

Curt

Joe Puma
 

I like the ND6T but I think Id rather have an audio agc. How would you wire this up? In a V3 board??

 

Joe

 

 

Sent from Mail for Windows 10

 

From: John Scherer
Sent: Thursday, November 8, 2018 2:23 PM
To: BITX20@groups.io
Subject: Re: [BITX20] uBITX AGC - Adafruit TPA2016, A Success! #ubitx

 

Wow, just found this thread.  I currently use the nd6t AGC and as playing around with controlling the hang-time digitally, but it takes 6 pins.  I just placed an order for the TPA2016 so I'll be playing with this for sure.  It would be really awesome if KD8CEC (or anyone) could add a config page for this to the Nextion display and support for it CEC firmware!  I'd take a stab at it but after looking at the graphics editor for the Nextion display, I'll pass.  It'd take me weeks to figure that hot mess out ;-)

John - N0CTL 

 

John Scherer
 

Wow, just found this thread.  I currently use the nd6t AGC and as playing around with controlling the hang-time digitally, but it takes 6 pins.  I just placed an order for the TPA2016 so I'll be playing with this for sure.  It would be really awesome if KD8CEC (or anyone) could add a config page for this to the Nextion display and support for it CEC firmware!  I'd take a stab at it but after looking at the graphics editor for the Nextion display, I'll pass.  It'd take me weeks to figure that hot mess out ;-)

John - N0CTL 

Tim Gorman
 

Respectfully - the audio amp in the ubitx gives plenty of output to
drive either headphones or a communications speaker. I'm not sure what
additional capability this unit will offer.

The ubitx does not provide stereo capability for music, there is no
left/right output from the receiver so the stereo capability of this
unit will be wasted.

You will be limited to a 6db gain unless you want to control it using
I2C. To do that you'll have to modify the ubitx software to allow you
to do that.

You may actually be better off with a TPA2012 where you can set gain
with a set of on-board switches and can turn one speaker off by
grounding the shutdown pin for one side or the other.

You will also need some kind of insulated jack for the speaker leads
since they can't be grounded in any way.

Since the ubitx only has single-ended outputs on the pre-amp you'll
have to make sure both the + and - input leads are fed through
capacitors.

The speaker leads need to be kept pretty short since they are carrying
300khz signals. I have no idea how that 300khz signal will impact the
operation of the ubitx. That signal could easily leak into unwanted
areas in the receiver.

The AGC in this unit is attractive but the other problems you will
encounter will make this a pretty involved project, especially writing
the operation of the unit into the ubitx software.

tim ab0wr





On Mon, 16 Apr 2018 15:54:54 -0700 "Richard E Neese" <kb3vgw@...>
wrote:

can some one doe a wire up on this board and how to add it in ?

Richard E Neese
 

can some one doe a wire up on this board and how to add it in ?

Mike Doty
 

Thanks for taking the time to reply and posting the library files, Nik.  I certainly appreciate it.  I have replaced the files in my TPA2016 library with your modified files and recompiled my sketch.  The results are still the same - almost no audio.  As I said in my last post, connecting the TPA2016 module as a basic amplifier, with no firmware control, the audio is very low.  There is no background noise and only signals at S9 or better can be heard.  The same module installed in a BiTX40ver3 as a basic amp to replace the LM386 works well.  To me the issue appears to be low drive in to the TPA2016.  I'll keep digging and I'd definitely like to see more detail in regards to your implementation. 

Thanks again -- Mike

Nick VK4PP
 

Nick VK4PP
 

Hi mike, I'll put the files up soon...
I did have the same issue with low audio. That is what the noise gate threshold is for, we want to set it very low(0) so that it lets even weak signals and static through... Then play with the gain setting in the software...
I'll try put up a bit more details as to my exact setup, but you are on the right track.

Mike Doty
 

Hi Nik,
I have two questions for you in regards to using the TPA2016 module.  First question is are you taking the audio input to the module directly from the volume pot wiper? That was my take on an earlier post you made.  I have two modules and both behave the same.  One module I connected as just a stock amplifier, with no connections to the I2C bus, and the audio output is extremely low.  In order to hear a 50uV 1KHz signal I have to turn the volume control to maximum.  The second module I have configured with the I2C connections to the Arduino Nano and have the Vcc line for the I2C connected to the 3.3V port.  The Vdd line is connected to 5V.  I have the same results - extremely low audio.  I'm using the left channel for input and output.  My speaker is not grounded in either case. 

The second question is more of a request.  Would you post your modified Adafruit library files in the File section here on Groups IO?  I thought I had your library modifications figured out but now I'm not completely certain.  Before I start chasing my tail in the wrong direction I'd like to know that at least the files I've modified and am using are not part of the problem.

Thanks for your work, I certainly appreciate it.
--73-- Mike  --  W0MNE

Nick VK4PP
 

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);
}

73

Nick VK4PP
 

My Appologies.
In my haste I pasted in the wrong function, I will get the correct one tonight...

I connected the board to the TDA side of the volume control, basically eliminating the TDA chip completely.

Please be aware that the output from the TPA2016 is to be connected directly to the speaker, and NOT grounded at all, this is due to the fact that these outputs are Bridge Tied Load which means you must connect the speakers directly - do not try to connect these outputs to another amplifier!

73 and good luck.

Hank W6IR
 

Where did you insert the board?

 

Thanks Nik,

One more thing.  It appears we need a function:

setNoiseGateThreshold(0);

that you may have also added.

Aug
AG5AT

Nick VK4PP
 

And the line for the header file:

void enableNoiseGate(boolean ng);

Nick VK4PP
 

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

// Turn on/off Nosie Gate
void Adafruit_TPA2016::enableNoiseGate(boolean ng) {
 
  uint8_t setup = read8(TPA2016_SETUP);
  if (ng)
    setup |= TPA2016_SETUP_NOISEGATE;
  else 
    setup &= ~TPA2016_SETUP_NOISEGATE;
  
  write8(TPA2016_SETUP, setup);
}

Nick VK4PP
 

/*************************************************************************
  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() {
  
  audioamp.begin();
  // 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....
  audioamp.enableNoiseGate(false);
  audioamp.setNoiseGateThreshold(0);
  
  // 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");
  audioamp.setAGCCompression(TPA2016_AGC_8);
 
  // Limiter Level: The value that sets the maximum allowed output amplitude.
//  Serial.println("Setting Limit Level");
  audioamp.setLimitLevelOn();
  // or turn off with 
  //audioamp.setLimitLevelOff();
  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)");
  audioamp.setAGCMaxGain(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. 
   *   http://www.qsl.net/va3iul/Files/Automatic_Gain_Control.pdf
   *
   */
  
  // See Datasheet page 23 for value -> ms conversion table
//  Serial.println("Setting AGC Attack (0.1-6.7ms - (0-63))");
  audioamp.setAttackControl(3);
  
  // See Datasheet page 24 for value -> ms conversion table
//  Serial.println("Setting AGC Hold (0.0137-0.8631ms - (1-63))");
  audioamp.setHoldControl(0);
  
  // See Datasheet page 24 for value -> ms conversion table
//  Serial.println("Setting AGC Release (0.0137-0.8631ms - (0-63))");
  audioamp.setReleaseControl(4);
}

Fred Buecker
 

The other board was a VK3YE that he said did not work very well.

-Fred
KC3HMS

On Feb 5, 2018 9:47 AM, "Michael Monteith via Groups.Io" <michael_r_monteith=yahoo.com@groups.io> wrote:
Which 2 boards?  I know the one is the TAP2016.  What's the other?

73, Michael
KM4OLT
On Fri, Feb 2, 2018 at 06:13 pm, Nick VK4PLN wrote:
Hi john, both boards from eBay...
I am really happy with the setup, AGC is performing very well in my opinion...

 

Nick,
Did you ever post the sketch for the TPA2016 AGC?

Aug
AG5AT

Michael Monteith
 

Which 2 boards?  I know the one is the TAP2016.  What's the other?

73, Michael
KM4OLT

On Fri, Feb 2, 2018 at 06:13 pm, Nick VK4PLN wrote:
Hi john, both boards from eBay...
I am really happy with the setup, AGC is performing very well in my opinion...