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

vlotage detect circuit

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







vlotage detect circuit
PostPosted: Fri Jun 03, 2005 6:45 am     Reply with quote

Hello,
I need to determine when an alternator is running on a tractor. The power system is similar to a car. Vbat=12Vdc or so when the engine is off and 14.2 or so when engine is on. My initial thought was to use a resistive divider to bring the two levels into range of 0-3.3vdc (my supply voltage to a PIC18) and use the A/D to determine what the voltage level is. Looks good on paper. Any body have any experience with this sort of thing?

Thanks in advance
Eaton
treitmey



Joined: 23 Jan 2004
Posts: 1094
Location: Appleton,WI USA

View user's profile Send private message Visit poster's website

PostPosted: Fri Jun 03, 2005 8:34 am     Reply with quote

The old standby is a analog current meter inline with the alt. output.
Are you just trying to do that digitally?

You talked about voltage,... but mostly you want to know the current that is feed back to the battery. Also if the tractor is old, it is probably a DC generator, and not an alternator.

Can you elaborate more,.. What are you trying to do? Is this just for fun?
or is this going to production?
Guest








PostPosted: Fri Jun 03, 2005 11:04 am     Reply with quote

I'm not concerned with the current. I just want to know that the alternator is spinning and the voltage regulator is putting out voltage. a ckt is already in place for other functions and this is an add-on that the customer has requested and i need to do it with the least amount of haedware possible.
treitmey



Joined: 23 Jan 2004
Posts: 1094
Location: Appleton,WI USA

View user's profile Send private message Visit poster's website

PostPosted: Fri Jun 03, 2005 12:48 pm     Reply with quote

I think that is right.
BUT
+12 to Gnd with a simple voltage divider
+12--1k--1k--Gnd
This will half the 12 to 6V between the resisters. Too much!

DO 1/4

+12---1k---1k---1k---1k---Gnd
or
+12--3K---1K--Gnd
That way between 3k and 1k to Gnd should read +3
SCALE BY 1/4
12 volts == 3
14Volts == 3.5V when read by A to D
And you have your window.
ps 3mA 36mW


Woops.. Thats still to high for your 3.3V PIC,... but you get the idea
treitmey



Joined: 23 Jan 2004
Posts: 1094
Location: Appleton,WI USA

View user's profile Send private message Visit poster's website

PostPosted: Fri Jun 03, 2005 12:54 pm     Reply with quote

Anyone know what would happen if you try to read 3.5V on the A to D
with a 3.3V PIC


Smoke? ? ?
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Fri Jun 03, 2005 1:50 pm     Reply with quote

There are tons of voltage divider calculators on the net.
That's the easy way. Put in your max output voltage of 3.3v
and put in your max input voltage of (let's say) 15.0v.
Then put in some reasonable value for your R1 series resistor,
which might be (let's say) 1.0K. Then click Compute.
http://www.raltron.com/cust/tools/voltage_divider.asp
treitmey



Joined: 23 Jan 2004
Posts: 1094
Location: Appleton,WI USA

View user's profile Send private message Visit poster's website

PostPosted: Fri Jun 03, 2005 2:42 pm     Reply with quote

Right you are!
But still. What would happen. This isn't within the spec, right??
I mean, if you try to read A to D thats above the rail.

Does the chip blow.
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Fri Jun 03, 2005 3:00 pm     Reply with quote

He didn't say what PIC he's using, other than "18F", so I'll assume
it's an 18LF452.

In Table 22-21 (A/D Converter Characteristics) of the data sheet, it says
the max analog input voltage (Vain) is AVdd + 0.3v. Since AVdd is 3.3v
in his case, the max analog input voltage is 3.6v.

There are also input protection diodes to ground and Vdd, which will limit
the input voltage to the PIC's A/D circuit to Vdd + 0.6v (which is 3.9v in
his case). But Microchip must have a reason for spec'ing the input
voltage to AVdd + 0.3v (3.6v), so I wouldn't exceed it.
DragonPIC



Joined: 11 Nov 2003
Posts: 118

View user's profile Send private message

PostPosted: Fri Jun 03, 2005 3:01 pm     Reply with quote

My spec for the 16F876A says absolute max is VREF + 0.3V so you should be safe with VREF 3.3V and VAIN 3.5V. Not sure of the accuracy after VAIN>3.3V.
_________________
-Matt
valemike
Guest







PostPosted: Fri Jun 03, 2005 5:14 pm     Reply with quote

Like PCM said, it is clamped to be one diode drop above Vdd and one diode drop below Vss.

I've programmed an application which simply had a 100Kohm resistor in series to the output of a 12V transformer, going the RB0 interrupt. And if you scoped it out, you'd get a pseudo-square wave, whose period is 16ms (60Hz).

I figured this was well above the allowed voltage on any pin, but was told that it was okay because the PIC clamps the voltage, and that we were not exceeding current since the 100K resistor was there.
JohnKennedy



Joined: 12 May 2004
Posts: 38

View user's profile Send private message

PostPosted: Mon Jun 06, 2005 5:49 am     Reply with quote

Why use a PIC at all to do this a simple comparater circuit would suffice and be alot cheaper, or even the TL431.

JFK
DragonPIC



Joined: 11 Nov 2003
Posts: 118

View user's profile Send private message

PostPosted: Mon Jun 06, 2005 10:54 am     Reply with quote

JohnKennedy wrote:
Why use a PIC at all to do this a simple comparater circuit would suffice and be alot cheaper, or even the TL431.

JFK


I believe the PIC already exists for original design. Extra parts would be a couple resistors.
_________________
-Matt
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