Specifying a relay to control lights etc.

S

scouselad

Guest
Hi,

I'm doing a project on home automation and, as you might expect, I'd
like to control a lighting circuit (standard filament bulbs, most
likely) via a digital light sensor and a micro-controller. Obviously,
to control the mains supply, I'll need some sort of relay. However,
I'm not sure how I could emulate a "dimmer" control in this way. For
example, I considered using PWM (which my micro-controller can produce
automatically), but I'm not sure if a relay can respond that fast. I
understand that solid-state relays (SSRs) respond much faster than
electromagnetic and electromechanical relays, so I'd like to use an
SSR if possible.

Basically, I'd like a device that I can give some variable input so
that it will vary the amount of AC mains voltage across my light bulb
(or heater, or fan, etc.). It would be nice if there was something
that will take digital input (perhaps PWM) but all I've found so far
in that department is the Crydom MCTC range, which are a little too
expensive (~Ł80/$160) compared to small SSRs (~Ł4-10/$8-20). However,
I'd be happy with something that takes analog input if it saves me a
lot of money.

Thanks for reading,
Allan Lewis.
 
On 22 Oct 2007 01:49:49 -0700, scouselad <allanlewis99@googlemail.com>
wrote:

Hi,

I'm doing a project on home automation and, as you might expect, I'd
like to control a lighting circuit (standard filament bulbs, most
likely) via a digital light sensor and a micro-controller. Obviously,
to control the mains supply, I'll need some sort of relay. However,
I'm not sure how I could emulate a "dimmer" control in this way. For
example, I considered using PWM (which my micro-controller can produce
automatically), but I'm not sure if a relay can respond that fast. I
understand that solid-state relays (SSRs) respond much faster than
electromagnetic and electromechanical relays, so I'd like to use an
SSR if possible.

Basically, I'd like a device that I can give some variable input so
that it will vary the amount of AC mains voltage across my light bulb
(or heater, or fan, etc.). It would be nice if there was something
that will take digital input (perhaps PWM) but all I've found so far
in that department is the Crydom MCTC range, which are a little too
expensive (~Ł80/$160) compared to small SSRs (~Ł4-10/$8-20). However,
I'd be happy with something that takes analog input if it saves me a
lot of money.

Thanks for reading,
Allan Lewis.
Trying to use a SSR for pwm to control lighting is iffy at best.
They, generally speaking, don't react fast enough and 50-60 cycles is
rather slow. One can usually detect 20+ cycles of flicker in
incandescent lamps. (halogen may be somewhat better because of a
relatively thick hot filament - but no telling if that would interfere
with the halogen cycle - some low wattage 120 VAC halogen lamps in
the US have diodes in them to halve the voltage - further complicating
dimming)

With SSRs they frequently incorporate a circuit to slow the operation
to prevent the SSR from half-cycling or fault conditions in the signal
which might cause the load to self destruct from fast on-off operation
- like induction motors.

What does work very well is a resistive optical coupler added into a
lamp dimmer in place of the control potentiometer to vary the phase
angle of the triac firing.

For lamp dimming with an isolated low voltage signal . . .

Some time ago there were incandescent lamp coupled to photocells to
arrive at a linear optical coupler - these days one of the led to
mosfet OC's might be a choice. The linear couplers are still around
in the incandescent form - but mostly as repair parts and somewhat
costly. Very easy to construct also.

You would need an analog signal to drive the coupler, but that is easy
enough if you have pwm - to analog is just a matter of adding a cap
and diode to integrate the signal, or many pics already have D/A built
in.

You don't mention how fast you want to modulate the light output - I'm
assuming home automation means setting a lighting level and leaving it
more or less constant for a period of time.
--

----== Posted via Newsfeeds.Com - Unlimited-Unrestricted-Secure Usenet News==----
http://www.newsfeeds.com The #1 Newsgroup Service in the World! 120,000+ Newsgroups
----= East and West-Coast Server Farms - Total Privacy via Encryption =----
 
On Oct 22, 1:27 pm, default <defa...@defaulter.net> wrote:
On 22 Oct 2007 01:49:49 -0700, scouselad <allanlewi...@googlemail.com
wrote:

Trying to use a SSR for pwm to control lighting is iffy at best.
They, generally speaking, don't react fast enough and 50-60 cycles is
rather slow. One can usually detect 20+ cycles of flicker in
incandescent lamps. (halogen may be somewhat better because of a
relatively thick hot filament - but no telling if that would interfere
with the halogen cycle - some low wattage 120 VAC halogen lamps in
the US have diodes in them to halve the voltage - further complicating
dimming)
Ok, so I'll either need a controller on the (AC) output of the SSR to
reduce the voltage across the lamp, or just ditch the SSR and try
something else.

With SSRs they frequently incorporate a circuit to slow the operation
to prevent the SSR from half-cycling or fault conditions in the signal
which might cause the load to self destruct from fast on-off operation
- like induction motors.

What does work very well is a resistive optical coupler added into a
lamp dimmer in place of the control potentiometer to vary the phase
angle of the triac firing.

For lamp dimming with an isolated low voltage signal . . .

Some time ago there were incandescent lamp coupled to photocells to
arrive at a linear optical coupler - these days one of the led to
mosfet OC's might be a choice. The linear couplers are still around
in the incandescent form - but mostly as repair parts and somewhat
costly. Very easy to construct also.

You would need an analog signal to drive the coupler, but that is easy
enough if you have pwm - to analog is just a matter of adding a cap
and diode to integrate the signal, or many pics already have D/A built
in.

You don't mention how fast you want to modulate the light output - I'm
assuming home automation means setting a lighting level and leaving it
more or less constant for a period of time.
Yes, the light would be pretty constant over at least several minutes,
often for several hours.

Anyway, thanks for the reply, I'll do some more research and see what
I come up with.

Anyone else...?
 
On Oct 22, 1:27 pm, default <defa...@defaulter.net> wrote:
On 22 Oct 2007 01:49:49 -0700, scouselad <allanlewi...@googlemail.com
wrote:
snip
What does work very well is a resistive optical coupler added into a
lamp dimmer in place of the control potentiometer to vary the phase
angle of the triac firing.
snip

"Resistive optical coupler"? I've heard of optical couplers/opto-
couplers but what do you mean by "resistive" in this context? Anyway,
I thought that they were limited to ~50V, something confirmed by a
quick search on Farnell - I'm using UK mains voltage (220-240V).

Please clarify...
 
On 22 Oct 2007 01:49:49 -0700, scouselad
<allanlewis99@googlemail.com> wrote:

Hi,

I'm doing a project on home automation and, as you might expect, I'd
like to control a lighting circuit (standard filament bulbs, most
likely) via a digital light sensor and a micro-controller. Obviously,
to control the mains supply, I'll need some sort of relay. However,
I'm not sure how I could emulate a "dimmer" control in this way. For
example, I considered using PWM (which my micro-controller can produce
automatically), but I'm not sure if a relay can respond that fast. I
understand that solid-state relays (SSRs) respond much faster than
electromagnetic and electromechanical relays, so I'd like to use an
SSR if possible.

Basically, I'd like a device that I can give some variable input so
that it will vary the amount of AC mains voltage across my light bulb
(or heater, or fan, etc.). It would be nice if there was something
that will take digital input (perhaps PWM) but all I've found so far
in that department is the Crydom MCTC range, which are a little too
expensive (~Ł80/$160) compared to small SSRs (~Ł4-10/$8-20). However,
I'd be happy with something that takes analog input if it saves me a
lot of money.
---
From your description I assume that you want to be able to set, and
have the device keep the ambient light level constant in, say, a
room, regardless of the effects of external light streaming in
through windows or from adjacent rooms.

That is, if there was no external light streaming into the room the
lamp would be at its brightest, but as more and more external light
illuminated the room the lamp would dim in order to compensate.

Is that right?


--
JF
 
On Oct 22, 11:58 pm, John Fields <jfie...@austininstruments.com>
wrote:
On 22 Oct 2007 01:49:49 -0700, scouselad



allanlewi...@googlemail.com> wrote:
Hi,

I'm doing a project on home automation and, as you might expect, I'd
like to control a lighting circuit (standard filament bulbs, most
likely) via a digital light sensor and a micro-controller. Obviously,
to control the mains supply, I'll need some sort of relay. However,
I'm not sure how I could emulate a "dimmer" control in this way. For
example, I considered using PWM (which my micro-controller can produce
automatically), but I'm not sure if a relay can respond that fast. I
understand that solid-state relays (SSRs) respond much faster than
electromagnetic and electromechanical relays, so I'd like to use an
SSR if possible.

Basically, I'd like a device that I can give some variable input so
that it will vary the amount of AC mains voltage across my light bulb
(or heater, or fan, etc.). It would be nice if there was something
that will take digital input (perhaps PWM) but all I've found so far
in that department is the Crydom MCTC range, which are a little too
expensive (~Ł80/$160) compared to small SSRs (~Ł4-10/$8-20). However,
I'd be happy with something that takes analog input if it saves me a
lot of money.

---
From your description I assume that you want to be able to set, and
have the device keep the ambient light level constant in, say, a
room, regardless of the effects of external light streaming in
through windows or from adjacent rooms.

That is, if there was no external light streaming into the room the
lamp would be at its brightest, but as more and more external light
illuminated the room the lamp would dim in order to compensate.

Is that right?

--
JF
Exactly. I have already bought a light sensor (an Intersil ISL29003)
with I2C output that I intend to control from a Microchip 16F877 or
similar - setting up that system is really another task entirely. What
I'm looking for is something that I can give a variable input (either
PWM or some digital input - I2C would be nice - or just an analogue
voltage level) causing it to adjust the power delivered to the light.
I know I can do this by adjusting the firing angle of a triac, but I'm
not sure of the circuitry involved to make to control fully
electronic. I've found lots of similar "dimmer" circuits on the net,
mostly using triacs, but they all have a large potentiometer to
control the dimming. What I want to do is use a circuit like that but
with an electronically-controlled potentiometer. Again, I know that
digital pots exist, but I don't think they will take UK mains voltage
(220-240V).

I hope that's clarified things.
 
On Tue, 23 Oct 2007 01:17:25 -0700, scouselad
<allanlewis99@googlemail.com> wrote:

On Oct 22, 11:58 pm, John Fields <jfie...@austininstruments.com
wrote:
On 22 Oct 2007 01:49:49 -0700, scouselad



allanlewi...@googlemail.com> wrote:
Hi,

I'm doing a project on home automation and, as you might expect, I'd
like to control a lighting circuit (standard filament bulbs, most
likely) via a digital light sensor and a micro-controller. Obviously,
to control the mains supply, I'll need some sort of relay. However,
I'm not sure how I could emulate a "dimmer" control in this way. For
example, I considered using PWM (which my micro-controller can produce
automatically), but I'm not sure if a relay can respond that fast. I
understand that solid-state relays (SSRs) respond much faster than
electromagnetic and electromechanical relays, so I'd like to use an
SSR if possible.

Basically, I'd like a device that I can give some variable input so
that it will vary the amount of AC mains voltage across my light bulb
(or heater, or fan, etc.). It would be nice if there was something
that will take digital input (perhaps PWM) but all I've found so far
in that department is the Crydom MCTC range, which are a little too
expensive (~Ł80/$160) compared to small SSRs (~Ł4-10/$8-20). However,
I'd be happy with something that takes analog input if it saves me a
lot of money.

---
From your description I assume that you want to be able to set, and
have the device keep the ambient light level constant in, say, a
room, regardless of the effects of external light streaming in
through windows or from adjacent rooms.

That is, if there was no external light streaming into the room the
lamp would be at its brightest, but as more and more external light
illuminated the room the lamp would dim in order to compensate.

Is that right?

--
JF

Exactly. I have already bought a light sensor (an Intersil ISL29003)
with I2C output that I intend to control from a Microchip 16F877 or
similar - setting up that system is really another task entirely. What
I'm looking for is something that I can give a variable input (either
PWM or some digital input - I2C would be nice - or just an analogue
voltage level) causing it to adjust the power delivered to the light.
I know I can do this by adjusting the firing angle of a triac, but I'm
not sure of the circuitry involved to make to control fully
electronic. I've found lots of similar "dimmer" circuits on the net,
mostly using triacs, but they all have a large potentiometer to
control the dimming. What I want to do is use a circuit like that but
with an electronically-controlled potentiometer. Again, I know that
digital pots exist, but I don't think they will take UK mains voltage
(220-240V).
---
Since you're going to use a ľC, you could use something as simple as
a pushbutton or two to ramp the setpoint up and down, and the output
of the sensor to cause the ľC to servo about that point.

For example, let's say that you have one pushbutton which causes the
light to get brighter, another which causes the light to grow
dimmer, and that you've held one of them down (or repeatedly pressed
and released one of them) until the illumination in the room is at
the level you want.

