Hi,

I have a question about VoltageC component.
As I can see it is meant for measuring battery voltage.

I made some tests with it and it gives around 352 (3557 mV ->  
1223*1024 / data) on Iris.
My battery actual voltage is around 3100 mV.

Is this conversion formula wrong?
Do I use VoltageC component correctly?




-----------AppNodeC.nc----------------
configuration AppNodeC {}
implementation {
   components NodeC, MainC, LedsC, ActiveMessageC;
   components new VoltageC() as BatteryVoltage;

   NodeC.ReadBatteryVoltage -> BatteryVoltage;




-----------NodeC.nc----------------
module NodeC {
        uses interface Boot;
        uses interface Read<uint16_t> as ReadBatteryVoltage;
        ...................
}
implementation {
        ...................
        event void Timer.fired() {
        //call Leds.led1Toggle();
                call ReadBatteryVoltage.read();
                
        }
        event void ReadBatteryVoltage.readDone(error_t result, uint16_t data) {
                if (result != SUCCESS) {
                data = 0xffff;
           }
        
           ADC= data;
          ADCconvert= (uint16_t)((uint32_t)1223 * (uint32_t)1024 /  
(uint32_t)data);
                
                if (!sendBusy)
                        sendMessage();
        }
        .....................



Andres vahter
_______________________________________________
Tinyos-help mailing list
[email protected]
https://www.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help

Reply via email to