Download presentation
Presentation is loading. Please wait.
1
Temperature and Humidity Lab.
2
Lab for Temp. and Humidity
3
Temp. and Humidity Configuration
SHT11 sensor module SHT11 containing temp. and humidity sensors is directly connected to Atmega 128. SHT11 includes itself ADC device for conversion. Component in TinyOS HumidityC
4
HumidityC component ADCC functions HumidityC functions humidity
HumidityC functions humidity Humidity.getData() – read data from ADC in SHT11. event Humidity.dataReady(uint16_t data) temperature Temperature.getData() event Temperature.dataReady (uint16_t data)
5
OscilloscopeSHT11 lab.
6
OscilloscopeSHT11 lab. OscilloscopeSHT11 location
c:\Programfiles\UCB\cygwin\opt\tinyos‐1.x\contrib\zigbex\Osilloscope SHT11\ Oscilloscope.nc, OscilloscopeM.nc, & OscopeMsg.h
7
Oscilloscope.nc Oscilloscope.nc OsilloscopeSHT11 components
UART Comm – PC connection HumidityC TimerC & LedsC configuration Oscilloscope { } implementation { components Main, OscilloscopeM, TimerC, LedsC , HumidityC as SHT11, UARTComm as Comm; Main.StdControl ‐> OscilloscopeM; Main.StdControl ‐> TimerC; OscilloscopeM.Timer ‐> TimerC.Timer[unique("Timer")]; OscilloscopeM.Leds ‐> LedsC; OscilloscopeM.SHT11_Humidity ‐> SHT11.Humidity; … }
8
OscilloscopeM.nc OscilloscopeM.nc (1) includes OscopeMsg;
module OscilloscopeM { provides interface StdControl; uses { … // interface } } implementation { uint8_t mytemp, myhumi; … // variables command result_t StdControl.init() { … // initialization return SUCCESS;
9
OscilloscopeM.nc OscilloscopeM.nc (2)
command result_t StdControl.start() { call SensorControl.start(); call Timer.start(TIMER_REPEAT, 125); call CommControl.start(); call SplitControl.start(); return SUCCESS; } command result_t StdControl.stop() { … return SUCCESS; } event result_t Timer.fired() { timetick++; //return call SHT11_Temp.getData(); return call SHT11_Humidity.getData();
10
OscilloscopeM.nc OscilloscopeM.nc (3)
async event result_t SHT11_Humidity.dataReady (uint16_t data) { struct OscopeMsg *pack; atomic { pack = (struct OscopeMsg *) humimsg[currentTempMsg].data; calc_SHT11(data,data); pack‐>data[HumipacketReadingNumber++]=myhumi; HumireadingNumber++; dbg(DBG_USR1, "data_event\n"); if (HumipacketReadingNumber == BUFFER_SIZE) { post dataTaskHumi(); } } if (data > 0x0300) call Leds.redOn(); else call Leds.redOff(); return SUCCESS; }
11
OscilloscopeM.nc OscilloscopeM.nc (4)
void calc_SHT11 (uint16_t p_humidity, …) { … //calc. Temperature from ticks to [C] t_C=t*0.01 ‐ 40; //calc. Humidity from ticks to [%RH] rh_lin=C3*rh*rh + C2*rh + C1; mytemp=(uint8_t)t_C; //return temperature [C] myhumi=(uint8_t)rh_true; //return humidity[%RH] } task void dataTaskHumi () { if (call DataMsg.send(TOS_UART_ADDR, sizeof(struct OscopeMsg), &humimsg[currentHumiMsg]))
12
OscilloscopeSHT11 Lab
13
OscilloscopeSHT11 lab. 1 Starts cygwin. Move to following folder.
Compile - make zigbex cd /opt/tinyos‐1.x/contrib/zigbex cd OscilloscopeSHT11
14
OscilloscopeSHT11 lab. 2 ZigbeX Download
Run AVR studio at Windows Tolol->auto connect-> browse main.hex located at c:\Programfiles\UCB\cygwin\opt\tinyos‐1.x\contrib\zigbex\ OscilloscopeSHT11\build\zigbex
15
OscilloscopeSHT11 lab. 3 Java application
When it is configured correctly, Move to /opt/tinyos‐1.x/tools/java in Cygwin Type as follows export cd /opt/tinyos‐1.x/tools/java java net.tinyos.oscope.oscilloscope
16
OscilloscopeSHT11 result
17
OscilloscopeSHT11 result
Show sensed temperature via oscilloscope!!!
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.