How to Use Photoelectric Sensor Counter Kit

  • Be sure to checkout “Tips & Tricks”
    Dear Guest Visitor → Once you register and log-in:

    This forum does not automatically send notices of new content. So if, for example, you would like to be notified by mail when Steve posts an update to his blog (or of any other specific activity anywhere else), you need to tell the system what to “Watch” for you. Please checkout the “Tips & Tricks” page for details about that... and other tips!

    /Steve.

rfrazier

Well-known member
Sep 30, 2020
489
143
Hi all. Over in my thread on counting the swings of a clock pendulum:


I mentioned the idea of using a photoelectric sensor and counter kit to do this task. I did have some success as described over there. In the process, I had to learn how to use the sensor and counter kit. I created this thread to pass that info along as some people might be interested in the kit but not necessarily interested in clocks. I'm using this kit from Amazon.

Twidec/6 Digits 0-999999 Customer Traffic Counter 100V-240VAC LED Auto Display Digital People Counter

One big problem is that there are no instructions with the package. There are wiring instructions only, and the sensor says it's an NPN model. But that's all. Further down, I'll link to some instructions from an American automation company that either relate to this sensor or are very similar. There is no housing for the counter and wiring. The wires, including AC power, are just attached to screw terminals. They will most assuredly break, and potentially become dangerous, if you don't add some type of external strain relief or put the whole assembly in an outer box.

The sensor has a green (stability) light, an orange (operation) light, a min / max pot, and a L(ight) / D(ark) pot. Let me see if I can explain how this works.

The green light should be on all the time unless something is wrong. I'm not totally sure what would make it go off.

The orange light should be on whenever the sensor is "triggered". The sensor can be triggered by lightness or darkness. The L / D pot controls this. The orange light comes on when the unit is triggered.

The min / max pot controls sensitivity. See the external links I provide for more detail on how to use that. I have thus far had it on max. Reducing sensitivity may allow operations at closer range when using the reflector panel.

The sensor contains an emitter and a receiver. Presumably, the emitter is always emitting.

The counter module will count UP when the ORANGE light on the sensor comes on.

You can trigger the sensor when something reflective gets near the sensor without the reflector plate, or when something comes between the sensor and the reflector plate. You can trigger the sensor when something enters the beam, or when something leaves the beam. Reflective doesn't have to be a mirror. Any non black object will reflect light. There are 4 permutations.

Trigger upon:

1) Object NEAR sensor, when ENTERING beam - Set sensor for Light mode. Point sensor into empty space. Rotate L / D pot all the way to L. Orange light may start to illuminate. Back off pot until orange light is off. Bring your hand or a non black object near the sensor. It should trigger. The orange light should light up. And the counter should count up.

2) Object NEAR sensor, when LEAVING beam - Set sensor for Dark mode. Point sensor at the reflector panel about 1" away. Rotate L / D pot all the way to D. Orange light may start to illuminate. Back off pot until orange light is off. Remove the reflector panel. Point the sensor into empty space. It should be triggered and the orange light should be on. Bring your hand near the sensor. The trigger should go off and the orange light should go off. When you remove your hand, the sensor should trigger, the orange light should come on, and the counter should count up.

3 Object BETWEEN sensor and reflector plate, when ENTERING beam - Set sensor for Dark mode. Point sensor at the reflector panel about 1" away. Rotate L / D pot all the way to D. Orange light may start to illuminate. Back off pot until orange light is off. Remove the reflector panel. Put the reflector panel about 2' away and point the sensor at it. The orange light should go off. Put your hand between the sensor and the reflector plate NEAR the reflector plate. The sensor should trigger. The orange light should come on and the counter should count up. This will NOT WORK if you hand is too close. Your hand must do more blocking than reflecting. The sensor must see a substantially darker signal with your hand there.