Now, when you release the pushbutton and the illumination in the
room changes because of, say, the sun shining into the room through
a window, later, the output from the sensor will increase and the ľC
will dim the light until the output from the sensor is as it was
when the pushbutton was released.


--
JF
 
On Oct 23, 10:49 am, John Fields <jfie...@austininstruments.com>
wrote:
On Tue, 23 Oct 2007 01:17:25 -0700, scouselad







allanlewi...@googlemail.com> wrote:
On Oct 22, 11:58 pm, John Fields <jfie...@austininstruments.com
wrote:
On 22 Oct 2007 01:49:49 -0700, scouselad

allanlewi...@googlemail.com> wrote:
Hi,

I'm doing a project on home automation and, as you might expect, I'd
like to control a lighting circuit (standard filament bulbs, most
likely) via a digital light sensor and a micro-controller. Obviously,
to control the mains supply, I'll need some sort of relay. However,
I'm not sure how I could emulate a "dimmer" control in this way. For
example, I considered using PWM (which my micro-controller can produce
automatically), but I'm not sure if a relay can respond that fast. I
understand that solid-state relays (SSRs) respond much faster than
electromagnetic and electromechanical relays, so I'd like to use an
SSR if possible.

Basically, I'd like a device that I can give some variable input so
that it will vary the amount of AC mains voltage across my light bulb
(or heater, or fan, etc.). It would be nice if there was something
that will take digital input (perhaps PWM) but all I've found so far
in that department is the Crydom MCTC range, which are a little too
expensive (~Ł80/$160) compared to small SSRs (~Ł4-10/$8-20). However,
I'd be happy with something that takes analog input if it saves me a
lot of money.

---
From your description I assume that you want to be able to set, and
have the device keep the ambient light level constant in, say, a
room, regardless of the effects of external light streaming in
through windows or from adjacent rooms.

That is, if there was no external light streaming into the room the
lamp would be at its brightest, but as more and more external light
illuminated the room the lamp would dim in order to compensate.

Is that right?

--
JF

Exactly. I have already bought a light sensor (an Intersil ISL29003)
with I2C output that I intend to control from a Microchip 16F877 or
similar - setting up that system is really another task entirely. What
I'm looking for is something that I can give a variable input (either
PWM or some digital input - I2C would be nice - or just an analogue
voltage level) causing it to adjust the power delivered to the light.
I know I can do this by adjusting the firing angle of a triac, but I'm
not sure of the circuitry involved to make to control fully
electronic. I've found lots of similar "dimmer" circuits on the net,
mostly using triacs, but they all have a large potentiometer to
control the dimming. What I want to do is use a circuit like that but
with an electronically-controlled potentiometer. Again, I know that
digital pots exist, but I don't think they will take UK mains voltage
(220-240V).

---
Since you're going to use a ľC, you could use something as simple as
a pushbutton or two to ramp the setpoint up and down, and the output
of the sensor to cause the ľC to servo about that point.

For example, let's say that you have one pushbutton which causes the
light to get brighter, another which causes the light to grow
dimmer, and that you've held one of them down (or repeatedly pressed
and released one of them) until the illumination in the room is at
the level you want.

Now, when you release the pushbutton and the illumination in the
room changes because of, say, the sun shining into the room through
a window, later, the output from the sensor will increase and the ľC
will dim the light until the output from the sensor is as it was
when the pushbutton was released.

--
JF
I'm not quite clear about what your saying, and I'm not sure that it
addresses my problem.
I'm already planning a control panel (cf. your push buttons) to adjust
the setpoint, which will be a combination of the ambient light and
that provided electrically. However, what I need is a way to control
the electric light level from the PIC. It should be pretty simple to
work out an algorithm to decide how much power to put into the light
bulb (or how much voltage across it - could be done several ways) but
that's not what I need help with: what I'm asking is how to control
the level of the bulb using an output from the PIC. Ideally, this
would be a digital output, but I'm happy to do use a DAC if necessary.

Perhaps you could clarify a little...
 
On Mon, 22 Oct 2007 13:22:48 -0700, scouselad
<allanlewis99@googlemail.com> wrote:

"Resistive optical coupler"? I've heard of optical couplers/opto-
couplers but what do you mean by "resistive" in this context? Anyway,
I thought that they were limited to ~50V, something confirmed by a
quick search on Farnell - I'm using UK mains voltage (220-240V).

Please clarify...
The optical coupler isn't intended to directly modulate the mains
voltage, just to provide an isolated way to control a variable
resistance.

Check out http://www.fairchildsemi.com/ds/H1%2FH11F1M.pdf

This was in the design newsgroup. An optical coupler that varies
resistance from 100 ohms to 300 megohms with an isolated low voltage
input - this would go inside a lamp dimmer circuit in place of the
potentiometer that would normally be used to vary brightness. It is
a component, not a complete solution for what you want.

The diac normally used in a lamp dimmer fires at about 30 volts (even
with 220 circuits) so a 60 volt coupler would be plenty.


H11F1M, H11F2M, H11F3M
Photo FET Optocouplers

Features
As a remote variable resistor:
Ś=100 to =300M
Ś=99.9% linearity
Ś=15pF shunt capacitance
Ś=100G I/O isolation resistance
As an analog switch:
ŚExtremely low offset voltage
Ś60 V pk-pk signal capability
ŚNo charge injection or latch-up
Śt on , t off =15ľS
ŚUL recognized (File #E90700)
General Description
The H11FXM series consists of a Gallium-Aluminum-Arsenide
IRED emitting diode coupled to a symmetrical
bilateral silicon photo-detector. The detector is electri-cally
isolated from the input and performs like an ideal
isolated FET designed for distortion-free control of low
level AC and DC analog signals. The H11FXM series
devices are mounted in dual in-line packages.
--

----== Posted via Newsfeeds.Com - Unlimited-Unrestricted-Secure Usenet News==----
http://www.newsfeeds.com The #1 Newsgroup Service in the World! 120,000+ Newsgroups
----= East and West-Coast Server Farms - Total Privacy via Encryption =----
 
On Mon, 22 Oct 2007 13:16:00 -0700, scouselad
<allanlewis99@googlemail.com> wrote:

http://ourworld.compuserve.com/homepages/Bill_Bowden/page4.htm#pumpkin.gif
Shows a basic lamp dimmer circuit - where the potentiometer is you use
a resistive optical coupler

Someone has already put it all together:

Shows an idea for taking a standard manufactured lamp dimmer and using
the pwm output from a basic stamp controller to set the brightness.

The little circuit shown converts the pwm signal to a varying DC
voltage and tells you what dimmer to use and where to get parts.

http://www.epanorama.rackhost.net/schematicsforfree/Lights/An_AC_Dimmer_for_Use_with_the_Stamp.PDF
--

----== Posted via Newsfeeds.Com - Unlimited-Unrestricted-Secure Usenet News==----
http://www.newsfeeds.com The #1 Newsgroup Service in the World! 120,000+ Newsgroups
----= East and West-Coast Server Farms - Total Privacy via Encryption =----
 
On Tue, 23 Oct 2007 03:18:42 -0700, scouselad
<allanlewis99@googlemail.com> wrote:

On Oct 23, 10:49 am, John Fields <jfie...@austininstruments.com
wrote:
On Tue, 23 Oct 2007 01:17:25 -0700, scouselad







allanlewi...@googlemail.com> wrote:
On Oct 22, 11:58 pm, John Fields <jfie...@austininstruments.com
wrote:
On 22 Oct 2007 01:49:49 -0700, scouselad

allanlewi...@googlemail.com> wrote:
Hi,

I'm doing a project on home automation and, as you might expect, I'd
like to control a lighting circuit (standard filament bulbs, most
likely) via a digital light sensor and a micro-controller. Obviously,
to control the mains supply, I'll need some sort of relay. However,
I'm not sure how I could emulate a "dimmer" control in this way. For
example, I considered using PWM (which my micro-controller can produce
automatically), but I'm not sure if a relay can respond that fast. I
understand that solid-state relays (SSRs) respond much faster than
electromagnetic and electromechanical relays, so I'd like to use an
SSR if possible.

Basically, I'd like a device that I can give some variable input so
that it will vary the amount of AC mains voltage across my light bulb
(or heater, or fan, etc.). It would be nice if there was something
that will take digital input (perhaps PWM) but all I've found so far
in that department is the Crydom MCTC range, which are a little too
expensive (~Ł80/$160) compared to small SSRs (~Ł4-10/$8-20). However,
I'd be happy with something that takes analog input if it saves me a
lot of money.

---
From your description I assume that you want to be able to set, and
have the device keep the ambient light level constant in, say, a
room, regardless of the effects of external light streaming in
through windows or from adjacent rooms.

That is, if there was no external light streaming into the room the
lamp would be at its brightest, but as more and more external light
illuminated the room the lamp would dim in order to compensate.

Is that right?

--
JF

Exactly. I have already bought a light sensor (an Intersil ISL29003)
with I2C output that I intend to control from a Microchip 16F877 or
similar - setting up that system is really another task entirely. What
I'm looking for is something that I can give a variable input (either
PWM or some digital input - I2C would be nice - or just an analogue
voltage level) causing it to adjust the power delivered to the light.
I know I can do this by adjusting the firing angle of a triac, but I'm
not sure of the circuitry involved to make to control fully
electronic. I've found lots of similar "dimmer" circuits on the net,
mostly using triacs, but they all have a large potentiometer to
control the dimming. What I want to do is use a circuit like that but
with an electronically-controlled potentiometer. Again, I know that
digital pots exist, but I don't think they will take UK mains voltage
(220-240V).

