[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Serial port data question



On Tue, Jan 28, 2003 at 09:18:53PM -0800, Gary Nixon wrote:
> I need to read a voltage that would be delivered to a serial port pin and 
> then push that data up to a server every hour, while having a batch of 
> daily readings emailed once per day. Obviously, some error trapping would 
> need to be employed, and some fault tolerance built in... but, the basic 
> scheme is very straightforward.
> 
> What are your recommendations? Would you recommend one of the available 
> pieces of software that's "out there"? Is there something one of you has 
> written that already covers this ground?
> 
> For the record, my Linux/Unix skills are rusty, but I can probably handle 
> whatever you'd throw at me. This is a personal project and one that does 
> not have a crunching timeline.

Hi Gary,

I assume you need to read an analog voltage, not just a digital one of
0V or 5V or similar.

You can't use a serial port to read a voltage, especially analog ones.
It receives correctly framed serial characters only, using two voltage
levels representing binary digits 0 and 1.

The parallel port is closer, in that you can just read the current state
of the pins (some of them, anyway), but again it's digital and only
reports 0 (0V) or 1 (5V).

I see a couple of solutions:
1. The game (joystick) port has an analog input which is used to read
the position of the joystick. You may be able to scale your analog
voltage into the range expected by the joystick input. You could find
details on the web somewhere, as well as how to program for it.

2. Use an ADC (analog to digital converter) IC, connected up to the
parallel port. There are plenty of suitable chips for low speed
applications at reasonable prices, though you would have to build up a
circuit etc. Programming in Linux for the parallel port is not too hard.


73,
Hamish
-- 
Hamish Moffatt VK3SB <hamish@debian.org> <hamish@cloud.net.au>



Reply to: