-1
\$\begingroup\$

guys once again back with a problem to my AGC circuit, however this is the last one.

  1. The problem is the LM833N is clipping around at less than 1.92Vpp at a 4.586V Vcc, I understand this op-amp isn't rail to rail however it should be well within its voltage swing?

  2. I can't explain why I am getting a Vpp of 1.80V.

The algorithm:

A. Ardunio Reads audio signal to A0: Reads 760mV this is in peak after the Precision Rectifier.

B. Ardunio performs equation \$R2 = ((\frac{Vo}{Vin})-1)*R1\$ Using a desire Vo target of 1.92V, this is a variable within the Ardunio IDE.

C. \$R2 = 1526.32\Omega\$

D. Ardunio proceeds to find how many steps it takes to get to \$1526.32\Omega\$ \$ Value = 1526.32/36.75\ = 41\$, where 36.75 was found using 9400(Measured on digi pot using 0xFF)/256 (datasheet)

E. Seeing the value on the amplifier, \$41*36.75 = 1506.75\Omega\$ This is expected as we are going to lose precision due to a 8 Bit resolution.

\$Vo = ((\frac{R2}{R1})+1)*V_{IN}\$

\$Vo = ((\frac{1506.75}{1000})+1)*760mV\$

\$Vo = 1.90513V_{p}\$

I dont understand why is this value showing as a Voltage Peak-Peak

It's either the Voltage Swing of the LM833N that's limiting me or I wasn't actually calculating Vp, but Vpp instead.

Here are pictures from the circuit and schematic

enter image description here enter image description here

schematic

simulate this circuit – Schematic created using CircuitLab

Ardunio Code(very Rough):

 #include <SPI.h>


int chipSelect = 10;
double voltageDivderOutput = A7;
int calibrationTurnOn = 3;
double desireAudioSignal = 1.98;
double audioSignalInput = A0;


double R1 = 1000.0;
double resolution = 256.0; 
double offset = 0.0;
double realValue = 9400;
double RS = 0.0;
double Voltage;
double Vcc;
double R2 = 0.0;
double ADCValue;
double R2New = 0.0;
double Vout = 1.92;
void setup()
{

  pinMode(chipSelect, OUTPUT);
  pinMode(voltageDivderOutput, INPUT);
  pinMode(audioSignalInput, INPUT);

  pinMode(calibrationTurnOn, OUTPUT);
  Serial.begin(9600);
  SPI.begin();
  SPI.setBitOrder(MSBFIRST);
  calibration();

}


 void calibration() {
  Vcc = readVcc()/1000.0; //Gives the voltage of Vcc
  RS = 9400.0/resolution; //In datasheet of the Digi pot
  digitalWrite(chipSelect, LOW);
  SPI.transfer(0x00);
  SPI.transfer(0x00); //Makes the gain close as one as possible
  digitalWrite(chipSelect, HIGH);
}

long readVcc() {
  long result;
  // Read 1.1V reference against AVcc
  ADMUX = _BV(REFS0) | _BV(MUX3) | _BV(MUX2) | _BV(MUX1);
  delay(2); // Wait for Vref to settle
  ADCSRA |= _BV(ADSC); // Convert
  while (bit_is_set(ADCSRA,ADSC));
  result = ADCL;
  result |= ADCH<<8;
  result = 1100800L / result; // Back-calculate AVcc in mV
  return result;
}


