Find your password

Datasheets : Optoswitch - Input Unit

What does it do?

There are two types of optoswitch – the slotted optoswitch and the reflective optoswitch. Both are used to detect nearby objects. The slotted optoswitch detects when an object is in the slot. The reflective optoswitch detects when a reflective object is near the optoswitch.

How does it operate?

Optoswitch circuit

Click on the circuit diagram to download a Livewire file of the circuit that you can investigate and add to your own circuit.

An optoswitch consists of an infrared LED and a phototransistor combined in a single package.

The phototransistor is arranged so that it can detect the infrared from the LED.

In the case of the slotted optoswitch the infrared beam travels through a slot. If an object is placed in the slot it blocks the beam.

In the case of the reflective optoswitch the infrared beam is only detected by the phototransistor if it is reflected by an object close to the switch.

In the circuit diagram the resistor R1 is used to limit the current into the LED. The value of 220R is suitable for a power supply of about 5V.

The best value for R2 depends on the ambient lighting conditions. Reducing R2 makes the opto switch less sensitive to ambient light. The value of 100k shown in the circuit diagram is usually appropriate. In the case of the Kingbright KTIR0821DS and Kingbright KTIR0221DS a suitable value for R2 is 1k.

The LED has an anode and a cathode. The phototransistor has an emitter and a collector. It is important that these are correctly connected in the circuit.


In the downloadable Livewire file the circuit symbol is for an ‘opto-isolator’. This has been used because it has the same symbol as an optoswitch (though an opto-isolator is used for a different purpose – eliminating noise in circuits). There is no package in Livewire for an optoswitch.

Possible applications

  • Detecting the number of rotations (or the speed of rotation) of a wheel with a notch in it
  • Detecting when something with white card or aluminium foil attached to it comes near to the sensor

Making

A variety of optosensors are available. Details are given below for four low cost sensors:

  • Kingbright KTIR0611S slotted optoswitch
  • Kingbright KTIR0221S slotted optoswitch
  • Omron EE-SY171 reflective optoswitch
  • Kingbright KTIR0821DS slotted optoswitch

Pin arrangements for two slotted optoswitches. The signal from the slotted optoswitch
is high when an object blocks the beam.

Examples of slotted optoswitches
Kingbright KTIR0221DS. Note that the Anode and Cathode of the LED are marked ‘+’ and ‘E’. The Collector and Emitter of the Darlington pair are marked ‘+’ and ‘D’. Kingbright KTIR0611S. Note the pip on the bottom surface near to the cathode. There is also a diode symbol and a C/E marked on the top surfaces

Pin arrangements for two reflective optoswitches. The signal from the reflective
optoswitch is low when a reflective surface is close to the switch.

Kodenshi SG-2BC. Note the flat side nearer to the collector and cathode. Omron EE-SY171. Note the dot on the top surface next to the anode.

How part of the PCB for a slotted
optoswitch might look

If the Livewire symbol for an opto-isolator is used the default PCB component will be a 6 pin DIL IC. This is not suitable for any of the optoswitches described.

The PCB on the left was produced by changing the package for the ‘optoisolator’ to ‘None’ and adding the necessary pads and tracks for the slotted optoswitch manually.

Testing

Make sure that the signal going out (on the green PCB track) changes from high to low when an object is placed in the slot (for the slotted optoswitch) or a reflective object is nearby (for a reflective optosensor).

Fault finding

If there is a fault, check that:

  • The voltages on the cathode and the emitter are low (0V)
  • The voltage on the anode is about 1.2 to 1.5V
  • The optoswitch has been correctly connected

If there is a fault, check the tracks and solder joints.

Alternatives

  • A microswitch can be used to detect if an object is nearby but this involves physical contact between the switch and the object
  • A reed switch / proximity switch can be used to detect if an object is nearby but this means that a magnet must be attached to the object
  • Separate LEDs and light sensors can be used but this is not as reliable
  • A Hall effect sensor can be used to detect if a magnet is close

Web links

  • Manufacturer’s data sheet for slotted optoswitch Kingbright KTIR0611S – Rapid Order code 58-0942
  • Manufacturer's data sheet for slotted optoswitch Kingbright KT1R0221DS - Rapid Order code 58-0310
  • Manufacturer’s data sheet for reflective optoswitch Omron EE-SY171 – Rapid Order code 58-0956
  • Manufacturer’s data sheet for reflective optoswitch Kingbright KT1R0821DS - Rapid Order code 58-0936

Return to list of datasheets

Go to Top
These are the details: