Topics Topics Edit Profile Profile Help/Instructions Help Member List Member List  
Search Last 1|3|7 Days Search Search Tree View Tree View  

Safe way to measure a voltage from th...

:: EPE Chat Zone ­:: ­Radio Bygones Message Board :: » EPE Forum Archives 2007-2009 » Archive through 21 August, 2007 » Safe way to measure a voltage from the 'outside' on a PIC ? « Previous Next »

  Thread Last Poster Posts Pages Last Post
  ClosedClosed: New threads not accepted on this page        

Author Message
Top of pagePrevious messageNext messageBottom of page Link to this message

nielsejner
Regular Contributor
Username: nielsejner

Post Number: 25
Registered: 06-2005

Rating: N/A
Votes: 0 (Vote!)

Posted on Sunday, 12 August, 2007 - 10:38 am:   Edit Post Delete Post Print Post    Move Post (Moderator/Admin Only)

Is there a safe way to apply a voltage that may always be present even when the pic is not powered, or in case that the supply for the pic got short circuited, to an analouge input of a pic ?

I am putting the voltage from the battery (12V. trough a resistor network, dividing to max 5V.) on a pics analouge port to measure the condition of the battery, and to turn of the circuit when there is a risk of decharging the battery too much.

I was recently told that it was risky to do so because in case the supply voltage of the pic was lower than the voltage on the input pin the input pin would supply the whole circuit, eventually overloading and destroying itselv.

If someone could illustrate what it takes, to safely put a LED, and two resistors in serie from 12V. to ground, and to use the point between the two resistors to measure the voltage of the battery I would appreciate it.

Sejner
Top of pagePrevious messageNext messageBottom of page Link to this message

john_becker
:::: Super User ::::
Username: john_becker

Post Number: 1523
Registered: 05-2005

Rating: N/A
Votes: 0 (Vote!)

Posted on Sunday, 12 August, 2007 - 11:30 am:   Edit Post Delete Post Print Post    Move Post (Moderator/Admin Only)

Sejner, I cant help directly on your question, but there are battery monitoring chips designed to respond when batteries get low. I've never used one so cant give a part number.

Beware that you cannot use the PIC's ADC to obtain a battery value as the value it produces is dependent on the PIC's supply voltage
Top of pagePrevious messageNext messageBottom of page Link to this message

nielsejner
Regular Contributor
Username: nielsejner

Post Number: 26
Registered: 06-2005

Rating: N/A
Votes: 0 (Vote!)

Posted on Sunday, 12 August, 2007 - 12:41 pm:   Edit Post Delete Post Print Post    Move Post (Moderator/Admin Only)

Hi John.

Cannot help me, because you do not know, or because you think that it is not possible ?

Doing what i did - in good faith - is dead simple and cheap, and have been in use for more than 18 months without damaging anything. (Four 12V. halogen lamps PWM'ed from a PIC, all supplied from a 12V. dry cell battery, simulating light from a fireplace, for use in a theatre.) However I do realize that there is an potential danger for the PIC, when doing it this way, so therefore looking for a safer way to measure the condition of the battery.

The last part of your letter I do not understand. The PIC is supplied from a 5V reg. The LED and the two resistors is supplied directly from the battery. The point between the resistors carries about half the battery voltage minus the LED's voltage drop. (Allways less than 5 volts.) This point is taken directly to an analouge input and measured.

Sejner
Top of pagePrevious messageNext messageBottom of page Link to this message

steerpike
Frequent Contributor
Username: steerpike

Post Number: 255
Registered: 05-2005


Rating: N/A
Votes: 0 (Vote!)

Posted on Sunday, 12 August, 2007 - 01:22 pm:   Edit Post Delete Post Print Post    Move Post (Moderator/Admin Only)

Pic inputs are high impedance, so if you use a high value series resistor on each input, you will still be able to read reliable data levels, but in the case of power supply failure, hardly any current will flow.
Another solution is a diode from +5v to each input pin (cathode to +5v, anode to pic input pin.). If the power supply goes to zero, the diode conducts and pulls the data input to (close to) zero. (YOU MUST USE A CURRENT LIMITING RESISTOR ON THE DATA LINE, or you will damage whatever circuit is supplying the data, or blow up the diode)
Top of pagePrevious messageNext messageBottom of page Link to this message

john_becker
:::: Super User ::::
Username: john_becker

Post Number: 1525
Registered: 05-2005

Rating: N/A
Votes: 0 (Vote!)

Posted on Sunday, 12 August, 2007 - 06:48 pm:   Edit Post Delete Post Print Post    Move Post (Moderator/Admin Only)

Sejner, if you're powering the PIC off a 5V reg, then no problem about using it to sense another voltage via a divider. I've done similar in my PIC controlled PSU of many years ago.

I cant see any potential problem as the Rs will protect the PIC when it's power is switched off. I assumed your PIC was controlled by the same decaying supply. Hope I've understood you correctly this time.

J
Top of pagePrevious messageNext messageBottom of page Link to this message

zeitghost
Frequent Contributor
Username: zeitghost

Post Number: 841
Registered: 01-2006

Rating: N/A
Votes: 0 (Vote!)

Posted on Monday, 13 August, 2007 - 09:02 am:   Edit Post Delete Post Print Post    Move Post (Moderator/Admin Only)

The inputs and outputs of PICs are protected by diodes to the ground and V+ rails.

So long as you use a potential divider/current limiting resistor, you ought to be ok.

Sometimes you can have problems if sufficient current is dumped through i/o pins to prevent the V+ decaying properly, which may prevent a proper power on reset.

(I've seen this with a 6303 system where the RS232 via a Max232 provided enough voltage to stop the thing resetting... though in that case the Max232 was still running and converting the RS232 voltages to +2V or so... who'd have thunk it?).
Top of pagePrevious messageNext messageBottom of page Link to this message

nielsejner
Regular Contributor
Username: nielsejner

Post Number: 27
Registered: 06-2005

Rating: N/A
Votes: 0 (Vote!)

Posted on Tuesday, 14 August, 2007 - 05:13 pm:   Edit Post Delete Post Print Post    Move Post (Moderator/Admin Only)

Thanks for all of your advices.

I will stick to a serial resistor to the input.

Sejner.

Administration Administration Log Out Log Out   Previous Page Previous Page Next Page Next Page