void loop()
{


 double R2 = 0.0;
 double Vin = (analogRead(A0)/1024.0)*Vcc; //Read the value of Vin of the audio signal
 R2 = ((Vout/Vin)-1.0)*R1; //Transfer Function of the Non-inverting amplifier, re-arrange to find R2  
 double value = 0.0;
 value = R2/RS; //Find the int number to insert into register

 if (value >= 255)
 {
  value = 255;
  digitalWrite(chipSelect, LOW);
  SPI.transfer(0x00);
  SPI.transfer((int)value);
  digitalWrite(chipSelect, HIGH);
 }

 else if (value <= 0)
 {
  value = 0;
  digitalWrite(chipSelect, LOW);
  SPI.transfer(0x00);
  SPI.transfer((int)value);
  digitalWrite(chipSelect, HIGH);
 }

 else
 {
  digitalWrite(chipSelect, LOW);
  SPI.transfer(0x00);
  SPI.transfer((int)value);
  digitalWrite(chipSelect, HIGH);
 }

  value = 0.0;


}
\$\endgroup\$
  • \$\begingroup\$ Can you define your transfer function overall with thresholds attack time constant, attenuation, control dB/V , step response , overshoot , delay, compression ratio etc? Then provide test results and discrepancies?? Otherwise it is a crap shoot. You caps are too big to drive fast due to current limited slew rate, \$\endgroup\$ – Tony Stewart Sunnyskyguy EE75 Jul 10 '18 at 5:11
  • \$\begingroup\$ Well then.. I wish I can provide you those parameters, but I dont own a function generator that can provide a burst of frequencies, I used an online tone generator... so I dont know how to measure attack time. Are all those necessary to diagnose the issue at hand? Then Ill try to give them to you tomorrow. I feel like the problem lies within the LM833N, I still dont fully understand if your output/input is compatible with VCM and VOM never understood how to find out \$\endgroup\$ – Pllsz Jul 10 '18 at 5:17
  • \$\begingroup\$ The 833 can't get any closer than 1.5V from either rail. At the voltage you are using, that leaves you less than 2V of swing. So, the clipping is to be expected if you exceed about 1.8V peak to peak. So, you have too much signal or too much gan. \$\endgroup\$ – JRE Jul 10 '18 at 5:48
  • \$\begingroup\$ OOOOO thank you so much, can you tell me how you derived this? I really never understood how VOM or VCM worked... \$\endgroup\$ – Pllsz Jul 10 '18 at 5:49
  • \$\begingroup\$ You also have too much gain with a comparator and too much gain on the OTA sensitivity control. \$\endgroup\$ – Tony Stewart Sunnyskyguy EE75 Jul 10 '18 at 6:06
0
\$\begingroup\$

From the comments, it appears to be simply that the LM833 is hitting its output limits.

You can determine those limits from the datasheet.

Look for the "output voltage swing" in the opamp specifications. For the LM833, that is given as +-13.5V when powered from +-15V.

That's 1.5V from each rail. That will hold pretty much true regardless of the operating voltage.

You are running your LM833 on 4.8V. So, upper limit is 3.3V (4.8-1.5), lower limit is 1.5V (0+1.5).

The difference is 1.8V, which is why you are seeing clipping at 1.8V peak to peak.


The LM833 doesn't look like a good match for your task.

Your suggested 21314 looks better - at least in terms of the output voltage swing. I didn't look at the rest of the specifications.

\$\endgroup\$
  • \$\begingroup\$ Would this one do the trick?ww1.microchip.com/downloads/en/DeviceDoc/21314g.pdf \$\endgroup\$ – Pllsz Jul 10 '18 at 8:11
  • \$\begingroup\$ The MCP601 is clipping as well, however at 2.68Vpp ? Using 4.5V~ VDD \$\endgroup\$ – Pllsz Jul 10 '18 at 20:31
  • \$\begingroup\$ It shouldn't clip. The MCP601 is rail to rail on input and output. \$\endgroup\$ – JRE Jul 11 '18 at 5:10
  • \$\begingroup\$ Yeah its the weirdest thing, I opened a new thread if you dont mind jumping into where I discuss it more in detail electronics.stackexchange.com/questions/384146/… however when I increase the VDD to ~6.1V it fixes everything \$\endgroup\$ – Pllsz Jul 11 '18 at 5:12
  • \$\begingroup\$ Depends on the load, though. Check out chart 2-20. The higher the load, the further away from the rails the output gets. Your circuit shows a 2k load resistor, so that gets you a couple of hundred mV away from the rails. If there's more on the output of the 601, then it will get bad fast. \$\endgroup\$ – JRE Jul 11 '18 at 5:18

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.