Discussion forum for the BasicX family of microcontroller chips.
Reading voltage higher than 5V - scubadubadubadiver - Sep 29 7:12:02 2007
Hi everyone. I have a very simple problem and I hope that someone
with greater experience than mine can help me out.
I am building a multichannel wireless acquisition system and each
acquisition point is essentially made by a BX24P, an XBee modem and
an 24 bit A/D converter. At the control station (a laptop computer)
it is important to know the state of the battery mounted on board of
each acquisition point which provides, of course, a voltage greater
than 5V (in this case it is about 8V when fully charged). To this
purpose I have simply connected between the two poles of the battery
a series of three resistors of 1 MOhm each (to limit the current
loss). Then I wanted to acquire by means of any BX24P internal A/D
converter the voltage level across the resistor connected directly to
the negative pole (my ground ...) and multiplying it by 3 to obtain
the final voltage (eventually sent down to the control station on
demand). By the way there is also a capacitor in parallel to this
resistor to better stabilize the reading.
Well ... it does not work ... because what I am actually reading at
the converter is not what it is supposed to be. So I thought that the
problem could be related to the internal pullup resistor that changes
the measure since it is one order of magnitude smaller that the
resistors outside. Could this be the problem ? Does anyone have a
solution ?
Thanks in advance and I apologize for the very long message ...
Fabrizio

(You need to be a member of basicx -- send a blank email to basicx-subscribe@yahoogroups.com )
Re: Reading voltage higher than 5V - Tom Becker - Sep 29 8:42:54 2007
> ... three resistors of 1 MOhm each...
The values are too large for the input impedance of the ADC; Atmel
recommends that the source impedance be on the order of 10k or lower;
although larger source impedances will work, accuracy and timing are
compromised.
You only need two resistors to make a voltage divider. If your maximum
supply voltage will be eight volts, useful resistor values that will
reduce that to below five volts and offer a low source impedance could
be 15k below 27k. The resulting voltage at the ADC will then be
(8.0*15/27)= 4.44v, and the maximum battery voltage can be (5.0*27/15)=
9.0v. To represent the battery voltage, multiply the ADC result by
27/15. For equivalent smoothing the capacitor will need to be
correspondingly larger but you probably will not need one - or you can
do some smoothing in code.
Tom

(You need to be a member of basicx -- send a blank email to basicx-subscribe@yahoogroups.com )
Re: Reading voltage higher than 5V - Tom Becker - Sep 29 9:15:15 2007
> ... three resistors of 1 MOhm each...
The values are too large for the input impedance of the ADC; Atmel
recommends that the source impedance be on the order of 10k or lower;
although larger source impedances will work, accuracy and timing are
compromised.
You only need two resistors to make a voltage divider. If your maximum
supply voltage will be eight volts, useful resistor values that will
reduce that to below five volts and offer a low source impedance could
be 10k below 8.1k (100k and 81k might work, too). The resulting voltage
at the ADC will then be 8.0*10/(10+8.1)= ~4.4v. To represent the
battery voltage, multiply the ADC result by (10+8.1)/10. For equivalent
smoothing the capacitor will need to be correspondingly larger but you
probably will not need one - or you can do some smoothing in code.
Earlier (too early) response was incorrect.
Tom

