2018-07-08

Rotacy CNC: Problem with optical input switches

Project history 

  1. Previous project: TravelCNC
  2. previous step: Building a rotacy CNC milling machine
  3. current posting
  4. next step: That damn earthing again
  5. Next project: designing a chain link tool library

The situation:



I'm trying to replace my microswitches as end-stops + homing sensors with an optical sensor for homing. (and keep the mechanical switches as end stops.)

I'm using a TCST2103 photointerruptor.
On the Emiter-side I use a 220 Ohm resistor to my common +5V to limit the current.
On the Detector-output side I use a 10 KOhm pulldown.
Emiter and Detector -inputs are on +5V.
Between the Detector-output and the 10KOhm I get my signal.

I meassured my VCC to be between +4.78V and +4.80V with allother loads connected to it.

The signal goes into an AKZ250 USB motion card that works with MACH3 to run my CNC milling machine.

(The sketch also shows the internal logic from the schematics of the USB board. It uses a TLP521-1 photocoupler, a 330Ohm resistor, the mentioned LED and a 4.7Kohm resistor on each input pin.)

 The problem:

When I hit "reset" in MACH3 with the photointertutor not interrupted, everything is fine. The input-LED on the USB board is off and the diagnostics page in MACH3 says the input is not active (high).

When I interrups the photointerruptor, the input-LED goes off and MACH3 says the input is active (low).

HOWEVER: When  I chease to interrupt the photointerruptor, the LED goes on again BUT MACH3 says the input stays active.
Until I tell MACH3 to reset.

Links:



Update:
I found my 220 Ohm resistor on the (E)mitter side too low.
180Ohm should have been used to reach the nominal 20mA on the emitter LED. 
This way we only get 15mA.

The graph "Fig. 8 - Collector Current vs. Collector Emitter Voltage" in the TCST2103 data sheet shows that this means only about Ic=2mA instead of about 4mA on the (D)etector output side.
(Apparently enough to still light up the red status LED just as bright as the others. These red ones nominally want 16mA but do work with less.)

The TLP521-1 inputs recommends 16mA (max 25mA) but gets 4mA.
This means only 4 instead of more then 10mA on the TLP521-1 output. (The recommend 16mA input would result in 40mA)
So I *guess* from studying just the data sheets, that way too little current get to the digital input that is behind the optocoupler on the AKZ250 USB motion control board.

Update 2:
I found THIS mention and it seems that may pull down resistors may be too large.

Update 3:
Or my 10K pulldown may be too large (correct for 3.3V) for 5V.