PDA

View Full Version : Low Voltage Detection - 16F628A



charudatt
- 24th April 2006, 19:49
Hello Guru's

for one of my project , I use a 16F628A, and am interested in detecting a low voltage condition , to blink an LED.

Any ideas , how i can do that. Needless to say that the project is battery driven. 4 x 1.5V = 6V.

regards.

paul borgmeier
- 24th April 2006, 21:22
How low is low? 3 V? 1V? 01.V? 1uV?

Paul Borgmeier
Salt Lake City, Utah
USA

mister_e
- 25th April 2006, 00:24
My best tip will be to use internal comparator interrupt for that. As they can accept a higher input impedance, it's suitable for battery powered stuff.

charudatt
- 25th April 2006, 03:38
Sir, considering i am using a 16F828A, i can detect a min of 3V.

Any idea on how to use the internal Comparator for detecting a low voltage situation.

Thank you for your help.

regards.

mister_e
- 25th April 2006, 03:58
a regular 16F628, depending of the crystal speed, is suppose to work from 3V to 5.5V. Detecting a 3V may work great or not. What i'll personnaly do is to use the 16LF628 wich work down to 2V. That's my own opinion.

What i usually do, and some may have another opinion, is to use an LF serie and a LDO voltage regulator. This give me a stable voltage reference to compare against the battery voltage. That way it work.

One way to do it...
Datasheet section 9.1 use mode 101 (one comparator)
Poll C2OUT bit of CMCON

OR Interrupt
Enable Comparator interrupt (see PIE1 register 4.2.2.4)
.
.
.
your code.
.
.
.
Interrupt routine
Blink your LED
Clear Comparator interrupt flag CMIF (PIR1 register 4.2.2.5)
Resume Interrupt.


Without any voltage regulator it's not impossible but you need a stable voltage reference... i remind one of my bench stupid idea in the past : use an I/O to supply a Resistor + Zener Diode for the voltage reference... worked. But as Zener diode need few mA to work properly... it's not suitable for a battery powered system... IMHO

Jerson
- 25th April 2006, 06:32
Take a look at the MC34064 low voltage detector. Connect this to a port pin and check the pin to decide if you want to blink the LED

Jerson

Melanie
- 25th April 2006, 08:38
Use the 16F628A's COMPARATORS, this is exactly what they can be used for...

Many years ago, I did a Comparator tutorial on the piclist, a link to the archive where it can be found is here...

http://list.picbasic.com/forum/messages/3064/3607.html?1020960642

By configuring the internal Voltage Reference Module (Datasheet secion 11), you can detect voltages as low as around 208mV, by using two Resistors (Potential Divider from 5v rail) as external Reference, you can get even lower. See the Datasheet (Table 17-2) for the Comparator Specification for exactly how low. Theoretically by setting the Reference to 0v you might be able to detect a positive going voltage as low as 10mV, though I haven't tried that.

Acetronics2
- 25th April 2006, 09:30
Take a look at the MC34064 low voltage detector. Connect this to a port pin and check the pin to decide if you want to blink the LED

Jerson

Hi, Jerson

As the 34064 detects 4.65v ... how do you do this kind of miracle ???

Alain

Jerson
- 25th April 2006, 11:30
Hi Alain

Since Charudutt did not specify how low is low voltage for him, I assumed. Anyway, I have a similar app where I use 6V for supply and 4.65 is low enough for the circuit to stop operating correctly.


Jerson

paul borgmeier
- 25th April 2006, 15:46
... detecting a low voltage condition , to blink an LED. ...
regards.

It is still not clear (to me) what you are trying to do - Are you trying to detect a low voltage condition of your 6V battery supply? In other words, do you want to monitor the 6V battery supply and then blink an LED when the batteries have reached 3V?

If you are detecting a low voltage condition of something else other than the Vdd of the 16F628A then Melanie's comparator primer (as suggested by Steve) is the approach and method you want.

If you are trying to do what I asked in my first paragraph of this post, then the internal comparators will not work without additional "efforts" because the internal reference voltage for the comparator is based on the Vdd supplied to the PIC.

Are you using a voltage regulator?
(6V is too high for a PIC and will damage it with time)

Paul Borgmeier
Salt Lake City, Utah
USA

Acetronics2
- 25th April 2006, 18:40
[QUOTEIf you are trying to do what I asked in my first paragraph of this post, then the internal comparators will not work without additional "efforts" because the internal reference voltage for the comparator is based on the Vdd supplied to the PIC.

Hi, Paul

Just compare a 2.5v ref ( or a Zener !!! ) to Vdd ( through a res. divider ...) and comparators will work fine here !!!

That's also how you can detect voltages w/ Logic CMOS, connecting a Zener to an input. ( input "level" changes at VDD/2 ... )

More difficult ( just a little ) is to play with Pics TTL inputs trip point that is a function of VDD ...
Experience shows the trip point is precise enough.

Alain

paul borgmeier
- 25th April 2006, 19:20
Just compare a 2.5v ref ( or a Zener !!! ) to Vdd ( through a res. divider ...) and comparators will work fine here !!!



Alain,

That is exactly what I meant in my post by "additional efforts." I did not want to go through the formal explanation if Charudatt was doing something different (which still is not clear to me from his/her posts). If it were me, I would ADC measure a reverse Zener or forward LED voltage. When the ADC value rose to a cutoff level (because the Vdd would be decreasing), I would flash the LED. You also could use the internal comparator in a similar manner. However, the specifics depend on whether or not Charudatt is using a regulator, anticipated temperature conditions, the problem Charudatt is trying to solve, etc. - I was looking for more input before providing more options. I think we match on how we would solve the scenario asked in my earlier reply. Now charudatt has lots of options.

Charudatt, please let us know how it turns out.

Paul Borgmeier
Salt Lake City, Utah
USA

charudatt
- 26th April 2006, 05:28
Sorry for the late reply,

Yes, I am using a LF series 628 in my application. My application works on 6V and I have a LDO for 4.5V to the PIC. I am building a Smart sensor for Crane Safety (which is battery Operate) and requires a HPWM output and a LO BAT Voltage Indication.

Melanie's excellent tutorial, helps me think in this direction more positively. Initially I planned to use a 16F676 and use the onboard ADC. but the software PWM gave me a problem. The Only next option was to use the LF628 with onboard comparators.

I have gots some excellent advise (as I always have) to try it out and see what suits me the most.

So now I can experiment with all your advice and post my results on it.

regards