Amplifying the signal before ADC

Started by Ridaros, March 16, 2017, 02:25:40 PM

Previous topic - Next topic

Ridaros

Hi guys,

I've been reading about Amplifying a signal before it reaches an ADC.

I've attached an image based on what I've read but there are some questions I still have.



The resistor values of rb1 and rb2 are to be high resistance and of the same value to set a dc point of half the supply so that maximum swing is achieved. Correct?

An operational amplifier in non inverting configuration was used for a high input impedance.

If a peak voltage of 0.5v is applied as a maximum input from guitar, a gain of 3 would keep this within the rails as the peak would then be amplified to 1.5v and below 1.65v

The second voltage divider chain on the output of the amplifier is present to keep the dc voltage at 1.65v so that the full signal is presented to the ADC. But after drawing this and reflecting, should a capacitor be fitted to the output of the amplifier before the potential divider as the amplifier would also amplify 1.65 volts too?

I have no idea what the values of the decoupling caps should be, can anybody help?

Im unsure of where to apply a filter and what frequency cut off this should be, how do I determine this?

If anybody could give me pointers, I would be grateful. I'm having such a good time learning :D


DrAlx

You should only set the bias point in one place (at one of the inputs of the first op-amp).
Rb1:Rb2 is setting the bias, but you have R1 connected to ground rather than to the bias voltage so you won't get the gain you think.
R3 and R4 should not be there at all.

Regarding how to calculate the R and C values read following link.

http://www.analog.com/en/analog-dialogue/articles/avoiding-op-amp-instability-problems.html

For the non-inverting config I would go for the method shown in Fig 3.
If you don't mind inverting the signal, go for the biasing shown in Fig 4.  Less stuff to calculate.

If the same bias level needs to be used by other circuit blocks then take the voltage from the resistive divider and buffer it with an op-amp before feeding it to the various points that need a bias voltage. Using an op-amp buffer will give you a nice "stiff" bias voltage.

An op-amp output is "stiff".  In other words you won't easily change its voltage by connecting stuff to it.  That's why trying to "set its voltage" using R3 and R4 is wrong.
A resistive divider is not "stiff" unless the resistors are very low valued (and that will wastes a lot of current).

anotherjim

The right idea.
Just to say in case you don't know, but not all op-amps can work with supply as low as 3.3v or swing the output fully between 0v and the + supply.

To your circuit...
R1 must go to ground via capacitor. That has implications for the low end frequency response as R1 forms a high pass filter with the capacitor, and R1 is variable.
I think it's easier to make R1 fixed and make R2 variable. When R2 is worth 0ohm, gain is unity.

An op-amp output is strong enough to overpower your R3 and R4. Also, if the ADC reference is the same as the 3.3v supply, it doesn't need R3 or R4 or a coupling capacitor. Rb1 & Rb2 if they are equal value, will keep the op-amp output biased to half voltage to present the DC level to the ADC.

So if Rb1/2 were both 2.2M that gives a suitable load to the guitar pickup of near enough 1M. The input capacitor can be small like 10nF.
If R1 was 10k fixed, the capacitor that needs adding in to ground will be 1uF. That can be an electrolytic capacitor with its negative wire to ground.
R2 can be a 22k variable and gain will be adjustable between x1 and x3.

There isn't really room to add much of a filter to protect the ADC. Another amplifier stage would be needed for a reasonably effective one. However, if the ADC can sample faster that 12Khz, there should be no frequencies high enough from a guitar unless it distorts by clipping in the amplifier. Guitars don't produce signal above 5kHz
That said, a simple, 1-pole RC low pass  filter could be added between the op-amp and the ADC input.

To help you to help yourself, have a play with this...
http://sim.okawa-denshi.jp/en/Fkeisan.htm



ashcat_lt

Quote from: DrAlx on March 16, 2017, 03:03:22 PM
http://www.analog.com/en/analog-dialogue/articles/avoiding-op-amp-instability-problems.html

For the non-inverting config I would go for the method shown in Fig 3.
I think it's Fig 2, actually, though for direct connection to a passive guitar Rin should be 1M, and the values of Ra and Rb aren't particularly critical.  If you do that, then R1 can actually go to the Vbias point (between Ra and RBN) and you can ditch C1 and not have to worry about it's affect on low frequency gain.

PRR

  • SUPPORTER

antonis

"I'm getting older while being taught all the time" Solon the Athenian..
"I don't mind  being taught all the time but I do mind a lot getting old" Antonis the Thessalonian..

anotherjim

Quote from: antonis on March 17, 2017, 08:01:37 AM
Quote from: anotherjim on March 16, 2017, 03:32:36 PM
0ohm
Is it a "Zero Ohm" or a "Dharma Spell", Jim..??  :icon_lol:
No, that would be "Aughmmm...."
Hey, Paul drew what I said with different value scaling. Does that amount to agreement?


antonis

Quote from: anotherjim on March 17, 2017, 08:12:41 AM
Paul drew what I said with different value scaling. Does that amount to agreement?
Can't say for sure..

Maybe he wanted to load down a little more guitar pick-up with the benefit of lower input bias noise..  :icon_wink:

@ Ridaros: Don't try desperately to find a 20nF cap - a 22nF should be more easily obntained with a merely 10% HPF cut-off frequency lowering..  :icon_wink:
"I'm getting older while being taught all the time" Solon the Athenian..
"I don't mind  being taught all the time but I do mind a lot getting old" Antonis the Thessalonian..

Ridaros



Thanks a lot for the help guys :)

Taking in what you've all contributed I've drawn a revised circuit. Does this look more like what I should be doing?

Picking up on the op amp supply issue, first -  if I supply an op amp with 5v, and set a bias point of 2.5v, won't this hit the rails on the ADC supply if I'm using a PIC supplied with 3.3v? Should I then just bias the input of the Op amp with a 1.65v dc level instead?

Is the value of 10uF before the bias voltage a suitable value? I've learned that a relatively low capacitance is fine in this case for a decoupling cap, but unsure why that is, or why the value of 10uF have been chosen for the cap below the 10K resistor.

The feedback resistor on the op amp was suggested as 22k in one method and 2k in another, what would the change in these values mean in the grand scheme of things?

I'm open to adding another amplifier stage, but I don't know where to start with this? I've done a little bit of reading and would this make the circuit a 2nd order active low pass filter if we went that route?
Should a low pass filter be added, what frequency cutoff should I aim for?

Thanks again for all your help guys!

anotherjim

Remove the 10uF on your input bias resistors - it will short circuit any input signal to ground!

I know the point made earlier, that that bias method invites noise from the power supply into the signal path. However, it shouldn't be too bad and you aren't applying a lot of gain. If the ADC is inside a processor, it will be pretty noisy in there anyway & nothing much you can do about it.

Do make sure you have sufficient capacitors close to the supply points. Usually, I would fit a 100nF ceramic type between the chip + power pin and ground and have the top 1M of the divider connect to +3.3V close to that. The capacitor should reduce any supply borne noise by a useful amount.



Ridaros

Quote from: anotherjim on March 17, 2017, 10:57:22 AM
Remove the 10uF on your input bias resistors - it will short circuit any input signal to ground!

I know the point made earlier, that that bias method invites noise from the power supply into the signal path. However, it shouldn't be too bad and you aren't applying a lot of gain. If the ADC is inside a processor, it will be pretty noisy in there anyway & nothing much you can do about it.

Do make sure you have sufficient capacitors close to the supply points. Usually, I would fit a 100nF ceramic type between the chip + power pin and ground and have the top 1M of the divider connect to +3.3V close to that. The capacitor should reduce any supply borne noise by a useful amount.
OK thanks!

I've just realised I missed a 1M resistor based on the analog.com reference. Should this be fitted? see image.



