Hi,
I've modified the oscilloscope application to read the voltage level
of the batteries of a Tmote Sky.
So I have included the InternalVoltageC in the
apps/Oscilloscope/Oscilloscope.nc file:
includes OscopeMsg;
configuration Oscilloscope { }
implementation
{
components Main
, OscilloscopeM as Scope
, InternalVoltageC // added for MSP430 internal voltage sensor
, TimerC
, LedsC
//, DemoSensorC as Sensor // removed because not using ext sensors
, UARTComm as Comm;
Main.StdControl -> Scope;
Main.StdControl -> TimerC;
Scope.Timer -> TimerC.Timer[unique("Timer")];
Scope.Leds -> LedsC;
//Scope.SensorControl -> Sensor; // removed
Scope.ADC -> InternalVoltageC;
Scope.CommControl -> Comm;
Scope.ResetCounterMsg -> Comm.ReceiveMsg[AM_OSCOPERESETMSG];
Scope.DataMsg -> Comm.SendMsg[AM_OSCOPEMSG];
}
And then in the corresponding module (OscilloscopeM.nc) I've just
removed the commands to turn on and start the external (not embedded in
the MSP430) sensors:
//call SensorControl.init();
and
//call SensorControl.start();
The application compiles and works, and I can read value, for example,
using the oscilloscope java application.
The problem comes trying to convert ADCcounts to Voltage values.
In the MSP430 Datasheet (and also reported in the Tmote Sky datasheet,
pag. 23) I can see this conversion formula:
DVcc = (ADCCounts/4096)*Vref*2R/R
My question is, which is the Vref value?
It should be 1.5V or 2.5V (see MSP430F1611 datasheet pag 349) but using
this values the conversion gives me wrong results.
For example:
Attaching the mote to a USB port, with the java oscilloscope I should
read 3 V, and the ADCcounts spans between 973 and 975.
If I take Vref = 1.5 V => DVcc = ADCCounts*2*Vref/4096 = 975*3/4096 =
0.714 V
If Vref = 2.5 V => DVcc = ADCCounts*2*Vref/4096 = 975*6/4096 = 1.428 V
So the right result should come from Vref = 6.301 => DVcc =
ADCCounts*2*Vref/4096 = 975*6/4096 = 2.9997 V
Where is my error?
Thank you all,
Fabrizio
_________________________________
This email has been ClamScanned !
www.clamav.net
_________________________________
_______________________________________________
Tinyos-help mailing list
[email protected]
https://mail.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help