I'm building a board controlling external stepper motor drivers that have optoisolators (with integrated resistors, these are meant to be driven with 5V and consume 13mA then) on their inputs. As the external boards are connected via cables that may be accidentally disconnected or shorted, I'd like to verify that there is indeed a LED connected on the other side. The signals are generated from an FPGA, so I have a bit of flexibility in the implementation.

Idea 1: Constant-Current 16-Output LED Driver IC with Fault Detection

This integrates everything in a single package, but it seems all of these ICs need data to be shifted in serially (which reduces the number of I/Os required, but adds complexity in the FPGA design). These seem to detect faults only when the channel is active, which is probably good enough, but could be improved. I'm not sure how well these detect faults if a series resistor is present.

Idea 2: 16-Channel Driver, High-Impedance Current Measurement, Comparators

A driver outputs a 0 or 7V signal, 2V drop in a series resistor, then the voltage is compared to 6V and 4V. Above 6V, the connection appears to be open, below 4V, the connection appears to be shorted. The series resistance protects the driver.

Fairly simple logic, detects faults while the LED is on. Downside is that it requires 48 IO pins on the FPGA and 32 comparators (but banks of comparators should exist) for an error condition that should essentially never happen.

Idea 3: "Open-Collector"

A colleague suggested an open-collector system, where I would run the IO pins essentially in bidirectional mode, and drive either 0V or go high-Z, at which current would flow to the LED through a pull-up resistor, however I still haven't quite understood how I could detect a broken connection this way (shorts are easy: while not pulling down, I can set the IO to input mode and check that it is high). Broken connections are more likely than shorts in the wiring.

Are there simpler approaches how I could control 16 optoisolators and detect wiring faults on the way to them?

  • \$\begingroup\$ What about connecting the LED buffer-driver power supply via a resistor and just shutting the LEDs down if over-loaded, or using current drives for the LED so that shorts do not matter at all? \$\endgroup\$ – skvery Feb 16 '17 at 22:22
  • \$\begingroup\$ I need to actually detect the error condition, because continuing a movement program would be unsafe then, so I need to trigger an emergency stop. \$\endgroup\$ – Simon Richter Feb 16 '17 at 22:31
  • \$\begingroup\$ Which FPGA do you intend to use? \$\endgroup\$ – Bruce Abbott Feb 16 '17 at 23:05
  • \$\begingroup\$ @BruceAbbott, at the moment I have a few Cyclone IV E (EP4CE22E22) and MAX II (EPM2210F324) lying around, and wanted to use the Cyclone IV if possible (because I can get away with fewer than 8 layers then). \$\endgroup\$ – Simon Richter Feb 16 '17 at 23:28
  • \$\begingroup\$ There are tradeoffs between complexity, fault coverage, reliability and cost. What faults did you want to exclude? EMI false triggers, crosstalk, short to 0V short to 5V, short to another signal.? The exact circuit also depends on specs of Opto, for Must switch and "may switch" ( induced current). high speed microstep PWM ? (may be affected by turnoff time), cable type (UTP, ribbon with interleaved gnd, shared 5V bundle etc) and cable capacitance. Also stepper, cogging, skipped step, do you want to detect this too? (motor current sense) \$\endgroup\$ – Tony Stewart Sunnyskyguy EE75 Feb 17 '17 at 1:20


simulate this circuit – Schematic created using CircuitLab

This is the best i could come up with. All the values are aproximate. The udn2987 is an 8 output driver chip with over current protection. Two of these will fill your needs. At the output R1 drops the voltage to 5v before the opto.

Here is the idea. When the opto is connected and off it will drop the voltage at the sense point to low. If the opto is disconnected (open) the sense point will be driven high by R3. If the opto is off and sense is high this is a fault condition.

If there is a short on any channel the udn2987 will assert its fault pin. If the fault pin is asserted then there is a fault.

This way you can drive and sense 16 channels with 34 pins.

The only problem is the udn2987 requires a minimum of 7v. Better ICs may be available.

| improve this answer | |

For a low side switch with a series drop R, you compromise If current somewhat but there is usually lots of margin depending on Opto used.

Hence a series R could measure Vol to the opto Cathode with common Anode to 5V.

But only you can decide how many input ports you want to allocate to sense each output port. It depends how you control the steppers using software state machine, external hardware state machine; half step, full step, or ustep.

  1. You can address the drivers with a 16 port SIPO latched buffer with open collector drivers and do the same for sensing using the analog voltage to the cathode as a CMOS logic level to 16 port PISO with suitable xx usec delay for turn off rise time just using 2 ports for data+Clk and 1 for direction control.

But then a couple SOIC-24 IC's may not fit in your real estate.

  • 3.9~5V floating depending on impedance to ground value. (1M to 1e9)
  • 2.5V HC input threshold
  • 1.5V HCT input threshold
  • 0.5V ~ 11.5 mA output estimated
  • 0V ~ 13 mA output assumed .

2.You could design a more complex circuit as well with parallel inputs/outputs.

3.I suggest your put state detection in the remote MOSFET driver board to determine if the motor is ready for steps in any active rotor position and have a single ready status bit returning. This would determine if stepper coils currents indicate valid phase currents. This needs some XOR logic to ensure alternating open windings to indicate a valid active rotor state.

4.Also you need to use good crosstalk prevention in the cabling if using high impedance modes which means 16 UTP pairs per port with +5V or else use low impedance standard logic drivers to handle 13 mA with Vol<0.5V and no chance of external power before internal driver Vcc is on to prevent latchup.

5.I suggest large CM ferrite chokes around stepper motor cables to reduce radiated noise with motor current transients.


simulate this circuit – Schematic created using CircuitLab

| improve this answer | |
  • \$\begingroup\$ This doesn't allow me to test whether the cable is disconnected while the LED is on -- the test voltage is zero then either way; also, testing the voltage requires a lot of comparators if I want to do it continuously. \$\endgroup\$ – Simon Richter Feb 17 '17 at 20:48
  • \$\begingroup\$ I agree but I suggest the analog voltage for Voh test only satisfies PIO inputs. If self test or start of sequence has no Vih feedback then a fault can be flagged. I think 1 state detection should be adequate for open and simplicity with logic sensing Cathode voltage. such as PISO register \$\endgroup\$ – Tony Stewart Sunnyskyguy EE75 Feb 17 '17 at 20:52

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.