Getting Started


getting started in pc automation and robotic control   Maybe it's just me but I've never liked starting on a long course of dry study with no end in sight and no opportunity to explore and make use of what has already been learned. Because of this the approach that will be taken will be to explain, inform and show by example, each topic covered in enough detail to allow small construction projects to be made at each stage. The key here is to "think small".

 In our first exploration the sole objective is to get the PC to turn on a small external light. It may not seem like such a big task but the range of "know how" that must be brought together is deceptively large for the novice PC user.  For example.... There are the following questions that would naturally spring to mind.....


Which connector on the PC should be used ?
How do I ensure I don't damage my PC ?
What program needs to be running on the PC to turn the light on and off ?
What tools do I need and do I need to be able to solder ?



What Connector Should I Use ?


  Before you can control anything from the PC you first have to establish a connection to it. It is possible to buy dedicated input / output boards to fit into a PC to provide specific types of electrical control capability but that is not the intended way for PC-Control. We prefer to use the standard desktop PC and exploit its existing capabilities to the full. With this in mind the connectors available can be divided into four categories,…


Standard serial port. This is the 9 pin d-type connector typically used for connecting the older style mice. (pinout)


Standard Parallel Port. A 25 pin D-Type connector commonly used for connecting printers and similar devices. (pinout)



Joystick Port. A 15 pin D-Type connector used primarily for Joysticks and MIDI connections. (pinout)



USB Port. Universal Serial Bus. 4 Pin rectangular connector offering the most flexible I/O connection offering a great improvement in ease of use plug and play capabilities. (pinout)





  Although each of these connections can be made to provide simple outputs for controlling simple devices they vary in how easy they are to use. For example, the serial type ports (USB and comms port) need external decoding of the serial information before they can be used to turn electrical devices on and off. For our initial purposes we shall concentrate on the parallel port...
  The parallel (or printer) port gets it’s name from the fact that all of the digital outputs that are available do not need to be decoded by external processing, i.e. they are all presented at the same time “in parallel”. Specifically there are 8 output connections that are set on or off (0volts or 5 volts). The pattern of on/off on these outputs can be set using suitable PC programmes. (examples are given in the software sections)..  Connecting to this port simply requires the use of a matching 25 Way (male) D-Type plug and connecting wires. The simplest and most economical way of achieving this is to purchase a standard printer cable from your local retailer and cut it in half. This gives you two cables each able to control 8 outputs.



How do I protect my PC from accidental damage ?
When making any electrical connection to the PC , even low voltage, you must consider and take precautions against damage. Contrary to popular belief things do not usually go up in a cloud of smoke when damage occurs , but rather just stop working correctly. Fortunately it is relatively easy to protect against this by following a few guidelines.
When making an external cable assembly to connect to the back of the PC, check all connections for short circuits. I.e. make sure adjacent pins do not have any part of their connecting wires touching or, if soldering, that there is no solder overlap bridging the gap. The best way to ensure this is to carry out a final check with a resistance meter (tone tester), or if you don’t have one use a battery and low voltage , low wattage lamp or LED. Always do these checks with the disconnected from the PC.



 -  Double check your pin out diagram or table. It’s no good having perfect connections when they are on the wrong pin.
 -  Double check polarity of power supplies used, battery or other.
When connecting to an inductive load, for example an electric motor or relay coil, consider the reverse voltage spikes that may be produced when switching on and off. For more information on this follow this link.
 -  Make sure the current/power rating of the attached device does not exceed the ratings of the port and/or wires connecting it.
 -  For the ultimate protection use opto-isolation techniques. Opto isolation removes all direct connections between the computer and the controlled device by using intermediate optical coupling devices. Typically these are small components on a circuit board that have a miniature light connection, similar to the infra red port on some PC’s for using a cordless mouse. For more information on opto-isolation follow this link. (opto-isolation)



What Program needs to be running to allow me to turn on and off individual outputs on the printer (parallel) port ?
There is no simple answer to this one. It really depends on what you to do with the port and how flexible you need it to be. To be specific the following points are relevant.
There are a two of distinct techniques for controlling the on/off state of printer port pins.
Writing your own program. Some of you may already be accomplished programmers fluent in C, C++, Basic, Assembler etc…., but have never used that knowledge for real world control. In this case all you need is a suitable driver and perhaps DLL library of utilities to give you complete access. This is the most flexible approach. For such people, you can find a section on this topic by following this link.
Using a proprietary program with it’s own dialog giving a range of control options via menus and control options. In this case it is is relatively easy to “program” the pins since all of the hard work has been done by the program author. However, the flexibility of this approach is restricted to what facilities have been made available within the program. Usually these programs are as easy to use as video recorder programming menus with much the same facilities. I.e. when and for how long to turn an output on or off. Using this approach in your initial stages of control with the PC is highly recommended. Immediate results are easy to achieve and the power and flexibility of some applications make a whole range of interesting control options possible. A basic (get you started) application for this purpose may be downloaded (free) by following this link.



What Tools and equipment do I need ?
  This largely depends on whether or not you are happy and competent soldering. If you already have a soldering iron and know how to use it then you are probably just skimming over this section knowing you already have all the necessary tools etc.. However, we intend to get total novices up and running with control and automation using a PC and we will assume no knowledge of electronics at this stage.
If you feel that soldering is one step too far at this point then the best solution for you is to purchase (from your local retailer, or one of the many online stores) one of the solderless breadboard systems. These are relatively inexpensive and allow quick and easy circuit construction without soldering. As such they are highly recommended. Aim to buy the type that has a 25 way D-Type connector already mounted. As this allows you to immediately connect to the PC parallel port using a standard 25 way printer cable. Beyond this all you really need are a pair of wire cutters/strippers for preparing the wires to “plug into” your breadboard.




LPT1 Pinout    Serial Pinout    USB Pinout


© Copyright 2008