Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

Oscilloscope to sound card buffer

Status
Not open for further replies.

()blivion

Active Member
I need a dirt simple basic oscilloscope to add to my tool box. I did some Google investigating and found that there are some circuits for a simple buffer that can be made for turning a PC sound card into an oscilloscope. I like this idea a lot since it's cheep (I can't afford to buy even a cheep toy scope) and it allows the possibility for me to use more advanced sound processing software like Cool Edit or similar and get some interesting incite into not just the waveform, but the spectrum as well. I am more or less aware of the limitations of using a sound card as a oscilloscope. I believe a correctly built unit will work for my modest needs.

Here is the rundown of the features I need/want.

1) Can survive RMS 240 mains continuously irrespective of user settings.
2) Is reasonably linear from 20Hz up to 30~40Khz.
3) Has switches for "range", IE... [1/100] [1/10] [1:1] [x10] [x100]
4) Ability to easily calibrate with a good DMM.
5) Does not use exotic parts. (Standard Op-Amps for example).
6) Does not load the source much, 1M ohm input impedance preferred.
7) Will work with the probes I already have. (100 Ohm - 9 Mega Ohm switch on probe)
8) Possibility to add a basic Opto-isolator in the mix. (NEC 2561 for example, as I have a few.)
9) Can measure a waveform with a DC offset on it. (ignores the offset)
10) Is a relatively compact and simple circuit. Point-to-Point constructable.

Here is the current circuit I am looking at modifying for my needs. I got this image from here.
I have no attachment to this schematic other than it's simplicity.

View attachment 65357

Constructive thoughts are very welcome. Naysaying... not as much.

Thanks for your time.
-()blivion



*TEMPORARY EDIT*
Hear is another thought, off topic but maybe deserving of it's own thread.

I have two high speed dual 6bit ADC's I salvaged out of some satellite TV boxes. Part numbers AD9066JR and STV0190. They may make a decent high speed DSO with the right design. Datasheet says up to 60 MSPS for the AD9066JR and 40 MSPS for the STV0190. If this sounds like an interesting project I could make a new thread? Or maybe a newer and better ADC could be found on one of the usual retailer sites. Either way, *I* need a scope for CHEEP. And this could possibly work for me.
 
Last edited:
Most sound cards are AC coupled on the input. You can't really measure DC with them. AC is fine.
 
Sometimes you can "steal" one on E-bay. I got a Tek 465 from a local guy for $50 a few years ago after my old one broke. Now I have a scope and spare parts.
If you like I can simulate the amplifier in your schematic.
 
Sometimes you can "steal" one on E-bay. I got a Tek 465 from a local guy for $50 a few years ago after my old one broke. Now I have a scope and spare parts.

I have the worst luck when it comes to doing that. I always find the "too good to be true" deals. Deals that turn out to.... not be true.

If you like I can simulate the amplifier in your schematic.

Sure, that sounds great. I'm using the www.falstad.com simulator for this right now, it's quick and lets you run things and make changes to your circuit and see what happens in real time. But it's not nearly as accurate or as powerful as LTSpice if you know how to use it. (I don't know how, never really tried it.)
 
Last edited:
Frequency response

I couldn't find your op amp so I used a TL081. It looks good. The only thing I see that might be a problem is that the bandwidth on the TL081 isn't high enough for the gain of 100 so the signal "rolls off" at 10KHZ. This might be a little confusing if you are looking at say a 30KZ signal at X100 then switch the probe to X1 and the range to X10. You would expect the same signal but it won't be the same. Hope that makes sense. If I remember right you were looking for 40KHZ.
 
You probably don't need the transistor buffer on the split supply if it is only driving the 1 op amp. The one with the TL081 only draws 6 ma.
 
Thanks for the simulation, looks like I may need to get a better op amp as the TL081 has even higher bandwidth than the 1458D. (~1Mhz unity gain as opposed to 4Mhz for the TL081). The original circuit had a capacitor across what is now the 900K resistor. Can you simulate that? How about with a 5p to 20p cap? This should pass more high frequency to the + input of the op amp, possibility improving high Khz gain. Though I'm sure it's more a op amp thing that needs to be fixed.

You probably don't need the transistor buffer on the split supply

Yeah, it's just my go to design for voltage splitting, I use it often. Plus small signal transistors are easy to come by. It *IS* driving 2 op amps plus maybe some other small things, but your probably still right.

Could you maybe also simulate a high power 240 volt RMS? IE, 360v P-P? When I do this myself in the falstad sim, the 900k resistor looks to dissipate ~140mW. I can't tell what exactly this simulator is counting as it shows a waveform for the power dissipated. I think it's reading the peek of the wave as the power consumed, so half of whats shown or the RMS is more likely the correct number. Even the highest possible value shown so far is low enough honestly. But I don't trust this simulator much, it could be completely wrong.

My simulations also showed that with 240 mains and the lowest possible probe impedance setting, around ~3mA of power was sent to the +6v and -6v rails, via the clamping diodes. (Part of the reason for the transistor buffered supply) Can you confirm this? Can you confirm that the clamping resistor is low enough to keep the op amp + input down to -+6 volts under all conditions?

