Maker Pro
Maker Pro

using a triac and a PIC at a wall switch

R

Robert A Moeser

hi!

i want to replace a wallswitch with a triac and a PIC. i have a working
circuit using a triac, an opto-isolator and a PIC.

i have access to only the two wires in the wall switch, so for now the
PIC power supply is a battery. can you say "yuck"? :)

i would like to have 5 volts at, say, 15 mA available in the wall switch
using mains power only. i think this is possible, as i have a commercial
motion detector wall switch, using a Holtek HT7611, and it connects only
where the switch would have been.

i posted a schematic on ABSE from the HT761X data sheet, all of which i
found at

http://tinyurl.com/ne95

i see (sort of) how it develops a local low voltage DC supply for the
electronics when the triac is off. what i don't see is how it continues
to do so when the triac is on.

in any case, it seems to do something like what i need. have you a
similar circuit or an idea of how the Holtek version works i can exploit?

-- rob
 
R

Robert Monsen

Robert A Moeser said:
hi!

i want to replace a wallswitch with a triac and a PIC. i have a working
circuit using a triac, an opto-isolator and a PIC.

I did this recently. The circuit is

1000 ohm 2W
AC Hot ____ ___
------|_--_|----|___|-+
| 0.47uF 250V (Should be at least X2 rated, I
belive)
100mA ---
---
| 1000uF Rload
+->|-+--------+----+----------------
| | | | |
- - | | .-.
^ ^ --- - | |
| | --- ^ | |
+->|-+ | | '-'
| | | | |
+-------------+----+----------------
| Zener
AC Neutral |
----------------------------
created by Andy´s ASCII-Circuit v1.24.140803 Beta www.tech-chat.de

I used a 7805 across the load, but I don't think its necessary for a PIC
circuit. Just use a 5.1V zener.

In the US, black is hot, and white is neutral. Green or bare wire is ground.
Ground should be within about 3.5V of neutral.

The resistor gets slightly warm, but not warm enough to hurt anything. The
entire power supply fits in about 2 sq inches of PC board. Most of it is the
capacitor. Those X2 caps are big.

Regards,
Bob Monsen
 
D

DaveC

Thanks, I've seen this before... These power supplies connect ground
to neutral through a fuse to detect improperly wired outlets. If the
outlet is wired backwards, the fuse will immediately blow.

My question is, is it good practice to connect neutral to ground?

Thanks,
Bob Monsen

I'm sure it is also done for improperly wired devices as much as it is
outlets. If you tie Neutral to ground with out a fuse then your whole house
and every device in it will be connected this way. If it was so simple then
why would plugs have three pins on them?

Having said that I dont have the expert's to be telling you this,.. but
I'll be safe and say NO!


DaveC
 
M

Michael A. Terrell

Robert said:
Thanks, I've seen this before... These power supplies connect ground to
neutral through a fuse to detect improperly wired outlets. If the outlet is
wired backwards, the fuse will immediately blow.

My question is, is it good practice to connect neutral to ground?

Thanks,
Bob Monsen

No, it defeats the entire concept if you tie them together. If they
are bonded, a piece of equipment can continue to work with a damaged
power cord. Then it gets plugged into a bad outlet with no ground. the
equipment doesn't work, and any exposed metal that is normally grounded
now has almost full line voltage on it, if the power switch is turned
on.

Also, you always want to verify that the AC line is connected to the
rear terminal of a fuse holder so you can't make contact with the AC
line voltage while changing a fuse.
 
R

Robert A Moeser

hi!

thank you for the circuits, pointers and ideas.

i will remember the circuits, but in this case i have only the two wires
at the switch, so what i need is not a transformerless 5 volt power
supply, i need the trick played in the schematic i posted on ABSE. i
think Spehro is probably correct about playing a game in the firmware.

i am also charmed by Ian's idea of shutting the power off for a half
cycle every once in a while.

if i get brave i'll take a closer look at the commercial motion-detector
wall switch which works somehow. it is not an exact implementation of
the Holtek app note circuit but uses the part, which does use
zero-crossing in some way. i assumed it was just to minimize switching
trash, but mebbe not.

