Yahoo Groups archive

AVR-Chat

Index last updated: 2026-04-28 22:41 UTC

Thread

low-battery detection, ADC, and ICP of mega16

low-battery detection, ADC, and ICP of mega16

2004-05-20 by jay marante

here's what i wanted to do:
 
first, i wanted to determine if the battery back-up supply is low on voltage output.
i had the circuit this way:
    main ---------------- >| ------------
                                             \__________________  dc-dc converter
                                             /
   battery -------------- >| ------------                                         * >|     - diode
 
max battery voltage : 12V
 
the max639 dc-dc converter has a low-battery output(LBO)  pin that goes low when the battery input(LBI) is less than the reference voltage of about 1.23V. the LBI pin is connected to the main power supply. im planning to connect the LBO pin to ICP of mega16 and the battery output to ADC input 7 of the chip. to have the battery voltage lowered to 5V before it goes in the ADC pin, i have this circuit:
 
      battery 
         |
        <
        > 1.3 Mega ohm
        <
         |
         |------------------- ADC7   ~ 5V as simulated in multisim
         |
        <
        > 10ohm
        <
         |
     GND
 
now, when circuit switches to the back-up battery, the LBI goes low; which in turn, switches the LBO low.
my question is: 
1. will the ICP work even if timer1 is off? i won't enable the timer, only the ICP interrupt bit. i cannot use the external interrupts since i have these pins connected to other devices. i'll use this interrupt to start an ADC conversion.
2. i don't know much of the ADC of mega16. i understand the datasheet says that it can be configured to use the AVCC as the reference voltage. does this mean that the AVCC pin can be connected to VCC?
3. the datasheet also says that the there should be an external capacitor at the aref pin. what should be the capacitor value?
 
thanks for the help.
-jay

		
---------------------------------
Do you Yahoo!?
Yahoo! Domains - Claim yours for only $14.70/year

Re: [AVR-Chat] low-battery detection, ADC, and ICP of mega16

2004-05-20 by Bruce Parham

jay marante wrote:
> 
> here's what i wanted to do:
> 
> first, i wanted to determine if the battery back-up supply is low on voltage output.
> i had the circuit this way:
>     main ---------------- >| ------------
>                                              \__________________  dc-dc converter
>                                              /
>    battery -------------- >| ------------                                         * >|     - diode
> 
> max battery voltage : 12V
> 
> the max639 dc-dc converter has a low-battery output(LBO)  pin that goes low when the battery input(LBI) is less than
> the reference voltage of about 1.23V. the LBI pin is connected to the main power supply. im planning to connect the
> LBO pin to ICP of mega16 and the battery output to ADC input 7 of the chip. to have the battery voltage lowered to 5V
> before it goes in the ADC pin, i have this circuit:
> 
>       battery
>          |
>         <
>         > 1.3 Mega ohm
>         <
>          |
>          |------------------- ADC7   ~ 5V as simulated in multisim
>          |
>         <
>         > 10ohm
>         <
>          |
>      GND
> 
> now, when circuit switches to the back-up battery, the LBI goes low; which in turn, switches the LBO low.
> my question is:
> 1. will the ICP work even if timer1 is off? i won't enable the timer, only the ICP interrupt bit. i cannot use the
> external interrupts since i have these pins connected to other devices. i'll use this interrupt to start an ADC
> conversion.
> 2. i don't know much of the ADC of mega16. i understand the datasheet says that it can be configured to use the AVCC
> as the reference voltage. does this mean that the AVCC pin can be connected to VCC?
> 3. the datasheet also says that the there should be an external capacitor at the aref pin. what should be the
> capacitor value?
> 
> thanks for the help.
> -jay
> 

Let's see now, I = E/R so I[10 ohm res] = 5/10 = 0.5 Amps.  
And E = I*R so E[1.3 Meg res] = 0.5 * 1.3e+6 = 6.5E+5 Volts or 650 KV. Wow, some battery!

(Typical SPICE result...)

Bruce

P.S.: I do wish thay would go back to teaching real EE.

Re: [AVR-Chat] low-battery detection, ADC, and ICP of mega16

2004-05-21 by jay marante

are you sure you got your formulas right?!  
that's just a voltage divider and im pretty sure you can't generate 650kV from a 12V battery. im sorry but i can't remember the formula for the voltage divider circuit. 
maybe someone might confirm that the multisim was right with its output. as far as i know, current can be computed by dividing Vbatt over the total resistance, which is 1,300,010 ohms. pretty low current there! 

Bruce Parham <obparham@jpl.nasa.gov> wrote:


jay marante wrote:
> 
> here's what i wanted to do:
> 
> first, i wanted to determine if the battery back-up supply is low on voltage output.
> i had the circuit this way:
>     main ---------------- >| ------------
>                                              \__________________  dc-dc converter
>                                              /
>    battery -------------- >| ------------                                         * >|     - diode
> 
> max battery voltage : 12V
> 
> the max639 dc-dc converter has a low-battery output(LBO)  pin that goes low when the battery input(LBI) is less than
> the reference voltage of about 1.23V. the LBI pin is connected to the main power supply. im planning to connect the
> LBO pin to ICP of mega16 and the battery output to ADC input 7 of the chip. to have the battery voltage lowered to 5V
> before it goes in the ADC pin, i have this circuit:
> 
>       battery
>          |
>         <
>         > 1.3 Mega ohm
>         <
>          |
>          |------------------- ADC7   ~ 5V as simulated in multisim
>          |
>         <
>         > 10ohm
>         <
>          |
>      GND
> 
> now, when circuit switches to the back-up battery, the LBI goes low; which in turn, switches the LBO low.
> my question is:
> 1. will the ICP work even if timer1 is off? i won't enable the timer, only the ICP interrupt bit. i cannot use the
> external interrupts since i have these pins connected to other devices. i'll use this interrupt to start an ADC
> conversion.
> 2. i don't know much of the ADC of mega16. i understand the datasheet says that it can be configured to use the AVCC
> as the reference voltage. does this mean that the AVCC pin can be connected to VCC?
> 3. the datasheet also says that the there should be an external capacitor at the aref pin. what should be the
> capacitor value?
> 
> thanks for the help.
> -jay
> 

Let's see now, I = E/R so I[10 ohm res] = 5/10 = 0.5 Amps.  
And E = I*R so E[1.3 Meg res] = 0.5 * 1.3e+6 = 6.5E+5 Volts or 650 KV. Wow, some battery!

(Typical SPICE result...)

Bruce

P.S.: I do wish thay would go back to teaching real EE.

Yahoo! Groups SponsorADVERTISEMENT


---------------------------------
Yahoo! Groups Links

   To visit your group on the web, go to:
http://groups.yahoo.com/group/AVR-Chat/
  
   To unsubscribe from this group, send an email to:
AVR-Chat-unsubscribe@yahoogroups.com
  
   Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service. 


		
---------------------------------
Do you Yahoo!?
Yahoo! Domains - Claim yours for only $14.70/year

Re: [AVR-Chat] low-battery detection, ADC, and ICP of mega16

2004-05-21 by Kathy Quinlan

jay marante wrote:

> are you sure you got your formulas right?!  
> that's just a voltage divider and im pretty sure you can't generate 
> 650kV from a 12V battery. im sorry but i can't remember the formula for 
> the voltage divider circuit.
> maybe someone might confirm that the multisim was right with its output. 
> as far as i know, current can be computed by dividing Vbatt over the 
> total resistance, which is 1,300,010 ohms. pretty low current there!

>      >
>      >       battery
>      >          |
>      >         <
>      >         > 1.3 Mega ohm
>      >         <
>      >          |
>      >          |------------------- ADC7   ~ 5V as simulated in multisim
>      >          |
>      >         <
>      >         > 10ohm
>      >         <
>      >          |
>      >      GND
>      >


Work it the other way, I = V/R = 12/1,300,010 = 
9.2306982253982661671833293590049e-6 A


Now we know that V=IxR = 9.2306982253982661671833293590049e-6 x 10 =
9.2306982253982661671833293590049e-5V or ~10uV at the ADC7 input...


I think the 10 ohm resistor needs to be higher say 10K and the 1.3M 
resistor lower say 13K which would make the ADC voltage 5.21 V now for 
saftey I would use a 15K resistor on the top.


All this is hypothetical if you are using the internal Aref as it is 
only 2.56V (haaaaaa why be so presise with the voltage ie to 2 decimal 
places when heat and supply variations make it nowhere near that acurate)

I would use an external Vref something like a 4.096V reference chip.

Regards,

Kat.

-- 
---------------------------------------------------------------
K.A.Q. Electronics	Website: www.kaqelectronics.dyndns.org
IM: Yahoo: PinkyDwaggy  MSN: katinka@kaqelectronics.dyndns.org
For Everything Electronics     Phone: 0419 923 731
---------------------------------------------------------------

Re: [AVR-Chat] low-battery detection, ADC, and ICP of mega16

2004-05-21 by jay marante

