Help choosing optocoupler/switch for microcontroller project

Click For Summary

Discussion Overview

The discussion revolves around selecting and configuring an optocoupler or photoswitch for a microcontroller project, specifically for counting rotations of an anemometer. Participants explore technical specifications, wiring configurations, and alternative sensor options.

Discussion Character

  • Technical explanation
  • Exploratory
  • Debate/contested

Main Points Raised

  • One participant describes the need for a slotted photoswitch and shares a datasheet, expressing confusion over the specifications related to reverse input voltage and collector-emitter voltage.
  • Another participant suggests connecting the collector to a pull-up resistor and the microcontroller's Vcc, explaining how the sensor pin would behave when the slot is blocked or open.
  • Concerns are raised about the high forward current of the LED, with a recommendation to consider lower power options for battery efficiency.
  • Discussion includes the possibility of using built-in pull-up resistors in microcontrollers to save power and the idea of powering the sensor intermittently to extend battery life.
  • One participant proposes using a hall effect sensor as an alternative to the photoswitch, citing lower power consumption.
  • A later reply indicates that the participant successfully implemented the optocoupler configuration as suggested, but mentions needing to calibrate the anemometer and tweak the microcontroller's code.

Areas of Agreement / Disagreement

Participants generally agree on the wiring configuration for the optocoupler as suggested by one member, but there is no consensus on the optimal current for the LED or the best sensor type, as alternatives like the hall effect sensor are also discussed.

Contextual Notes

Some participants express uncertainty regarding the interpretation of the datasheet specifications, and there are unresolved considerations about the power requirements and efficiency of different sensor options.

Who May Find This Useful

Individuals working on microcontroller projects, particularly those involving sensors for rotation counting or similar applications, may find this discussion beneficial.

phlegmy
Messages
120
Reaction score
0
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:
Engineering news on Phys.org
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
 
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
 
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.
 

Similar threads

  • · Replies 6 ·
Replies
6
Views
7K
  • · Replies 22 ·
Replies
22
Views
9K
  • · Replies 13 ·
Replies
13
Views
7K