Oscilloscoop

Hello folks,

I'm making an oscilliscoop!
Therefore I need to convert a random voltage/current to 0-5V for arduino to read it.
I have to use an opamp that will convert this voltage to 0-5V and making the negative
voltage positive. Does anybody have an idea on how to deal with one of these problems
or even better, both of them!

thanks in advance!

Therefore I need to convert a random voltage/current to 0-5V for arduino to read it.

Current does not go from 0 to 5V only voltage is measured in volts.

I have to use an opamp that will convert this voltage to 0-5V and making the negative
voltage positive.

No you don't, if you make negative voltages positive to will not be able to measure anything. What you have to do is to apply a DC shift.

Does anybody have an idea on how to deal with one of these problems
or even better, both of them!

Ever thought you might not be the first to do this. What is wrong with Google, second hit is:-

Potentially the most important components of an oscilloscope input amplifier are those
that protect it from being damaged by high voltage :slight_smile: So first decide what range of voltages
you are going to handle and design (or copy) a suitable input protection section. Usually
there is a switched attentuator as well, then a high-impedance high-speed buffer stage.

What bandwidth are you aiming at? - most op-amps are slow and not suitable, specialist
high-speed op-amps and video op-amps are a reasonable approach I think. Video amplifiers
have the advantage of being designed for flat phase response.

If full 10-bit resolution is needed, then signal to be measured must be bandwidth limited to ~ 4500 Hz, as the 110uS conversion rate of the ADC means samples at about 9 KHz rate, (barely) enough for a sample high and then a sample low.

You may want to take a look here too
http://www.negtronics.com/simplot

CrossRoads:
If full 10-bit resolution is needed, then signal to be measured must be bandwidth limited to ~ 4500 Hz, as the 110uS conversion rate of the ADC means samples at about 9 KHz rate, (barely) enough for a sample high and then a sample low.

In other words, the Arduino's speed is the issue, not the op-amp. The Arduino will also have to process the data and update the display.

FYI - You can easily make an inverting op-amp circuit, but it will also turn positive signals into negative signals. You need to "capture" the positive half and the negative half of the signal, and/or you need to know if it's positive or negative.

As Mike suggested, you can add an offset... i.e. Add 2.5V to the analog input, and subtract 2.5V digitally.

If you want to make an oscilloscope "just for fun", that's OK. If you want to make a useful test/measurement/troubleshooting tool, that's NOT easy, and that's one reason 'scopes are not cheap.

CrossRoads:
If full 10-bit resolution is needed, then signal to be measured must be bandwidth limited to ~ 4500 Hz, as the 110uS conversion rate of the ADC means samples at about 9 KHz rate, (barely) enough for a sample high and then a sample low.

Recommended maximum ADC clock speed for 10-bit operation is 200kHz. The Arduino default is 125kHz. If you change the ADC prescaler from 128 to 64, you double the ADC clock frequency to 250kHz and hence double the sample rate, and you are only a little over the recommended maximum for 10-bit resolution.

Okay, that supports this from the datasheet I suspect:

Up to 76.9kSPS (Up to 15kSPS at Maximum Resolution)

Forget that BS about the Nyquist limit. Could you see a reasonable approximation of a sine wave with only two samples per cycle? Plan on something like 8 samples per cycle, or more.

polymorph:
Forget that BS about the Nyquist limit. Could you see a reasonable approximation of a sine wave with only two samples per cycle? Plan on something like 8 samples per cycle, or more.

2.5 samples per cycle and some digital filtering, yes, a very good sine wave, but a rectanglar
wave, no!

While 2.5spcycle and digital filtering may -show- you a nice sine wave, is that what was coming in? Will that show accurate phase information?

I should be more clear in what I mean. If you are looking at a waveform at, say 10MHz, 20Msps sample rate is NOT good enough. 30Msps isn't good enough. Heck, with an analog scope I'd want at least 50MHz bandwidth to look at a 10MHz signal, which might be digital or have other frequency components (sawtooth, periodic pulses, etc.). So in that case, with a digital scope I'd want a 50MHz BW also, and in that case I'd accept 2.5x that, or 125Msps.

If I were building my own digital scope (with unlimited resources and time), I'd build it so the sample rate is at least 5x the input lowpass filtering.