# Analog to Digital PC Signal Interface?

1. Sep 26, 2003

### NeutronStar

First, let me introduce the situation:

I'm an undergraduate physics major taking a course in Experimental Physics. In the lab I am investigating the motion of natural underdampened oscillators. The oscillators under investigation are nothing more than various pieces of metal suspended between two springs in various orientations. The motion will be both free and forced.

An Idea
I need a way to measure and capture the motion so that I can analyze it. I have the idea of attaching a gradient film to the edge of the oscillating object. Then using a laser diode and a photo transistor I can turn the position of the object into an electrical signal. (I am only interested in a single axis of motion at this time). The idea here is that this type of sensor will not affect the motion of the oscillator because it does not physically touch it.

The Problem
I need a way to capture (or record) the electrical signal from the photo transistor so that I can analyze it outside of the lab. I would prefer to capture the electrical analog signal into a computer where I can easily analyze the data. The raw signal is analog and computers are digital so this is the problem.

Constraints
I need to do this cheaply. By cheaply I'm talking in the neighborhood of $10 to$25.

Criteria

The signal can be taken into the computer via the serial or parallel port. Once the signal has been digitized I can write software on the computer to capture and analyze it. The main goal of this design is to simply digitize the analog signal into a digital signal that the computer can read. The analog signal from the sensor can be chosen to be anywhere from a few milivolts to 12 VDC maximum

So my real question here is this:

Does anyone know of a quick and cheap way to digitize an analog signal that can be read by a serial or parallel port on an IBM type PC?

Alternative Solutions

As alternative interface solutions I also have the following equipment available to work with:

An Xess XS-95 CPDL board - complete with a parallel PC interface
An Xess XS-40 FPGA board - complete with a parallel PC interface
A single board 68HC11 microcontroller called a BotBoard - complete with a serial PC interface
A single board 8051 microcontroller from New Micros - complete with a serial PC interface

If anyone can offer suggestions on how I can use any of these devices to solve my interface problem (or has an idea for a single chip design) I would appreciate it very much. I don't have the time to sit down and design a CPLD circuit right now but I could download a prewritten bitcode. I also don't have time to write assembly code for either microcontroller board since I am very rusty at assembly language programming. Perhaps this stuff has already been done elsewhere?

Thanks in advance for any help or suggestions. And my apologies if this post is inappropriate for this topic.

James

P.S. Does anyone know where I can find a supplier of optical gradient film for this project?

2. Sep 28, 2003

Sorry I didn’t see your post sooner, I’m still getting used to the new forum layout here at PF.

