Shop OBEX P1 Docs P2 Docs Learn Events
Op Amp as Voltage Follower? — Parallax Forums

Op Amp as Voltage Follower?

Jeff DegeJeff Dege Posts: 85
edited 2006-03-04 17:22 in BASIC Stamp
Playing around with the Pocket Watch B, I tried out the circuit and the sample BS2 code from their datasheet.

They have the ALARM pin from the Pocket Watch connected to an input on the Stamp and through an LED to ground.

They don't have a resister in series with the LED, because "the ALARM pin is internally current limited".

Problem is that with the LED in place, the Stamp never recognized that the pin was high. So I added a resister to reduce the current through the LED, and the Stamp recognized the high. But the LED was lit very dimly. And it stayed lit dimly even after I'd reset the alarm on the Pocket Watch. I played around with a number of resister values, and never found one that would have both the Stamp input pin and the LED working correctly together.

I'm also playing around with the "Understanding Signals" text, and the chapter on Op Amps pointed me to your "Basic Analog and Digital" book. Which has one example in which an Op Amp is used as a "Voltage Follower".

Am I right in thinking that this might be a reasonable solution for problems like the above issue, where the Pocket Watch's ALARM pin can't seem to drive both the Stamp input pin and the LED at the same time? Assuming, of course, that there was some reason why couldn't have the Stamp use a spare output pin to light the LED whenever it saw the ALARM pin go high.

If so, would you have the Op Amp drive the LED? Or the Stamp pin?

Comments

  • Paul BakerPaul Baker Posts: 6,351
    edited 2006-03-03 21:24
    An op amp is actually overkill, you could use a driver such as a darlington transistor which takes the input and connects the anode of the LED to ground if the input is high.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    ·1+1=10
  • Ryan ClarkeRyan Clarke Posts: 738
    edited 2006-03-03 21:47
    For that matter you could use simply a 2N2222 or other transistor- (just decide which you'd rather have, a smaller required base current, or smaller C-E voltage drop)

    Ryan

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Ryan Clarke
    Parallax Tech Support

    RClarke@Parallax.com
  • Jeff DegeJeff Dege Posts: 85
    edited 2006-03-04 02:20
    So that raises the question of why did "Basic Analog and Digital" use an Op Amp for nothing more than driving an LED?

    Possibilities:

    - Trying to teach about Op Amps, rather than to design an economic circuit

    - Sold with a parts kit that already had an Op Amp, and didn't have a transistor.
  • PJAllenPJAllen Banned Posts: 5,065
    edited 2006-03-04 03:34
    · I advocate using the "humble" transistor, often.· It's a versatile component, but if it's not in a DIP-8 then it's scary or something·and people run for the hills.
    · Why some people won't take that big step and buy a couple is beyond me (they've bought their "wambo" kit and that's the extent of their commitment -- no mas.)
    · Commonly I propose this in response to questions like when·someone wants to know·whether it's OK to·source 100mA from a STAMP pin.· (But, isn't there an IC... ?)
    · Oh, well.
  • edited 2006-03-04 03:57
    jdege·said...
    So that raises the question of why did "Basic Analog and Digital" use an Op Amp for nothing more than driving an LED?
    The main theme in Basic Analog and Digital is A/D and D/A conversion. On the D/A end, the point was to provide a buffer with an output mirrors the input and can handle a load. If you throw a transistor on a DAC, it's good for some things, but you have also introduced a whole bunch of other considerations that obscure an introduction to D/A conversion basics.

    What's a Microcontroller (which usually comes before BASIC Analog and Digital) shows an example of using a transistor that's similar to the 2N2222 to drive an (LED) current load.
  • Jeff DegeJeff Dege Posts: 85
    edited 2006-03-04 16:06
    So the idea wasn't to drive an LED, but to demonstrate how to mirror an input, and the LED was simply a cheap and easy way to demonstrate that it was working?
  • edited 2006-03-04 17:22
    Exactly. The opamp wired as a voltage follower (often just called a buffer) matches the input voltage at its output. Whereas the DAC's voltage output might drop like a stone when you attach a load to it, the opamp's output doesn't care (up to its output current limits at any rate). So, by putting the opamp buffer between the DAC's output and the load, you get reliable voltage that matches the DAC's output.

    Yes, in that particular book, the LED is just an inexpensive way to demonstrate that a circuit can load down a DAC output, but be driven correctly by the opamp buffer. In hindsight, I wish I had added a few different output loads that would have demonstrated the distinction more clearly.

    Your guess that the book had to go with an existing kit was also pretty close to the mark. I was a summer intern when I started working on Basic Analog and Digital, which at the time was already a manuscript and kit. Rewriting the book from scratch to make it fulfill some "pre-engineering" requirements was an option, but foraging for new parts was not.

    While transistors can be connected in various ways that mirror voltage output, there are a lot of extra rules and exceptions. In general, a transistor is like a valve that allows current through two terminals (usually the first and third). The second terminal controls the current. Depending on the flavor of transistor, it either requires some voltage or current to open the valve. The more current/voltage into that second terminal, the more current it lets pass into terminal 1 (and back out terminal 3).

    Transistors typically have "off" ranges, where you can change the input voltage/current slightly, but no change appears at the outputs. Transistors also have input ranges where you can increase the input current/voltage, but the output current just won't go any higher.

    In between those two input ranges, you can get some linear response to input at the output. By taking the various attributes of your transistor into account, you can build some pretty reliable voltage follower circuits, but it seems to me that it takes a lot more study and experimentation to get to the point where you can voltage-buffer a DAC's output with confidence using just transistors.

    By switching the input current/voltage from a transistor's off input region to its saturation input region, the transistor makes a good current switch. And, transistors can amplify the small input current/voltage into a much larger current through their output terminals. In effect, the transistor becomes a current on/off switch. Combinations of transistors can make even better switches (like the Darlington configuration mentioned earlier in this thread). Of course, the opamp in your voltage follower is probably nothing more than thirty-some-odd transistors connected in three separate stages.

    Anyhow, there's lots you can do with transistors. For Stamps in Class examples, check out the PDFs for What's a Microcontroller, Applied Sensors, Industrial Control, and Experiments with Renewable Energy. With the transistor part numbers from those PDF examples, you can search the Parallax site to find more. The forums also have lots of transistor circuits, and Google will also lead you to thousands of different transistor apps.

    Same deal with opamp's, there's lots more than the voltage follower from What's a Microcontroller and the two amplifier circuits from Understanding signals. Anyhow, have fun and keep on experimenting with different circuits and programs. Always expanding your bag of tricks is the key to making inventing and projects go more smoothly.
Sign In or Register to comment.