Other Op-Amp Ideas
Op-Amps are extremely handy for all sorts of analog signal processing tasks. The Art of Electronics spends some 90 pages going through them all. We'll take a quick overview of some of the more interesting op-amp applications for robotics here. You can play with the circuits to learn more about the ones that appeal to you, or look them up in Horowitz and Hill.
Op-Amp Current Source
This source provides a constant current supply to a circuit load. Note that the transistor current source is inside the feedback loop. Here, R1 and R3 make a voltage divider to set Vref, but Vref could be set by some other voltage signal, instead. The current is determined by the formula:
Current Out = (V+ - Vref) / R2
The summing junction takes several signals and adds them together arithmetically. When all the R values are equal, each signal is given equal weight. If the R values are different, the output signal is a weighted sum, where the weight is inversely related to the R value.
Although 3 input signals are shown in the diagram, the summing junction can handle as many inputs as you like. Typical Runit value is 10k. Note that the summing junction is an inverting amplifier, so your signal will get flipped around. Remember to use buffers on either end if impedance is as issue for your circuit. After all, op-amps are cheap.
The summing junction allows us to do arithmetic on analog signals, like Output = 3X - 2Y. A basic use would be to allow one RCX input to process several different input signals.
Sample and Hold
The Sample and Hold circuit uses two buffers to keep a voltage level stored in a capacitor. Pressing Ssample will charge the capacitor to the present signal level, while the input buffer ensures the signal won't be changed by the charging process. From there, the output buffer will make sure that the voltage level across the storage cap won't decrease over time.
Pressing Sclear will short out the storage cap, discharging it and setting the output to 0V.
We can build the Sample and Hold circuit with mechanical pushbutton switches to see it in action. In actual practice, the switches used are various forms of transistor switch, which provides cleaner switching and also allows another circuit to control the sample and clearing operations.
Excellent Sample and Hold circuits like the LF398 are available on a single chip for cheap and easy use.
Sample and Hold circuits are used internally in Analog to Digital conversion. We might also use them to hold a given signal value from any particular sensor on a robot, for analysis and later use, especially if we don't want to bother encoding it and sending it to the CPU's memory.
This circuit cleverly performs a bit of basic calculus on an input waveform, and outputs its integral as a voltage level. The exact voltage level is given by:
where k is a constant.
This circuit works quite well -- so well that it integrates small errors like random noise, and can soon float out of the output range. There are two ways of solving this problem.
The first solution uses a very large resistor across the cap to drain off the errors accumulated by random noise:
In the second solution, we have a switch that resets the integration from time to time. Pushing Sreset shorts out the cap to erase the errors. Here, we've drawn it as a pushbutton switch, but it could also be a transistor switch to allow for control from somewhere else in the circuit.
A good use for an op-amp integrator could be as part of a position sensing system.