(You need to be a member of basicx -- send a blank email to basicx-subscribe@yahoogroups.com )
Re: Reading voltage higher than 5V - David Sousa Mendes - Sep 29 10:44:08 2007
Hello Fabrizio
I had exactly the same problem as you are having.
My solution was to use a saturated transistor whose base is connected to a I/O port of
the bx24.
This way, I control the state (opened or closed) of the voltage divider that you are
using to measure the voltage of the batery...
So, every time you want to measure the voltage of the batery, first you must close the
voltage divider circuit by setting the I/O port to HIGH. After reading the values, dont
forget to set the I/O port to LOW again!
And the problem is solved! No current losses!
David
----- Original Message -----
From: Fabrizio Sellone
To: b...@yahoogroups.com
Sent: Saturday, September 29, 2007 1:13 PM
Subject: Re: [BasicX] Reading voltage higher than 5V
Thanks Tom. What you are saying is in perfect accord to what I did, apart
from the values of the resistors. The reason I've chosen such large values
is because the acquisition points should stay awake for at least one day of
continous operation (acquisition and transmission) and thus any waste of
current could cost a reduction in liftime.
Suppose that I really cannot change the values of the resistors ... Is there
a way to get a measure at least close to what It should be ? I do not need
10 bit of accuracy ... just a rough indication of what the battery level is
(0.5V of resolution could even do the job). Do you thins there could be some
interaction with the on-board pull-up resistor ?
Thanks again,
Fabrizio
>From: Tom Becker
>Reply-To: b...@yahoogroups.com
>To: b...@yahoogroups.com
>Subject: Re: [BasicX] Reading voltage higher than 5V
>Date: Sat, 29 Sep 2007 08:07:47 -0400
>
> > ... three resistors of 1 MOhm each...
>
>The values are too large for the input impedance of the ADC; Atmel
>recommends that the source impedance be on the order of 10k or lower;
>although larger source impedances will work, accuracy and timing are
>compromised.
>
>You only need two resistors to make a voltage divider. If your maximum
>supply voltage will be eight volts, useful resistor values that will
>reduce that to below five volts and offer a low source impedance could
>be 15k below 27k. The resulting voltage at the ADC will then be
>(8.0*15/27)= 4.44v, and the maximum battery voltage can be (5.0*27/15)=
>9.0v. To represent the battery voltage, multiply the ADC result by
>27/15. For equivalent smoothing the capacitor will need to be
>correspondingly larger but you probably will not need one - or you can
>do some smoothing in code.
>
>
>Tom
>
__________________________________________________________
Gioca a Ladybird, il nuovissimo gioco di Windows Live Messenger!
http://messengergiochi.it.msn.com/ladybird.aspx
[Non-text portions of this message have been removed]

(You need to be a member of basicx -- send a blank email to basicx-subscribe@yahoogroups.com )Re: Reading voltage higher than 5V - Fabrizio Sellone - Sep 29 12:16:18 2007
Thanks Tom. What you are saying is in perfect accord to what I did, apart
from the values of the resistors. The reason I've chosen such large values
is because the acquisition points should stay awake for at least one day of
continous operation (acquisition and transmission) and thus any waste of
current could cost a reduction in liftime.
Suppose that I really cannot change the values of the resistors ... Is there
a way to get a measure at least close to what It should be ? I do not need
10 bit of accuracy ... just a rough indication of what the battery level is
(0.5V of resolution could even do the job). Do you thins there could be some
interaction with the on-board pull-up resistor ?
Thanks again,
Fabrizio
>From: Tom Becker
>Reply-To: b...@yahoogroups.com
>To: b...@yahoogroups.com
>Subject: Re: [BasicX] Reading voltage higher than 5V
>Date: Sat, 29 Sep 2007 08:07:47 -0400
>
> > ... three resistors of 1 MOhm each...
>
>The values are too large for the input impedance of the ADC; Atmel
>recommends that the source impedance be on the order of 10k or lower;
>although larger source impedances will work, accuracy and timing are
>compromised.
>
>You only need two resistors to make a voltage divider. If your maximum
>supply voltage will be eight volts, useful resistor values that will
>reduce that to below five volts and offer a low source impedance could
>be 15k below 27k. The resulting voltage at the ADC will then be
>(8.0*15/27)= 4.44v, and the maximum battery voltage can be (5.0*27/15)=
>9.0v. To represent the battery voltage, multiply the ADC result by
>27/15. For equivalent smoothing the capacitor will need to be
>correspondingly larger but you probably will not need one - or you can
>do some smoothing in code.
>Tom
>
_________________________________________________________________
Gioca a Ladybird, il nuovissimo gioco di Windows Live Messenger!
http://messengergiochi.it.msn.com/ladybird.aspx

(You need to be a member of basicx -- send a blank email to basicx-subscribe@yahoogroups.com )Re: Reading voltage higher than 5V - Tom Becker - Sep 30 2:07:25 2007
> ... the acquisition points should stay awake for at least one day...
The BX-24p normally draws about 20mA. If you shut down all peripheral
loads and invoke CPUSleep between samples, the processor will draw about
2mA. A 30k voltage divider from 5v draws about 1.6mA so, if you are
shutting the machine down between samples (and not disconnecting the
divider, per David), the voltage divider will significantly affect
battery life. If you're not using CPUSleep, though, I doubt you'll note
much battery life difference between it and a 3Megohm divider. If you
must use a large divider, you could buffer it with a micro-power opamp.
On pullup effects on ADC inputs, see
http://tech.groups.yahoo.com/group/basicx/message/21479 and others.
Tom