The end goal in this case is to create an 8/16 bit pedal, so it sounds like the old Sega, and Nintendo sounds. So naturally, I don't need the signal to be Squeaky clean, but I'd also like to learn how to get the signal as clean as possible for future projects. I am thinking about using external ADC 's and DAC' s this time around so that I get experience in interfacing them to a PIC.

antonis

#11
Too much noise..!!!  8)

You can place the 1M Vref series resistor (I should limit it down to 510k..) but lower bias resistor values to, say 10k - 47k each..

"I'm getting older while being taught all the time" Solon the Athenian..
"I don't mind  being taught all the time but I do mind a lot getting old" Antonis the Thessalonian..

ashcat_lt

Quote from: Ridaros on March 17, 2017, 11:07:09 AM
I've just realised I missed a 1M resistor based on the analog.com reference. Should this be fitted? see image.
IMO yes, especially is you're leaving that cap there, but you should also make the other 1Ms quite a bit smaller as mentioned above.  Then, as I said earlier, you can get rid of the "cap below the 10K" and connect the 10K itself right to this bias voltage.

QuoteThe end goal in this case is to create an 8/16 bit pedal, so it sounds like the old Sega, and Nintendo sounds.
Ummm... 16 bit is CD quality and more dynamic range than a guitar needs.  8 bit is actually about plenty for most guitars, and really isn't likely to have the drastic effect you're expecting.  Sample rate might be another question, but this kind of actual bit crushing is rarely as satisfying as you'd think.  Is why most "bit crusher" pedals aren't actually digital.  ;)

I think most of what we think of as the old video game sounds has more to do with the relatively simplistic synthesis methods they were using and the way the sounds themselves were programmed.

Not trying to be a downer, but this looks like a lot of work just to end up disappointed.

anotherjim

Yes, you might just as well copy the arrangement in a typical guitar effect, so...

From input to pin 3 of the op-amp.
The divider resistors are both 10k (the top 10k is connected to the + supply) with the 10uF filter capacitor. The input bias is connected via 1M. This circuit also has a simple input protection/filter. The 1k resistor reduces any chance of an accidental connection to a voltage source from damaging anything. The 47pF capacitor after the 1k filters out & reduces any high frequency stuff such as radio interference that might find its way in. I would keep that if you can.
The input impedance is 1M, so the input capacitor can be smaller at 10nF.

antonis

 ::) ::) ::)
Someone forgot to post a diagram...
"I'm getting older while being taught all the time" Solon the Athenian..
"I don't mind  being taught all the time but I do mind a lot getting old" Antonis the Thessalonian..

Ridaros

Quote from: ashcat_lt on March 17, 2017, 11:38:41 AM
Quote from: Ridaros on March 17, 2017, 11:07:09 AM
I've just realised I missed a 1M resistor based on the analog.com reference. Should this be fitted? see image.
IMO yes, especially is you're leaving that cap there, but you should also make the other 1Ms quite a bit smaller as mentioned above.  Then, as I said earlier, you can get rid of the "cap below the 10K" and connect the 10K itself right to this bias voltage.

QuoteThe end goal in this case is to create an 8/16 bit pedal, so it sounds like the old Sega, and Nintendo sounds.
Ummm... 16 bit is CD quality and more dynamic range than a guitar needs.  8 bit is actually about plenty for most guitars, and really isn't likely to have the drastic effect you're expecting.  Sample rate might be another question, but this kind of actual bit crushing is rarely as satisfying as you'd think.  Is why most "bit crusher" pedals aren't actually digital.  ;)

I think most of what we think of as the old video game sounds has more to do with the relatively simplistic synthesis methods they were using and the way the sounds themselves were programmed.

Not trying to be a downer, but this looks like a lot of work just to end up disappointed.

I aim to achieve it through both bitcrushing, and sample rate reduction to compare the differences. It should also give me good experience, shouldn't it?

