-1

I'm running a new psychological experiment that uses an old, non-legacy machine that communicates with a host PC via a parallel cable and physical LPT (DB25). It sends data to 8 data pins to control eight motors, basically turning individual motors on and off for a specific duration.

For extended compatibility and flexibility, I'm trying to find ways to use the machine in a modern computing environment -either on a Mac or latest windows laptops (as the original host laptop is 15 years-old and kind of finicky). Ideally, I'd like to use python to interface with the machine (I wrote the experiment on Python).

As most modern workstations lack LPT, I should somehow emulate a parallel port with a USB port- and this is where I'm kind of stuck.

I did lots of reading on this matter for last two weeks. It seems that there is no obvious way around this, and sending inputs to control individual pins is not possible using a regular USB-to-Parallel converter cable- which only works with printers but not other peripheral devices. Packages such as pyparallel, pyserial, or pyusb don't seem to adequately support such functionality either, although some people here and there who claime that they managed to sort it out (but exactly how- is not clear to me).

Could somebody direct me to any possible solutions? I know that there exists some commercial products that properly emulates a parallel port when connected to a USB slot. But they are rather expensive (<$300). If this experiment were to run on a desktop, I could try PCI extension but everyone in the lab, including myself, will use a laptop so physically installing an additional PCI card isn't really a viable option.

Currently, I'm leaning towards building my own microcontroller such as Arduino that converts serial signals to parallel outputs. Still, I'd be SOOO happy to learn how to get this old machine to work using a "softer" way, with coding and minimum hardware configuration. If such thing is anyway possible.

Can someone help me with this? Any tips or suggestions would be greatly appreciated!!! Thank you!

  • Aliexpress seem to have USB to LTP cables and Pci ports for uder $10. For that price it's worth a try since it can save you hours of implementing something similar on an Arduino. – Sembei Norimaki Feb 22 '23 at 12:49

1 Answers1

0

The easiest way is to use an arduino nano for example, by connecting its digital outputs to the inputs of the parrallele interface by respecting the levels, pullup etc ....

enter image description here

Then create a sketch which receives orders from the serial port, and interprets them to activate the necessary outputs of the parrallele interface. very basic example :

const int D[8] =  {2, 3, 4, 5, 6, 7, 8, 9}; //nano or uno pins connected to LPT output 0-7
String CommandPC = "";
char character;

void setup() {
  Serial.begin(9600);

  // set the digital pin as output:
  for (int i = 0; i < 8; ++i) {
    pinMode(D[i], OUTPUT);
  }
  parallelOutput(0x00); //init output
  Serial.println("OK");
}

void loop() {

  //listening serial
  while (Serial.available()) {
    character = Serial.read();
    CommandPC.concat(character);
    delay (10);
  }

//interpret PC commands
  if (CommandPC == "LEFT") {
    parallelOutput(0x47);
  } else if (CommandPC == "RIGHT") {
    parallelOutput(0x27);
  } //etc....

//aknowledge
  Serial.println("OK");
}

//activate output lines
void parallelOutput(int number) {
  for ( int i = 0; i < 8; ++i) {
    digitalWrite(D[i], number % 2);
    number = number >> 1;
  }
}

Then just send commands to the Nano Serial Port (emulated via USB), via a Python or .net program.

tuyau2poil
  • 767
  • 1
  • 2
  • 7