Home Articles Photoelectric sensors in practice – recognition of the direction of movement

Photoelectric sensors in practice – recognition of the direction of movement

In a variety of industrial automation applications, two types of sensors are most commonly used: photoelectric and inductive (proximity). Both have their pros and cons that determine their use. For example, if an inductive sensor can detect metallic objects hidden behind an opaque, non-metallic obstacle, then this option is not available for a photoelectric sensor that must "see" the object in some range of light. On the other hand, if we use laser light in such a sensor, the detection range can be very large, reaching several dozen meters. Induction sensors can no longer boast of such a range.
The photoelectric sensor works by measuring the intensity of the light beam emitted by the transmitter, which falls on the photosensitive element of the receiver. Depending on the purpose of the sensor, different types of light are used and the beam is modulated. The most used is with infrared light, invisible to the human eye. Thanks to this detection, it can be carried out in a distracting way, but it also has its drawbacks, as every installer is convinced, for example, a sensor on the door, whose task is to prevent it from closing when a vehicle is in it. That is why laser pointers are often used as accessories during assembly work, making it easy to mutually position the transmitter and receiver. Many photoelectric sensors are equipped with diodes that indicate the status of their work, including the correct cooperation of the transmitter and receiver. Observing these LEDs and their illumination colors facilitates proper sensor installation and determines the status of the output or correctness of the reaction to the object, which is particularly important when the sensitivity is adjustable.
Almost any electronic designer, automation engineer or integrator, because they are the most common users of a photoelectric sensor, will be able to easily assess the requirements of the target application and choose the right type of sensor. Certainly important criteria will be factors such as: the sensor's working environment, ambient temperature, mechanical resistance (and all these factors will affect the choice of housing material, its IP tightness and mounting method), the type of of light in the environment, the purpose of the sensor and the required detection range, available supply voltage or type of output. In some applications, sensor response time can be of great importance, although this is unlikely to be expected for long-range sensors. The type of object or objects detected will also be an extremely important criterion. Some sensors already react when a thin, transparent film is in the beam path between transmitter and receiver. Others require the object to be almost completely opaque.

Still others are equipped with a potentiometer for sensitivity adjustment, thanks to which the response threshold can be precisely set. When choosing a sensor, it is also good to be guided by the brand. For industrial applications or other devices where reliable sensor operation is important, not only for the safety of users, but also for the convenience of using the application, it is worth looking for proven products from well-known manufacturers. For example, if the manufacturer of the sensor is, for example, Panasonic, it can be assumed that a thorough quality control of the sensors has been carried out, and they will work reliably and stably. Let's see how you can get such a sensor up and running in conjunction with any PLC. Although the sample program was made for Siemens LOGO! v8, thanks to the readability of the FBD language without much effort, can be adapted for use on another platform. Having a photoelectric sensor, it is very difficult to recognize the direction of movement of the object. To be able to do this, you must modulate the light beam and use the Doppler effect, or measure the time between pulses of pulses sent towards the object. However, these methods are difficult to implement in practice, they are quite expensive, and not everyone can handle them.

It is much easier to place two sensors next to each other and verify the activation order. Figure 1 shows the principle of this solution. If we use two sensors, let's number them by convention “1” and “2” – “1” will work, and then “2” can indicate the conventional direction of movement to the right, and in reverse order, to the left. However, in order for our algorithm to work reliably and to be able to use it not only to detect the direction of movement, but also, for example, to count objects, we still need to introduce some restrictions. First of all, the object must be moving in front of the sensors for them to work, but it's kind of obvious. Second, the maximum distance between the sensors cannot be greater than the smallest dimensions of the object. Thanks to this, our sensors will work in order, for example: both inactive or “1” on or ”1” and “2” on or “2” on or both inactive Thirdly, the accidental movements of the object that occur between the sensors should not cause a malfunction of the installation. Of course, this is a program and it is impossible to rule out all logical errors, but despite this, you need to carefully check it with the help of a simulator or model installation, testing the algorithm in various situations that can happen in practice. In figure 2 there is an example program in FBD language written in a free environment LOGO! Soft Comfort. If we were to use the LOGO! controller, its input I1 and I2 will have to provide a voltage that represents logic “1”.

If it were LOGO! 24RC, then we would have a voltage in the range 18-24V DC. If we use the version powered by 230V AC, then the logic “1” represents a much higher voltage, but then pay attention to the type and parameters of the sensor output! As mentioned, the voltage from the sensor contacts must be connected to inputs I1 (from sensor “1”) and I2 (from sensor “2”). The program is written in such a way that the direction of movement from I1 to I2 generates a pulse at the output of gate B020, while from I2 to I1 at the output of gate B006. To demonstrate the usability of the sample application, a bidirectional counter (B023) and logic circuit (B021 – XOR gate, B022 – RS flip-flop) are connected to the outputs of both gates. The purpose of the logic circuit is to set the count direction input if “positive” pulses are input (from gate B020) and zero if negative (from gate B006) and to calculate the clock waveform given to the input of count. When setting and resetting the counting direction input, the counter counts up (input set) or down (input zeroed). The Up/Down Counter block in LOGO! has an output set and zeroed according to the conditions set in the meter properties window. If, as in figure 3, we enter “1” in the “On” field, while “0” is left in the “Off” field, the output will be set when the counter value is greater than 0 and zero if it is. 0.
If now from this output we supply the output function block, eg Q1, it is output relay number 1 of the LOGO! 24RC will make contacts when the meter level is greater than 0. In this way, we can quickly and easily build a device that automatically turns lights on and off, counting people entering and leaving the room. The light should come on if someone comes in and go off if everyone goes out.
For more information visit: www.tme.eu/en