thanks, kat. i already figured this out. got a computer from an internet site. i would prefer 100 ohms for the upper resistor and 125 ohm for the lower resistor. would this be alright? i'll use this as the analog input to the ADC to monitor the batter voltage. i'll use the VCC as the reference voltage. i just saw in the datasheet how to conenct the VCC as the reference voltage.
 
-jay

Kathy Quinlan <kat-yahoo@kaqelectronics.dyndns.org> wrote:
jay marante wrote:

> are you sure you got your formulas right?!  
> that's just a voltage divider and im pretty sure you can't generate 
> 650kV from a 12V battery. im sorry but i can't remember the formula for 
> the voltage divider circuit.
> maybe someone might confirm that the multisim was right with its output. 
> as far as i know, current can be computed by dividing Vbatt over the 
> total resistance, which is 1,300,010 ohms. pretty low current there!

>      >
>      >       battery
>      >          |
>      >         <
>      >         > 1.3 Mega ohm
>      >         <
>      >          |
>      >          |------------------- ADC7   ~ 5V as simulated in multisim
>      >          |
>      >         <
>      >         > 10ohm
>      >         <
>      >          |
>      >      GND
>      >


Work it the other way, I = V/R = 12/1,300,010 = 
9.2306982253982661671833293590049e-6 A


Now we know that V=IxR = 9.2306982253982661671833293590049e-6 x 10 =
9.2306982253982661671833293590049e-5V or ~10uV at the ADC7 input...


I think the 10 ohm resistor needs to be higher say 10K and the 1.3M 
resistor lower say 13K which would make the ADC voltage 5.21 V now for 
saftey I would use a 15K resistor on the top.


All this is hypothetical if you are using the internal Aref as it is 
only 2.56V (haaaaaa why be so presise with the voltage ie to 2 decimal 
places when heat and supply variations make it nowhere near that acurate)

I would use an external Vref something like a 4.096V reference chip.

Regards,

Kat.

-- 
---------------------------------------------------------------
K.A.Q. Electronics      Website: www.kaqelectronics.dyndns.org
IM: Yahoo: PinkyDwaggy  MSN: katinka@kaqelectronics.dyndns.org
For Everything Electronics     Phone: 0419 923 731
---------------------------------------------------------------      

Yahoo! Groups SponsorADVERTISEMENT


---------------------------------
Yahoo! Groups Links

   To visit your group on the web, go to:
http://groups.yahoo.com/group/AVR-Chat/
  
   To unsubscribe from this group, send an email to:
AVR-Chat-unsubscribe@yahoogroups.com
  
   Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service. 


		
---------------------------------
Do you Yahoo!?
Yahoo! Domains - Claim yours for only $14.70/year

Re: [AVR-Chat] low-battery detection, ADC, and ICP of mega16

2004-05-21 by Mike Murphree

Kathy Quinlan said:
> jay marante wrote:
>
>> are you sure you got your formulas right?!
>> that's just a voltage divider and im pretty sure you can't generate
>> 650kV from a 12V battery. im sorry but i can't remember the formula
>> for  the voltage divider circuit.
>> maybe someone might confirm that the multisim was right with its
>> output.  as far as i know, current can be computed by dividing Vbatt
>> over the  total resistance, which is 1,300,010 ohms. pretty low
>> current there!
>
>>      >
>>      >       battery
>>      >          |
>>      >         <
>>      >         > 1.3 Mega ohm
>>      >         <
>>      >          |
>>      >          |------------------- ADC7   ~ 5V as simulated in
>> multisim |
>>      >         <
>>      >         > 10ohm
>>      >         <
>>      >          |
>>      >      GND
>>      >
>
>
> Work it the other way, I = V/R = 12/1,300,010 =
> 9.2306982253982661671833293590049e-6 A
>
>
> Now we know that V=IxR = 9.2306982253982661671833293590049e-6 x 10 =
> 9.2306982253982661671833293590049e-5V or ~10uV at the ADC7 input...
>

There's quite a few ways to do this, but one of the easiest to remember
is to name the top resistor as R1, the bottom resistor as R2, then the
output voltage to the ADC is given by the formula:

Vout = R2/(R1+R2) * Vbatt

Then you don't have to suffer through all the intermediate results...

:)
Mike W4LNA

Re: [AVR-Chat] low-battery detection, ADC, and ICP of mega16

2004-05-21 by David VanHorn

At 08:45 AM 5/21/2004 -0500, Mike Murphree wrote:

>Kathy Quinlan said:
>> jay marante wrote:
>>
>>> are you sure you got your formulas right?!
>>> that's just a voltage divider and im pretty sure you can't generate
>>> 650kV from a 12V battery. im sorry but i can't remember the formula
>>> for  the voltage divider circuit.
>>> maybe someone might confirm that the multisim was right with its
>>> output.  as far as i know, current can be computed by dividing Vbatt
>>> over the  total resistance, which is 1,300,010 ohms. pretty low
>>> current there!
>>
>>>      >
>>>      >       battery
>>>      >          |
>>>      >         <
>>>      >         > 1.3 Mega ohm
>>>      >         <
>>>      >          |
>>>      >          |------------------- ADC7   ~ 5V as simulated in
>>> multisim |
>>>      >         <
>>>      >         > 10ohm
>>>      >         <
>>>      >          |
>>>      >      GND
>>>      >


You must be way off in your math somewhere.
A 12V battery is <3X 5V, so the divider should be in that range.

Re: [AVR-Chat] low-battery detection, ADC, and ICP of mega16

2004-05-24 by wagner

Kat, errrr, 9.23uA x 10 ohms = 92uV (9.23e-5), not 10uV.
:)
Show quoted textHide quoted text
----- Original Message -----
From: "Kathy Quinlan" <kat-yahoo@kaqelectronics.dyndns.org>
To: <AVR-Chat@yahoogroups.com>
Sent: Friday, May 21, 2004 12:07 AM
Subject: Re: [AVR-Chat] low-battery detection, ADC, and ICP of mega16


> jay marante wrote:
>
> > are you sure you got your formulas right?!
> > that's just a voltage divider and im pretty sure you can't generate
> > 650kV from a 12V battery. im sorry but i can't remember the formula for
> > the voltage divider circuit.
> > maybe someone might confirm that the multisim was right with its output.
> > as far as i know, current can be computed by dividing Vbatt over the
> > total resistance, which is 1,300,010 ohms. pretty low current there!
>
> >      >
> >      >       battery
> >      >          |
> >      >         <
> >      >         > 1.3 Mega ohm
> >      >         <
> >      >          |
> >      >          |------------------- ADC7   ~ 5V as simulated in
multisim
> >      >          |
> >      >         <
> >      >         > 10ohm
> >      >         <
> >      >          |
> >      >      GND
> >      >
>
>
> Work it the other way, I = V/R = 12/1,300,010 =
> 9.2306982253982661671833293590049e-6 A
>
>
> Now we know that V=IxR = 9.2306982253982661671833293590049e-6 x 10 =
> 9.2306982253982661671833293590049e-5V or ~10uV at the ADC7 input...
>
>
> I think the 10 ohm resistor needs to be higher say 10K and the 1.3M
> resistor lower say 13K which would make the ADC voltage 5.21 V now for
> saftey I would use a 15K resistor on the top.
>
>
> All this is hypothetical if you are using the internal Aref as it is
> only 2.56V (haaaaaa why be so presise with the voltage ie to 2 decimal
> places when heat and supply variations make it nowhere near that acurate)
>
> I would use an external Vref something like a 4.096V reference chip.
>
> Regards,
>
> Kat.
>
> --



---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.688 / Virus Database: 449 - Release Date: 5/18/2004

Re: [AVR-Chat] low-battery detection, ADC, and ICP of mega16

2004-05-24 by Kathy Quinlan

wagner wrote:

> Kat, errrr, 9.23uA x 10 ohms = 92uV (9.23e-5), not 10uV.
> :)

Yeah I missed a 0 lol :o)

Regards,

Kat.

-- 
---------------------------------------------------------------
K.A.Q. Electronics	Website: www.kaqelectronics.dyndns.org
IM: Yahoo: PinkyDwaggy  MSN: katinka@kaqelectronics.dyndns.org
For Everything Electronics     Phone: 0419 923 731
---------------------------------------------------------------

Re: [AVR-Chat] low-battery detection, ADC, and ICP of mega16

2004-05-24 by David VanHorn

>
>> All this is hypothetical if you are using the internal Aref as it is
>> only 2.56V (haaaaaa why be so presise with the voltage ie to 2 decimal
>> places when heat and supply variations make it nowhere near that acurate)

On my M128's we were getting 2.7V.  10% drift on a "precision reference" for use with a 10 bit A/D.  Now that's funny! :-P

>> I would use an external Vref something like a 4.096V reference chip.

That. or VCC if it's reasonably accurate.

Move to quarantaine

This moves the raw source file on disk only. The archive index is not changed automatically, so you still need to run a manual refresh afterward.