You may not need an oscilloscope!

Aparently there are some problems with the images in this one. Since the images are not THAT important for you to get the point, I take the liberty to just direct you to the albom they are in, in case some are missing on your monitor:

http://picasaweb.google.dk/fritslyneborg/SoundrecordingAsDebugging#

Sorry & thanks for understanding ;)


 

Step 1:
Localize your computers audio in. If it has both Mic and Line in, use the Line.

Step 2:
Find a jack or whatever fits into the port, and in the other end find3-4 wires. If you have 4, 2 of them are ground, if you have 3, one is ground, and you need to split that in 2. The other 2 are Left & Right:

 

STEP 3:
At the other end of the wires, make whatever you like; Point is that you will have to be able to hook this up to anything, if you do not want to solder every time you use this tool. I mae up some multi-thingeys that can be plugged / unplugged, and hooked up to anything:

 

Step 4:
Download a soundrecording tool that can show the 2 channels next to each other.

 

That's it!

To use this, plug in the cable to your computer, turn down recording level / put it on Aux / Line, not Mic, no pre-amp.

You can now measure 2 Logic Level signals at once (or just one) and compare them.

 

EXAMPLE ONE

As you may know, it is possible to buy extremely cheap radio recievers and transmitters. Theory is, that you can send serial signals from one Microcontroller to the other, wireless.

i reality, it has often proved very hard to get a steady signal going. Now check this:

On Picaxe, here is first this code used on the sending part:

Billede_2_0.png

I hooked up the cable made as shown above like this: Ground to ground on both units. Data in on reciever, Data out on sender. And this is what I got:

Billede 1.png

Oops - something is wrong!

Signal is send, but nothing is recieved!

Now without the debugging-tool, it could have taken me a long time to find out what was going on. I hate serial for the fact that it is so hard to debug.. well untill now ;)

Ok, I hook up again, fixin all loose connections, recieving is shown on top, sending is shown at the bottom:

Billede 3.png

Oh, the reciever is sending a lot of noise to the Microcontroller at first, so the Microcontroller cannot tell when the serial signal is starting!

Well then, let's modify the code:

Billede 7.png

- And see:

Billede 2.png

Well, from a distance, we can see that the sender is generating noise if left to hang high! Will fix that later, by using other combinations of T/N of the serout.

But first, let's zoom in, and see how the signal on the reciever is now first made steady, so the MCU can understand when to start listening:

Billede 8.png

- and even closer:

Billede 9.png

Bingo!

 


OTHER EXAMPLES:

Now, what I'd like to see is your examples, please send them in below if you have any.

 

If nobody sends in anything, when time, I will try to have a look at:

A: LED shining on..
B: LDR

A: PWM out of an EZ ultrasound
B: Analoge out of an EZ ultrasound

.. and more to come :)

 

hail fritsli did experiments

hail fritsl

i did experiments with audio in too

there are may free software oscilloscopes build to work with audio in of the pc

i used them with success for some time, they can trigger and lock periodic signal and have all feature of a normal oscilloscope…

remember to chop input signal using diodes to prevent overvoltage which can damage audio in

 

the only big problem with this solution is that audio-in are band-pass filter which limit visible signal in the audible band…

anyway the benefit/cost ratio is a division by zero :slight_smile:

Oh yes, thanks, I completely

Oh yes, thanks, I completely forgot in this post; The Software Oscilloscopes… Yes, you are right, if you want an oscilloscope, you can use it like that.

problem with them is, that you cannot do what is done above; History! it would be absolutely impossible to debug and see why the first bit of a signal was not counted for as a serial signal.

No way you could do that with an oscilloscope as far as I know?!

But extremely easy if you sample it.

For more of my reasoning, please see my original blog-posting about this.

right you can use audio in

right you can use audio in for periodic (oscilloscope flavour) or non periodic (data logger flavour) signals …

anyway the fun think is to record and HEAR electic signals in your circuits…

when i was addicted to audio-in data-logging i have recorded many sounds and saved in mp3…

try to hear a I2C bus… it seems a machine-gun conflict :smiley:

the best for me is a mechanical switch that open and close CC motor… it sounds loke a ZOOAP… a sort of UFO engine when it enter in a light-speed jump :D:D

I know - before I got this
I know - before I got this idea, I was only debugging by adding speakers! But even at 600 BAUD it is hard to hear if a bit is missing :wink:

Wow, I’ve thought that

Wow, I’ve thought that something like this might work. It would do well in a pinch definitely!

Now to find a set of headphones the hub won’t cry about if I cut the end off. :stuck_out_tongue:

Now used in real

Now used in real life…

 

Here: https://www.robotshop.com/letsmakerobots/node/5194

Here: https://www.robotshop.com/letsmakerobots/node/5994

 

Free DACs and ADCs
Not only can you use the mic input as an ADC, but you can also use teh speaker output as a DAC as illustrated here.

Audio recording tool
So which software are you guys using for recording?

Hi,I am new to this forum

Hi,

I am new to this forum and also quite new to robotics and electronics.

My question is a bit off-topic , but I wondered wether it is possible to build RF-transmitters / receivers yourself ?

And just like rippa911 i would like to know which software you used.

Thanks

Questions not related to the

Questions not related to the topic should be written in a new topic with a self-explaining name, thanks.

I do not know what SW I used, yesterday I did almost the same as above, and dowloaded another SW, there are a million free SW samplers out there, pick one :slight_smile:

Voltage allowed soundcard

How high is the voltage that is maximum allowed in a soundcard input(mic.)?

 

