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:
- GPIO port thresholds (from ATmega328 datasheet):
- LOW is < 0.3 Vcc, i.e. < 1.5 Volts
- HIGH is > 0.7 Vcc, i.e. > 3.5 Volts
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?
- If the signal generator supports DC biasing, Method 1 is the obvious answer.
- If not, the simplest and least expensive solution would be Method 3.
An instrumentation amp is essentially a difference amplifier. The output is directly proportional to the difference between the two input (essentially, which is what you need) and so any common mode signals, ie, those which exist in both inputs, should in principle be eliminated. It looks like a fairly straightforward application of an inamp to me.
Simply tap the voltages at both points and dump them into the two inputs of an inamp. You have to make sure that the inamp has sufficient bandwidth to respond to your harmonics, and inherent noise and stability at the frequency of interest that comes from the inamp itself should be lower than your signal.
EDIT:
On looking at your circuit, I will posit one of three possibilities :
The circuit is incorrect, and the label "Lock-In" should be on the rightmost corner, as if the lockin is not shown.
The circuit is incorrect, and the output of the first opamp(the triangle, left top) goes to the second (left bottom) instead of the third, and to its angled side. (as ref input)
The circuit is correct but the text is not, and the signal from the resistor is used as the lock in reference instead of something nicer coming out of the current source. The subtraction then occurs inside the lockin implicitly. From what I know of lockins, I'd bet against this possibility.
Using an instrumentation amp is easy. A difference amp is slightly more complicated. In both cases, look at the datasheet for a typical application circuit. For an inamp, the output is generally given by G x (In+ - In-) + Ref, where G is generally set by a resistor or two. Ref is typically ground unless otherwise specified, and lets you add an offset to the output.
From what I gather, both the left two triangles can be instrumentation or difference amplifiers. The output of the top one is what you want to subtract from that of the bottom one. In order to do that, one way is to send both into a third instrumentation or difference amplifier, as in possibility 1 with the lockin mislabelled. The inamp will subtract the two signals and let you give it to the locking with impunity.
Another way go perform this subtraction is to send the output of the top inamp into the ref input of the bottom inamp. I suspect you'd want one of the two inamps to be in reverse polarity for that to work, but I'll have to think about it. This would correspond to possibility 2.
Best Answer
An automatic gain control (AGC) appears to be what you want. It will try and keep the output constant by using a variable gain cell (usually a JFET) driven by a voltage that represents the peak magnitude of the output. If the output voltage signal level is too small the gain cell is rapidly compensated to achieve the correct amplitude.
You might also consider using a high frequency boost filter just to raise the amplitude of the input signal so that things are levelled out.