BTW, when i was testing it it did indeed have a current through it,
enough to make a 7 watt lamp glow dimly. is this a code violation? it is
UL approved or listed and offered to "anyone" at Home Depot.

or is code satisfied by the three position switch, on-auto-off, where on
is just on, auto detects motion and off breaks the circuit completely.

-- rob
 
U

Uns Lider

Thanks, I've seen this before... These power supplies connect ground to
neutral through a fuse to detect improperly wired outlets. If the outlet is
wired backwards, the fuse will immediately blow.

I remember reading what I believe is the app note you're talking about. It
appeared to me that the example circuit had not been thought through. The
fuse is not in the path of the power supply circuit, so what's supposed to
happen after it blows? Magic, perhaps?

-- uns
 
R

Robert Monsen

Uns Lider said:
I remember reading what I believe is the app note you're talking about. It
appeared to me that the example circuit had not been thought through. The
fuse is not in the path of the power supply circuit, so what's supposed to
happen after it blows? Magic, perhaps?

-- uns

I don't think the fuse is meant to protect against shorts in the circuit.

If the fuse blows, that means the plug is miswired, and the neutral wire is
actually hot. If this is the case, the neutral wire (which is actually hot)
is disconnected from the circuit and ground, and everybody is happy (except
the user who replaces the fuse, again and again, never taking the hint, and
possibly getting electrocuted when he touches the fuse...)

However, if the plug is actually wired properly, then there is no fusing at
all, since ground and neutral are close enough so that the current through
them is hopefully lower than the limit on the fuse. If there is a short in
the circuit for some reason, I guess the hope is that the breaker will trip.

My question centered around whether connecting ground to neutral was bad. I
think it probably is, because the ground return for all the appliances on
the same circuit is going to go through that fuse as well ( the path to
ground through the fuse will be lower impedance than the one back to the
box, I think.) Thus, Fred Bloggs joking suggestion that the fuse be 15A...

However, this leads to another question. What is a good way to detect a
miswired plug, and disconnect the circuit? A non-isolated power supply is
potentially fatal to touch unless there is a foolproof way to do this.

Regards,
Bob Monsen
 
S

Spehro Pefhany

However, this leads to another question. What is a good way to detect a
miswired plug, and disconnect the circuit? A non-isolated power supply is
potentially fatal to touch unless there is a foolproof way to do this.

You physically prevent any possibility of the user touching the
output. If there's a possibility you spend the money to add isolation
(transformer or SMPS with transformer).

Best regards,
Spehro Pefhany
 
U

Uns Lider

If the fuse blows, that means the plug is miswired, and the neutral wire is
actually hot. If this is the case, the neutral wire (which is actually hot)
is disconnected from the circuit and ground, and everybody is happy (except
the user who replaces the fuse, again and again, never taking the hint, and
possibly getting electrocuted when he touches the fuse...)

I went back and looked at the schematic, and it turns out I was wrong -- the
circuit does "work" as designed. What slipped my mind is that with the plug
backwards, the circuit to be powered would be between ground and real
neutral (nominal live), so it wouldn't run.

However, I still think the design is very bad. The user plugs it into a
miswired outlet, the fuse blows, the circuit doesn't operate. So far so
good. Then the user takes it out and tries it in a correctly wired
outlet. The circuit powers up and starts merrily dumping current into
ground. Since this is an old, badly wired house we're talking about,
there is no GFCI, and everything appears to be running OK. Satisfied,
the user goes to take a shower, and gets fatally electrocuted to death
by the 6 billion megaamp pipe.

-- uns
 
S

Spehro Pefhany

However, I still think the design is very bad. The user plugs it into a
miswired outlet, the fuse blows, the circuit doesn't operate. So far so
good. Then the user takes it out and tries it in a correctly wired
outlet. The circuit powers up and starts merrily dumping current into
ground. Since this is an old, badly wired house we're talking about,
there is no GFCI, and everything appears to be running OK. Satisfied,
the user goes to take a shower, and gets fatally electrocuted to death
by the 6 billion megaamp pipe.