Edit: The directly above data *may* have been from an older revision of the modifications to the primary circuit.

Thanks for the help.
 
Last edited:
High Voltage

Looks pretty good. Only 100s of ua's.

I'll play with the cap, but when I "scoped" it the problem was the op amp.

Need to make sure the op amp can take input voltage .6 volts above the supply. The simulation is happy with it but the models often miss some stuff.
 
Need to make sure the op amp can take input voltage .6 volts above the supply.

I saw that too. That is usually exactly the upper limit for most IC's. If it's a problem I could use Schottky diodes for a V-forward of 0.2 Volts. Or I could also drop the supply to the clamping diodes by a small amount. Say to ~5 volts. Then it's only 5V + 0.6V for diode drop, which would be just under the supply.

In any case, I'm not anticipating problems with this. But it's good that you spotted this. Reassures me that you know what your doing, as if I had doubts. ;-)


Edit:
This PDF also has some ideas to deal with the above problem that I might try. Particularly "TIP #11 5V ->3.3V Active Clamp". Though I'm not sure if the voltage drop changes much with this method vs whats already done.
 
Last edited:
Take a look at the LM6142 op amp.

Cool part, nice work. I'm going to try and find something in my junk that will meet up with the bandwidth needed first before going and buying anything. (I'm a supper cheep ass) If I decide to make a real/better DSO though using the chips I mention in the first post, I'm going to need more bandwidth than even the LM6142 can offer. I may want to go with something like the LT1364 or LT1469 if I do this. But $7 to $10 per part is a lot to spend on just an OP-Amp IC. And just because these parts are more precise, doesn't mean the whole circuit will be too. A lot depends on a good PCB layout and case. Also, if it's beneficial I *MAY* change the circuit to be in an instrumentation amp configuration. Since it is "particularly suitable for use in measurement and test equipment". Which in theory is what we are making.

If you could simulate all that stuff it would be really cool. ( I *AM* asking a lot though honestly, you don't have to do any of it.)

(EDIT: I guess DigiKey caries MCP6N11-100E/SN-ND, which is a Microchip built instrumentation amp in a single package. Works up to 500Khz.)


1 or 2 pf across the resistor does seem to help.

K, good to know. That is most likely why the original schematic had a cap in there. I will prolly add one.

One thing I want to add, I had some odd intermittent drifting of the input signal, right after the input impedance would change. I think it was because the input cap was accumulating a charge on it during a signal's peek and this was DC biasing the + input of the op amp till it discharged. The 100K and 900K resistors are supposed to float the input close to neutral, and have a high input impedance at the same time. But It may not work 100% with the input impedance so high. I can't think of a way to have my cake and eat it to on this one. :)-/) Maybe just cut out the cap altogether? Then it would just be straight DC coupled. But things are not as isolated if I do this and as stated in post #2 a sound card is AC coupled anyway. I'm thinking this would be more appropriate for the mentioned real/custom DSO.



I think in the end, I'm ultimately either going to do one of the following.

1) Not give a damn and make the circuit close to as advertised with what I have laying around and hope all works well.

*OR*

2) Design a better/custom circuit that has more bells and whistles, better bandwidth, better control, and a real PCB.

I would start another thread for option 2. I'm bread boarding option 1 now though.
 
Last edited:
The only reason I can see for ac coupling it is that then you can see a small ac signal on a large dc level. It does take a while for it to settle out. Not sure what is in the sound card.
Not much reason to go above the sound card frequency so a wide bandwidth op amp probably wouldn't buy much.
I have a vision of a little metal box with a BNC and phono plug. Most op amps now days have pretty low noise even for a gain of 100.
Let us know how it comes out.
What were you thinking about the A to D?
Seems like there ought to be a sneaky way to see the dc value.
Can you do cool tricks with the sound card?
 
For the simple circuit posted, the AC coupling cap is prolly a must then. Sound cards can't see DC as has been mentioned. I may make a switch that throws in and out such a cap if I go with a better design though. As seeing DC is useful.

Sound cards are usually AC coupled 16bit ADCs that run at aprox ~50Khz or better. The sound card I have *SAYS* it can do 196Khz sample rate. So it's pretty fast for a sound card. Nyquist–Shannon theorem would suggest 98Khz as my upper limit if the sample rate is not marketing. I would only expect 25Khz max though, as that's about the limit of human hearing.

Can't really do anything trick with it mods wise if that's what your asking, since it's an "on-board" sound card. Big unnecessary risk to my gaming rig. AC only is fine.

The thing with the ADC chips that I have is they are fairly fast, but low-ish resolution. > 40Mhz is OK for a scope IMO, far better than a sound card. And I don't think there will be a problem with 64 voltage levels. That's enough to tell apart almost any waveform. A sound card would be far better for this. And I could always make both. With a custom ADC based DSO, I can design the input front end myself, so I can make it AC and DC coupled, with a switch for either. The analog front end circuit could be pretty much the same as the sound card buffer I would think. It would just need to be a far better physical construction. IE, proper PCB, ground plane, short connections, precision parts, ect. ect. The biggest problem is going to be getting the data in a viewable form, say into a PC. 40Mhz X 6 bits is 240Mbps of bandwidth, times two probes is a total of 480Mbps. USB 2.0 High speed can just barely do this, but it wouldn't work for real time do to overhead, latency, and being a shared buss. It would be best to instead use a digital processor that has plenty of speed and memory to capture and record the data locally. Then you just use the PC as a way to display and process the captured data. Also note that with 480Mbps of data capturing you would fill 1GB of RAM in only 17 seconds.

