My “audio oscilloscope” can't measure static/constant voltages but only changes

I don't have a oscilloscope (costs so much) so I decided to make a "audio oscilloscope"

It works great in many ways. When connecting a IR receiver module to the audio oscilloscope I can clearly see the (correct) signals when clicking a remote control.

However there is one very annoying problem. I ONLY manage to monitor CHANGES in voltage, but NOT continuous static/constant voltage. If the scope receives a constant voltage (for example connects it to a battery) then it will after a short, in lack of better terms, "recalibrate" or "get used to" the voltage and start to think of it as zero voltage.

In the example I first have the oscilloscope without and voltage. It correctly shows zero voltage.

Then I connect the oscilloscope to 5V (from USB) and correctly the scope shows positive voltage... for a very short while, and then it goes bananas and eventually "recalibrates"/"gets used to" the 5V and think that it is 0V (even though the 5 volts are still applied!!)

Does anyone know how to measure constant/static voltages correctly with an audio oscilloscope, or know why this "problem" exists? I assume that a real oscilloscope does not behave in this way.

• That would be because your sound card is AC coupled. – Matt Young Jul 14 '15 at 16:18
• That's why it's called an "audio oscilloscope". DC is not audio. – endolith Jul 14 '15 at 19:05
• It may still be too much, but you can get a pocket oscilloscope for $100. Mine came direct from China, but in the US Adafruit do one that looks better built. Either of these will do more than your audio scope (though not as much as a basic bench scope), and they're smaller than a multimeter. – Chris H Jul 15 '15 at 12:25 • Thanks. It will probably be a little bit more expensive in Sweden (tends to be). I ought to buy a real scope eventually. My brother have a cheap scope that works good, except that I really want a scope with more memory than his (don't remember how much memory that was, but when configuring enough resolution to see 38kHz carrier frequency it could not catch a whole NEC IR signal, only about half of it). An audio oscilloscope (sound card oscilloscope) seems to have ton of memory. – fredrik.hjarner Jul 15 '15 at 14:53 • There's also a kit from the usual Chinese sources for about$25, if you're not put off by some easy SMD soldering. – user_1818839 Nov 17 '16 at 22:12

Sorry to butt in after a good answer was given, but I kind of, sort of, wanted to add some extra fun knowledge as a procrastinatory tool...

To expand on the basic difference between AC and DC coupling:

The AC coupling in the sound card is very important to protect it from harmful effects of cheap microphones, cheap line-in/line-out devices and cheap PC boxes, all of which can do filthy tricks to create a signal with what is called a DC-bias. Since the audio card cannot easily handle outputting to a DC-bias or can not always correctly process a DC-biased input, they couple it for AC, which removes all the DC-bias.

What happens with your USB is that you apply the 5V and that creates an AC-like-impulse upwards toward 5V, but then that AC aspect is gone when the 5V stays there and the actual input of the sound card settles back to 0V.

For an illustration, this is what AC coupling looks like:

simulate this circuit – Schematic created using CircuitLab

The capacitor blocks any DC voltage. For now just assume I'm right when I say that a capacitor's resistance to current flow is inverse to its value, multiplied by the frequency, like so: "Resistance" = 1 / ("sort of Frequency" * Capacity) (I don't feel like going into complex maths or radians or pi at this point).

So if the frequency gets larger it will conduct currents easier, also if the capacity gets larger it will conduct easier. But you can see that for DC, where the frequency is 0, not close to 0, but actually 0, its resistance becomes "infinite".

DC will not get through.

Fixing AC coupling in this scenario:

It will not be easy. But it can be done without modifying your sound card. Modifying your sound card is unwise, to say the least.

EDIT: You can also just chop the signal to get an AC wave you can use, only just occurred to me :-S -- See below for that

This part of the answer is given more "for fun" than an actual "this is what you should do". This solution is cumbersome and requires much more work than it's worth, but it is to show that it could be done with some creative "abuse".

You could turn a 2 channel AC coupled audio device into an AC+DC coupled single channel, but it requires both hardware and software knowledge.

Basically you turn the DC voltage into an AC signal through a known method:

You can use a cheap uC with built in 10bit ADC to get a decent impression of the DC voltage present by filtering out the AC first, you then turn that 10bit number into either a PWM signal with sufficient resolution, or as a frequency with a known formula (quite a bit harder in most cases, but eliminates the risk of PWM value 0x00 or 0xFF becoming DC again).

You can then put that on the other sound channel (i.e. Left if you use Right for the original signal) and combine that information with the AC signal you were getting to get the DC-coupled AC+DC signal.

Illustrated that looks like this:

simulate this circuit

But then, if you are using a MicroController and some programming, it's a small step of upgrading to an Arduino-Scope type of tool. I'd imagine some tutorial or ready-made thinger is out there around the $25 mark with 20kHz or above performance. You can also use a LM/NE/LMC555-type multivibrator to get the PWM signal or a voltage controlled oscillator and still have no micro controllers in there. To quickly explain anyway: The op-amp buffers the signal. It will have to be able to go close to its negative supply on in and output, but many LM3** type op-amps will probably be okay for sub 20kHz signals. The output is then put towards the capacitor C2, which stores the positive peaks, but because there is a resistor, it takes some time to charge, so this makes it slow to respond to frequencies above a certain point. It will also be discharged again by low valleys, but again through the resistor, because the ADC input doesn't take much current away. So the resistor and the capacitor average out the value into a sort of DC value. If you are measuring above 50Hz-ish the average will become more and more stable with these values. Of course, measuring DC will cost you some time now, because of the charging of C2. The uC/NE555 turns the voltage it sees on the input into a PWM value, if you do that according to a fixed algorithm the PC can measure the AC signal on the left channel and re-calculate what the DC level must have been. With PWM it is quite important to use a low frequency, because PWM needs many higher frequencies to be seen correctly and the sound card can only see up to 22kHz, so maybe even as low as 100Hz for the PWM frequency. No problem, since C2 already makes the DC response a little bit slow. Don't go too low, o the Audio card might filter it out. Of course D1 and D2 and R1 are there to clip the PWM signal from the MCU to protect the Left audio channel the same way D3 and D4 protect Right. With some toying around and given a 10bit ADC in the scheme above (where you waste quite a bit of its range), you could still get 5mV or better of DC recognition over the 0.7V diode span on the signal after the potentiometer. EDIT: Chopping the signal: If you want to measure DC and low frequency signals + DC with a sound card, you can chop it up: simulate this circuit You can power the inverter here with a USB voltage. (When you start connecting different ports to the same DIY toy, make sure you use old hardware that you can miss. It's easy to make a mistake the first few experiments) A neater chopper would be (but will again require a balanced supply that you cannot get from the USB port): simulate this circuit This is neater, because now the Op-Amp acts as a buffer between the input and the chopper switches, so the input can't see the fluctuating current of the chopping, which will help prevent you causing oscillations where they would not be if you weren't measuring there. But as said, you need a + and - voltage that can't come from the USB for safety reasons. You can supply the inverter with the same, although it is just a little beyond its power supply, but you can also power it with just the 3V. You should get a set of MOSFETS with a Vgt (gate threshold voltage) of 2.3V or below though. Basically, when the output of the inverter goes high with respect to ground this will cause the MOSFET to conduct, then this also charges up C1 through R3. When the input of the Schmidt inverter crosses a given level upwards, it will toggle its output low, which will then draw the charge from the MOSFET gate and make it stop conducting. This will also discharge C1 through R3. Then when C1 crosses another, lower level downwards the output of the gate will go up again, starting all over again. The Analogue signal will not go low enough for you to need two back-to-back MOSFETs, because the diodes are already clipping the signal, so for this one specific example you can also use just a normal single N-channel MOSFET with its source to ground. You could also use MOSFETs differently to not need the protection diodes, but I feel this would go too far and would require a course in looking at datasheets to look for body-diode characteristics and much more fiddly stuff. The last schematic offers a Chopped and un-Chopped output, so you can select for AC-coupled original signal, or Chopped AC+DC signal. What happens is that the chopping MOSFET that turns on and off automatically will turn the signal into one that is its original value half the time and 0V the other half. So it will become a square wave. Any signal reasonably slower-moving, like DC or anything up to 50Hz, can be recovered well enough by software and you can even interpret the chopping out of your trace yourself on the inside of your brain, if you can't change the software. Of course the special case where the signal itself is 0V, the chopping won't change anything and your screen will correctly show 0V anyway. Of course frequencies that are close to your Chopping frequencies, or are higher, will get deformed by the chopping and will require more advanced maths to find back, I will not go into that. With the given values for C1 and R4 R3 (typo) I expect the frequency to become between 1kHz and 3kHz for the chopper, but experimentation will show if some values may need tweaking. • The chopping was a option that I was thinking of. Nice answer and lots of detail. – KalleMP Jul 14 '15 at 20:45 • Thank you! Very good answer! I understand more accurately now what the "problem" was and how one can work around it. It sparked my imagination and curiosity. I can't understand all the specifics (yet), but I read a few more times though it and I am sure I that will get it. – fredrik.hjarner Jul 14 '15 at 22:04 • @taz0k I hope you will find a nice way to test some tricks with some old hardware, but it's always good to read up on more details. I'm known by a few here to keep rambling off ideas, so I'm always glad if a few turn out to actually help ;-) – Asmyldof Jul 14 '15 at 23:14 • if it's a$5 USB sound card, experimental modifications are not really a bad idea. – Jasen Jan 6 '16 at 12:13
• @Jasen That is true, though small plug-in sound cards made to a budget may also not be very consistent with power routing. There'd be a tiny risk of also damaging the PC upon a mistake. Unlikely, but good to keep in mind when making the decision. – Asmyldof Jan 6 '16 at 14:13

Sound card inputs (as usally any audio input) are AC coupled, i.e. via a capacitor. That's why they are only sensitive to changes of voltage.

Its not a fault of the sound card it's a feature.

Real oscilloscopes have the possibility to choose between AC or DC coupling input signals.

• Thanks! Perhaps it is not a problem with the sound card, but it is a problem for an "audio oscilloscope". Is there a way around this? Is something either AC coupled or DC coupled and never both? – fredrik.hjarner Jul 14 '15 at 16:24
• No, there is no (easy) way around it. Yes, an input can be either AC coupled or DC coupled, not both. (Which doesn't mean you couldn't measure AC signals with DC coupling). You can easyly convert a DC coupled input into an AC coupled input (just by adding a capacitor) but not vice versa (You had to remove the coupling capacitor from the sound card which probably would introcude several other problems). – Curd Jul 14 '15 at 16:30
• Thank you! Hm, I could try to find and remove that capacitor from an old computer if I find one. I guess the (only) solution is unfortunately to buy a oscilloscope. – fredrik.hjarner Jul 14 '15 at 17:06
• @tazok you may have a DC offset that you didn't expect when removing the cap. It is also possible that the signal is decoupled in more than one location: right after the input connector and after an input preamp. Would be a nice little exploration project if you have the hardware to spare. A perfect way to learn some electronics hands on. – jippie Jul 14 '15 at 17:33

The linked makezine article states "The bandwidth of the sound card is much lower: about 20 – 15kHz. Anywhere out of this range and measurements get sloppy.". The questioner would have been helped by fuller explanation that an unchanging voltage is effectively a frequency of zero i.e. far below 20 Hz. The DIY scope displays only the voltage step when the source is first connected, followed by a decay back to zero. This is consistent with a high-pass filter like Fig. 1 here https://en.wikipedia.org/wiki/High-pass_filter which is also the input circuit of most audio equipment, including sound cards. High-pass filters are used for AC coupling at the inputs of many audio power amplifiers, for preventing the amplification of DC currents which may harm the amplifier, rob the amplifier of headroom, and generate waste heat at the loudspeaker's voice coil.

There is nothing here that "goes bananas" as alleged.

• The display screenshot showed a large positive step, then a large negative step (this, along with the positive portion of the decay curve, is the "bananas" OP refers to), then the decay you refer to. – Random832 Jul 15 '15 at 0:04
• Though I bet if you integrated the area under the positive and negative sections of the curve, you'd get zero. – Random832 Jul 15 '15 at 0:08
• I could have been more clear and written that "to my eyes" it seems to go bananas because for me it was unexpected behavior, because I didn't understand how a sound card works. – fredrik.hjarner Jul 15 '15 at 14:57