Optocouples

Status
Not open for further replies.

glitchau

New Member
Hi Everyone.

For a assignment I was asked to make an alarm system with a reed switch that would activate an alarm. The reed switch is >15m away from where the micro controller is going to be installed.
I'm thinking I could make an RC circuit to remove noise but think this would be less reliable then an octocoupler circuit as I wouldn't know what values to use for R and C.

I've draw up an octocoupler circuit but not sure what value for resistor 2 I should use and why. The reed switch would be used to turn the LED on and off. The whole idea of the project is to learn so I feel that its quite important to know the reason + I also need to create a report explaining why I used that value. I've looked through the datasheet and not really sure what I'm looking for. The octocoupler I'm using is the 4N25

Could someone please help me out with this, I'd be extremely happy
 

Attachments

  • circuit.JPG
    73.4 KB · Views: 294
I'm thinking I could make an RC circuit to remove noise but think this would be less reliable then an octocoupler circuit as I wouldn't know what values to use for R and C.
Even with an optocoupler circuit you will need noise filtering (e.g. an RC circuit). Noise would otherwise modulate the current through the opto-diode current, which would result in the voltage at the micro input being modulated too. The advantage of using an opto is galvanic isolation of the micro from excessive voltages on the reed switch wiring. For filtering, choose an RC time constant several times the period of anticipated noise frequencies. Think of the RC filter as a potential divider, with the reactance of C being small for high frequencies so that the high frequencies get attenuated.
not sure what value for resistor 2 I should use and why
10k is fine, because current through it is at least an order of magnitude greater than input bias and leakage currents of the micro (unless you're using a very strange micro!).
 
Thanks for the quick response!
I was thinking of adding a couple of delays in the program to prevent that from setting off the alarm. Having no clue what potential noise could occur down the line makes it kind of hard to select R and C values though. Any help with this section?
Awesome, I shall use a 10k ohm resistor.
 
Having no clue what potential noise could occur down the line makes it kind of hard to select R and C values though.
True, but how often will the reed-switch be changing state? If the frequency of operation is f Hz then to attenuate noise above, say, 10 x f Hz without significantly affecting the f Hz signal you could make the RC time constant ~ 1/(10 x f).
 
The reed switch will only be used as a switch to detect if a window or door has been opened. I was thinking of noise from potential power lines being the main contributor.
 
In that case I would use a time constant ~30mS. Filtering after the opto is more effective than filtering before it.
 
Status
Not open for further replies.
Cookies are required to use this site. You must accept them to continue using the site. Learn more…