Quote from: anotherjim on March 17, 2017, 11:40:34 AM
Yes, you might just as well copy the arrangement in a typical guitar effect, so...

From input to pin 3 of the op-amp.
The divider resistors are both 10k (the top 10k is connected to the + supply) with the 10uF filter capacitor. The input bias is connected via 1M. This circuit also has a simple input protection/filter. The 1k resistor reduces any chance of an accidental connection to a voltage source from damaging anything. The 47pF capacitor after the 1k filters out & reduces any high frequency stuff such as radio interference that might find its way in. I would keep that if you can.
The input impedance is 1M, so the input capacitor can be smaller at 10nF.


As Antonis pointed out, is there meant to be a diagram with your post? :P


samhay

>I aim to achieve it through both bitcrushing, and sample rate reduction to compare the differences. It should also give me good experience, shouldn't it?

8 bit ADC is noisy, so even if this is your intended output resolution, sampling the input at higher resolution is a good idea. You can do any math at higher resolution then down-sample at the output.

Has anybody mentioned that most op-amps used in pedals don't work very well on a 3V3 supply? I assume you have something in mind?
I'm a refugee of the great dropbox purge of '17.
Project details (schematics, layouts, etc) are slowly being added here: http://samdump.wordpress.com

Ridaros

#18
Quote from: anotherjim on March 17, 2017, 03:13:38 PM
I can see it. Twice.
http://www.freeinfosociety.com/electronics/schematics/audio/pictures/bossds1.png


Thanks, Jim. I've changed the schematic to resemble something similar. Does this look ok?
I seen the diode configuration on the output on another thread. It will make the output sound less harsh if the signal is amplified enough to hit the rails, or so I read. Can anybody confirm/deny this?

Quote from: samhay on March 18, 2017, 03:34:43 AM
>I aim to achieve it through both bitcrushing, and sample rate reduction to compare the differences. It should also give me good experience, shouldn't it?

8 bit ADC is noisy, so even if this is your intended output resolution, sampling the input at higher resolution is a good idea. You can do any math at higher resolution then down-sample at the output.

Has anybody mentioned that most op-amps used in pedals don't work very well on a 3V3 supply? I assume you have something in mind?

I plan to sample it with a 12 bit ADC initially, and may use an external ADC afterwards to see the difference.

Regarding the 3.3V op amp supply. I have changed it to 5V in the schematic... But would this mean I need to bias the resistors to be at 1.65V rather than 2.5V to ensure it doesn't hit the 3.3V supply of the PIC?

Thanks everyone for all your help once again.

EDIT: OK now I'm having trouble posting images haha. Any idea how to link from an imgur URL?

http://imgur.com/a/9WO1e

anotherjim

I can't get this to show either!
[img]http://imgur.com/a/9WO1e[/img]

However,
http://i.imgur.com/pdSsmWH.png
This does. Go to the link to your image. Right click on the image and take "copy image location". Paste that between the image code tags.

I made it show smaller with this...
[img height=400]http://i.imgur.com/pdSsmWH.png[/img]


Have you selected a single supply op-amp type that can output to ground?

Connect R1 to 3.3v instead of 5v and your bias will be 1.65v.

The op-amp output voltage cannot go negative below 0v, so D2 will never act - it isn't needed.

D1 won't start to act until the output exceeds 5.5V. It cannot do this either.
If D1 connects to 3.3v instead of 5v, it will act when the output exceeds  3.8v. Not ideal, but better than 5.5v.

Actually, I would be surprised if the input pin to the PIC ADC does not already have the 2 diodes internally across 3.3v to 0v anyway, but I would keep D1 on the op-amp output connecting cathode to 3.3V and fit a 10k resistor between there and the ADC input. The resistor will limit current in the event of the internal diode on the ADC input conducting and let D1, being before the resistor, carry it safely away from the chip.

In the event you want some input filtering, the 10k resistor will have another use. Add a capacitor from the ADC pin to 0v and it acts with the 10k to form a low pass filter.