CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to CCS Technical Support

Zero Crossing Hardware question

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
sadlpx



Joined: 19 Feb 2004
Posts: 23

View user's profile Send private message

Zero Crossing Hardware question
PostPosted: Sun Dec 16, 2007 7:53 am     Reply with quote

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

View user's profile Send private message

Re: Zero Crossing Hardware question
PostPosted: Sun Dec 16, 2007 10:33 am     Reply with quote

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







PostPosted: Sun Dec 16, 2007 11:14 am     Reply with quote

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

View user's profile Send private message Send e-mail Visit poster's website

PostPosted: Sun Dec 16, 2007 11:19 am     Reply with quote

Forum wasnt taking my posts for some reason.. Crying or Very sad

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

View user's profile Send private message

PostPosted: Sun Dec 16, 2007 2:08 pm     Reply with quote

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

View user's profile Send private message

PostPosted: Sun Dec 16, 2007 2:57 pm     Reply with quote

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







PostPosted: Sun Dec 16, 2007 4:26 pm     Reply with quote

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

View user's profile Send private message

PostPosted: Mon Dec 17, 2007 2:10 am     Reply with quote

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

View user's profile Send private message

PostPosted: Mon Dec 17, 2007 10:26 am     Reply with quote

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








PostPosted: Mon Dec 17, 2007 3:55 pm     Reply with quote

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.
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group