Home and Links
 Your PC and Security
 Server NAS
 DVD making
 Raspberry Pi
 PIC projects
 Other projects
 Next >>
[PC based digital oscilloscope] [The LPT] [Using the Printer Port] [Powering the front-end]

PC based digital oscilloscope

Whilst the PC makes a great waveform display, the problem is how to 'sample' the analogue signal in the first place.

PCI ADC (Analogue to Digital Converter) boards do exist, however these cost 'an arm and a leg'.
What I wanted was something a lot cheaper - and that means using an existing 'data input' path - the simpler the better !

All PC's have USB ports, however accessing these using DIY hardware is a total pain - what I needed was a 'real simple' way to get data into my PC - and that means using the LPT (printer port) or RS232 Serial link


The LPT (Printer Port)

Most PC's have motherboards equipped with an 8 bit I/O port capable of supporting data transfers of up to 2 mega-bytes per second = this is the EPP/ECP Parallel Port (or PRN:, Printer Port). One can be found on almost all motherboards (although modern PC's don't actually 'expose' the Printer Port as a 25way connector on the backplate anymore - instead you have to pick up the interface from a 'header strip' on the motherboard itself (some don't even have pins fitted = instead you have to solder direct to holes in the motherboard))

The LPT port really is the simplest way to get data into the PC - you present 8 bits of data, assert a flag bit to say 'data ready' and wait for a response, 'data taken'. Unlike the RS232 Serial Link, there are no 'start bits', no 'stop bits' and no need to maintain some set/chosen 'baud rate' (data transfer speed)
If you want to know if your PC motherboard actually has a printer port, go into the BIOS and look for 'EPP/ECP Printer Port' in the 'Legacy Devices' tab. Of course just because the BIOS says the port exists, this doesn't mean you can plug anything into it - many OEM's (such as Dell) don't actually bother to fit the 'header', and some don't even track the port pins to a row of 'holes' on the motherboard.

(+) PC Parallel port pin out


Using the Printer Port (see also external link)

The printer connector is/was a 25pin 'D' type socket found on the back of most older PCs (next to the Serial Port, something else that's often omitted these days). Of the 25 pins, 8 are unused (Gnd) and the others 'fed' from/to the CPU via 3 i/o ports.

First we have the 8 bit data (d0-d7) port, then the 5 bit status (s3-s7, normally inputs) and the finally the 4+2bit control port (4 control pins c0-c3, normally outputs, are wired to the 25pin D connector, and two 'mode control' pins, c4 (enable IRQ from ACK) and c5 (enable bi-directional data EPP/ECP mode) are used 'internally').

Originally, the data pins were output only (i.e. the port supported only printing), however the 4 status pins were often used for the 'cunning trick' of reading data 'nibble at a time' - it was even possible to add 4 of the control lines (so long as you used 'open collector' drivers) to the 4 status pins to support byte input (but don't try this if the Printer Port supports bi-directional mode - why ? because then the Control pins become 'outputs' (only) and you risk blowing them !).

WARNING - by default (eg PC power-on) the Printer Port data pins will always be enabled as outputs ! If you plug in your own device designed to 'input' to the Port and allow it to 'enable' on it's own power-on, you can blow the Port (or your own device) !! It is thus VITAL to use PC based software to 'enable' your own device drivers

Although the max data rate supported by the basic printer port was about 125k bytes/s, any motherboard that's less than 10 years old will have an EPP (Enhanced Parallel Port, aka IEEE 1284) or ECP (Extended Capability Port) mode which not only supports both output (for printers) and input (for scanners) but offers data rates exceeding 1 Mbytes/s !

Note that ECP is just EPP with DMA support (usually ISA DMA on channel 3). In theory, EPP can achieve 'up to' 2 Mbytes/s bandwidth, whilst ECP supports 'up to' 2.5 Mbytes/s (the limit of 8-bit ISA DMA) - and this sets a limit on the 'real time' samples per second (sps) that a simple parallel port oscilloscope can achieve.
To support higher 'real time' sps via LPT, some form of compression would have to be used.
Of course a large 'front end' data buffer would allow non-real-time 'snap shots' at much higher sps.

If you can't get access the parallel port on your motherboard, you can buy PCI / PCIe based ECP/EPP Parallel Port cards (rated at 1.5Mbytes/sec or better) on eBay (from China) for less than £5.

For a good explanation on how to drive the Parallel Port, visit here

Whatever the data rate limit, a Parallel Port based DIY project will 'come in' at a fraction of the cost of a dedicated 'digital input' card (let alone the cost of a dedicated analogue input card or a 'commercial' parallel port 'picoscope' (which does, however, incorporate some buffer RAM - typically 32kb))

Note that, unless buffer RAM is used, the max. samples per second (sps) will be divided by the channel count.
So whilst 1 ch might get you >1m sps, 2 will share the 1m sps (so 500k sps each). Even so, this is more than enough when working with audio frequencies (500k sps will define a 20kHz audio tone with 25 sample points which should be more than enough to detect distortion in even the highest audio frequency)


Powering the front-end

On some PC's, you can find +5v on pin17 of the physical DB25 Parallel Port socket. If not, then simplest approach is probably to 'steal' +5v from a spare USB socket.

If you have to open the PC case (to get to the motherboard Parallel Port pins) you can wire your 'pin 17' to any of multiple +5v sources -
- for example, spare USB port 'pin sets' (where you can pick up +5v) or, if you are going to use an external DC-DC converter anyway, +12v from one of the many cooling fan connectors.
If all else fails, you can always pick up +5v from an unused connector off the power-supply cable harness (eg. +5 is on pin 1 of the floppy disk connector - usually a red wire (but watch out = the other end of the plug, pin 4, is +12v (usually a yellow wire)) whilst Gnd can be found on the two center pins (2 & 3, usually black wires)

Note that for maximum 'noise immunity' it's not a bad idea to run the analogue 'front end' from a battery supply - and for this I recommend using a 'Power Bank'

It is (just) possible to align the Power-bank against one side of the case and cut a hole in the end to access to it's micro-USB 'recharge' socket

Next page :- RS232 PC Serial Port use