PDA

View Full Version : A->D converter?


VanWEric
05-19-2002, 09:00 AM
I know this is a little bit off topic, but heregoes:

I am attempting to write a program (in C++ hopefully, but i also know PBASIC, and can learn others) that will sample a voltage coming in from a displacement sensor and use that information to tell a motor how far to push. In other words, i need it to push a little bit for a small displacement and a lotta bit for a big displacement. To find out how far i need to push i am going to have it pass/fail its own attempts by seeing how far the sensor is now pushed, and do a regression on it to make it "learn". What i need now is a way to get a powerful enough processor to do the math, and the ability to read the data. BTW - the voltages are approx -10 to 10volts

THanks

Lloyd Burns
05-19-2002, 10:12 PM
It matters little what language you use, but measuring voltages is something to do in hardware.

As I see it, your biggest problem is a voltage that goes minus. If you know how, or know someone who knows how, to make an op-amp take the voltage and make it 0-5 V (ie +2.5 V +/- 2.5 V), you could use a Basic Stamp and an ADC0831 A to D Converter. National Semiconductor used to make this little wonder, and Yahoo ought to get the data sheet for you. (The complete sheet is 550K on my HD.) Read it to find out about successive approximation ADC.

Many processors have a pin or 2 to some power of analog (ADC) input, and are very quick at the approximations, sometimes doing it in the background, with no help from your program.

I have to wonder what you are using to sense distance - I programmed a PIC 12C508 to drive a 40 kz (ultrasound) transducer, and give me the distace in mm, from 15 cm out to 1 m, resolving 1 mm quite accurately, and I got a machine-readable output. It would easily read out to 3 m, but that is a matter of waiting. I had to tweak the processor speed just a fraction to get mm counts.

If you would like to discuss ADC or distance measurement further, I'm reachable.

VanWEric
05-21-2002, 06:04 PM
the displacement sensor is some kind of transducer -- i can't remember esactly what it is called, but i do remember that it was a transducer, it was linearized, and that it had a tiny pin that you push in or out to get a reading. I can get current or volts (the device inbetween changes it to volts and makes the reading displacement rather than velocity. something about the capacitors in the device store the charge )

I really need more computing power than a basic stamp. I will be doing statistical analyses on the data i read, and the amount of data i wish to pull will fill the stamps eeprom shamefully fast. How might i get the data into a c++ or other computer app?


sorry about the lack of clarity, but i really can not remember the exact devices, i only understand their function and how to use them

thanks
Eric VanWyk

Lloyd Burns
05-22-2002, 06:00 AM
I needed to look at the voltage input to a DC motor speed controller recently, so I hooked up an opto-isolated A-to-D converter and drove it from the printer port of a 1985 (10Mhz, 80C88, 640 k) Zenith laptop I have for the purposes. I programmed in Turbo Pascal 4.0, over DOS 3.3.

To get data in, Windows needs a .dll to allow your program exclusive access to inputs (and/or outputs), which you can then retreive in your program. Someday, I'm gotta learn to write some of those. Another way is to use an embedded computer to write data to compatible disks which C/C++ can suck in.

You could also convert your number data to numberpad keystrokes (and carriage return / linefeeds) and feed them directly into a commercial program on whatever machine you have.

Matt Reiland
05-22-2002, 07:42 AM
Sounds like a job for the StangSense program team 111 used to read analog then sent back real time through our dashboard to a palm or similar product. Check their website they put up the schematic in the chairmans award or contact them directly

It might work for your application