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

Detecting the presence of 'high' voltage

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



Joined: 02 Mar 2004
Posts: 49

View user's profile Send private message

Detecting the presence of 'high' voltage
PostPosted: Sat Jun 18, 2005 5:42 am     Reply with quote

I am working with a simple data logger using PIC12F683. The Vdd is supplied through an LDO with 2.5V output and the main power source is 'any' battery combination which can be from 3V to 12V.

I am trying to use one of GPIO to monitor the presence of the main battery power using digital input (not AI) with interrupt-on-change feature. When the main power goes down, it has to save the current status to data eeprom and go to sleep till the power is back with the some power stored in a capacitor.

My question is :-

Is it safe to connect a large value resistor such as 100K or 1M directly from the main power (3V - 12V) to the GPIO?

Since the battery voltage can be variable depending on the battery sets, voltage divider will not work to trigger with low battery voltage. (or will it?)

I am expecting that the current flow to the GPIO from the main power is limited to less than 1mA and the over-voltage clamping diode within the PIC shall be able to handle 12V without being damaged.

But I am hoping to get confirmation or some advices on other possible ways.

Thanks in advance.

-- dj
SherpaDoug



Joined: 07 Sep 2003
Posts: 1640
Location: Cape Cod Mass USA

View user's profile Send private message

PostPosted: Sat Jun 18, 2005 6:33 am     Reply with quote

Look up Micochip application note AN521. It describes simple manufacturer recommended ways to connect upto 220VAC to a digital I/O pin.
_________________
The search for better is endless. Instead simply find very good and get the job done.
djpark



Joined: 02 Mar 2004
Posts: 49

View user's profile Send private message

PostPosted: Sat Jun 18, 2005 7:03 am     Reply with quote

Thanks for letting me know.

I consider the answer to my question is "yes"!?

For max 500uA current for 12V, min 24K resistor is to be used. So I am going with much bigger one like 470K.

-- dj
libor



Joined: 14 Dec 2004
Posts: 288
Location: Hungary

View user's profile Send private message

PostPosted: Sun Jun 19, 2005 5:32 am     Reply with quote

I use an added external clamping diode (Schottky), and a clamping zener together with a small capacitor (as part of an RC filter) for a similar purpose (checking AC power presence),
Somehow I felt unsecure letting in the noisy main power or unregulated DC into the PIC in any way. (I do precise A/D conversion on the adjacent pins) Also felt kinda sympathy for the buit-in clamping diode in the PIC doing it alone.

Note regarding the 220VAC: be sure to use resistors with a high voltage rating, ie. small SMD chip resistors are not suitable for this, some dust + moisture and they will let the 220VAC straight thru. I use large, 2W metal-oxide resistors, because of their mechanical size giving a reliable 220VAC spark gap. (check for resistor's max. voltage rate in their datasheets) This also has to do with the human safety considerations.
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