Help choosing optocoupler/switch for microcontroller project

AI Thread Summary
The discussion focuses on selecting an optocoupler for a microcontroller project involving a slotted photoswitch to count an anemometer's rotations. Key points include the need for a series resistor for the LED, with calculations suggesting a 40-ohm resistor for a 5V supply. Clarification was provided on connecting the collector to the 5V supply and using a pull-up resistor for the microcontroller's input. Suggestions were made to consider lower power consumption options, such as using a hall effect sensor instead. The original poster confirmed they successfully implemented the optocoupler setup as advised, nearing completion of their anemometer project.
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.
 
Hi all I have some confusion about piezoelectrical sensors combination. If i have three acoustic piezoelectrical sensors (with same receive sensitivity in dB ref V/1uPa) placed at specific distance, these sensors receive acoustic signal from a sound source placed at far field distance (Plane Wave) and from broadside. I receive output of these sensors through individual preamplifiers, add them through hardware like summer circuit adder or in software after digitization and in this way got an...
I have recently moved into a new (rather ancient) house and had a few trips of my Residual Current breaker. I dug out my old Socket tester which tell me the three pins are correct. But then the Red warning light tells me my socket(s) fail the loop test. I never had this before but my last house had an overhead supply with no Earth from the company. The tester said "get this checked" and the man said the (high but not ridiculous) earth resistance was acceptable. I stuck a new copper earth...
Thread 'Beauty of old electrical and measuring things, etc.'
Even as a kid, I saw beauty in old devices. That made me want to understand how they worked. I had lots of old things that I keep and now reviving. Old things need to work to see the beauty. Here's what I've done so far. Two views of the gadgets shelves and my small work space: Here's a close up look at the meters, gauges and other measuring things: This is what I think of as surface-mount electrical components and wiring. The components are very old and shows how...

Similar threads

Replies
22
Views
8K
Replies
13
Views
6K
Back
Top