Making a soundcard logic analyser.

Have you ever needed to capture a logic signal to check that your Arduino or Raspberry Pi project is doing what it’s supposed to be doing, but you don’t have an oscilloscope? Or maybe you do have a ‘scope but it doesn’t have a storage mode, so the signal goes past far too quickly to see.

No need to shell out loads of money on an expensive logic analyser, when you have one with virtually unlimited storage capability right in your PC! You can use the sound card to capture logic signals as they pass through the bus, and then investigate the signal timing at your leisure.

The only problem is logic signals are generally +5V or +3.3V, whilst the line-in on your soundcard is designed to capture only voltages between plus and minus 2V at most. We can easily get around that by making a voltage divider out of a couple of resistors. I used an 82K and an 18K resistor giving me a 1/5 voltage reduction. That makes my +5V logic signal just 0.9V which is well within the range of the soundcard input. The resistor values don’t matter too much, so long as they have a ratio that brings your logic level down to something appropriate for the soundcard. Although it’s best to try to keep the total impedance as high as possible to prevent the connection interfering with you circuit.

First, get an old stereo cable with a 3.5mm jack plug. Cut off one end and strip the insulation to reveal the shield braiding and the two conductors.

Logic Analyser

Unbraid the shielding, and solder on your 18K resistor, and a length of wire that will form the “ground” connection for your logic probe. I’ve used two since I’m making up both channels. Use the left and right stereo inputs to make a two-channel logic analyser!

Logic Analyser

Put a bit of heat shrink over the joint to isolate the connection. Next, solder your 82K resistor onto the other side of the 18K resistor, and attach the left and right signal cables to the centre point of the voltage divider.

Logic Analyser

Attach your signal probe wires to the far side of the 82K resistor. Again, isolate the connections with some heat shrink.

Logic Analyser

Finally, put some more heat shrink over the whole thing to secure it all together. Nice tidy job!

Logic Analyser

Now you’re ready to feed it some signals and capture them. I used Audacity under Linux which is a free, open source, cross-platform application for recording and editing sounds. It’s perfect for this task. Did I mention it was free?

Here we are capturing two square waves at 192kHz sampling frequency. You’ll notice that the square waves are not very square, especially at lower frequencies. This is because the soundcard has a high-pass filter and tries to reject DC offsets. As soon as the square-wave pulses to a positive or negative level, the soundcard starts to pull the signal back to zero and the signal “droops”. That’s not too much of a problem, since we’re only aiming to look at the pulses and be able to measure the timing and synchronisation with other logic channels. For this, it’s perfect for the job!

Logic Analyser

Don’t make the mistake of thinking you can use this as a replacement for a proper multi-meter or an oscilloscope. If you decide to try to measure the frequency of your mains electricity you will destroy your soundcard and probably your whole PC.

But for the purpose of capturing logic signals – it’s perfect!

Posted in Geekorama.

Steven Hale leads the operation and development of the international Birmingham Solar Oscillations Network (BiSON), a global network of automated robotic solar telescope run by the University of Birmingham in the UK. His research interests are instrumentation and electronics, and high-resolution optical spectroscopy techniques. In his spare time he has many interests including photography and aviation, and has a private helicopter license rated on the Robinson R22 and R44 aircraft.

This is a private blog and in no way represents opinions or endorsements from the University of Birmingham.


  1. Pingback: Home Automation: Reverse engineering a Worcester-Bosch DT10RF wireless thermostat. – Steve's Stuff

  2. I am interested to use my Pc as data logger.
    Many thanks

  3. Pingback: Controlling a British Gas WR1 Receiver with an Arduino

  4. Pingback: Decoding a Siemens RCR10/433 Thermostat Signal to Control a Boiler from a Raspberry Pi |

  5. Hi Steven,

    just tried out this “project” cabling and soldering was the easy part 🙂

    but i get a flat line in Audiacity when i try to capture a signal that goes from HIGH to LOW (from a 3-wire Photocell – NPN-NO)

    i’m not used to work with audio software, maybe i’m doing something stupid 🙁
    i’ve got a pull-up resistor between my “dataline” and signalpoint where i measure with the selfmade LA


    can you help me on the way?

  6. Hi Yves,

    First thing I would suggest is plugging in a real sound source and make sure you can capture it. The problem is most likely to do with your mixer settings. You’ll need to make sure your system is set to record from the correct input. Once that works, only then try making it more complicated by trying to capture a logic signal.

    Also remember that you wont be able to capture a DC signal, or even a very low frequency signal, using this method. Most likely the output from your photocell is quasi-DC and you wont be able to see the signal via the AC-coupled soundcard input.

    Good luck!


  7. Hi Steven,

    Thanks for the info

    as you mentioned, since i trigger the cells, i wil be mostly a HIGH signal of an very LOW frequency (< 1Hz) only a LOW will happen when I trigger the sensors 🙁

    maybe, i have to look for an other solution on this matter?


  8. Hi Yves,

    Yes, I think for this application the sound card input isn’t going to work.

    I would suggest using a real digital I/O pin on a Raspberry Pi, or interfacing to a normal PC via a micro-controller.

    Hope that helps.


Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.