RE: [Tinyos-help] battery voltage micaz

2006-05-22 Thread David Moss
Title: Message



FYI - 
I haven't looked into implementing this, but the CC2420 radio on the 
MicaZ and Telos does offer battery monitor. 

From 
the CC2420 datasheet, page 53: "The on-chip 
battery monitor enables monitoring the unregulated voltage on the VREG_IN 
pin. It gives status information on the voltage being above or below a 
programmable threshold."

Basically you enabled the battery monitor through the BATTMON control 
register, set a 5-bit target voltage in the BATTMON.BATTMON_VOLTAGE register, 
and then read the BATTMON_OKstatus bit to tell if the input voltage is 
above or belowyour defined threshold. Seems pretty simple to 
do. And the CC2420 battery monitor can be turned off when you don't need a 
reading.

It 
would be nice to have a component that would tell your application when the 
battery voltage is running low... either by an eventdriven by a periodic 
timer that samples the CC2420, or through your application explicitly polling 
the battery monitor component.

-David



  
  -Original Message-From: 
  [EMAIL PROTECTED] 
  [mailto:[EMAIL PROTECTED] On Behalf Of R 
  GartzSent: Friday, May 19, 2006 4:04 PMTo: Michael 
  SchipplingCc: 
  tinyos-help@Millennium.Berkeley.EDUSubject: Re: [Tinyos-help] 
  battery voltage micazYes I know they are very 
  suspicious ;) But I don't have any bit shift anywhere in my program(s)... 
  Those are the actual values I'm gettingMichael, in your robocode 
  you're getting the right values for mica2? But you're not using the VoltageM 
  component. So, I decided to try the same thing you did: not using 
  VoltageM. Although I know the Xbow MPR manual describes something about 
  the mapping from ADC7 to the ADC channel 30, and by using VoltageM in micaz. 
  "RobotM.BVoltage - ADCC.ADC[ROBOADC_BVOLTAGE];" (I tried both 
  ROBOADC_BVOLTAGE = 7 and ROBOADC_BVOLTAGE=30) but the dataReady-event never 
  fires (although like I said before, I was expecting something like that when 
  not using VoltageM)So, there remain 2 options: -the VoltageM 
  component contains an error (e.g. wrong mapping / reading of the ADC 
  channel)-Measuring Voltage in micaz is not possible? (although the xbow 
  MPR manual claims it should be)greetings and thanks, 
R.
  On 5/19/06, Michael 
  Schippling [EMAIL PROTECTED] wrote:
  I 
don't remember the solution to the problem in the previous email 
youreference, but I think they were reading the wrong ADC or 
gettingwrong values somehow...perhaps Gina Upperman is still online here 
andcan answer. But your values look suspiciously like they have 
been divided by two.Do you have an accidental bit shift 
someplace?MSR Gartz wrote: Hello, 
I'm trying to measure the voltage of the batteries of my micaz nodes. 
 When using the VoltageM component, I'm always getting 
values like Vbat= 3901, 4638, 4892, 5261, 5398, 5351, 5445, 5398 
 - So, 5,3 Volt for two AA batteries?? Seems very 
strange... When printing the raw 10-bit ADC value (so without the 
conversion (in the VoltageM component) Vbat = Vref * 1024/ADC_Count) 
the ADC_Count = 315, 258, 243, 230, 227, 229, 225,... So in 
order to get more realistic values like Vbat = 2900mV: the  
ADC_Count should be around 430... Everything is mapped right, I'm 
measuring the ADC-channel 30 for micaz... Anyone knows what 
is wrong? (the same problem has already been posted a month ago, 
 http://mail.millennium.berkeley.edu/pipermail/tinyos-help/2006-April/016227.html) 
Greetings, Robin 
 
___ Tinyos-help mailing 
list Tinyos-help@Millennium.Berkeley.EDU 
https://mail.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help 

___
Tinyos-help mailing list
Tinyos-help@Millennium.Berkeley.EDU
https://mail.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help


Re: [Tinyos-help] battery voltage micaz

2006-05-19 Thread Michael Schippling

I don't remember the solution to the problem in the previous email you
reference, but I think they were reading the wrong ADC or getting
wrong values somehow...perhaps Gina Upperman is still online here and
can answer.

But your values look suspiciously like they have been divided by two.
Do you have an accidental bit shift someplace?

MS

R Gartz wrote:

Hello,

I'm trying to measure the voltage of the batteries of my micaz nodes.

When using the VoltageM component, I'm always getting values like Vbat= 
3901, 4638, 4892, 5261, 5398, 5351, 5445, 5398  - So, 5,3 Volt for 
two AA batteries?? Seems very strange...
When printing the raw 10-bit ADC value (so without the conversion (in 
the VoltageM component) Vbat = Vref * 1024/ADC_Count) the ADC_Count = 
315, 258, 243, 230, 227, 229, 225,...
So in order to get more realistic values like Vbat = 2900mV: the 
ADC_Count should be around 430...

Everything is mapped right, I'm measuring the ADC-channel 30 for micaz...

Anyone knows what is wrong? (the same problem has already been posted a 
month ago, 
http://mail.millennium.berkeley.edu/pipermail/tinyos-help/2006-April/016227.html)



Greetings,

Robin





___
Tinyos-help mailing list
Tinyos-help@Millennium.Berkeley.EDU
https://mail.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help

___
Tinyos-help mailing list
Tinyos-help@Millennium.Berkeley.EDU
https://mail.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help


Re: [Tinyos-help] battery voltage micaz

2006-05-19 Thread David Gay

On 5/19/06, Michael Schippling [EMAIL PROTECTED] wrote:

I don't remember the solution to the problem in the previous email you
reference, but I think they were reading the wrong ADC or getting
wrong values somehow...perhaps Gina Upperman is still online here and
can answer.


AFAICT, there's no voltage sensor on the micaz (at least there's no
sign of it on the schematic on Xbow's web site). The micaz tinyos 1.x
Voltage component tries to read the built-in V_BG (bandgap) voltage.
Perusing the atmega128 documentation suggests that that voltage is not
stable until 40-70us after the ADC is enabled - so the problem may be
that it isn't stable. I'm also unclear on how a measurement of V_BG
(as setup in TinyOS 1.x's ADCREFM and HPLADCM modules...) relates to
battery voltage.



But your values look suspiciously like they have been divided by two.
Do you have an accidental bit shift someplace?

MS

R Gartz wrote:
 Hello,

 I'm trying to measure the voltage of the batteries of my micaz nodes.

 When using the VoltageM component, I'm always getting values like Vbat=
 3901, 4638, 4892, 5261, 5398, 5351, 5445, 5398  - So, 5,3 Volt for
 two AA batteries?? Seems very strange...
 When printing the raw 10-bit ADC value (so without the conversion (in
 the VoltageM component) Vbat = Vref * 1024/ADC_Count) the ADC_Count =
 315, 258, 243, 230, 227, 229, 225,...
 So in order to get more realistic values like Vbat = 2900mV: the
 ADC_Count should be around 430...
 Everything is mapped right, I'm measuring the ADC-channel 30 for micaz...

 Anyone knows what is wrong? (the same problem has already been posted a
 month ago,
 
http://mail.millennium.berkeley.edu/pipermail/tinyos-help/2006-April/016227.html)


___
Tinyos-help mailing list
Tinyos-help@Millennium.Berkeley.EDU
https://mail.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help


Re: [Tinyos-help] battery voltage micaz

2006-05-19 Thread Michael Schippling

I assume it's the same trick as the mica2 where the ADC Vref IS the
battery, and you get an inverted reading from the internal ref which
increases as the battery voltage droops.

Is there a micaz schematic on the XBOW site? I keep looking for one at
   http://www.tinyos.net/scoop/special/hardware
and then give up...

Also, I just referenced your name in vain on having sent me a link to
something that details the nesc include path, which I have lost as usual.
Can you resend that (assuming it was you...)

thanks
MS


David Gay wrote:

On 5/19/06, Michael Schippling [EMAIL PROTECTED] wrote:

I don't remember the solution to the problem in the previous email you
reference, but I think they were reading the wrong ADC or getting
wrong values somehow...perhaps Gina Upperman is still online here and
can answer.


AFAICT, there's no voltage sensor on the micaz (at least there's no
sign of it on the schematic on Xbow's web site). The micaz tinyos 1.x
Voltage component tries to read the built-in V_BG (bandgap) voltage.
Perusing the atmega128 documentation suggests that that voltage is not
stable until 40-70us after the ADC is enabled - so the problem may be
that it isn't stable. I'm also unclear on how a measurement of V_BG
(as setup in TinyOS 1.x's ADCREFM and HPLADCM modules...) relates to
battery voltage.



But your values look suspiciously like they have been divided by two.
Do you have an accidental bit shift someplace?

MS

R Gartz wrote:
 Hello,

 I'm trying to measure the voltage of the batteries of my micaz nodes.

 When using the VoltageM component, I'm always getting values like Vbat=
 3901, 4638, 4892, 5261, 5398, 5351, 5445, 5398  - So, 5,3 Volt for
 two AA batteries?? Seems very strange...
 When printing the raw 10-bit ADC value (so without the conversion (in
 the VoltageM component) Vbat = Vref * 1024/ADC_Count) the ADC_Count =
 315, 258, 243, 230, 227, 229, 225,...
 So in order to get more realistic values like Vbat = 2900mV: the
 ADC_Count should be around 430...
 Everything is mapped right, I'm measuring the ADC-channel 30 for 
micaz...


 Anyone knows what is wrong? (the same problem has already been posted a
 month ago,
 
http://mail.millennium.berkeley.edu/pipermail/tinyos-help/2006-April/016227.html) 


___
Tinyos-help mailing list
Tinyos-help@Millennium.Berkeley.EDU
https://mail.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help


Re: [Tinyos-help] battery voltage micaz

2006-05-19 Thread R Gartz
Yes I know they are very suspicious ;) But I don't have any bit shift anywhere in my program(s)... Those are the actual values I'm gettingMichael, in your robocode you're getting the right values for mica2?  But you're not using the VoltageM component.
So, I decided to try the same thing you did: not using VoltageM. Although I know the Xbow MPR manual describes something
about the mapping from ADC7 to the ADC channel 30, and by using VoltageM in micaz. RobotM.BVoltage
- ADCC.ADC[ROBOADC_BVOLTAGE]; (I tried both ROBOADC_BVOLTAGE = 7 and
ROBOADC_BVOLTAGE=30) but the dataReady-event never fires (although like
I said before, I was expecting something like that when not using VoltageM)So, there remain 2 options: 
-the VoltageM component contains an error (e.g. wrong mapping / reading of the ADC channel)-Measuring Voltage in micaz is not possible? (although the xbow MPR manual claims it should be)greetings and thanks,
R.On 5/19/06, Michael Schippling [EMAIL PROTECTED] wrote:
I don't remember the solution to the problem in the previous email youreference, but I think they were reading the wrong ADC or gettingwrong values somehow...perhaps Gina Upperman is still online here andcan answer.
But your values look suspiciously like they have been divided by two.Do you have an accidental bit shift someplace?MSR Gartz wrote: Hello, I'm trying to measure the voltage of the batteries of my micaz nodes.
 When using the VoltageM component, I'm always getting values like Vbat= 3901, 4638, 4892, 5261, 5398, 5351, 5445, 5398  - So, 5,3 Volt for two AA batteries?? Seems very strange...
 When printing the raw 10-bit ADC value (so without the conversion (in the VoltageM component) Vbat = Vref * 1024/ADC_Count) the ADC_Count = 315, 258, 243, 230, 227, 229, 225,... So in order to get more realistic values like Vbat = 2900mV: the
 ADC_Count should be around 430... Everything is mapped right, I'm measuring the ADC-channel 30 for micaz... Anyone knows what is wrong? (the same problem has already been posted a month ago,
 http://mail.millennium.berkeley.edu/pipermail/tinyos-help/2006-April/016227.html) Greetings,
 Robin  ___ Tinyos-help mailing list
 Tinyos-help@Millennium.Berkeley.EDU https://mail.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help

___
Tinyos-help mailing list
Tinyos-help@Millennium.Berkeley.EDU
https://mail.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help


Re: [Tinyos-help] battery voltage micaz

2006-05-19 Thread Michael Schippling

I did the excavate thing a while ago and satisfied myself that
the mica2 uses the moral equivalent of the Battery as the Vref.
Since I couldn't find the micaz schematic I just assume that it's
the same. I don't know why the 'Z uses the internal ref and the '2
has an external one. Maybe it's that settling time you mentioned.

I was thinking I would find the full 'Z schematic as a separate
document. But in the User Manual?...strange...Unfortunately it
is not complete, it's missing the controller page. I guess it's
the same as the '2...I hope. From a quick look the Vref section
seems the same.

As for the include path, I meant the implicit path. For instance
nothing explicitly references hardware.h (in most apps anyway),
but it automagically appears in the (pre-)compiled code, and,
various source directories are searched in some (unspecified to me)
order when compiling. I mentioned it because there was just a
statement made about micaz using mica2/HPLUARTC.nc, which might
confuse anyone below the level of prelate in the TOS hierarchy...


oh, and my (hopefully vanilla and regular-guy kinda) TOS 1.1.7
install doesn't find a man page for ncc...is it really part of
the standard install, and I didn't set my MANPATH right?
MS

David Gay wrote:

On 5/19/06, Michael Schippling [EMAIL PROTECTED] wrote:

I assume it's the same trick as the mica2 where the ADC Vref IS the
battery, and you get an inverted reading from the internal ref which
increases as the battery voltage droops.


Well I was thinking that too, but I didn't want to spend lots of time
digging through the code to confirm it... (the 1.x code doesn't very
explicitly select which reference voltage to use)


Is there a micaz schematic on the XBOW site? I keep looking for one at
http://www.tinyos.net/scoop/special/hardware
and then give up...


http://www.xbow.com/Support/Support_pdf_files/MPR-MIB_Series_Users_Manual.pdf 


(it is on xbow's micaz web page...)


Also, I just referenced your name in vain on having sent me a link to
something that details the nesc include path, which I have lost as usual.
Can you resend that (assuming it was you...)


I don't think it was. But man ncc does tell you (at least with the
latest toolchain), and compiling with -v will show you all the -I
directives...

David Gay

___
Tinyos-help mailing list
Tinyos-help@Millennium.Berkeley.EDU
https://mail.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help


Re: [Tinyos-help] battery voltage micaz

2006-05-19 Thread Michael Schippling

Don't use my Robo code for Bvoltage. I have a whole different hardware
scheme and it gets different values. However, you should be able to
get the raw ADC readings using ADCC the way I do. The mica2 and 'Z
hardware are different as well, which is why they read different
channels, so your mileage may vary.

If you are a nuts'n'bolts type, look at the micaz schematic, or what
there is of it, in the UserGuide that David Gay just referenced, and
read the ATMEGA section on using the internal ref. It's pretty turgid,
but there may be a clue about the apparent x2 readings you are getting.

sorry, I can't be much more help without actually doing work myself...
MS


R Gartz wrote:


Yes I know they are very suspicious ;)
But I don't have any bit shift anywhere in my program(s)... Those are 
the actual values I'm getting


Michael, in your robocode you're getting the right values for mica2? But 
you're not using the VoltageM component.

So, I decided to try the same thing you did: not using VoltageM.
Although I know the Xbow MPR manual describes something about the 
mapping from ADC7 to the ADC channel 30, and by using VoltageM in micaz.


RobotM.BVoltage - ADCC.ADC[ROBOADC_BVOLTAGE]; (I tried both 
ROBOADC_BVOLTAGE = 7 and ROBOADC_BVOLTAGE=30) but the dataReady-event 
never fires (although like I said before, I was expecting something like 
that when not using VoltageM)


So, there remain 2 options:
-the VoltageM component contains an error (e.g. wrong mapping / reading 
of the ADC channel)
-Measuring Voltage in micaz is not possible? (although the xbow MPR 
manual claims it should be)


greetings and thanks,
R.


On 5/19/06, *Michael Schippling* [EMAIL PROTECTED] 
mailto:[EMAIL PROTECTED] wrote:


I don't remember the solution to the problem in the previous email you
reference, but I think they were reading the wrong ADC or getting
wrong values somehow...perhaps Gina Upperman is still online here and
can answer.

But your values look suspiciously like they have been divided by two.
Do you have an accidental bit shift someplace?

MS

R Gartz wrote:
  Hello,
 
  I'm trying to measure the voltage of the batteries of my micaz
nodes.
 
  When using the VoltageM component, I'm always getting values like
Vbat=
  3901, 4638, 4892, 5261, 5398, 5351, 5445, 5398  - So, 5,3
Volt for
  two AA batteries?? Seems very strange...
  When printing the raw 10-bit ADC value (so without the conversion (in
  the VoltageM component) Vbat = Vref * 1024/ADC_Count) the ADC_Count =
  315, 258, 243, 230, 227, 229, 225,...
  So in order to get more realistic values like Vbat = 2900mV: the
  ADC_Count should be around 430...
  Everything is mapped right, I'm measuring the ADC-channel 30 for
micaz...
 
  Anyone knows what is wrong? (the same problem has already been
posted a
  month ago,
 

http://mail.millennium.berkeley.edu/pipermail/tinyos-help/2006-April/016227.html)
 
 
  Greetings,
 
  Robin
 
 
 
 

 
  ___
  Tinyos-help mailing list
  Tinyos-help@Millennium.Berkeley.EDU
mailto:Tinyos-help@Millennium.Berkeley.EDU
 
https://mail.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help
https://mail.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help



___
Tinyos-help mailing list
Tinyos-help@Millennium.Berkeley.EDU
https://mail.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help


Re: [Tinyos-help] battery voltage micaz

2006-05-19 Thread David Gay

On 5/19/06, Michael Schippling [EMAIL PROTECTED] wrote:

As for the include path, I meant the implicit path. For instance
nothing explicitly references hardware.h (in most apps anyway),


hardware.h is referenced from tos.h, which is magically included
when you compile a TinyOS program (but if you pass -v to ncc, you will
see somewhere a -fnesc-include=tos option, which is the source of the
magic...)


but it automagically appears in the (pre-)compiled code, and,
various source directories are searched in some (unspecified to me)
order when compiling.


Well, as I said, make sure ncc gets a -v option, and you will see the
full set of include paths searched.


oh, and my (hopefully vanilla and regular-guy kinda) TOS 1.1.7
install doesn't find a man page for ncc...is it really part of
the standard install, and I didn't set my MANPATH right?


I did say the latest toolchain ;-) The TinyOS 2.x toolchain is
supposed to work with TinyOS 1.x as of TinyOS 1.1.something recent.
But looking at the release date for 1.1.15, I guess my fixes for using
the 2.x toolchain in 1.x haven't made it out of CVS and into a minor
release :-(

David Gay

___
Tinyos-help mailing list
Tinyos-help@Millennium.Berkeley.EDU
https://mail.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help