Photomicrosensor (Transmissive) - Omron EE-SJ5

Posted on
  • #optical #photo #sensor #solid #state #switch #photosensor #enstop

    When something moving has to stay within limits, has to 'find zero' on power-on (calibration), or its particular position has to be detected, end stop / zero position detectors are to be used. There are several options:

    1. Mechanical switch
    2. Magnetic switch - reed switch, hall sensor
    3. Optical switch - photo sensor

    I opted for slot-type photo sensor, where LED generated infrared light exits a slot, passes a detection gap, and enters a slot to finally hit a photo transistor.

    I just had them on hand... and very quickly some surprises as well....

    Purple bordered inset in attached image of data sheet (modified page 1) shows my 'final' circuitry. The goal was to run with VCC = 3.3 V in order to not have to worry about pin input 5/3.3V compatibility and extra external components - even though it may be border line for the photo transistor to work.

    The selection of the resistor for the LED was simple... I decided to go first with a 10 [mA] current and related 180 Ohm.

    For the emitter resistor, I picked at first 1 K resistor, but it did not work with intended digitalRead(C4).

    To see what's going on, I switched to analogRead(C4) and added (prallel) ditigalRead(A8). Now I noticed some analog changes, but not enough to make a dent for the digitalRead(): they were in the realm of tens of millivolts... then I started to do some trial and error and testing all (four) sensor.

    I wondered why not better results... and you would not believe what it was: I used a piece of black plastic to interrupt the light flow. The plastic piece is about 1/16" / 1.8mm hick and is the actual lid of the car cassette tape player from where one of the switches was scavenged.
    For no reason I had a (light) dollar bill at hand and put that into the gap instead of the dark plastic piece and it worked! I thought I was smart to use the black, not shiny plastic which to the naked eye did not pass any light what so ever even when held against a bright light source, but obviously let the pass most of the infrared light. I'm now planning to mount a dollar bills on the machinery to enter the gap for zeroing... just kidding ;)

    On top of that, the first sensor I worked with was a failing - or extremely out average - switch (S_4), because the other 3 behaved in acceptable range. S_4 I could get to work by increasing the emitter resistor to 18 K.

    If all sensors had such a marginal delta voltage between on and off as the first one, I would have to add an op-amp as comparator to every sensor - so much about 'no extra external components'.

    I know that more modern devices are available that include amplifiers... but I would first have to order them. After all, my 'instant gratification' with things at hand was not really that 'instant'.

    For now, I hope my 0.4..0.5 [mA] are enough to resist eventual noise that could be picked up by unshielded, 6 feet long cable between the sensor and Espruino.


    1 Attachment

    • EE-SJ5_p1_Omron.png
  • Thanks for the post! It's always hard to find out what's electrical, what's software, and what's actually a physical real-world problem :)

    It's well worth pinging the IR filter off an old webcam and adding a visible light filter to it - it's fascinating what the world looks like in IR (I know a class of Coke looks like lemonade :).

    Also, did you try using the internal pull-downs with pinMode(pin, "input_pulldown")? They're around 40k, but may well be enough to do what you want.

  • Adding an IR-filter helps to increase selectivity, but in the strange situation of the black plastic tab I made sure that no other light entered the sensor...

    Since the analogRead() was parallel only for investigative purpose and was parallel to the planned digitalRead() on a different pin set with "input_pullup", I got a stable line in disconnect state. For final runtime I do not need the "pullup" since the circuitry is clearly
    pulled down by the 5K6 emitter resistor at the sensor - called the load - in off/obstruction state, and pulled up by the transistor's emitter in on/no-obstruction state.

    Just the 30..50K pulldown - as you suggest - seemed not to be enough of a load to the sensor under 3.3V operations conditions for robust operation (do not exactly understand why, but may be it IS the low 3.3V over the CE-R path and the LED driving with 10[mA] only - measurements for data sheet are taken with 5..10[V CE]/100[Ohm] load and 20[mA] light current). I can give it another try to just use a GPIO pin in pull-down input for the load.

    By thinking about noise resistance, I'm now not sure where to place the load resistor: at the sensor 6 feet away, or at the pin... I guess it should be at the pin, then it is system-comparable with a 20...40[mA] loop, just with 0.4..0.5[mA]... on the other hand, voltage difference puts the low with 0.00###[V] and high with 2.###[V] safely away from the digitalRead() switching point, which is about 0.44V, correct?

    Pulldown left 'in parallel' to the 5K6 doesn't make functional difference. For the out-of-regular-tolerance sensor though - which needs a 18K load - 30..50K become significant. But I trashed this sensor anyway because of its Gauss-bell-rim lifestyle... ;-)

  • Yes, I can't totally remember (I'd have to look at the datasheet), but 0.44v for the switching point sounds about right.

  • Post a reply
    • Bold
    • Italics
    • Link
    • Image
    • List
    • Quote
    • code
    • Preview
About

Photomicrosensor (Transmissive) - Omron EE-SJ5

Posted by Avatar for allObjects @allObjects

Actions