Searching \ for 'Variable gain amp using PIC - possible?' in subject line. ()
Make payments with PayPal - it's fast, free and secure! Help us get a faster server
FAQ page: www.piclist.com/techref/microchip/devices.htm?key=pic
Search entire site for: 'Variable gain amp using PIC - possible?'.

Truncated match.
PICList Thread
'Variable gain amp using PIC - possible?'
1999\10\26@013309 by Nikolai Golovchenko

flavicon
face
Hello all.
I need to read 50Hz signal with PIC16F877. Actually, 10-bit accuracy is
enough, but the signal level is unknown, therefore PIC has to adjust to the
signal. The level changes relatively slowly and there is some time allowed
for adjusting. In this case four gain bands (1:2, 1:4, 1:8, 1:16) will do
the job.

Now, the problem is that I don't want to use variable gain amps, because
they are too expensive and hard to get here, in Ukraine. Another way is to
use analog switches which will change the gain of a usual op amp. Can the
PIC's pins be used as analog switches, connected to ground? The datasheet
says that ports use FETS and that the leakage current is as small sa 1uA.

I would connect four resistors to PIC and made the pins go low or tri-state.
Will the circuit work?

        __
-------| + \
        |       \
        |         >------------- To RA0/AN0
        |        /          |
    ---|--  /              |
    |        ____      |
    |-----[_____]----
---------
---------
    |----------------
    |      |      |     |
   [ ]    [ ]   [ ]   [ ]
   [ ]    [ ]   [ ]   [ ]
    |      |      |     |
    |      |      |     ----------    RA1
    |      |      ---------------    RA2
    |      ---------------------   RA3
    --------------------------    RA5

Thanks in advance.

1999\10\26@035432 by Dr. Imre Bartfai

flavicon
face
Hi,

sorry, the circuit cannot be read. OTOH, you can try digital potentiometer
from Xicor or from DALLAS...

I hope this helps.

Imre


On Tue, 26 Oct 1999, Nikolai Golovchenko wrote:

{Quote hidden}

1999\10\26@041558 by Mark Willis

flavicon
face
It was a basic variable gain op-amp circuit (ascii schematics, ACK!  I
swear, I'm going to write a VGA Dos circuit renderer, if this keeps
up...)

Looked functional to me, though I'd want a little more flexibility than
just 4 gain bands (as in, the jump from 1:8 to 1:16 is pretty large; how
about using any 1,2,3 or 4 pins at once to give more gain choices?)
Careful resistor choices should let this happen...  When all 4 resistors
are grounded, you have 1:2 (with my plan here.)  Just another option <G>

 Mark

Dr. Imre Bartfai wrote:
{Quote hidden}

1999\10\26@045118 by Workshop Users

flavicon
face
part 0 3161 bytes
{Quote hidden}

Attachment converted: wonderland:sch-draw.exe (bina/mdos) (0000E77E)

1999\10\26@052450 by Joe McCauley

picon face
If your oupput signal swings below 0V you may have a problem with the signal
path through the port pins.
A more serious problem may be that you are connecting the signal path
through the port pins directly to your digital ground. It is possible that
this will add some noise to your signal.

Joe

{Original Message removed}

1999\10\26@062438 by Dmitry Kiryashov

flavicon
face
Hi Nikolay.

Your idea will work. If all pins are tri-stated total
amplifying is equal to 1. If you ground some resistors
it will increase amplification. You only thing you
should take into account that true ground for op-amp
(nor negative supply pin but really ground) and ground
of PIC  are connected together otherwise in case of
connection negative supply pin of op-amp with PIC
ground you will cause re-charging of cap every time
you change code on pins. So in this case put some delay
before beginning ADC read.

The second point is PCB tracing. Do ground between PIC
and op-amp and ADC as short and wide as possible. Else
you get additional error because of ground level shifting.
(Very easy to see it with 10 bit conversion ;-)

WBR Dmitry.

{Quote hidden}

1999\10\26@161507 by l.allen

picon face
You wrote

{Quote hidden}

The problems are thus;
1. The signal cannot swing below ground in the present configuration.

2. The noise introduced by connecting the analog signal path to the
digital signal path would be seriously detremental to youre 10 bit
resolution.

SO.....
The nicest application I have used was a Light Dependant Resistor
that replaced the resistors controlled by the micro thus
        __
-------| + \
        |       \
        |         >------------- To RA0/AN0
        |        /          |
    ---|--  /              |
    |        ____      |
    |-----[_____]----
---------
---------

    |
   [ ] LDR
   [ ]
    |
    |
  ___
  Agnd

A LED shines onto the LDR whose intensity is controlled by your 4
digital control lines, giving 16 levels if you like.
The led drive can be decoupled with a suitable capacitor to remove
noise from the digital circuit and now you have an unpolluted signal
train with common components and digital control. It does work.
_____________________________

Lance Allen
Technical Officer
Uni of Auckland
Psych Dept
New Zealand

http://www.psych.auckland.ac.nz

_____________________________

1999\10\27@024508 by Nikolai Golovchenko

flavicon
face
part 0 5405 bytes
<META content=text/html;charset=koi8-r http-equiv=Content-Type><!DOCTYPE HTML PUBLIC "-//W3C//DTD W3 HTML//EN">
<META content='"MSHTML 4.72.3110.7"' name=GENERATOR>
</HEAD>
<BODY bgColor=#ffffff>
<DIV>Hello!,<BR></DIV>
<DIV>&nbsp;</DIV>
<DIV>Thanks Rob! This editor is what I needed.</DIV>
<DIV>I hope, this drawing is better readable:</DIV>
<DIV><BR><FONT face="Courier New" size=2>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
+1.5&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<BR>&nbsp; 2.5V -1.5
|\&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<BR>&nbsp;&nbsp; ---------|+
\&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
RA0<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
|&nbsp;&nbsp;&nbsp; &gt;----+----&nbsp;
<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; +-|-
/&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; |&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; |
|/&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; |&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
|&nbsp;&nbsp;&nbsp;&nbsp; R&nbsp;&nbsp;&nbsp;&nbsp;
|&nbsp;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sp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
+---\/\/\---+---&nbsp;&nbsp;
<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; |&nbsp; R3=R/7&nbsp;
1:8&nbsp; RA3 <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
+---\/\/\---+---&nbsp;&nbsp;
<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; |&nbsp; R4=R/15 1:16
RA5 <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
+---\/\/\---+---&nbsp;&nbsp; </FONT></DIV>
<DIV><FONT face="Courier New" size=2></FONT><FONT
color=#000000></FONT>&nbsp;</DIV>
<DIV><FONT color=#000000>Right, I didn't take into account the noise from
current going through PIC</FONT></DIV>
<DIV><FONT color=#000000></FONT>Besides there is a protection diod on any pin
with anode tied to ground! The diodes will switch on all resistors when output
swings below virtual ground (2.5V)&nbsp; 8-(&nbsp; Because the capacitor starts
discharging in that condition&nbsp; )&nbsp; Will this diod disable any
possibility of the plot???</DIV>
<DIV>&nbsp;</DIV>
<DIV>I'm thinking about LDR or digital potentiometers now... Nice thing about
LDR is that it can be controlled with only one digital line if you use PWM -
needs only RC network for filtering.</DIV>
<DIV>&nbsp;</DIV>
<DIV>Thanks to all who replied.</DIV>
<DIV>Nikolai<BR></DIV></BODY></HTML>

</x-html>

1999\10\27@035300 by Michael Rigby-Jones

flavicon
face
You could use small MOSFETs to switch the resistors to a nice quiet analog
ground.  However, parts count is starting to go up quite a bit.  If you are
tempted by a digital pot, I have used the Xicor Quade2pot range quite a bit,
they seem pretty good, although the datasheet is pretty obscure on some
aspects.  As an aside, I have the preliminary datasheet for a new Xicor part
that contains: 3 digital pots (one 64 tap 50k, one 100 tap 10k and one 200
tap 10k), reset supervisor with power on reset, low voltage reset with
adjustable trip levels, a manual reset input, three voltage monitor pins
with user adjustable threshold (one with a hardware output, the other two
readable through the serial bus), 2K eeprom memory and 2.7 to 5.5 volt
operation.  Phew.  Sounds like a very useful part though, it's number is
X6402

The only thing I would check about the LDR arrangement is linearity.  I
don't know how straight the transfer curve of a typical LDR is and combined
with the non-linearity of a typical LED, you would have to use some kind of
lookup table to get specific gains from the circuit.  Certainly do-able
though.

Regards

Mike Rigby-Jones

> {Original Message removed}

More... (looser matching)
- Last day of these posts
- In 1999 , 2000 only
- Today
- New search...