# power supply How do I select the accompanying components for an optocoupler

Posted on Feb 5, 2014

Using an optocoupler ( MOC3021 ) to sense the On/Off state of an electrial appliance using a microcontroller ATmega16L. How do i go about doing this My mains supply specs are 230V, 50Hz. How do I design the surrounding circuit and select component values, like the resistors Referring to the above schematic. The idea is to use this circuit to

determine whether the load is on or off. The output pin from the optocoupler connects to an external interrupt of the Microcontroller I`m using which is ATmega16L. The interrupt will Monitor the state of the load. After monitoring I can toggle the state of the load using a relay (relay acts as a Control mechanism) which connects to the same microcontroller. Now, I tried calculating the resistor values for R1, R2 and Rc. Note, microcontroller`s VIL(max) = 0. 2xVcc = 660mV and VIH(min) = 0. 6xVcc = 1. 98V and VIH(max) = Vcc+0. 5 = 3. 8V. To calculate Rc is quite easy. When the transistor is not conducting the output is high (at 3. 3V). When the transistor conducts the output is pulled low. so from microcontroller`s point of view, output high means load is switched OFF and output low means load is switched ON. Looking at the datasheet for SFH621A-3, using 34% minimum CTR at IF = 1mA. Therefore, at 1mA input, the output is going to be 340uA. So in order for the microcontroller to detect low voltage from the output of the optocoupler can I use resistor value of 1Kohm So that the output from the optocoupler will have a voltage of 340mV (which is below VIL(max) Aim: the aim is to keep the LEDs ON* for maximum period of time in a 10mS half period (20mS full period of 50Hz). Lets say LEDs have to be ON for 90% of the time, that means LEDs require at least 1mA of current for 90% of the time for that half period which means LEDs will...

Leave Comment characters left:

• ## New Circuits

.

Popular Circuits 