Ok, you could convert the analog signal to digital using the ADC0803. It has 8-bit output (DB0-DB7). With 2nbits = 28, this would likely provide a sufficiently small enough Step Size to make this project work (in fact, you might only need to use 4 or 5 rather than them all). If you run this chip in continuous conversion mode, which at the nominal values given for clock frequency (fclk) by National Semiconductor will be 640KHz, then you can save time from experimenting. The Conversion Rate will simply be 1/(Conversion Time) and will be the limit of maximum frequency that can be accurately sampled (which doesn't sound like will be a problem here).
This chip, if I remember correctly, falls within your cost limitations and can get the conversion from analog to digital accomplished without too much trouble. I’ll let you worry about the best way to get the digitized signal into a computer, but

Here is another interesting approach;

Lastly, (and I owe the credit for introducing me to this program from another PF member) you might consider feeding the signal in analog form into a computer sound card where you can manipulate the signal from within the PC, rather than having to manipulate outside the PC first;
http://polly.phys.msu.su/~zeld/oscill.html

The above is a free download in both 16 and 32 bit versions.

Good luck.

3. Sep 28, 2003

### NeutronStar

Thanks BH.

All three of your suggestions are great! That free oscilloscope software that uses the sound card sounds really interesting too. In fact, that might just be the easiest way to get up and running with basically no hardware needed save for the transducer itself! I'll download the package and see how it works.

I still need to find some gradient film for the sensor though. I've been searching all over the Interent and can't seem to find anything. I remember seeing it somewhere in the past so I know that it's out there, I just can't remember where the heck I saw it.

Maybe they call it something else?

It's just a small strip of film that is clear at one end and gradually gets darker until its totally black at the other end. The gradient from clear to black is supposed to be perfectly linear. I think they sell them in different lengths. If anyone knows what I'm talking about maybe you can give me a better name for it? All I can think of is "gradient film" but that doesn't produce much in a search. All I seem to get are movie reviews.

4. Sep 28, 2003

### NeutronStar

WOW!

BH! I had no idea that such a cool oscilloscope was free for the downloading. That thing is fantastic! Dual trace no less! And it even saves the data in a form that can be pasted directly into a spreadsheet. This is awesome! You just saved me a couple weeks of work writing a data capture routine!

Tom was right, - check out alternative solutions! Who would have thought that I could get a dual-trace computer-integrated data-point-generating oscilloscope for FREE!!!

I still need a gradient strip though. But now I'm wondering if I can somehow use sound and a microphone or just a magnet and a microphone? That would even save the trouble of building a transducer! I might be able to get a degree without doing any work at all.

Well, I'll still have to do all the differential analysis of the motion, and that's really what this course is all about. The sensor and data collection is really just a side track.

Thanks! It really pays to ask questions on these forums!

5. Sep 28, 2003

Pretty nifty, true?

I thought you might like that one because it doesn't require so much research, construction, and troubleshooting, which lets you get on with other concerns. Of course, I still enjoy building circuits such as the ADC I first mentioned, but seeing that you’re a student you no doubt have enough to deal with without making things overly time consuming.
I’m afraid I can’t help with the gradient film stuff but then I probably wouldn’t have thought about employing such measures in first place. Seeing how I’ve got an old junky metal detector lying around I’d probably have used that to read the movement with. Maybe something like that could work for this project?

6. Oct 1, 2003

### Integral

Staff Emeritus
Not sure where you are on this project, consider this. What you need is called an encoder, a common type is the vane encoder, essentially you would use a comb rather then the gradient film. Your output from the photo diode would be a square wave caused by the LED passing the teeth of the comb. The period of the wave would be related to your velocity, postition information comes from counting pulses. This would be much easier to calibrate then the gradient film, the draw back would be finding the appropriate tooth spaceing along with a small mass so as not to effect your motion.

You could also simply attempt to mount an LED to the end of your moving piece, you may be able to see intensity variations at the photodiode due simply to a varition in distance.

7. Oct 1, 2003

### NeutronStar

I'm actually just getting started. So far I have downloaded the software oscilloscope that BoulderHead suggested. I've been playing with that for now. I just checked its calibration using precision tuning forks. The scope is amazingly accurate and has fantastic precision. I am also totally in love with the way it creates data that is spreadsheet ready. I'm sold on this software oscilloscope for this project. The 20 kHz bandwidth is more than adequate for this experiment. And the inputs will allow me to look at either analog or digital data.

So Ironically I'm already kind of past the need for an analog to digital conversion.

I still need a way to measure the motion though.

I'm familiar with the type of pulse encoders that you are suggesting. If I were measuring the position of a motor shaft or something that would be my first thought also. But in this experiment the mechanical oscillator will be moving back and forth freely. If I'm counting pulses I need to know which way the thing is moving and when it turns around (which will be very often and very quickly). So it seems to me that I would need a second signal to indicate the direction of movement.

I'm sure that this can be done, but it seems unnecessarily complicated with multiple signals. With a motor this would not be a problem because we generally know which direction a motor is turning, and we don't expect it to change directions without our knowledge. Or if it does change directions we usually have sensors to indicate that.

The pulse idea may be of use though simply because the pulse width would increase near a turning point and decrease near the middle of the oscillation. So it might be feasible to use the pulse method as a stand alone signal. It's worth a shot since it is so easy to set up. I would basically need the same equipment for a pulse encoder as the gradient film, the only difference would by the actual optical object between the light source and photo transistor.

I've been thinking about making my own gradient film by just using a paint program to create the gray gradient, and then printing the result out to a clear plastic overhead film. I could make up some pulse encoders of various sizes whilst I'm printing. Then I can try both methods by simply replacing the encoder films between the optical sensors.

In fact, I'm sure that I'll do this as it will look good on the report that I've tried various methods.

It will be interesting to see how they compare in the final analysis.

I've actually been thinking about this one as well. The biggest problem is that the LED battery would need to ride on the oscillator too, which may not be much of a problem since I can use something almost as small as a watch battery. Not having actually set up the oscillator apparatus yet I'm really not sure what my limitations on mass and/or surface area will be. The only thing that I would like to avoid completely is having any wires or other umbilical cords attached to the oscillator that would cause unwanted damping.

Another consideration with this method is the sideways movement of the oscillating object. The oscillating body is hung freely between two springs. There is no track to hold it perfectly straight. For this reason the light intensity of an LED may give erroneous readings due to its sideways or tilting motions. Both the gradient gray film and the pulse encoder would be much less susceptible to any slight sideways or tilting motions of the oscillating body.

The main purpose of this experiment is to study the damping effects of viscosity and drag on an oscillating body. So I'd like to keep the body as free of any sensors as possible. A small strip of gradient film or bar encoded film attached to the side should not have any serious damping affect on the oscillator so I like both of these ideas.

I've also thought about just bouncing light off of a reflective surface on the oscillator as using in intensity of that to measure the motion. But the sideways and tilting motions of the oscillating body could be a real problem for that method as well.

So far, the lightweight optical film attached to the side of the oscillating body sounds like the best approach thus far.

I have thought about just "listening" to the oscillations by placing a microphone against the frame that supports the oscillator. That might actually work. It won't give me any absolute position measurements, but it might give me the relative amplitude decay that I am ultimately interested in measuring. The biggest problem with this idea is trying to sell it to my professor.

I'm not sure if it would qualify as a "professional" method of "position measurement". It might not even work!

I hope to have an oscillator set up here to start experimenting with by the end of the week.

I do appreciate all input on this topic.

8. Oct 3, 2003

### GENIERE

I don’t know where you could obtain a gradient film but you might try making one. Find a hospital in your area that has a Radiation Oncology or Radiation Therapy Department. They irradiate their cancer patients using a linear accelerator and will have a full time or part time physicist on their staff for treatment planning and quality control. Ask the physicist to expose a sheet of quality control X-ray film to the beam. The film should be placed so the beam enters the film edge-on. You will have a choice of electron or photon beams and different energies of each. The result will not be a linear gradient, so you will have to scan the film to determine its characteristics. A well-equipped physicist should also have a scanner. A film can be exposed and developed in about 3 minutes, so its not a big deal.

Just recalled that cc.1970 I built a sleep apnea monitor that used a sonic auto-focusing module from a Polaroid camera. I resolved motions of less than 1 mm. There must be similar and superior devices available today. Maybe home security web sites would have sensors suitable to your needs.

Last edited by a moderator: Oct 3, 2003