View previous topic :: View next topic |
Author |
Message |
sadlpx
Joined: 19 Feb 2004 Posts: 23
|
Zero Crossing Hardware question |
Posted: Sun Dec 16, 2007 7:53 am |
|
|
This is a hardware question but i did not know where else to ask. I'm working on a AC diming project with multipule channels (ok christmas lights). I need to detect the zero crossing point of the AC line. I've read Picref-4 but gut feel says AC into PIC with just a 20m resistor is suicide. Any help or comments appreciated. |
|
|
RLScott
Joined: 10 Jul 2007 Posts: 465
|
Re: Zero Crossing Hardware question |
Posted: Sun Dec 16, 2007 10:33 am |
|
|
A 20M resistor is safe. Even if the input voltage were 4800 volts, the resistor would only allow 240 microamps of current, which is easily absorbed by the protection diodes in the PIC. These diodes will ensure that the voltage at the pin never goes more than about half a volt outside of the power supply rails. If you are worried, then add extra protection diodes off your own - Schottky diodes - which will start conducting before the diodes in the PIC.
Robert Scott
Ypsilanti, Michigan |
|
|
Ttelmah Guest
|
|
Posted: Sun Dec 16, 2007 11:14 am |
|
|
The key question, is the _nature_ of the resistor, and the board it is on. The current at 20M, is very low, but you need to be thinking 'what happens if it fails'. This is why you will often see such droppers done with two series resistors (this way if one fails 'short circuit', you only get a double current). Oher thing is to add a SCR crowbar on the 5v rail, at (say) 5.2v.
Personally though, I'd just use an opto-isolator. Somewhat larger resistor feeding the LED on this. Use an AC input type, and it'll go off, when the AC input is at zero. Just what you want, and safe...
Best Wishes |
|
|
SET
Joined: 15 Nov 2005 Posts: 161 Location: Glasgow, UK
|
|
Posted: Sun Dec 16, 2007 11:19 am |
|
|
Forum wasnt taking my posts for some reason..
Anyway, was just going to say the same. you really should use 2 resistors for fault tolerance. And optos are cheap - put the LED side inside a bridge rectifier driven from the mains signal (via dropper resistors) and you get a nice zero-cross edge either side of the mains zero point. |
|
|
sadlpx
Joined: 19 Feb 2004 Posts: 23
|
|
Posted: Sun Dec 16, 2007 2:08 pm |
|
|
Thanks for the help.
1) Are you recomending 2x by 20M in parrallel or 2x 40m ?
2) Did not know there was an AC input optoisolator, agree that is the best solution. got a part number. |
|
|
ckielstra
Joined: 18 Mar 2004 Posts: 3680 Location: The Netherlands
|
|
Posted: Sun Dec 16, 2007 2:57 pm |
|
|
sadlpx wrote: | 1) Are you recomending 2x by 20M in parrallel or 2x 40m ? | Ttelmah said to use 'two series resistors'. With two resistors in parallel you will weaken the security instead of improving it. Use two 10M resistors in series.
Quote: | 2) Did not know there was an AC input optoisolator, agree that is the best solution. got a part number. | A cheap standard DC opto-isolator (with added reverse diode) will do the same trick. |
|
|
Ttelmah Guest
|
|
Posted: Sun Dec 16, 2007 4:26 pm |
|
|
There are literally hundreds of AC input opto's around. KB814, KB354NT, HCPL-3700, TIL195, H11AA1 etc. etc..
Many of them are nearly as cheap as the normal versions now.
As a comment, by 'bigger resistor', when referring to this, I am talking wattage. Even drawing only a small mA level, the total power rises somewhat, compared to the direct input drive...
Best Wishes |
|
|
libor
Joined: 14 Dec 2004 Posts: 288 Location: Hungary
|
|
Posted: Mon Dec 17, 2007 2:10 am |
|
|
Ttelmah wrote: | by 'bigger resistor', when referring to this, I am talking wattage. |
...and isolation voltage also comes with the physical size. Even if a SMD resistor might be enough regarding the wattage but they're rated for 50-100-150 Volts max. safely only.
...after years of working some dirt can build up in a device, then comes some moisture (e.g. dew) and a small size resistor can easily become a good conductor. |
|
|
PICdawg
Joined: 13 Dec 2007 Posts: 17
|
|
Posted: Mon Dec 17, 2007 10:26 am |
|
|
As the others have said, I'd highly recommend using an AC input, phototransistor optocoupler for isolation purposes. Cheap part, readily available from DigiKey, Mouser, etc. I built a PIC based holiday light controller a couple weeks ago and used the H11AA1. Put a 15K 1/2 W resister on each side of the input diodes and connect to the AC line. Put a 10K pullup on the output side from the collector to Vdd, ground the emitter, and run the collector point into the PIC for nice 120hz pulse. I used the ext interrupt pin B0.
Also, do not use a zero-cross type triac for your output photocoupler or load switch. You won't be able to do any dimming!
Mine has been running 24/7 and it works great! |
|
|
Guest
|
|
Posted: Mon Dec 17, 2007 3:55 pm |
|
|
If this is for a product you should find out what regulatory requirements are first. In North America it's UL/CSA and in Europe it's EN's.
These specifications WILL impose limits on your optocoupler package possibilities.
If this is just for a one off or a limited run lab equipment then be careful and make sure you ground the chassis very well.
HTH - Steve H. |
|
|
|