I have a Mini DSO DS203 portable oscilloscope. It can generate sine, triangle, and square waveforms with a peak to peak voltage difference of 2.8V. Desired frequency range is 0-200Hz. Duty cycle is not important.
I wish to boost the square wave output of this function generator to a voltage level that can be interpreted by an Arduino as a HIGH on a digital input pin. Can I use a simple JFET op amp to boost the signal?
I also have access to a reference 5V signal on my breadboard. Is it instead possible to use an NPN transistor to switch the 5V signal using the 2.8V input signal?
What is the best route?
Best Answer
Method 1: Do nothing special...
Simple if the generated signal can be DC-biased by the signal generator, i.e. instead of -1.4 to 1.4 Volts, output a waveform of 1.0 to 3.8 Volts.
This signal can be directly used as digital input to an Arduino GPIO pin. For standard Arduino boards, Vcc is 5 Volts, while some clones and specific newer boards work at 3.3 Volts. For the 5 Volt case:
Thus, raise the voltage floor of the square wave so it goes beyond these voltage levels at high and low, and it's all done.
Method 2: Use a comparator, or an Op Amp as comparator
This is as already suggested by Nick Alexeev in comments. Please note that the LF355N may not be suitable for this purpose: Minimum Vcc supported is +/- 5 Volts, i.e. 10 Volts in single supply configuration. You will need a (preferably) rail-to-rail output op-amp supporting single supply operation at Vcc of 5 Volts.
(from this web page, which has additional explanations)
Clamp (or adjust at signal generator) the negative part of the incoming signal so it does not go below Ground potential. If the generator does not support DC biasing, a diode-based voltage clamp could be used, several suitable schematics show up on a web search.
Choose R1 and R2 such that the voltage divider provides a comparison threshold within the voltage high and low levels of the square wave, say 0.8 Volts. The output will be inverted, but will toggle between the supply and ground levels (or as close to the supply rails as the op amp chosen can drive its output) according to the input signal.
Method 3: Use an NPN transistor as a switch
A BJT designed for switching, such as the 2n2222, can be used for this purpose. This transistor is designed to withstand higher reverse bias voltages at the base than the -1.4 Volts that a 2.8 Volt peak to peak signal would have, so no additional care needs to be taken for the negative part of the cycle.
What is the better route?