Electronic Projects, forums and more.

Go Back   Electronic Circuits Projects Diagrams Free > Electronics Forums > Electronic Projects Design/Ideas/Reviews


Electronic Projects Design/Ideas/Reviews Are you building an electronic project or want to? Maybe you need some assistance? Come and submit your electronic questions here and let our experienced members find a solution.

Reply
 
LinkBack Thread Tools Display Modes
Old 13th April 2004, 11:54 PM   (permalink)
Default Interfacing Pots with a PC

I have 3 linear pots that I need to interface with a PC. When I turn a pot, my software should detect it and react accordingly based on the value returned. So far, I haven't had any luck. I'm using the 74HC14 Hex Schmitt Inverter to generate a pulse that my software can detect. The circuit I'm using is attached. I just can't get it to work. I'm using 100k pots and the unmarked caps are 10 uF. I am a novice at electronics, but trying to learn.

Any ideas (or alternative methods)? I have no joystick port and adding one is not a possibility, so rule that one out.

Thanks
Attached Images
File Type: gif 5POT2PC.gif (12.1 KB, 553 views)
Brian is offline  
Old 14th April 2004, 12:46 AM   (permalink)
Default

The circuit you have generates a square wave whose frequency depends on the pot. Windows is really bad at timing things like square wave inputs.

A better way would be to use a I2C AtoD(analog to digital) converter. You can then emulate the I2C bus with your parallel port. There should be lots of examples of how to do this on the web. One leg of the pot goes to +5 and the other goes to ground. The wiper goes to the AtoD input.

Another possibility would be to use rotary encoders. they are simple mechanical switches that output digital codes depending on their position.

Look at Digikey.com to buy components for either method.

Brent
bmcculla is offline  
Old 14th April 2004, 01:17 AM   (permalink)
Default

Actually, rotary encoders were the first things I looked at, but could never get a clear answer about whether they could be connected directly to LPT1 or would require other hardware. So should I be able to connect it to the parallel port directly? I've done parallel programming in the past, so that's not a concern. I simply need a clear signal that tells the current position of the pot.

Also, this is being done on a linux system, not Windows.

Thanks for your help.
Brian is offline  
Old 14th April 2004, 06:56 AM   (permalink)
Default

Quote:
Originally Posted by Brian
Actually, rotary encoders were the first things I looked at, but could never get a clear answer about whether they could be connected directly to LPT1 or would require other hardware. So should I be able to connect it to the parallel port directly? I've done parallel programming in the past, so that's not a concern. I simply need a clear signal that tells the current position of the pot.
Rotary encoders wouldn't work for you, there's no way to tell their current position - with a pot you can alter them when the computers not running, and find there position as soon as it is.

Quote:
Also, this is being done on a linux system, not Windows.
Presumably Linux has the same timing problems as Windows?, basically as a multitasking system you don't usually have 100% control of what it's doing.

You could always use a PIC, something like a 16F876, feed the pots into three of it's A2D converter inputs and feed the results out as RS232. All the analogue parts will be done by the PIC, all the PC has to do is read the serial port and process the data.

I have a PIC tutorial that does this for two inputs, it would be trivial to do it for three!.
__________________
PIC programmer software, and PIC Tutorials at:
http://www.winpicprog.co.uk
Nigel Goodwin is offline  
Old 15th April 2004, 07:06 PM   (permalink)
Default

Linux has the same probelm as Windows as far as timing goes. There are Real-Time versions of Linux that are desinged to do timming sort of stuff but its probably more trouble that its worth. The real-Time version will give each task exactly 1ms (or some simmilar time) before running a new task. This guarantees the time between tasks which lets you time things acurately.

Nigel is right about some rotaty encoders. Some rotary encoders only give you relative position. This means that as you turn them they output a signal that tells you the change in position. If your program is always keeping track of the position then this is no porblem. You wont be able to see any changes when the computer is off. This might not be a problem though. For a voulume control you just have toe computer store the last position before it shuts down. You don't really need to worry about position changes when the computer is off. If position changes are important when the computer is off they do make rotaty encodes that output a binary number that tells you the absolute position of the knob. Both of these types can be connected to the parallel port with a couple of resistors.

Brent
bmcculla is offline  
Reply

Bookmarks

Thread Tools
Display Modes





All times are GMT. The time now is 03:34 AM.


Electronic Circuits  |  Learning Electronics
Powered by vBulletin® Version 3.7.0
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.

eXTReMe Tracker