Thanks

Wow!! Impressive!!

Let me get this straight: I can split a mini jack wire that fits the mic in port on my laptop and send serial data from my arduino into the mic in and use a software oscilloscope for musical use to view the data??

If so that would be PERFECT. I’ve recently found a way to monitor the current draw of my servos as described in the end of this thread. I’ve been using a simple Processing based oscilloscope that performs awfully.

The data looks like this:

scope_100_blue_millis_small.jpg

However there are some REALLY cool software oscilloscopes available that works of the line/mic in port only. For instance the FREE Visual Analyzer.

Do you think this could work? Or does it only work with a simple ON-OFF signal as shown above?

I am not sure about the

I am not sure about the Visual Analyzerm, do not have the time to read into what it does, how it is hooked up.

So, you MAY be able to also read the analouge levels of some sort. Maby you would prefer to use some sort of cheap mixer / pre-amp or something, so that this burns before your laptop’s soundcard do :wink:

My final say is that the method I have “invented” above, only is ment to be analyzing on/off’s for 1-2 channels; The horisontal lines are dancing as if they where drunk, as the different factors kick in. So using just that simple, simple, simple setup that I describe, you can only detect High/low / on/off

Confidence

With confidence, the mic input is an ADC (Analogue to Digital Converter). The resolution is dependant on the sound card. On really old PCs, it might be 8-bit. These days I’d be surprised if it were less than 16-bit. Of course, it’sdesigned for teh audio frequeny range, so the capture rate is likely to be at least 44kHz.

The raw data which goes into it is available to the processor. I haven’t used any commercial or freeware scope packages which make us of it as an input, but I’m a big fan of LabVIEW, which certainly has direct access to the stream of analog values, and there are definitely API calls which allow this.

There’s a good query been raised, though, on the input levels. These are likely to be in millivolts. It’s quite possible (I couldn’t say for definite) that the square inputs you’re seeing are a result of the input being over driven.

Thanks for the reply…

It seems I’ll have to keep searching for a proper SW oscilloscope that works of the serial port.

BUT…I haven’t completely given up on your setup, and I see no reason why it would burn my soundcard if it works for you guys. Basically I’ll be doing the same as you; sending a bunch of 0’s and 1’s (on-off-pulses). The SW will then pack the 0’s and 1’s into bytes and convert it to numeric values.

The Visual Analyzer has digital to analog conversion, and it generally seems like a REALLY cool program. I tested it and it immediately started showing waveforms based on the inbuild microphone in my laptop.

I’m worried about the PRECISION though. As you say the lines are dancing quite a bit. And the whole setup (mine) seems kinda silly when I think about it: Arduino ADC reads analog input, converts it to digital, sends it by serial (digitally) to the mic in which reads it as analog and converts it back to digital. The SW then converts it to analog…

As I said kinda silly :expressionless:

 

Men ellers tak for tippet, Frits. Hehe. Ja jeg er også dansker :slight_smile:

I dont understand why you

I dont understand why you want to send serial data into the mic-in? Isnt the point of this to test to see if a signal is as it’s supposed to be - or to check for noise on a circuit.

Anyhow, I was able to use my mic-in to monitor the high-low’s using Frits’ setup yesterday. Kind of fun to listen to a led blink :slight_smile:

Well…

The reason I wanna do that is because I’ve been searching for a software oscilloscope I can use to display data from my Arduino’s serial port. In my search I found several cool programs BUT they were ALL made for musical purposes, thus they ONLY use the mic/line in. So when I saw this I thought it could solve that problem.

But I don’t think it’ll work either and since there are no scopes around (with acceptabel performance) that work off the com ports I decided to make one. :slight_smile:

So far I made the graphical part and it performs smoothly at 60 FPS. It’s a C++/DirectX application. But I’m having a lot of problems getting the serial connection to work. In Processing you simply write “Serial.Read()” but in C++ it’s ridiculously complicated.

The idea is to be able to TEST my servos (in realtime) to see if I can come up with a way of classifying the current draw patterns in such a way that I (or rather my robot) can make an educated guess about the load/stress of each servo at a given time. This I would call a rudimentary robotic nervious system. Example: if something is blocking the movement of a leg it would sense it and react accordingly.

Besides I thought it would be cool to have a control application on my PC that receives ALL the sensor data (including the servos’ current draw) from my robot and displays it graphically in realtime…

Sorry about the long answer…but hey…you asked :slight_smile:

Thanks for the (long)

Thanks for the (long) answer. Clears it up and your project sure sounds cool.

Took a quick look at the Serial code for the processing ide. It implements the SerialPortEventListener and using the SerialPort interface. So they probably have an easier job then you. Their Serial package was at 500 lines of code including comments. Wich is rather small talking about Java :stuck_out_tongue:

Hi again

Java and C/C++ is quite different so I’m afraid it would only confuse me if I started looking at the code you mention

I started off from scratch again with the serial communication. There are wrappers/API’s that make it simpler but 1st I couldn’t get any of them to compile. So I was doing it the hard way like THIS. BUT…after a few hours struggle installing something called Platform SDK I got THIS wrapper to compile and ~work (after rewriting an example line by line).

Now I’m getting quite consistent data AND most of it looks like it should. But there are still a lot of work to do. I’m currently sending bytes of pure 1’s from Arduino. In hexadecimals: FF. And for some reason I get spaces after every 4th byte: FFFFFFFF FFFFFFFF FFFFFFFF etc…

And then I have to implement it into the DirectX app. But I consider those minor details compared to what I’ve been through :slight_smile: