Pages: [1]   Go Down
Author Topic: Photoelectric Switch  (Read 1075 times)
0 Members and 1 Guest are viewing this topic.
Florida
Offline Offline
Newbie
*
Karma: 0
Posts: 48
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I have a photoelectric switch that runs on 5V. It has three different pins on it, VCC  (which I would hook up to the 5V supply from the Arduino), Ground (to ground), and Output (which I'm assuming should be hooked up to an I/O pin).

The switch gives a high level output without obstruction, and a low output level when there are obstacles in front of it. If I want the Arduino to just read if the switch is giving a high or low value can I set an I/O Pin to INPUT and hook it up to the output on the sensor without any problems?
Logged

Germany
Offline Offline
Faraday Member
**
Karma: 56
Posts: 2983
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

If you detected this "high" and "low" with a voltage meter, "high" was between 3 and 5V and "low" was below 1V, then your switch seems just made for this usage.

If you get strange quick (noisy) signal changes, you might need to add a resistor (1k ..10k) between your Input pin and GND.

Or provide a data sheet reference to your device,
   ... or read it yourself smiley-wink
Logged

Left Coast, CA (USA)
Offline Offline
Brattain Member
*****
Karma: 361
Posts: 17263
Measurement changes behavior
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset


The output may be an 'open collector' type and require a pull-up resistor to work correctly. However what really is required to determine that is a datasheet for your device.

Lefty

Logged

Germany
Offline Offline
Faraday Member
**
Karma: 56
Posts: 2983
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
The switch gives a high level output without obstruction, and a low output level when there are obstacles in front of it
How would one see the level ? Especially if it were an open collector...
Sure, my "voltage meter reading" was just a guess, inspired by my own approach (most likely) as a newbie myself.
But if there's something that you can measure this way, chances are good you can simply supply it to analogRead or digitalRead as you like.

Quote
what really is required to determine that is a datasheet for your device.
Internet is not only for porn, you find every datasheet there, too.  Awesome.
Logged

Pages: [1]   Go Up
Jump to: