View previous topic :: View next topic |
Author |
Message |
bhyatyab
Joined: 26 Jan 2005 Posts: 13
|
Voltage change |
Posted: Tue Feb 08, 2005 4:12 am |
|
|
Hi
I want to connect a PIC to a 3.7V battery which is charged by a car battery (12v.) How do I go about detecting if the car battery is 0v and maybe flash an LED. Can some one please send me the code. Thanks |
|
|
dyeatman
Joined: 06 Sep 2003 Posts: 1934 Location: Norman, OK
|
More info needed |
Posted: Tue Feb 08, 2005 7:27 am |
|
|
A few questions in order here:
1. Do you simply want to know when the battery is pretty much dead? Or do you want to know what voltage the battery is actuially putting out? With the first case you can use a buffer circuit on a digital input pin. In the second case you will have to use an ADC input to monitor the voltage.
2. In either case, to be able to sense 12V with a 5V device, you will have to use a voltage divider on the input to the PIC.
3. What PIC chip will you be using?
4. What CCS compiler version will you be using?
5. I hate to break it to you but the folks here won't do your project for you. We will be glad to give you suggestions and help you get started, BUT the project is assigned to you, not us, and you won't learn by us doing it for you. We will be here to help you debug once you have something put together if it doesnt work the way you hoped it would.
Good Luck! |
|
|
SherpaDoug
Joined: 07 Sep 2003 Posts: 1640 Location: Cape Cod Mass USA
|
|
Posted: Tue Feb 08, 2005 8:35 am |
|
|
If you just want to detect the presence or absence of the 12V, and the 12V comes in through a polarity protection diode, you can just use a voltage divider. Connect the divider to the battery side of the diode. Set it so that at max voltage (16V for an automobile system???) the voltage out of the divider is safe for the PIC, in this case 3.7V. Use high resistor values and a cap so that the PIC pin is protected, like a 300K divider with .1uF. Then at 1/2 of 16V or 8V the PIC pin is also at 1/2 voltage and starts to switch from 1 to 0 indicating the 12V is missing. The exact threashold will vary with temperature etc. The PIC datasheet will tell you more. _________________ The search for better is endless. Instead simply find very good and get the job done. |
|
|
rwyoung
Joined: 12 Nov 2003 Posts: 563 Location: Lawrence, KS USA
|
|
Posted: Tue Feb 08, 2005 8:53 am |
|
|
Beware load dump from the alternator. Protecting from just 16V won't cut it. Think 45V and higher spikes. _________________ Rob Young
The Screw-Up Fairy may just visit you but he has crashed on my couch for the last month! |
|
|
|