Quick Optical Sensor Question

I was playing around with an optical sensor today and am curious why they require two digital inputs. When I hooked one up today and observed its behavior, I noticed that when a reflection was detected the two values of the inputs were swapped (the 1 became a 0 and the 0 became a 1). I could not get only one value to change at a time nor both the values to become equal. It seems to me that the use of two sensor inputs is a waste if this is the case. Can anybody confirm that this behavior is what is expected? If not, could you please explain how to elicit a different reaction?

Thanks in advance,
Greg Szorc

Not sure but it could be a way of letting one sensor work for either folks that want a 0 or folks that want a 1 when they see a desired signal.

It may sound like a trivial thing but there is a lot of legacy code in industrial automation. In order to keep from making 2 different models of sensors (and from plants around the country from having to stock 2 different sensors in their parts cribs), they could offer one an have it work with either normally ON or normally OFF controllers.

Just a thought.

Joe J.

If you look at the documentation appendix g on page g-12, there is a diagram at the top of the page that gives the logic of the sensor. It was intended for positive or negative logic and outputs both a positive and negative signal so the user can choose whichever meets the needs of the system. The bottom line is that the outputs will always be opposite unless your sensor is broken. You are correct in saying that it wastes a digital input but only if you’ve reprogrammed the controller. The way it is set up for the default program, and the example of pins 15 and 16 there is an assumption that the condition of the sensor either disables relay 2’s forward bias of the voltage or reverse voltage bias of the voltage depending on the state of the sensor. This assumes that you will always want to disable one condition and allow the other. Reprogramming the controller would be necessary to allow disabling relay 2 for either forward or backwards bias OR enabling forward AND reverse biasing at the same time.
OK, final point, referring to the diagram on g-12. The reason for connecting both outputs…if the outputs have little output resistance, you risk shorting the power supply to ground which means your sensor becomes an odd shaped fuse and burns out. However, you’ve asked a good question and it’s probably one that you could forward to F.I.R.S.T… just be sure to insulate the unused output.

Me and Stephen(srawls) fooled around with the sensor today and found out that one output is given for sensed and one for unsensed, but they are both the same polarity. It seemed to me that it was done this way to replace an old fashioned switch. It might harken back to the days before people had fancy programs. In fact it would seem one could just put it right into an electrical circuit without any sort of PIC to read the output, and just use the output to drive a relay of some sort. Of course I am not an electrical engineer so I might be wrong.

This is what we observed this afternoon
blue -vdc ground
black +vdc when sensed
white +vdc when nothing sensed
brown +vdc input

Thanks for the information.

Greg Szorc

Specs on sensor say:
Off-State leakage current: less than 50 uA @30V
On-State Saturation Voltage: less than 1V @10 mA, less than 1.5V @ 100mA

When you played around with the sensor,
do you recall what the actual voltage produced was
that goes into the digital input on the robot controller?

e.g. If I supplied 12 V power to the sensor…
For ON position, is voltage at output 5V or 0V ?
For OFF position, is voltage at output 5V or 0V ?

Do you know if these Banner Sensors, can detect a analog
signal, something that ranges between 0 and 5 V?

Anyone try it out?

FYI.

no these sensors cannot read analog in any way. Tere are 2 outputs. one is active when white is detected and the other is active when black is detected. if u only want to use one input then either jut insulate the other or tie it to ground through a resister.

thanks for the quick response.
I understand, it is a “switch” type sensor.

Since from the schematics from first says
connect black wire to Switch3 and white wire
to Switch4. This means 12 V goes to Switch3,
and then 0 Volts goes to Switch4 (On State). The 12V,
goes directly to the digital input…

Does this short circuit or cause problems to the
robot control (digital input)?

I read from the Innovation’s RC Reference Guide, says…

“Digital Inputs are “looking” only for ground signals
to become “active”… Do not connect positive voltage
to any switch or digital input pin, only ground”

Thanks for your advice!!

So, are those all the specs and stuff for the bannersensors? :confused: :confused: :confused: :confused:

*Originally posted by crazycliffy *
**I read from the Innovation’s RC Reference Guide, says…

