PC based Oscilloscope

This 7th article in the series of “Do It Yourself: Electronics”, guides you to use your laptop as an oscilloscope for 0-5V 100Hz-20kHz range waveforms.

<< Previous Article

Based on his learnings till now and ideas which keeps on coming to his head, Pugs was building some circuit to understand the workings of resistor-inductor-capacitor (RLC) circuits. He had already done similar experiments in his semester lab. But what he wanted to do is all in his room, to be specific without any lab equipment like function generator, CRO, etc. With a function generator, one could straight away generate the required waveform – specifically sine wave of specific frequencies. With CRO, one can straight away see the various specific input / output waveforms, their magnitudes, phase differences. But how to do that without any of those expensive equipment.

Till now he has been using the digital multimeter (DMM) for all kinds of measurements. If it is a known waveform like sine wave, checking its magnitude and frequency is possible using DMM. But how to check phase difference between two such waveforms, or for that matter how to know whether it is really a sine wave or not.

Pugs was lost in all these thoughts with a basic RC circuit in front of him, when his friend Vinay arrived in the Innovation Garage.

“Hey Pugs! What experiment are you planning today?”, questioned Vinay.

No response came from Pugs.

Vinay shook Pugs, “Pugs, where are you?”

“Ya! what happened”, came out Pugs from his lost world.

“What are you doing?”, asked Vinay.

“I was thinking …”, slowly started Pugs.

“Yes that I could see”, interrupted Vinay, “Thinking what?”

“See, I want to measure the phase difference between the input and output of a given circuit. How do I do that?”

“Simple. Use an oscilloscope.”

“Without using any expensive equipment.”

“What are your voltage levels?”

“Say between 0 & 5 volts.”

“Okay, then make your own oscilloscope using your laptop.”

“Oscilloscope using a laptop?”, asked Pugs surprisingly.

“Yes.”

“That would be cool. But how?”

“Think and tell me which interface of your laptop is an analog one.”

Pugs thinks for a while. “Hmmm! Audio may be.”

“Why may be? That’s the one. You’d just need an audio cable and using your audio mic input, you can feed analog input to your laptop.”

“What connections do we need to do? We have 3 lines in an audio cable, right?”

“Yes. Connect the ground to the base of the connector. Other two could be your two inputs – the two channels of stereo.”

“How do I connect to the cable? Do I solder on it?”

“Not really. You may use crocodile clips.”

“Just a doubt. Wouldn’t it have frequency limitations because of the audio card?”

“Yes. It would work only for frequencies in audio range, say 100Hz to 20kHz. What is your requirement?”

“Nothing specific right now. I want to just start playing with RC circuits. Give some input, and compare with the output.”

“In that case, the audio range should be good enough to start with.”

“Okay, hardware-wise understood. I feed the input. But how to view it. Then do I write a program which reads audio input and displays that as a waveform.”

“Yes. But you don’t need to write one. There’s already many software available for it. You may just do a google. Or, may be try the open source software (OSS) called xoscope.”

“Does it come pre-installed?”

“In general not. Just install it using your distro’s installer. Or, you can download the latest source code from http://xoscope.sourceforge.net and build yourself.”

“That I can take care of.”

“Once you run it, select the input as the sound card to make your laptop an oscilloscope. That’s all.”

“Then, we must also be able to generate a sine wave from our audio output?”

“Yes. You are correct.”

“How do we do that?”

“Let’s go for lunch now. We’ll talk about it, later.”

Next Article >>

Note

  1. In general, MIC input voltage is expected to be in the range of around ±10mV and LINE input voltage is expected to be in the range of around ±1V. However, they typically have in-built protection and hence giving voltages upto 5V also doesn’t damage them. However, note that in case the input is beyond the corresponding range, the waveforms would show as saturated to the highest level possible, and one may not get the actual voltage levels.
Anil Kumar Pugalia (123 Posts)

The author is a hobbyist in open source hardware and software, with a passion for mathematics, and philosopher in thoughts. A gold medallist from the Indian Institute of Science, Linux, mathematics and knowledge sharing are few of his passions. He experiments with Linux and embedded systems to share his learnings through his weekend workshops. Learn more about him and his experiments at https://sysplay.in.


   Send article as PDF   

2 thoughts on “PC based Oscilloscope

  1. Pingback: Wearable LED Wristband | Playing with Systems

  2. Pingback: Multi-colour using RGB LED | Playing with Systems

Leave a Reply

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