Loading ...
Sorry, an error occurred while loading the content.

RE: [Electronics_101] 230V AC as i/p to a uC

Expand Messages
  • Scott Thompson
    If you re using a 60Hz system, the capacitive reactance of the 0.33 uF capacitor is 1/(2*pi*60*0.33e-6)=8 kOhms. For 50 Hz, it s 9.65 kOhms. Things get a bit
    Message 1 of 8 , Aug 5, 2003
    • 0 Attachment
      If you're using a 60Hz system, the capacitive reactance of the 0.33 uF capacitor is 1/(2*pi*60*0.33e-6)=8 kOhms.  For 50 Hz, it's 9.65 kOhms.  Things get a bit more complicated with the 470uF capacitor due to its time constant.  The GaAs LED limits the voltage on the capacitor to about 2V during the positive cycles.  Since you will want about 10-15 mA during the positive peaks, you need a total impedance of
      (325-2)/10mA=33 kOhms.
       
      Having C17, the 470uF capacitor, in the circuit, is doing you no good.  It slowly gets charged up to the on voltage of the GaAs LED and discharges through this LED when the circuit would normally be off.  If you need to avoid false triggers or something, we'll talk later.  So, please remove C17 or replace it with something much smaller, like 0.47uF.
       
      Since capacitors drop the voltage without dissipating heat (first order stuff here, I'm not taking a lot into consideration), it should be the dominant (or only) series component before the diodes.  You can make the 100R resistor a 1k ohm resistor and reduce the power dissipation in it significantly (10mA^2*1kOhms=100mW--you can use a 1/4-watt resistor).
       
      You need a residual impedance of about 31.3 kOhms.  You could use a 0.1 uF series capacitor, which gives you slightly more current, in place of the 0.33 uF capacitor.  You can keep the 1M Ohm resistor if you like, it will discharge the capacitor should you unplug the device.
       
      The circuit is now JR2-1 into 1k-1.  1k-2 goes to 0.1uF-1 and 0.1uF-2 goes to *1N4004* diodes.
       
      Be sure to change the diodes to either 1N4004 or 1N4005 and rate the 0.1uF capacitor at least 400WVDC.  You can probably keep the 1N4001s because of the voltage drops across the resistors, but since you're dealing with very high voltages, if you can change them, then I would recommend using rated components for the possible line voltages that may appear.  For example, when you are charging the capacitor, the full voltage will momentarily appear across the diode.  Since it is only rated at 50WVDC, it will conduct in its reverse zener region.  The current is limited, so it's probably no big deal, but I do suggest at least 1N4004s which are rated at 400WVDC.
       
      Remember that the output will go LOW at some point when the input goes HIGH (towards 325 V) when the input LED is biased on with enough current to cause the output transistor to turn on.
       
      That was a good article from Microchip.  The cost savings are substantial when one doesn't use a transformer, but the dangers of using line-powered equipment are outrageous :)  I'm glad you're using an optocoupler.
       
      Have fun!
      Scotty
       
       
       
      ----- Original Message -----
      Sent: 8/1/03 9:54:39 PM
      Subject: RE: [Electronics_101] 230V AC as i/p to a uC

      Hi,

       

      Thanks! Initially I was trying to do the same thing trying to drop the voltage across a large resistor. But things were getting hot and ugly. The idea here is to use the reactance of the cap to drop the voltage. In fact I got this idea from a microchip app note (www.microchip.com/download/appnote/pic16/91008b.pdf)

       

      I have a good amount of time about 500 ms to detect a change over. I just want to know how to get the time constant right.

       

       

      Regards,

       

                           ,,,

                          (@-@)

              +==---o00----(_)----00o-----==+

              {                             |

              {        Thoughts from        |

              {         Vijay  Raju         |

              {                             |

              +==-------------------------==+

                         |__|__|

                          || ||

                         ooO Ooo

       

      -----Original Message-----
      From: Scott Thompson [mailto:blueelectron9@...]
      Sent: Friday, August 01, 2003 10:32 PM
      To: Electronics_101@yahoogroups.com
      Subject: RE: [Electronics_101] 230V AC as i/p to a uC

       

      The 470uF capacitor is holding a lot of charge on the LED.  The optocoupler has what is called a current transfer ratio (CTR), so the LED is biased slightly on at all tiimes because of the charge of C17 and the output is reflecting the current fluctuation in the GaAs LED (U2).  Also, the 1N4001's are only rated at 50PIV and they may conduct during a portion of the cycle due to the charge of the 0.33uF capacitor.

       

      You only need about 2V @ 10 mA to drive the LED.  At 230VAC, you have ~325V peak.  Take (325-2)/10 mA=R=33k.

       

      Therefore, your circuit would like like this:

       

      On JR2.1, replace the 100R 2W resistor with the 33k ohm resistor.  The resistor should be rated at about 5W.  You can use a 2W resistor since the input is always changing.  If you want to use lower power valued resistors, you can make a capacitive voltage divider first.  The problem with a capacitive voltage divider is that if bottom capacitor opens, you will be left with the full voltage anyway, so it's probably better to just be prepared to handle what may come down the pipe.

       

      Kill the 1M resistor and C19.  Replace the diodes with 1N4004s or 1N4005s.  Kill the 470uF capacitor.

       

      Place PD2 on an INPUT pin of the microcontroller instead of an OUTPUT pin.  You may damage your microcontroller if you are are forcing an output to change state.

       

      Your circuit should now work properly.  Note that when the voltage on the line goes above about 1.7V, the output will go LOW (0V).  The output will swing high when the LED is not on (i.e., most of the AC cycle).  Therefore, expect to see a very narrow pulse from +5V to 0V around the rising zero-crossing level of the input voltage.

       

      You may wish to include a zener or something in place of the first 1N4001 in case of a power surge.

       

      For further information on interfacing to AC power lines (and a very simple one resistor approach), see Microchip's website and look at their application notes.  They rely on the maximum current into the microcontroller pin and the fact that there is intrinsic diodes to the power line rails to determine a value of resistance that will limit the input current to something that the microcontroller can handle.  All of the excess voltage just gets dumped across the very high valued resistor.

       

      Personally, I'd stick with the optocoupler.

       

      Good luck,

      Scotty

       

      ----- Original Message -----

      From: Vijay Raju

      Sent: 8/1/03 7:04:25 AM

      Subject: [Electronics_101] 230V AC as i/p to a uC

       

      Hi,

       

               I am using the ckt in the attachment to detect 230V AC arriving on an output of an industrial PLC. I am trying to step down the voltage to 5V so my microcontroller can recognize the presence or absence of 230V. Now the problem is that the ckt seems to hold charge for really long times. i.e. if I remove the 230V input for a couple of minutes the output of the MCT2E is low. The second problem is that the output of the MCT2E is varying only between 4 and 5V. i.e 4V at 230V and 5V at 0V. What could be causing these problems?

       

       

      Regards,  

       

                          ,,,

                          (@-@)

              +==---o00----(_)----00o-----==+

              {                             |

              {        Thoughts from        |

              {         Vijay  Raju         |

              {                             |

              +==-------------------------==+

                         |__|__|

                          || ||

                         ooO Ooo

       


       

       



      To unsubscribe from this group, send an email to:
      Electronics_101-unsubscribe@yahoogroups.com



      Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.



      To unsubscribe from this group, send an email to:
      Electronics_101-unsubscribe@yahoogroups.com



      Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.




      To unsubscribe from this group, send an email to:
      Electronics_101-unsubscribe@yahoogroups.com



      Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.
    Your message has been successfully submitted and would be delivered to recipients shortly.