1
\$\begingroup\$

I would like to examine the string of data being outputted from an industrial equipment's DB25 connector that is being sent to a printer. I was thinking I need to convert this 25 pin parallel connection to USB type A, which would then be plugged into my PC and then examined using a serial monitor.

My question is what kind of hardware could I use to convert this parallel data to USB?

Do I only need the data 0 - 7 pins and ground pin on the DB25 connector to analyze the data on my PC?

Is there any arduino library out there that could convert this data?

I appreciate any help. This is my first time dealing interfacing a DB25 connector to USB. I've done some research on the parallel communication and seem to have hit a wall.

\$\endgroup\$
  • \$\begingroup\$ There's a clock/latch signal on that connector which you'd use in addition to the D0-7 lines. \$\endgroup\$ – brhans May 31 '17 at 17:34
  • 2
    \$\begingroup\$ Surely an arduino nano could do the whole thing gnd-gnd, 8 data lines + 1 for the strobe, capture the byte then send to serial port - (serial.print). Essentially a parallel in - serial out. Probably about a half dozen lines of code. \$\endgroup\$ – JIm Dearden May 31 '17 at 18:20
  • \$\begingroup\$ Why do you need to snoop the DB25 parallel traffic? \$\endgroup\$ – Ale..chenski Jun 1 '17 at 2:55
  • \$\begingroup\$ Note also that the STRoBe signal can ve very short. In your case you may find that you can use the leading edges of the ACKnowledge or BUSY signal/s the printer replies with instead. Timing is the key to reliably catching those signals and interrupts after a hardware latch are usually used. \$\endgroup\$ – KalleMP Jun 1 '17 at 4:45
  • \$\begingroup\$ Could you please answer the question, why do you need to "examine" DB25 traffic? What do you mean by "examining by a serial monitor? \$\endgroup\$ – Ale..chenski Jun 1 '17 at 15:52
1
\$\begingroup\$

Just parallel plug it into the Arduino. Tap it like the old serial break out box days. Either make yourself a Y cable to repeat the pins to another 9 pin connector, or buy one of these:-

enter image description here

Then you just read the 8 data pins with a Arduino as a port read instruction (say PINC). You may have to play with the wire order to get sensible codes. Then send the byte over the Arduino's USB cable (using Serial.print(byteValue) ) to the PC running terminal emulation software like SCREEN or PuTTY. Try to run the printer at a low speed, say 10 kBaud. The Arduino software is surprisingly simple. I estimate 10 - 15 lines plus a quick interrupt service routine.

You'll find that in order to discriminate one byte from another passing along the cable, you'll also have to access the /STROBE line on pin 1. If you connect this pin to the Arduino as an interrupt, you should be able to read the 8 data bits on every strobe signal.

The old Centronics ports ran fairly slowly so the additional impedance of the Arduino's input ports and Y cable shouldn't load the industrial equipment's printer port. The interface was 5V so get a 5V Arduino to avoid level issues or catastrophic explosion of a 3V one.

Essentially you'd build a logic analyser, which you could also just use if there's one lying around. Mixed signal oscilloscopes are good for this too.

\$\endgroup\$
  • 3
    \$\begingroup\$ Essentially you are advising the OP to build his own logic analyzer. Obviously the analyzer must be wider than just 8 bits, because you would need to monitor STROBE, ACK, and Busy, and more. The strobe can be only 500ns short, so the analyzer must have at least 2MHz sampling rate. Building a logic analyzer (sampling port, converting the data into byte-serial format into some USB class, having USB driver, and writing PC application S/W to get the data in presentable format) would be a challenge. It would be much easier to purchase one, 16CH Saleae-clone for $40 on eBay \$\endgroup\$ – Ale..chenski Jun 1 '17 at 16:23
0
\$\begingroup\$

You don't just "convert" a DB-25 to USB. A DB-25 is just a connector. USB is a set of connectors and a whole protocol. USB is much more complicated. You can't just connect the right pins on the DB-25 to a USB connector and plug it in.

Then there is the question of what protocol is being transferred over this DB25 connector. This might be a old "parallel port" printer interface. In that case, it's 8 data lines with a few control lines. Look up the parallel port spec, then probe around on your 25 lines with a scope and see if it seems to match.

Once you know the protocol, it would probably be easier to sniff the data by programming a microcontroller to do the low level reading, then send the data on via a UART or something. The low level electrical protocol likely has some timing constraints, which will hard, if not impossible, to meet with a PC running user code on a modern operating system.

There are micros with 8 bit parallel interfaces built in. It shouldn't be hard to harness that to read whatever 8 bit parallel interface you have, assuming that is what you have. You may need a little glue logic to get the right polarity strobe and the like, but it shouldn't be too hard.

However, again, the first step is determining what each of the wires do, and what the low level protocol is. Only then can you find or make something to capture the data as it is going by.

\$\endgroup\$
  • \$\begingroup\$ If you find a DB-25 to garden hose adapter you can go this way: DB-25 --> garden hose --> USB \$\endgroup\$ – Curd Feb 5 '18 at 10:51
0
\$\begingroup\$

I've done it a year or two back. I used a Pic32MX. Basically there is a strobe signal that you use to get the 8 bit data from the port - I used this to trigger an interrupt. The data went into a buffer which was eventually written as a file to a USB stick. It worked fine - but be aware that you will need to do some tricky conversion to turn the data into an image.

It worked fine for me, but I used a piece of software called PrintCapture which it seems is no longer available. I am actually now investigating doing the conversion to bitmap on teh PIC, but it means parsing the printer language and writing to an image file, which may take a bit of work. As far as I know there are no FOSS libraries for this (if I am wrong I'd be very interested to know!)

It could also be a nice job for a Raspberry Pi or similar, which has enough IO pins and a lot more memory.

There are quite a few bits of old gear out there that have parallel printer ports so this might be quite an interesting project.

\$\endgroup\$
-4
\$\begingroup\$

It looks like you have an equipment that prints something to a printer via parallel interface, but you can't find any modern printer with this interface anymore, all printers today are USB, right? You can easily find a simple converter from USB port to Parallel Port, but making a transition from Parallel Port to USB host would be a challenging undertakings.

First, you would need a sizable MPU board that is capable of USB host functionality. So something like Raspberry Pi3 at least, that runs a decent OS.

Then you need a software support for USB printer class running on your MPU.

Then you would need to make a 8-bit parallel interface on that MPU emulating Centronics printer port(IEEE1284), to connect it to your old industrial equipment DB25 port, so the equipment will believe that it is printing to some normal printer.

Then you will need to write a software bridge between the two interfaces, parsing Centronics commands and data into API calls to USB Printer Driver.

That's about it. Good luck.

ADDENDUM: It looks like these kind of bridges are commercially available, see this one at Amazon. Here is another almost DIY project, "LPTzUSB".

\$\endgroup\$
  • 2
    \$\begingroup\$ Please re-read the question. It does not require an embedded USB host implementation, rather "convert this 25 pin parallel connection to USB type A, which would then be plugged into my PC and then examined using a serial monitor." - the data sink is a PC, not a printer. \$\endgroup\$ – Chris Stratton Jun 1 '17 at 1:09
  • \$\begingroup\$ @ChrisStratton And why would OP do such a thing as snooping on Centronics traffic? I just did the next logical step, assuming the real problem the OP is facing. The question tag contains "conversion", so I do believe this is the classic XY problem, meta.stackexchange.com/a/66378 \$\endgroup\$ – Ale..chenski Jun 1 '17 at 2:05

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.