3
\$\begingroup\$

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?

\$\endgroup\$
  • \$\begingroup\$ Some questions: Is this output signal AC or DC coupled, and which range of frequencies doe you want to use? And is the symmetry of the square wave into the Arduino important? \$\endgroup\$ – Wouter van Ooijen Feb 4 '13 at 8:18
  • \$\begingroup\$ another design option: add a comparator in front of the Arduino to digital input. \$\endgroup\$ – Nick Alexeev Feb 4 '13 at 8:23
  • \$\begingroup\$ I like the comparator idea. I have one here in my kit. \$\endgroup\$ – JonnyRo Feb 4 '13 at 13:38
  • \$\begingroup\$ Wouter van Ooijen: DC coupled. \$\endgroup\$ – JonnyRo Feb 4 '13 at 13:38
4
\$\begingroup\$

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.

Op Amp inverting comparator (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.

NPN BJT as switch


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.
\$\endgroup\$
  • \$\begingroup\$ You sir, are the juggernaut. Honeybadger of the electronics kingdom. \$\endgroup\$ – JonnyRo Feb 4 '13 at 14:39
  • \$\begingroup\$ Honey badgers are not universally loved, but i did intend that as a compliment, in the internet meme sense. \$\endgroup\$ – JonnyRo Feb 4 '13 at 14:39
  • \$\begingroup\$ @JonnyRo I'll have to check whether my spouse likes furries :-) \$\endgroup\$ – Anindo Ghosh Feb 4 '13 at 15:33
  • \$\begingroup\$ You really ought to change your display for option 3. You've missed the inversion that the transistor produces. \$\endgroup\$ – WhatRoughBeast Aug 8 '14 at 17:29

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.