---
Since you're going to use a ľC, you could use something as simple as
a pushbutton or two to ramp the setpoint up and down, and the output
of the sensor to cause the ľC to servo about that point.

For example, let's say that you have one pushbutton which causes the
light to get brighter, another which causes the light to grow
dimmer, and that you've held one of them down (or repeatedly pressed
and released one of them) until the illumination in the room is at
the level you want.

Now, when you release the pushbutton and the illumination in the
room changes because of, say, the sun shining into the room through
a window, later, the output from the sensor will increase and the ľC
will dim the light until the output from the sensor is as it was
when the pushbutton was released.

--
JF

I'm not quite clear about what your saying, and I'm not sure that it
addresses my problem.
I'm already planning a control panel (cf. your push buttons) to adjust
the setpoint, which will be a combination of the ambient light and
that provided electrically. However, what I need is a way to control
the electric light level from the PIC. It should be pretty simple to
work out an algorithm to decide how much power to put into the light
bulb (or how much voltage across it - could be done several ways) but
that's not what I need help with: what I'm asking is how to control
the level of the bulb using an output from the PIC. Ideally, this
would be a digital output, but I'm happy to do use a DAC if necessary.

Perhaps you could clarify a little...
---
Sure.

You'll need one register (lets call it 'RSET') to store the value of
the setpoint, another ('RINT'), to store the value of the intensity
sensor, another ('RDLY') to store the value which will be loaded
into another ('DCNT') used as a down-counter which will trigger a
TRIAC when it times out, controlling the light. You'll also need
either a hardware or software zero-crossing detector.

The way the thing works is that you use the zero-crossing detector
to load the value of the setpoint into SREG and the value of the
sensor into IREG, then you compare the values.

If SREG is > IREG, then decrement RDLY, load that value into DCNT,
and start counting down. When DCNT gets to zero, send a pulse to
the TRIAC to trigger it and wait for the next zero crossing to start
the cycle again.

If SREG is < IREG, then increment RDLY, load that value into DCNT,
and start counting down. When DCNT gets to zero, send a pulse to
the TRIAC to trigger it and wait for the next zero crossing to start
the cycle again.

If SREG = IREG, then load the contents of RDLY into DCNT, and start
counting down. When DCNT gets to zero, send a pulse to the TRIAC to
trigger it and wait for the next zero crossing to start the cycle
again.

One thing you'll need to do to make the counter work properly is to
make sure that its maximum count can't quite get to 180°. That's to
make sure that at low brightness it won't trigger the TRIAC at the
beginning of the next half-cycle, making it as bright as it can be.

Let's say that the counter is 8 bits wide and that your mains
frequency is 60Hz. That means that the time per half-cycle will be:


1 1
t = ---- = ------- = 0.00833...s = 8.33ms
2f 120Hz

Now, if your timer is 8 bits wide and is set to hex ff when it
starts counting, that means that each increment of time it counts
down until it gets to zero will be:


8.33E-3s
t = ---------- ~ 3.27E-5s ~ 32.7 microseconds
255

if it starts counting at one 60Hz zero crossing and stops at the
next.

Depending on how long it takes for your capture-compare-load-trigger
routine to run, you'll have to decrease that time in order to keep
from running into the next half-cycle and false-triggering the
TRIAC.

Alternately, if you could accept the increase in granularity, you
could truncate some of the high end of the counter and use a lower
frequency 'tick'.

Do you know how to set up a software timer?


--
JF
 
John and "default", thanks to both of you - I think I have what I need
now :D
 

Welcome to EDABoard.com

Sponsor

Back
Top