“Digital Inputs are “looking” only for ground signals
to become “active”… Do not connect positive voltage
to any switch or digital input pin, only ground”**

If you look at the schematic on FIRST’s parts spec sheet page (the leftmost NPN version), you will see that one, and only one, of white and black will be connected to ground. This comports with IFI’s statement that “Digital Inputs are ‘looking’ only for ground signals to become ‘active’.”

THink of it this way:

First you provide power to the sensor-
Brown gets 12V
Blue gets Ground

Now, you have two choices for output on the remaining 2 wires-
Light Operate
Dark Operate
(These are called complementary outputs, like NO and NC on the mechanical limit switches you got in the kit)

In this example let’s say the sensor is set up so it can “see” it’s own emitted light coming back from some reflective tape - i.e., Light Operate
One of the output wires wire will be a path to ground and the other wire will will “float” above Ground.
When the tape is removed, the conditions reverse (the Dark Operate wire becomes a path to ground)

The Robot Controller is looking for that “path the ground” at an input pin.

The reason it is built that way is, like you partially guessed, because good ole’ mechanical switches worked that way. It also gives you flexibility in setting up a system.

Imagine that you are using the sensor to track a line - using the Light Operate wire makes the most sense (pun intended) “logically” - the condition is true when the tape is visible to the sensor.

Now imagine you are using the sensor in a factory to detect when someone walks through a door or when a box comes down a conveyor - Using Dark Operate makes themost sense “logically” the condition is true every time I get my beam blocked. . . .

The LEDs on the top of the sensor are to indicate that power is present and to indicate when the sensor “sees” its own light being reflected back.

Keep reading if still interested -

When the sensor has just enough light coming back into itself to be able to turn the LO output on, it is said to have an excess gain of (1). If you set the sensor up one foot away from a good target (like a bicycle reflector) you will have 200 times (excess gain) the light required coming back into the sensor.

You can find these datasheets (for range, beam pattern, and excess gain) at http://www.bannerengineering.com/literature_resources/product_literature/literature_worldbeam.html

Why would you want that? Well some factories are very dirty environments - setting up your photoeyes in this fashion (with lots o’excess gain) is akin to designing something structurally “like a tank” - Designing your photoelectric set up to an excess gain of (1) is like building a bridge that can only hold itself up - it can’t carry any cars or it would collapse . . .That lens better stay very clean and the alignment must remain PERFECT!

When you see the LED on the sensor that indicates LO “Flashing” the sensor is telling you that it now sees (1.5) times excess gain (Hey buddy, that reflected light is getting pretty faint!) However, even though that LED is flickering, the output wire for LO is NOT FLICKERING- it is ON “steadily” Keep that in mind.

Here is some info on the adjustment pot. on the sensor

Two examples of where you would use the 3/4 turn sensitivity adjustment on the sensor:

    • You need to see an object pass between the sensor and its retro-target that is smaller than the beam of the sensor (the beam is roughly the size of the sensor’s 18mm “snout”. In this case you want to see the DO wire switch when only some of the light get’s blocked. If you left it turned all the way up, the output wire would never change state.
    • You are using the sensor as an encoder by sensing tape on on your robot’s wheel. Gray or white surfaces may reflect enough light that the sensor is still above an excess gain of 1, even though the tape you put on the wheel reflects back an excess gain of 50. By turning the sensitivity down, you may be able to ignore the gray and white areas and only see the tape.

I hope this helps

PS - if you test the sensor by moving a target towards it from a distance (say a bin with tape on it) you will see that at “X” feet the sensor sees its light and the indicator light comes on - Now start backing away and it will be “X + Y” feet when the light goes off.

This is known as hysteresis

It is setup so you always get positive transitions ON and OFF - without it, you’d be able to get the box in a position that would cause the output to chatter on the edge of ON and OFF -

Imagine how you could screw up without hysteresis-
For example: if using the sensor as an encoder to sense wheel rotation and the robot was stopped, but the tape that the sensor was supposed to be seeing was right on the edge of the beam and the output was chattering -your controller would think that you are still in motion. . . (that is an important little note for any teams that build their own photoelectric encoder using parts from digi-key - be sure that the circuit has some hysteresis)