4) Object BETWEEN sensor and reflector plate, when LEAVING beam - Set sensor for Light mode. Point sensor into empty space. Rotate L / D pot all the way to L. Orange light may start to illuminate. Back off pot until orange light is off. Put the reflector panel about 2' away and point the sensor at it. The sensor trigger should go on and the orange light should go on. Put your hand between the sensor and the reflector plate NEAR the reflector plate. The sensor trigger should go off and the orange light should go off. This will NOT WORK if you hand is too close. Your hand must do more blocking than reflecting. The sensor must see a substantially darker signal with your hand there. When you remove your hand from the beam, the sensor should trigger, the orange light should go on, and the counter should count up.

I've found this sensor and counter kit very interesting to play with and it works fine as long as you know how to set it up. Here are the external documents I've found on an American automation site. They are either for this sensor or are very similar.



Hope you find this information useful.

May your bits be stable and your interfaces be fast. :cool: Ron
 
Last edited:

SeanBZA

Well-known member
Oct 1, 2020
75
14
Alright, the output type being NPN means it switches the output line to common ground when active, so active low signal. Otherwise open circuit (or actually clamped via a diode in most cases to the positive supply). The alternative is PNP output, which makes the output positive when active, otherwise it is floating. Other types use different methods, where you get a current limited voltage swing on the output, on a defined steady voltage, used in industry where you also need to know that there is an actual connection still there, and lack of output is not because the cable broke or is disconnected.

Then you run into a whole host of 2 wire sensors, that operate by varying the current in the 2 wires, and they operate off a various number of methods. But not appropriate here. We are dealing with the simple sensors.

Stability is referring to signal level on the detector, this is influenced by ambient light and the flickering light from modern light sources that generate noise, if it lights up other than briefly on transitions you neecd to fix your setup to exclude light. The emitter is a light source, generally these days an IR LED, though I have old ones which use a very under driven 6V filament lamp, and a set of IR filters that allow only IR light to enter the photodetector. The LED typically for the counters is modulated with a very high frequency, so as to make the detector easy to have ambient light rejection, using an amplifier that is AC coupled to reject the slow change in ambient, and a high gain so the signal can be easily detected. Then after the amplifier, which has gain adjustable to set sensitivity, you have a simple AM detector and a comparator, used to recover the signal. This then drives the output stage, to give the output.

Industrial logic is very much modular, you can drive the counter with a simple switch close, or the optical detector, or even use other detector types that give the same signal type. Often over long distances, though there you use line drivers, that are more robust noise wise, or you need to use long shielded cables, which get expensive and hard to route. then the whole other world of EEX rated sensors, for use in explosive environments, that are designed to be safe.
 

rfrazier

Well-known member
Sep 30, 2020
489
143
@SeanBZA You seem to know about these automation systems. I have a question for you (or anyone else). I accidentally discovered a hidden mode in the counter module documented in the clock thread. I accidentally held the reset button too long. It goes into a different mode which presumably allows me to set "something". 3 of the 6 digits go out. The three that remain on allow me to set some kind of setting from 001 to 199. After I leave it be for a few seconds, all 6 digits come back on. I have no idea what it does or even what it was set to initially. I left it set on 001 and the counter still worked the last time I used it. There is no documentation of this feature in the sheet that came with the unit. Googling did me no good at all. I'm guessing that it may be some sort of time delay or hysteresis, but I could be completely wrong. Any ideas what that's doing? All help is appreciated.

May your bits be stable and your interfaces be fast. :cool: Ron
 

SeanBZA

Well-known member
Oct 1, 2020
75
14
Going to guess it is actually a internal setup menu. Yes no information, but there are a lot of clones of this counter, some actually almost like the original, and they are available with many different input configurations. So there is no way to tell, just that they likely change how the input debounces the contact closure, adjusting how long it has to be closed to be considered valid, or it could also be used as a way to preset counting, so that you need either 1-199 counts before incrementing, or the counter will increment that number of counts for each press. Short of buying another, and exploring the option, hard to say.
 
  • Like
Reactions: rfrazier

rfrazier

Well-known member
Sep 30, 2020
489
143
@SeanBZA Thanks for the suggestions. Maybe I'll be able to experiment with it later and determine something. The ideas you proposed sound plausible.

May your bits be stable and your interfaces be fast. :cool: Ron
 
  • Done!
Reactions: SeanBZA