Newsgroups: comp.robotics,sci.electronics
Path: cantaloupe.srv.cs.cmu.edu!europa.chnt.gtegsc.com!news.mathworks.com!udel!gatech!swrinde!cs.utexas.edu!news.sprintlink.net!news.indirect.com!seeker
From: seeker@indirect.com (Stan Eker)
Subject: Re: AC zero crossings into microcontroller?
Message-ID: <D77x72.7JF@indirect.com>
Sender: usenet@indirect.com (Internet Direct Admin)
Organization: Internet Direct, indirect.com
Date: Tue, 18 Apr 1995 06:40:13 GMT
References: <mark.stephens-1704951112570001@mstephens.gsfc.nasa.gov>
X-Newsreader: TIN [version 1.2 PL2]
Followup-To: comp.robotics,sci.electronics
Lines: 33
Xref: glinda.oz.cs.cmu.edu comp.robotics:19888 sci.electronics:128437

mark stephens (mark.stephens@gsfc.nasa.gov) wrote:
: I need to control a few AC power devices from a microcontroller (HC11).  I
: have working a typical triac circuit controlled by a zero crossing
: opto-isolator ( MOC3040 <-> 10K resistor <-> triac gate ).  This works
: fine for turning a device on or off from one of the HC11's ports.  

: But I'd really like to do a dimming routine to control incadescent lights
: and possibly an AC fan.  So I think I need to get the timers on board the
: HC11 in sync with the AC power source.  That way I should be able to turn
: on a device for as little as 1/60th of a second (or is that 1/120th).

Here's what I've used (quite successfully)


              D1        R2       1 --------- 5       4.7K  R3
    -----------|<|----/\/\/\-------|       |--------/\/\/\--- +5V
    |        1N4148    12K       2 |       | 4   |----------
    | R1               /-----------|       |--|            |----- zero cross
AC --/\/\/\----|-----| 2N3904      ---------  | gnd
      470K     -    b  \e  Q1         4N25
           D2  ^        |
        1N4148 |        |
AC-----------------------

note: D1 is hacked in.  I supplied the 4N25 from a local 14V source that
was tied to the AC line.  R2 was 1K in that case, 12K if powered from 120.

This is a half-wave zero-cross circuit - it outputs a LOW pulse whenever the
AC line is above zero, and is only delayed about 70uS after the crossing. 
Your 'HC11 code needs to watch BOTH edges to find the zero crossings.

It may not be perfect, but it's easy to second-source.

