Help choosing optocoupler/switch for microcontroller project

  • Thread starter phlegmy
  • Start date
  • #1
119
0

Main Question or Discussion Point

Hey guys
i'm putting together a shopping list for my first microcontroller project.
One thing i need is a slotted photoswitch (to count rotations of an anometer)

The project will be powered by a 9v battery, regulated to 5v.

The photoswitch has an led on one "post" and the other post has a photo transistor to detect the light from the led.

The switch i'm looking at has a this data sheet
http://www.farnell.com/datasheets/9111.pdf
and the product is here:
http://ie.farnell.com/optek-technology/opb610/opto-switch-slotted/dp/1497899

I'm finding some info a bit difficult to interperut
On page 2, it says the reverse input voltage is 3v (drop across the led on input post?)
with a forward dc current of 50mA
This means i need a resistor in series of (5-3)/.05 = 40ohms? for the input led

CONFUSION:
It also says that the collector-emmiter voltage is 24V with a collector-emitter current of
30mA,
this is what confuses me. i have no idea if i can just hook up the collector to the 5v supply and connect the emmiter to ground through a resistor, and measure the output on the switch side of the resistor?i suppose i could just buy one and see if it will work, but words of wisdom at this stage would save me some troubel and potentially some €'s!
 
Last edited by a moderator:

Answers and Replies

  • #2
247
1
phlegmy,

Typically you would connect pin 3 to a pull up resistor and the other side of the resistor to the uController's Vcc, in this case likely 1k to 10k for a 5ma to 0.5ma drain @ Vcc = 5V. You would also connect your uController "sensor pin" to both pin 3 and the resistor where they are connected together. When the space between the slot is "blocked" the "sensor pin" will go "High", in this case 5V. When the space between the slot is "Open", the "sensor pin" will go "low", 0V.

The LED source current sounds high to me. In general something in the 10mA to 20mA range is what I have run across in optical switches I have used in the past, so you may want to consider sourcing something with lower power consumption if you plan on operating it for any length of time on a 9V battery.

uControllers like the AVR family have I/O pins with built-in pull-up resistors, so you could use this in place of the external resistor on the transistor side, and you could also power the LED with another I/O pin. This would allow you to disable both for a considerable period of time between pulses.

If you have only one "opening" or "closing" per revolution, then it is fairly easy to calculate the maximum acceleration/deceleration in any given revolution and turn both the LED and the Sensor "Off" for the entire period greater than or less than the min/max, thus saving a tremendous amount of power over days/weeks/months. You might also choose to only power the sensor on every few seconds or minutes if you are not interested in the instantaneous readings.

You might also consider using a hall effect sensor & a magnet, this will use considerably less power.

Fish
 
  • #3
119
0
THanks so much for the REply fish!

Thats a much better way of hooking up the switch,
switching the photoswitches collector and thus controllers input to ground through a resistor,
rather than trying to get a high signal from the emitter.

I;ll look into a hall effect sensor,
Thanks again for your help!
JAmes
 
  • #4
119
0
Just to report that i have all but finished my anomometer but for calibration and a few tweeks to the microcontrollers code.
I ended up using the optocoupler configured as described by Fish4Fun, Thanks again.
 

Related Threads on Help choosing optocoupler/switch for microcontroller project

  • Last Post
Replies
4
Views
2K
  • Last Post
Replies
4
Views
962
  • Last Post
Replies
2
Views
3K
  • Last Post
Replies
1
Views
1K
Replies
17
Views
5K
  • Last Post
Replies
9
Views
13K
Replies
8
Views
1K
  • Last Post
Replies
1
Views
2K
  • Last Post
Replies
1
Views
4K
Top