(You need to be a member of basicx -- send a blank email to basicx-subscribe@yahoogroups.com )
Re: Re: Reading voltage higher than 5V - David Sousa Mendes - Jan 29 11:34:24 2008
Hello
I solved that problem in another way...
I also used 3 resistors and same logic as you...
The diference is that I used an I/O pin to control a BJT working as a switch.
This switch is normally open so normally you are not spending energy trough the 3
resistors.
When you want to measure the voltage of the batery, you must first close that switch
(saturate the transistor by setting that I/O pin to high state).
As you are only spending energy during the measurement period, you can reduce the value
of those resistors to say 100Ohms... This way, these values are much smaller than the
internal pull-up resistor thus the measurement is not affected by the internal pull-up
resistor.
It worked in perfection!
BR
David M.
----- Original Message -----
From: johntbiggs
To: b...@yahoogroups.com
Sent: Tuesday, January 29, 2008 9:59 AM
Subject: [BasicX] Re: Reading voltage higher than 5V
I have had similar trouble. In my case the solution was to use an
instrumentation amp(Operational Amp LM741), the output of which can
handle the low ohm/volt rating of the input pin and the high input
impeadance for the metering.Calibrate with feedback resistor.
Hope this gives you an idea that will help.
John T. Biggs
--- In b...@yahoogroups.com, "scubadubadubadiver"
wrote:
>
> Hi everyone. I have a very simple problem and I hope that someone
> with greater experience than mine can help me out.
>
> I am building a multichannel wireless acquisition system and each
> acquisition point is essentially made by a BX24P, an XBee modem and
> an 24 bit A/D converter. At the control station (a laptop computer)
> it is important to know the state of the battery mounted on board
of
> each acquisition point which provides, of course, a voltage greater
> than 5V (in this case it is about 8V when fully charged). To this
> purpose I have simply connected between the two poles of the
battery
> a series of three resistors of 1 MOhm each (to limit the current
> loss). Then I wanted to acquire by means of any BX24P internal A/D
> converter the voltage level across the resistor connected directly
to
> the negative pole (my ground ...) and multiplying it by 3 to obtain
> the final voltage (eventually sent down to the control station on
> demand). By the way there is also a capacitor in parallel to this
> resistor to better stabilize the reading.
>
> Well ... it does not work ... because what I am actually reading at
> the converter is not what it is supposed to be. So I thought that
the
> problem could be related to the internal pullup resistor that
changes
> the measure since it is one order of magnitude smaller that the
> resistors outside. Could this be the problem ? Does anyone have a
> solution ?
>
> Thanks in advance and I apologize for the very long message ...
>
> Fabrizio
>
[Non-text portions of this message have been removed]

(You need to be a member of basicx -- send a blank email to basicx-subscribe@yahoogroups.com )Re: Reading voltage higher than 5V - johntbiggs - Jan 29 21:33:59 2008
I have had similar trouble. In my case the solution was to use an
instrumentation amp(Operational Amp LM741), the output of which can
handle the low ohm/volt rating of the input pin and the high input
impeadance for the metering.Calibrate with feedback resistor.
Hope this gives you an idea that will help.
John T. Biggs
--- In b...@yahoogroups.com, "scubadubadubadiver"
wrote:
>
> Hi everyone. I have a very simple problem and I hope that someone
> with greater experience than mine can help me out.
>
> I am building a multichannel wireless acquisition system and each
> acquisition point is essentially made by a BX24P, an XBee modem and
> an 24 bit A/D converter. At the control station (a laptop computer)
> it is important to know the state of the battery mounted on board
of
> each acquisition point which provides, of course, a voltage greater
> than 5V (in this case it is about 8V when fully charged). To this
> purpose I have simply connected between the two poles of the
battery
> a series of three resistors of 1 MOhm each (to limit the current
> loss). Then I wanted to acquire by means of any BX24P internal A/D
> converter the voltage level across the resistor connected directly
to
> the negative pole (my ground ...) and multiplying it by 3 to obtain
> the final voltage (eventually sent down to the control station on
> demand). By the way there is also a capacitor in parallel to this
> resistor to better stabilize the reading.
>
> Well ... it does not work ... because what I am actually reading at
> the converter is not what it is supposed to be. So I thought that
the
> problem could be related to the internal pullup resistor that
changes
> the measure since it is one order of magnitude smaller that the
> resistors outside. Could this be the problem ? Does anyone have a
> solution ?
>
> Thanks in advance and I apologize for the very long message ...
>
> Fabrizio
>

