[Tinyos-help] TinyOS:Amtega128 ADC values help
Varun Jain
varun at spiderbox.com.au
Sun Jun 1 04:36:15 PDT 2008
Hi,
Thanks for your reply. I have taken the basic sensor code from the tos/sensorboards/basicb. Further, I have modified it according to my Chipcon CC2420DBK boards which has an onboard LM61 temperature sensor. The code is as follows:
generic configuration TempC() {
provides interface Read<uint16_t>;
}
implementation {
components new AdcReadClientC(), TempP;
components HplAtm128GeneralIOC as AtmGeneralIO;
Read = AdcReadClientC;
AdcReadClientC.Atm128AdcConfig -> TempP;
AdcReadClientC.ResourceConfigure -> TempP;
TempP.TempPin -> AtmGeneralIO.PortF3; //WIRING PORT-F3 and then setting it up in TempP
}
---------------------------------------------
module TempP
{
provides {
interface ResourceConfigure;
interface Atm128AdcConfig;
}
uses {
interface GeneralIO as TempPin;
}
}
implementation
{
async command uint8_t Atm128AdcConfig.getChannel() {
return ATM128_ADC_SNGL_ADC3;
}
async command uint8_t Atm128AdcConfig.getRefVoltage() {
return ATM128_ADC_VREF_OFF;
}
async command uint8_t Atm128AdcConfig.getPrescaler() {
return ATM128_ADC_PRESCALE;
}
async command void ResourceConfigure.configure() {
call TempPin.makeOutput();
call TempPin.set();
}
async command void ResourceConfigure.unconfigure() {
call TempPin.clr();
}
}
----------------------------------------------
I am using the Oscilloscope application where DemoSensorC is called
which further calls the TempC() module. I am getting constant reading of
03 FF 03 FF 03 FF 03 FF 03 FF in the payload part using the listen tool.
If i use the MsgReader tool from Oscilloscope application and connect the serial port on the "BaseStation" application, i constantly get '0xff 0xff.... 0xff' as the readings for "local.readings" in the "OscilloscopeMsg"
If i use a voltmeter across the temp.sensor, it gives about 1000mV which is approximately 40 degrees according to LM61 (National Semiconductor temp sensor) datasheet, but my readings still come out to be 03 FF 03 FF..., it does not vary at all. Even after putting the temp. sensor in front of a hot air source which makes it really hot and voltage changes to 1100mV which is 50 degrees C [10mV/degree C + 600mV(offset) ].
Even if i use "ATM128_ADC_VREF_2_56" or "ATM128_ADC_VREF_AVCC" to get the reference voltage, the result is the same, if the reading across the temp.sensor is only 1V then these references should be alright. What is the effect of using "ATM128_ADC_VREF_OFF" but anyways in all cases it gives me 03 FF 03 FF...
Thanks.
Cheers,
Varun
________________________________
From: Razvan Musaloiu-E. [mailto:razvanm at cs.jhu.edu]
Sent: Sun 6/1/2008 10:21 AM
To: Varun Jain
Cc: tinyos-help at millennium.berkeley.edu
Subject: Re: TinyOS:Amtega128 ADC values help
Hi!
Sorry for answering so late. :-(
On Fri, 30 May 2008, Varun Jain wrote:
> Hi,
>
> I am currently trying to set up a WSN using tinyos-2.x. I have Chipcon's
> CC2420DBK with me, it has an onboard temperature sensor LM61 attached to
> it with atmega128 processor. I am trying to read the temperature values
> from this sensor, I am constantly getting 0x3ff as my data in the raw
> packet using the Listen tool. I am trying to get Oscilloscope
> application running. I am reading the value on ADC3 channel on PortF3.
>
The Atmega128 has 10 bits of precision so the 0x3ff is the maximum value.
This is the value you'll get if the voltage you are reading is above the
reference used by the ADC. How did you configured the ADC? Can you measure
the output voltage from temperature sensor with a voltmeter?
--
Razvan ME
>
> I read somewhere you discussing about this value. Can you guide me as to
> what does this value depict, I think I am reading wrong values as I
> keep the board in front of hot air source which really heats up the
> sensor but still it gives the same value.
>
>
>
> Any help or direction will really help...
>
>
>
> Varun Jain
> R&D Engineer
> Spiderbox Pty. Ltd.
> P: +617 3318 9509
> F: +617 3318 9595
> M: +61401 091 248
> E: varun at spiderbox.com.au <mailto:bdarcy at spiderbox.com.au>
> W: http://www.spiderbox.com.au <http://www.spiderbox.com.au/> <http://www.spiderbox.com.au/>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: https://www.millennium.berkeley.edu/pipermail/tinyos-help/attachments/20080601/797206f6/attachment-0002.htm
More information about the Tinyos-help
mailing list