Here is a diagram of roughly what I had in mind for a custom DSO...

View attachment 65402

And here is a picture of the parts I have for either project...

View attachment 65403
 
Last edited:
I like the concept, but alas I know nothing about computers so I have no idea how you would get the digital data onto the screen. :confused::confused:Don't know how you do it with the sound card either, but I know I have seen sounds displayed so it must be possible. Seems like if you could get the sound card out of the loop you could have dc info in the digital data.
Anyway you need the analog front end so it might be fun to see how well it works with the sound card.
 
I know nothing about computers so I have no idea how you would get the digital data onto the screen.

This is mostly my field of expertise. And there are numerous ways to do it.

The simplest way, (and it would be dirt simple too) Would be to just have the device enumerate (connect to the PC) as a USB "Mass Storage Device". (Thumbdrive). The DSO processor would capture the data to RAM, when done it would say there was a new file on the drive. When you open what would be the drive, you would see a .CSV file. Something like "Current-Date.cvs". All this file would be is a LONG LONG LONG text document that lists all of the ADCs measurements for that moment in time. All the measurements would be separated by commas (CSV stands for Comma Separated Values and is a very standardized way to store raw data). This file could be easily read and graphed by something like M$ excel and dozens of other programs also.

So... if for example, we had a 10Mhz square wave of 1v p-p, scaled to meet the rail to rail voltages of our ADC. And we opened the file in notepad... we would would see something like this...

Code:
64,64,64,64,0,0,0,0,64,64,64,64,0,0,0,0,64,64,64,64,0,0,0,0,64,64,64,64,0,0,0,0,
...[~1GB snip]...
64,64,64,64,0,0,0,0,64,64,64,64,0,0,0,0,64,64,64,64,0,0,0,0,64,64,64,64,0,0,0,0,

This is a crude example, but you should be able to tell what the data is saying and how it would all work. The number 64 is the highest (most positive) value the ADC reads out, and 0 is the lowest (closest to V- rail) with 32 being about the center or "neutral". Since it's a 10Mhz signal, and we are sampling the signal at 40Mhz, we would expect to see four of the same numbers in a row. This is because 40Mhz is 4 times faster than 10Mhz. The reality is we are not going to get it exactly right. I would expect to see some ~63s and ~1s, as well as a missing or an extra number in a row. something like five zeros or three 64s in a row. As for exactly what voltages these numbers would be? Well, there would have to be some precise voltage measuring and a calculations of the gain of the front end that the internal processor could log. This would probably be tagged onto the end or onto the beginning of the .CSV file as information above 64. Or something like a double zero value instead of a single zero, to mark that the information that follows as not being waveform data. Armed with the information above, one could use something like "Live Graph" to look at the file and get an actual waveform like what you would see in a normal scope most likely. All in all, a fairly straight forward process honestly.

And that is just for if it was done as a MSD (thumbdrive) class USB device. I haven't even explained how it would work as CDC (communications) or HID (human interface) yet. Hell... even the possibility of saving it as an .mp3 and opening it with a sound editing program exists too.

So yeah, lots of ways to do it. Bandwidth is my only worry. May want to consider a faster buss for real time display. Or drive an independent screen directly. Like an old laptop screen.
 
Last edited:
I actually almost understood some of that.;):confused::D
Seems like as long as you store the A to D values in the "Probe" you could use multiple DtoAs and clock each into it's own RAM at very high speed. Say 8 bits, then read out at USB rate?
That way the A-D could be 1/8 as fast - few gigs of memory and...........
 
in the rail splitter, keep the 10k resistor inline with the - input of the op amp. it's there to protect the input stage in case you for some reason get a high differential voltage between the inputs. without current limiting (like that provided by the 10k resistor) you will fry the input stage of the op amp should something go wrong with the output stage or or maybe with normal voltage shifts that happen during powering up or down.
 
in the rail splitter, keep the 10k resistor inline with the - input of the op amp. it's there to protect the input stage in case you for some reason get a high differential voltage between the inputs. without current limiting (like that provided by the 10k resistor) you will fry the input stage of the op amp should something go wrong with the output stage or or maybe with normal voltage shifts that happen during powering up or down.

OK... Good to know, I'll keep it in then prolly. I actually didn't use some one else's schematic for the rail splitter, I cobbled it together myself. Not to suggest that I was the first to design the circuit. In fact I'm certain that I wasn't, far to obvious a circuit config for it to have not been made before my take on it. I'm just saying that the resister was something I threw in there during said cobbling together, because it felt right. So... looks like it was a good choice then?
 
Status
Not open for further replies.

Latest threads

New Articles From Microcontroller Tips

Back
Top