(You need to be a member of basicx -- send a blank email to basicx-subscribe@yahoogroups.com )Re: Re: Reading voltage higher than 5V - John Biggs - Jan 30 6:53:47 2008
There are many ways to skin a cat. Your idea is like the tri state buffer only in the
analog world. Have you had any problems
with intermittent lock up of the stamp? I used the BX24 in my RV to measure batt voltage
LP gas fail and tank levels. My LCD readout would
read 0 to 100% as opposed to the OEM three levels of LEDs.
Every time the heater fired up, due to the EMF generated as magnetic field collapsed, the
stamp would lock up.
I solved the problem by designing a circuit to break ground loop. Part of that was using
the op amp.
I really like the BX24 stamp over Paralax. But I do think the Paralax module is less
prone to EMP lock up. But every time I try to
use it I go back to the BX24. My main reasons are Clock calendar feature, 10 bit A/D
inputs, and being able to use the data pins in push pull.
I have found it easier to interface to seven segment led's for example using the matrix I
use. Well I think I have said enough. Happy designing.....
----- Original Message ----
From: David Sousa Mendes
To: b...@yahoogroups.com
Sent: Tuesday, January 29, 2008 7:58:38 AM
Subject: Re: [BasicX] Re: Reading voltage higher than 5V
Hello
I solved that problem in another way...
I also used 3 resistors and same logic as you...
The diference is that I used an I/O pin to control a BJT working as a switch.
This switch is normally open so normally you are not spending energy trough the 3
resistors.
When you want to measure the voltage of the batery, you must first close that switch
(saturate the transistor by setting that I/O pin to high state).
As you are only spending energy during the measurement period, you can reduce the value
of those resistors to say 100Ohms... This way, these values are much smaller than the
internal pull-up resistor thus the measurement is not affected by the internal pull-up
resistor.
It worked in perfection!
BR
David M.
----- Original Message -----
From: johntbiggs
To: basicx@yahoogroups. com
Sent: Tuesday, January 29, 2008 9:59 AM
Subject: [BasicX] Re: Reading voltage higher than 5V
I have had similar trouble. In my case the solution was to use an
instrumentation amp(Operational Amp LM741), the output of which can
handle the low ohm/volt rating of the input pin and the high input
impeadance for the metering.Calibrate with feedback resistor.
Hope this gives you an idea that will help.
John T. Biggs
--- In basicx@yahoogroups. com, "scubadubadubadiver "
wrote:
>
> Hi everyone. I have a very simple problem and I hope that someone
> with greater experience than mine can help me out.
>
> I am building a multichannel wireless acquisition system and each
> acquisition point is essentially made by a BX24P, an XBee modem and
> an 24 bit A/D converter. At the control station (a laptop computer)
> it is important to know the state of the battery mounted on board
of
> each acquisition point which provides, of course, a voltage greater
> than 5V (in this case it is about 8V when fully charged). To this
> purpose I have simply connected between the two poles of the
battery
> a series of three resistors of 1 MOhm each (to limit the current
> loss). Then I wanted to acquire by means of any BX24P internal A/D
> converter the voltage level across the resistor connected directly
to
> the negative pole (my ground ...) and multiplying it by 3 to obtain
> the final voltage (eventually sent down to the control station on
> demand). By the way there is also a capacitor in parallel to this
> resistor to better stabilize the reading.
>
> Well ... it does not work ... because what I am actually reading at
> the converter is not what it is supposed to be. So I thought that
the
> problem could be related to the internal pullup resistor that
changes
> the measure since it is one order of magnitude smaller that the
> resistors outside. Could this be the problem ? Does anyone have a
> solution ?
>
> Thanks in advance and I apologize for the very long message ...
>
> Fabrizio
>
[Non-text portions of this message have been removed]
____________________________________________________________________________________
Never miss a thing. Make Yahoo your home page.
http://www.yahoo.com/r/hs
[Non-text portions of this message have been removed]

(You need to be a member of basicx -- send a blank email to basicx-subscribe@yahoogroups.com )