Let's Make Robots!

You may not need an oscilloscope!

Want to see what's going on? Even with "history" and zoom? Make a simple cable, download a free program and..

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:

IMG_6174.JPG

 

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:

IMG_6175.JPG

 

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%201.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%203.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%207.png

- And see:

Billede%202.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%208.png

- and even closer:

Billede%209.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 :)

 

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.

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 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 ;)

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

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 :|

 

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

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 :)

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. :)

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 :)

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 :p

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 :)

 

 

Correct me if I'm wrong, but spaces might have something to do with Frame size? In your case you get 32-bits and then a space, right?

Thinking about it I believe my frame-size assumtation doesnt make sense.  

Got the serial working smothly...Now lays ahead the struggle of integrating it into the realtime DirectX app (=the FUN part) :)

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.