A sound card oscilloscope tour
PLJack
Posts: 398
I have been reading about sound card oscilloscopes lately.
So I thought I would give one a shot and post my results here for the benefit of the Parallax forums.
Let it be known that all I know about oscilloscopes I learned in the last hour.
The Hardware:
Could not be simpler. Take a cheap microphone designed to plug into a sound card.
I had one lying around. Snip off the microphone. Most likely the cable will have a plastic coated center conductor with copper strands wrapped around it. Snip off the copper strands. Remove plastic from center wire. Attach a 100K ohm resistor to it. Attach the other end of the resistor to your probe.
Very simple.
The Software:
I downloaded two free programs. The first one s**ks. So I will be using BIP Electronics Lab Oscilloscope - 3.0
The knobs to pay attention to are TIME/DIV and VOLT/DIV. These will tell you the grid spacing.
So in the picture above the grid is 10ms wide by 1 volt tall.
10 x 1ms = 10ms.
1v x 1v = 1v.
Get it?
The SX/B Code:
Just some code to test with. Listed at bottom of this article.
Probe connected to RB0.
Fig.1 [noparse][[/noparse]100ms]
Here is a 100ms off / on pulse.
Grid is 50ms by 1volt.
LED blinks nicely.
Fig.2 [noparse][[/noparse]10ms]
Here is a 10ms off / on pulse.
Grid is 10ms by 1volt.
From here on the LED blinks to fast to notice.
Fig.3 [noparse][[/noparse]1ms]
Here is a 1ms off / on pulse.
Grid is 1ms by 1volt.
Fig.4 [noparse][[/noparse]250us]
Here is a 250us off / on pulse.
Grid is 500us by 1volt.
Fig.5 [noparse][[/noparse]100us]
Here is a 100us off / on pulse.
Grid is 100us by 1volt.
Fig.6 [noparse][[/noparse]50us]
Here is a 50us off / on pulse.
Grid is 50us by 1volt.
Fig.7 [noparse][[/noparse]20us]
Here is a 20us off / on pulse.
Grid is 50us by 1volt.
As you can see things are starting to fall apart.
Anything under 20us and there is no signal at all.
Fig.8 [noparse][[/noparse]1_4ms]
Here is a 4ms off / 1ms on pulse.
Grid is 5ms by 1volt.
[noparse][[/noparse]1_4ms.gif]
Enough!!
Lets measure something.
I have been working on IR stuff, hence the interest in oscilloscopes.
So I have collected a few IR remotes.
Fig.9 [noparse][[/noparse]ir_1]
Here is the CHDown button on a really old remote.
Grid is 5000us by 1volt.
Fig.10 [noparse][[/noparse]ir_2]
Here is the CHDown button of a newer one.
Grid is 5000us by 1volt.
Fig.11 [noparse][[/noparse]ir_3]
Here is the CHDown button of a Comcast Remote.
I would say it is not up to the task. I have no idea what that is.
Grid is 5000us by 1volt.
Fig.12 [noparse][[/noparse]SXKey]
And here is the SX-Key Osc2 pin while Debug is in Walk mode.
Notice the three groups.
If you Step through the code you can see one group at a time.
All in all a fun exercise.
There are problems with a free oscilloscope of course.
The trigger function leaves allot to be desired. At no time during this exercise was I
able to get the graph to stand still. It was always moving left or right.
In other words the values are hard to measure because they never stand still in reference to the grid.
But compared to what I had before, nothing, I'll take it.
In most of the LED experiments above you would not know the voltage was pulsing unless you put the probe to it.
That is very useful information for a free tool.
It may be hard to measure the "precise" values, but you can certainly see what is going on.
The mouse dial / button thing is a pain. There seems to be no way via the keyboard to control them.
No fun if your holding a probe in one hand and using the mouse in the other.
If you have no way of measuring voltage patterns then start snipping microphones.
Can't beat the price.
Code Listing:
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
- - - PLJack - - -
Perfection in design is not achieved when there is nothing left to add.
It is achieved when there is nothing left to take away.
Post Edited (PLJack) : 7/10/2005 2:02:29 AM GMT
So I thought I would give one a shot and post my results here for the benefit of the Parallax forums.
Let it be known that all I know about oscilloscopes I learned in the last hour.
The Hardware:
Could not be simpler. Take a cheap microphone designed to plug into a sound card.
I had one lying around. Snip off the microphone. Most likely the cable will have a plastic coated center conductor with copper strands wrapped around it. Snip off the copper strands. Remove plastic from center wire. Attach a 100K ohm resistor to it. Attach the other end of the resistor to your probe.
Very simple.
The Software:
I downloaded two free programs. The first one s**ks. So I will be using BIP Electronics Lab Oscilloscope - 3.0
The knobs to pay attention to are TIME/DIV and VOLT/DIV. These will tell you the grid spacing.
So in the picture above the grid is 10ms wide by 1 volt tall.
10 x 1ms = 10ms.
1v x 1v = 1v.
Get it?
The SX/B Code:
Just some code to test with. Listed at bottom of this article.
Probe connected to RB0.
Fig.1 [noparse][[/noparse]100ms]
Here is a 100ms off / on pulse.
Grid is 50ms by 1volt.
LED blinks nicely.
Fig.2 [noparse][[/noparse]10ms]
Here is a 10ms off / on pulse.
Grid is 10ms by 1volt.
From here on the LED blinks to fast to notice.
Fig.3 [noparse][[/noparse]1ms]
Here is a 1ms off / on pulse.
Grid is 1ms by 1volt.
Fig.4 [noparse][[/noparse]250us]
Here is a 250us off / on pulse.
Grid is 500us by 1volt.
Fig.5 [noparse][[/noparse]100us]
Here is a 100us off / on pulse.
Grid is 100us by 1volt.
Fig.6 [noparse][[/noparse]50us]
Here is a 50us off / on pulse.
Grid is 50us by 1volt.
Fig.7 [noparse][[/noparse]20us]
Here is a 20us off / on pulse.
Grid is 50us by 1volt.
As you can see things are starting to fall apart.
Anything under 20us and there is no signal at all.
Fig.8 [noparse][[/noparse]1_4ms]
Here is a 4ms off / 1ms on pulse.
Grid is 5ms by 1volt.
[noparse][[/noparse]1_4ms.gif]
Enough!!
Lets measure something.
I have been working on IR stuff, hence the interest in oscilloscopes.
So I have collected a few IR remotes.
Fig.9 [noparse][[/noparse]ir_1]
Here is the CHDown button on a really old remote.
Grid is 5000us by 1volt.
Fig.10 [noparse][[/noparse]ir_2]
Here is the CHDown button of a newer one.
Grid is 5000us by 1volt.
Fig.11 [noparse][[/noparse]ir_3]
Here is the CHDown button of a Comcast Remote.
I would say it is not up to the task. I have no idea what that is.
Grid is 5000us by 1volt.
Fig.12 [noparse][[/noparse]SXKey]
And here is the SX-Key Osc2 pin while Debug is in Walk mode.
Notice the three groups.
If you Step through the code you can see one group at a time.
All in all a fun exercise.
There are problems with a free oscilloscope of course.
The trigger function leaves allot to be desired. At no time during this exercise was I
able to get the graph to stand still. It was always moving left or right.
In other words the values are hard to measure because they never stand still in reference to the grid.
But compared to what I had before, nothing, I'll take it.
In most of the LED experiments above you would not know the voltage was pulsing unless you put the probe to it.
That is very useful information for a free tool.
It may be hard to measure the "precise" values, but you can certainly see what is going on.
The mouse dial / button thing is a pain. There seems to be no way via the keyboard to control them.
No fun if your holding a probe in one hand and using the mouse in the other.
If you have no way of measuring voltage patterns then start snipping microphones.
Can't beat the price.
Code Listing:
' ------------------------------------------------------------------------- ' Device Settings ' ------------------------------------------------------------------------- DEVICE SX28, OSC4MHZ, TURBO, STACKX, OPTIONX FREQ 4_000_000 ' ------------------------------------------------------------------------- ' IO Pins ' ------------------------------------------------------------------------- LED VAR RB.0 ' LED pin Run VAR byte ' Item to run OnDelay VAR byte ' time LED is on OffDelay VAR byte ' time LED is off ' ------------------------------------------------------------------------- ' Constants ' ------------------------------------------------------------------------- C_D100ms CON 0 C_D10ms CON 1 C_D1ms CON 2 C_D250us CON 3 C_D100us CON 4 C_D50us CON 5 C_D20us CON 6 C_D1_4ms CON 7 ' ========================================================================= PROGRAM Start ' ========================================================================= ' ------------------------------------------------------------------------- ' Subroutine Declarations ' ------------------------------------------------------------------------- msDelay SUB usDelay SUB D100ms SUB D10ms SUB D1ms SUB D250us SUB D100us SUB D50us SUB D20us SUB D1_4ms SUB ' ------------------------------------------------------------------------- ' Program Code ' ------------------------------------------------------------------------- Start: Run = C_D100ms ' Run = C_D10ms ' Run = C_D1ms ' Run = C_D250us ' Run = C_D100us ' Run = C_D50us ' Run = C_D20us ' Run = C_D1_4ms BRANCH Run, D100ms, D10ms, D1ms, D250us, D100us , D50us ,D20us, D1_4ms GOTO Start ' ________________________________________________________________________ msDelay: msTop: LOW LED ' turn LED off pause OffDelay HIGH LED ' turn LED on pause OnDelay GOTO msTop ' ________________________________________________________________________ usDelay: usTop: HIGH LED ' turn LED on pauseus OnDelay LOW LED ' turn LED off pauseus OffDelay GOTO usTop ' ________________________________________________________________________ D100ms: OnDelay = 100 OffDelay = 100 GOTO msDelay ' ________________________________________________________________________ D10ms: OnDelay = 10 OffDelay = 10 GOTO msDelay ' ________________________________________________________________________ D1ms: OnDelay = 1 OffDelay = 1 GOTO msDelay ' ________________________________________________________________________ D250us: OnDelay = 250 OffDelay = 250 GOTO usDelay ' ________________________________________________________________________ D100us: OnDelay = 100 OffDelay = 100 GOTO usDelay ' ________________________________________________________________________ D50us: OnDelay = 50 OffDelay = 50 GOTO usDelay ' ________________________________________________________________________ D20us: OnDelay = 20 OffDelay = 20 GOTO usDelay ' ________________________________________________________________________ D1_4ms: OnDelay = 1 OffDelay = 4 GOTO msDelay
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
- - - PLJack - - -
Perfection in design is not achieved when there is nothing left to add.
It is achieved when there is nothing left to take away.
Post Edited (PLJack) : 7/10/2005 2:02:29 AM GMT
Comments
Virtins Sound Card Instrument
www.virtins.com
The improvements are:
Adjustable window! None of the other apps allowed this. Runs great full screen.
Able to start / stop the osc with the keyboard. Same for most controls. Very nice.
The trigger actually works. Visually adjustable by viewing tick on chart.
Two cross hair cursors for easy measurement. In other words the graph on the chart is not really needed.
When zoomed in (scale) you can pan back and forth to view the whole signal capture.
Very happy with it. Although if you start changing items while in constant scan mode it has locked up a few times.
I found keeping it in single shot mode and just performing a long scan works best.
You can always pan and zoom to the part that needs inspecting.
For the images below I switched from the internal SX clock to an external 4Mhz clock.
As you can see the new SOC is very accurate. I went down as far as 100us and I could measure it within a 3us.
[noparse][[/noparse]1ms ON / OFF Pulse]
[noparse][[/noparse]1ms ON / 4ms OFF Pulse]
[noparse][[/noparse]50us ON / OFF Pulse]
[noparse][[/noparse]Old IR Remote Down key Pulse]
Anyone care to explain what I am looking at here.
It looks like a bunch of one's and zeros.
But the probe is connected to an IR photo transistor not a an IR decoder.
I expected to see a bunch of ~ 90us pulses lasting X-ms separated by zero voltages.
The scope can read an 80us signal OK so I guess I dont get it. Hmm.....
The pulse patterns are ~34.4ms apart.
There are two ~3.6 pulses before each one.
The short +1.0v spikes are ALL ~900us from zero
The long +1.0v spikes are ALL ~2.5ms from zero
Looks like 1's and 0's to me.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
- - - PLJack - - -
Perfection in design is not achieved when there is nothing left to add.
It is achieved when there is nothing left to take away.
Post Edited (PLJack) : 7/10/2005 8:19:49 PM GMT
Same remote, same button.
It is the SAME as the above IR image. Only upside down because the decoder is normally high.
So, is the SOC too slow to detect the rapid rising and falling of the IR photo transistor?
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
- - - PLJack - - -
Perfection in design is not achieved when there is nothing left to add.
It is achieved when there is nothing left to take away.
So you need a scope with 80 Khz rate to capture it. This is probably too much for your scope ?
However the capture from the IR decoder should run fine. I don't understand why your picture is the same no matter you use the decoder or the IR raw·receiver.
I have performed this test many times with my scope and yes, when there is no decoder the signal is a chunk of carrier signal followed by zero signals.
The decoder gives·the same signal without the carrier. That is it gives high(or low, depending on the specific decoder)·when carrier is detected and the inverse when carrier is not detected.
So the difference seen when using a scope between a raw IR led and an IR decoder is that you can see the carrier or not. Otherwise the envelope of the signal·is the same.
Although sound card oscilloscopes are limited I have found it to be a very useful tool.
Even though it is too slow to read a 50Hz signal my IR project has progressed in leaps and bounds just by being able to visualize what kind of signal is coming out of the pins.
A unexpected benefit is being able to "hear" signals. One can tell allot about what a voltage is doing just by listening to it. If there is no noise then it is a steady voltage. Assuming its not a super fast frequency. You might want to use your dog for diagnostics in that case.
I'm a technician in real life so I don't really care if I fry my sound card / computer.
For those of you that are a little squeamish about the prospect there are probe circuits that can protect your equipment.
If you want to dabble in micro-controllers and don't have an oscilloscope I highly recommend this approach.
Jack
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
- - - PLJack - - -
Perfection in design is not achieved when there is nothing left to add.
It is achieved when there is nothing left to take away.
Is this something you buy or build? If you buy, can you tell me where I can get one. If you build, can you post a schematic. I would love to play with one of these, but don't want to chance destroying my laptop.
Thanks,
Steve
From www.virtins.com/:
In order to prevent the sound card from excessive input voltage, the following limiter circuit can be added. The two Silicon diodes will clamp the input voltage at about 2 ´ 0.65 = 1.3 (V). If the sound card A/D conversion range is affected, one more Silicon diode can be added in series to clamp the input voltage at about 3 ´ 0.65 = 1.95 (V) instead. The protection is limited to ± 50 V maximum (also depending on the resister's value and maximum allowable current and the diode's maximum allowable current). If the amplitude of the signal to be measured exceeds the acceptable range of the sound card, it must be attenuated before connecting.
More information at the above website.
Jack
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
- - - PLJack - - -
Perfection in design is not achieved when there is nothing left to add.
It is achieved when there is nothing left to take away.