driving optocoupler with parallel port

20 May 2019 20:33 #134397 by geertd

Still trying to connect my cnc router table to linuxcnc. I made a lot of progress thanks to the answers to some of my questions on this forum. All axis work, limit/home switches work, speeds and accelerations are ok etc...

Right now, the only missing thing (hardware-wise at least) is the following: I need to connect 4 output pins of my parallel port to 4 optocouplers on my breakout board (the spindle speed on the BoB is adjusted with a 4bit value). The optocoupler IC is a quad PS2801-4. As far as I could see on the breakout board, all anodes of the opto's input LEDs are connected to Vcc with a 150 ohm resistor between Vcc and each of the LED anodes. The cathode side of the LED's go directly to the 4 connector pins of the breakout board.

Connecting the parport output pins directly to those 4 pins on the BoB does not work, the optos stay ON, no matter if I switch them on or off... Am I right in thinking that I should put a pullup resistor between Vcc and my parport outputs ? And that in that case, I should invert those parport output pins (1 to switch the opto OFF and 0 to switch it ON ) ?



Please Log in or Create an account to join the conversation.

20 May 2019 21:41 #134400 by PCW
I suspect the issue is that you have a 3.3V parallel port so when th eoutput is high (3.3V) the OPTO is still on (since it will still have 1.7V of drive)

Probably the easiest way to fix this is to drop the OPTO common anode
voltage from 5V to 3.3V ( 2 diodes in series with the 5V will do this )

Another way would be to put a resistor across the OPTO LED (say 150 ohm) Then the 1.7V in the "off" state across the OPTO LED would get divided by 2 so would not be high enough to light the LED

And yes you need to invert the outputs
The following user(s) said Thank You: geertd

Please Log in or Create an account to join the conversation.

21 May 2019 18:03 #134514 by geertd
Thanks PCW,

Getting closer...... I did as suggested (only had 220 Ohm resistors).
Now the following happens:
The output of the optocouplers goes into a darlington high current array, and the output of this array goes to the VFD that takes the 4 outputs and selects the spindle speed accordingly. There are also 4 leds on the BoB to show which of the 4 lines are activated. As long as I do not connect the VFD to the outputs, this works fine, and the LEDs light according to the status of the for outputs of my parallel port.
But as soon as I connect the VFD to the BoB, weird things happen: selecting only one output on the parallel port makes al the LEDS go on and there seems to be no logic to which leds go on and wich parallel outputs are selected....

You were right in assuming that voltages on my BoB are 5 V but the Parallel Port is 3.3V.
Spindle speed selection works fine when the original controller is connected to the BoB, so there is no issue with the BoB.
I cannot use the suggestion to add those 2 diodes, because that would require modifying the BoB and I want to be able to use it both with LinuxCNC and with the original controller, but I am making a small box to go from the 2 parallel port connectors to the 50pin SCSI of the BoB. This little box already contains 2 Quad Transceivers that translate the parallel port axis step and dir signals to differential lines.

For the spindle signals, I was thinking of adding a quadruple optocoupler in this box, connect the 3.3V parport signals to the input and in that way get 5V signals on the other side of the optocoupler. Would that be a good idea ?


Please Log in or Create an account to join the conversation.

22 May 2019 19:52 - 22 May 2019 20:52 #134603 by geertd

Apparently the 220 ohm resistors were not sufficient (too high). Since I had no 150 ohms at hand, I joined 2 x 220 ohms in parallel, and now speed selection works fine.

Thanks for the help
Last edit: 22 May 2019 20:52 by geertd.

Please Log in or Create an account to join the conversation.

Moderators: cncbasher
Time to create page: 0.083 seconds
Powered by Kunena Forum