Andres,

Yes, the conversion formula is wrong. The bandgap reference voltage of
the atmega1281 is 1.1V (vs. the 1.23V of the mica2/micaz). The correct
formula should be more like 1100*1024/data.

Janos

On Thu, Jul 23, 2009 at 9:59 AM, Andres Vahter<[email protected]> wrote:
> 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
>

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

Reply via email to