The audio codecs in most modern PCs are capable of at least 96kbps stereo sampling at 16 bits per sample, with 192kbps/24-bit "HD audio" being relatively common. This is enough to analyze a 38.4kbps UART signal in modest detail (5 samples per bit). With some hardware to connect to the audio input and software to record and view the signal data it is possible to have the functionality of a basic storage oscilloscope and logic analyzer.
What's needed for the hardware is a 3.5mm stereo plug and 3 wires. The largest tab is ground, and the smaller two are the left and right channels. I used 24awg wire from a spool of ethernet cable since its cheap (~10c/ft), and when the ends are stripped it easily plugs into breadboards.
For my testing, I recorded the 2kbps output of a pro mini running VirtualWire. The pro mini is running at 5V, while line input voltages should be ~1V peak, so I used a 100kOhm resistor in series with pin 12 to limit the voltage at the line input.
For recording software, Audacity is probably the most popular free audio program, and one that I tested. Here is a view of one of the output pulses captured at 192kbps:
all signals are summations of sinusoidal waveforms. The straight lines audacity draws between points doesn't reflect that reality, so I tried resampling to a higher frequency (768kbps):
Another program I tested is GoldWave 5.70. I didn't find the interface very intuitive. My first problem was getting it to record at 192kbps. I eventually found the control properties, which indicated the default WASAPI maxed out at 96kbps. Switching to DirectSound allowed me to use 192kbps.
I find the grid makes analyzing the signal easier than with Audacity. I also tested resampling, which is limited to a maximum of 500ksps:
It seems to do a better job at resampling than Audacity.
I also tested Soundcard Oscilloscope. It seems to be limited to 44ksps 16-bit samples and doesn't support viewing of recorded signals. Visual Analyzer allows for analyzing a signal in many different ways, however I could not find a way to record at more than 96ksps.
I'll finish by pointing out that when trying to analyze faster communications, rather than getting a faster scope or analyzer, consider slowing down the transmitter. For example it would not be practical to analyze 230.4kbps serial UART output when logging at 192ksps. However setting the CKDIV8 fuse on an AVR MCU when running the same code would output a 28.8kbps signal, which can easily be captured with a PC audio codec.
Post a Comment