Getting IO into/out of a PC


Thread Starter

David R

Hi all. First post and all that jazz, just learning the layout of this site.

I got here from a google search, and found this: thread, which doesn't really conclude.

I am looking to make use of older PC's to control various aspects of a home project (a CHP engine if anyone's interested) but have no idea about how to get digital and analogue information in and out of a PC. I am specifically looking at using a PC, as I can use something like an old Fujitsu Stylistic to get a nice big "Touchscreen HMI", but then can of course network to it and control the system from any other PC, or even over t'internet.

I have read various bit of "just use a USB cable and make an IO board." The actual making of this is the easy bit from my point of view (I am a mechanical, and to some extent, electrical engineer) but I have very limited understanding of electronics, specifically USB protocol and how to interpret USB/Parallel signalling.

Can anyone recommend a good resource to go and read, and then come back with sensible questions, rather than the n00b questions I currently have?

Thanks in advance.

Curt Wuollet

You might google the Linux lab Project for lots of information on using daq cards, etc.

Take a look at the LabJack products, possibly together with whatever level of DAQFactory HMI and scripting software (including a free version you get with the LabJack) is appropriate to your budget and application.
There are lots of inexpensive USB Data Acquisition solutions (DAQ) USB DAQ. I got one back in 2008 for $50 to make a simple little project in college. For example, this company has quite a few options:

However, I reply with a question asking WHY? Modern PLC's are quite powerful, very robust, easy to program, and CHEAP. Check for example. They have all the I/O stuff you need and then you can interface with them via interwebz and all that jazz.

I'm a mechanical guy too, and always hate to throw away old usable equipment, but sometimes old computers are just not worth anything. By the time you deal with all the software problems, driver problems, system crashes,'d be better off to implement a modern PLC (and maybe cheaper).

Also, the computer is consume much more electricity and make more heat.

I've been on a few small scale CHP setups and they are all run by PLC's. Here's a video of one:

James Ingraham

Connecting to the real world is done through the rather generic term of "I/O." There are lots of options, and I've mentioned some of them in previous posts. Here's a few:

Some of the options are rather inexpensive. Some of them are EXTREMELY expensive. (IP67 rated analog IO blocks on Profibus would be several thousand dollars in parts alone.)

However, getting the IO data is not the hard part. The hard part is DOING something with it. Once you've got the data in the PC, what are you going to do? You could write a program in C or Java or Ada or Clojure or whatever. You could use a control package like LabVIEW or CoDeSys. There are so many variations here that it's hard to know where to even start.

As I've said about a billion times, the better data we have about the problem, the better data we can give you back about how to solve it. How much I/O? What type of I/O? How fast? How much money do you have to throw at the problem? How long will the project last? Is it a one-off, are do you want to start making a thousand units a month? Do you know what you want your software to look like? What country are you in? (Location matters more than you might think. If you live in Austin, TX, USA, then you are within National Instruments sphere of influence, and there are literally thousands of people around to help you with LabVIEW, and maybe give you old parts they don't need anymore. If you are in Cote d'Ivoire, that probably won't be the case.)

-James Ingraham
Sage Automation, Inc.

Tallak Tveide

The 'industrial' way would be to use an IO module that for example speaks modbus, and use a PLC og HMI package to interface them. You could do some quite easy scripting with a command like modbus-cli (free open source) or using the modbus library directly (rmodbus, also free open source).

For home automation, you might also want to consider using a Rasberry PI or Beaglebone that has some IO provisions on the board and that allows you to read IO as though they were a file eg.:

# Write output
echo "1" > /sys/class/gpio/gpio4/value

# Read from input
cat /sys/class/gpio/gpio7/value

You could write your system on top of that if it is not too complex. ;-)

marty simmons

You can directly access the 13 or more I/O pins of the PC's legacy 8-bit parallel port using QBASIC, assembly language or C from Borland or Microsoft, or Visual Basic 6.

The simplest direct way to access the external world from a PC is using the input and output statements of QBasic which can read or write directly to the parallel port and its control pins. QBASIC is easily downloaded from the internet.

Marty Simmons

This website doesn't even list a price or a way to buy this device for the device. It probably costs many $100's US and it is not offered for sale.

James Ingraham

Quoting marty simmons: "You can directly access the 13 or more I/O pins of the PC's legacy 8-bit parallel port..."

True, if you have such a beast, which the vast majority of people don't anymore. Even getting an ancient machine at Goodwill will probably cost you more than picking up a USB I/O module from NI for $99, or Hobby Engineering for $72.

"using QBASIC, assembly language or C from Borland or Microsoft, or Visual Basic 6... QBasic can read or write directly to the parallel port and its control pins."

Unfortunately, this won't work on systems with a Windows OS from the last decade or so. Well, you can get to the parallel port from C or VB6 with some effort, but QBasic can't do it at all anymore. Direct writes to ports have been blocked off. This trend is continuing, with the Windows and Mac App Stores, Secure Boot, etc., etc.

For low level playing around, PCs are no longer really viable. Arduino, Raspberry Pi, and similar are the way to go for this kind of thing now. And, thankfully, you can use Python instead of QBasic.

-James Ingraham
Sage Automation, Inc.
Some Extremely interesting replys from people, and thanks for everyone's comments.

I have since found some interesting USB-I/O solutions, including one that pretends to be a USB storage device, and edits the contents of files on the "storage" for the PC to pick up.

As people have mentioned, the main issue seems to be how to make use of the information once it has been gotten into the PC, and how to process it and make outputs happen based on inputs and logic. I may have to look closer at Arduino or similar systems, as they do seem to be the way to go for smaller projects such as this.

Should I be looking at software BEFORE hardware here?