How about when they plug it into a two-wire extension cord? A 50:50
chance that anything "grounded" on the unit is now "hot" (with Fred's
15A fuse in series)?

I'd be very, very surprised if UL or CSA would ever approve anything
like that.

Best regards,
Spehro Pefhany
 
F

Fred Bloggs

Spehro said:
How about when they plug it into a two-wire extension cord? A 50:50
chance that anything "grounded" on the unit is now "hot" (with Fred's
15A fuse in series)?

I'd be very, very surprised if UL or CSA would ever approve anything
like that.

Best regards,
Spehro Pefhany

It wouldn't come on at all- because the GND pin is not connected. The
Microchip application is not the only place you can find that hookup.
 
S

Spehro Pefhany

It wouldn't come on at all- because the GND pin is not connected.

Line & Neutral is enough, n'est pas? Why would you need GND if the
fuse is intact? The GND pin (hanging off the end of the extension
cord) could also be hot, of course.
The Microchip application is not the only place you can find that hookup.

Okay, I'll bite, where else, especially in a UL/CSA approved *product*
have you seen this?

Best regards,
Spehro Pefhany
 
R

Robert Monsen

Uns Lider said:
I went back and looked at the schematic, and it turns out I was wrong -- the
circuit does "work" as designed. What slipped my mind is that with the plug
backwards, the circuit to be powered would be between ground and real
neutral (nominal live), so it wouldn't run.

However, I still think the design is very bad. The user plugs it into a
miswired outlet, the fuse blows, the circuit doesn't operate. So far so
good. Then the user takes it out and tries it in a correctly wired
outlet. The circuit powers up and starts merrily dumping current into
ground. Since this is an old, badly wired house we're talking about,
there is no GFCI, and everything appears to be running OK. Satisfied,
the user goes to take a shower, and gets fatally electrocuted to death
by the 6 billion megaamp pipe.

That isn't going to happen. Your user, unless she is made of copper, is
nowhere near as conductive as the pipe going to ground. Thus, no current
will go through her. (not that I would test this with my daughter in the
tub... I'm just too fond of her to trust her to the laws of physics. Maybe
my wife...)

The problem with baths (and why they require GFI plugs in bathrooms in new
construction) is that if you drop something 'hot' into the water, your body
(being composed of a good electrolyte: salt water) is far more conductive
than the water in the tub. Thus, the current passes through you in
preference to the non-salinated water. Bzzzap!
 
R

Robert Monsen

Fred Bloggs said:
It wouldn't come on at all- because the GND pin is not connected. The
Microchip application is not the only place you can find that hookup.

Seems like the circuit could be made better by applying a resistor in series
with the fuse. Then, the path to ground is more conductive through the
neutral wire for everybody else on the circuit, but if the plug is miswired,
you get more current through the fuse. With a 1k resistor, you could use a
100mA fuse. In normal situations, you get only 3 mA from the 3V disparity in
voltage, but when the plug is miswired, you get 165mA, which hopefully blows
the fuse. If everybody else on the circuit was active, and your return to
ground through neutral is, say 5 ohms (thats 2000 ft of #14 wire), then you
have

5
---- X 15A = 75mA
1005

The circuit is still preferentially dumping current through the local
ground, however, which may not be good.

However, what I really want is a detection circuit to enable me to shut off
power with a triac if there is a miswire. Then, the circuit simply doesn't
work with a miswired plug, and I can use ground for the right thing, which
is grounding the case. Maybe an LED could go on to alert the user if the
plug is miswired.

Regards,
Bob Monsen
 
F

Fred Bloggs

Spehro said:
Line & Neutral is enough, n'est pas? Why would you need GND if the
fuse is intact? The GND pin (hanging off the end of the extension
cord) could also be hot, of course.

Right- brain out the window with two hours of sleep....
Okay, I'll bite, where else, especially in a UL/CSA approved *product*
have you seen this?

Some dimmers...but these are wired in and not plugged.
 
Top