Lab Probe Alternatives
Posted: Tue Mar 01, 2005 10:46 pm
I spent a few years developing some real cheap resistance lab probes using the game port.
Kids would build their own probes and write their own programs in QBasic to read and calibrate the analog channels of the gameport. I had a $3 connector that adapted the game port to use a phone plug.
By next year all my older computers will be replaced with Dells that have no gameports!!!
So, any hints (software & hardware) on how can I cheaply interface a PC to a variable resistor using a USB or SERIAL port?
I'm commited to this project and will have an answer by this summer or sooner but I'd rather not reinvent the wheel
Posted: Thu Mar 03, 2005 9:06 pm
In terms of simplicity, my suggestion would be an inexpensive microcontroller with an analog to digital converter connected to the serial port. I suspect you could get away with pulling power from the serial port if you are careful about component selection. The following provides some information:
http://www.hut.fi/Misc/Electronics/circ ... power.html
In terms of microcontroller selection there are lots of choices. I like the Atmel AVRs myself. Atmel has several application notes on ADC interfacing. The following is the simplest. I will say that I have never done ADC with the Atmel myself so I don't have personal experience.
http://www.atmel.com/dyn/resources/prod ... OC0942.PDF
For my projects I typically use an existing microcontroller design to do my prototyping before building something dedicated. Though I have not used it, it looks like SFEs AVR-P20 would get you started and the ATTINY2313 is seems like a reasonable choice. (I have used and like the AVR-MT128 but the hardware is much less like something you would end up building.)
Posted: Sun Mar 06, 2005 9:57 am
For one of my own projects I want to read an analog joystick from an AVR microcontroller so I did some experimenting this weekend. Turns out the following seems to work reasonably well:
+5v -- (150k variable resistor) -- 1k -- Microcontroller -- 0.1 uF -- GND
The code merely sets the microcontroller pin to output low for a perod of time, discharging the capacitor. Then, it sets it as an input with the internal pullup disabled. The code counts until the capacitor is charged and the pin reads high.
It appears that with the values listed above, the read time was in the range 0-1ms. I was using a 32khz clock and was getting counts in the 0-27 range. Obviously a faster clock would result more precision.
I had originally tried using the analog comparator, and while it seemed like it was going to work, it requires more components and many AVRs can only sample one input and I needed more for a dual axis joystick. I suspect I could get more precision that way, but I am not sure it is enough to matter.
Based on this experience, I would say that a joystick (probe) to serial adaptor would require only an 8-pin controller, a regulator (to self power) and the required resistor/capacitor for the analog sampling.