Presentation is loading. Please wait.

Presentation is loading. Please wait.

HANBACK ELECTRONICS CO., LTD. 저자권 보호됨 Light Sense Lab. Read data from light(photo diode) sensor, display using oscilloscope.

Similar presentations


Presentation on theme: "HANBACK ELECTRONICS CO., LTD. 저자권 보호됨 Light Sense Lab. Read data from light(photo diode) sensor, display using oscilloscope."— Presentation transcript:

1 HANBACK ELECTRONICS CO., LTD. 저자권 보호됨 Light Sense Lab. Read data from light(photo diode) sensor, display using oscilloscope.

2 HANBACK ELECTRONICS CO., LTD. 저자권 보호됨 2015-10-20 2 ZigbeX Photo Diode

3 HANBACK ELECTRONICS CO., LTD. 저자권 보호됨 2015-10-20 3 ZigbeX Photo Diode Photo diode CDS – named CDS is connected to INT0 & ADC0 on Atmega 128(8bit CPU) –CDS inputs resistance value varying on light strength –Output to ADC0 Light Sensor Component –Photo component

4 HANBACK ELECTRONICS CO., LTD. 저자권 보호됨 2015-10-20 4 Photo component ADCC component –Photo component needs to uses upper level component ADCC. ADCC functions Get data from ADC ADC.getData() – read data from ADC port(command). event ADC.dataReady(uint16_t data) – event delibers.

5 HANBACK ELECTRONICS CO., LTD. 저자권 보호됨 2015-10-20 5 Read Light strength Ex. // upper level comp. xxx_function() { call ADC.getData() … } // upper level comp event ADC.dataReady(uint16_t data) { //data -> measured data … } Photo component

6 HANBACK ELECTRONICS CO., LTD. 저자권 보호됨 2015-10-20 6 Using Oscilloscope

7 HANBACK ELECTRONICS CO., LTD. 저자권 보호됨 2015-10-20 7 Oscilloscope Lab Oscilloscope program –Oscilloscope program delivers data from mote to PC via “com” port Oscilloscope Location –c:\Programfiles\UCB\cygwin\opt\tinyos ‐ 1.x\contrib\zigbex\ Osilloscop e – Oscilloscope.nc, OscilloscopeM.nc, &OscopeMsg.h.

8 HANBACK ELECTRONICS CO., LTD. 저자권 보호됨 2015-10-20 8 Oscilloscope.nc –Osilloscope components UART Comm – connecting to PC DemoSensorC- Get the light data TimerC & LedsC configuration Oscilloscope { } implementation { components Main, OscilloscopeM, TimerC, LedsC, DemoSensorC as Sensor, UARTComm as Comm; Main.StdControl ‐ > OscilloscopeM; Main.StdControl ‐ > TimerC; OscilloscopeM.Timer ‐ > TimerC.Timer[unique("Timer")]; OscilloscopeM.Leds ‐ > LedsC; OscilloscopeM.ADC ‐ > Sensor; … }

9 HANBACK ELECTRONICS CO., LTD. 저자권 보호됨 2015-10-20 9 Serial Comm. UARTComm component –UARTComm provides ReceiveMsg interface and SendMsg interface. UARTComm functions ReceiveMsg event TOS_MsgPtr receive(TOS_MsgPtr m) – received from PC with event type, and message type is TOS_Msg SendMsg send(...) – sense mode to PC, passes TOS_Msg sendDone(...) - send(...) - when done, tells by event type

10 HANBACK ELECTRONICS CO., LTD. 저자권 보호됨 2015-10-20 10 OscilloscopeM.nc OscilloscopeM.nc (1) includes OscopeMsg; module OscilloscopeM { provides interface StdControl; uses { … // interfaces } } implementation { … // variables command result_t StdControl.init() { … // initialization return SUCCESS; }

11 HANBACK ELECTRONICS CO., LTD. 저자권 보호됨 2015-10-20 11 OscilloscopeM.nc OscilloscopeM.nc (2) command result_t StdControl.start() { call SensorControl.start(); call Timer.start(TIMER_REPEAT, 125); call CommControl.start(); return SUCCESS; } command result_t StdControl.stop() { … return SUCCESS; } event result_t Timer.fired() { return call ADC.getData(); }

12 HANBACK ELECTRONICS CO., LTD. 저자권 보호됨 2015-10-20 12 OscilloscopeM.nc OscilloscopeM.nc (3) async event result_t ADC.dataReady (uint16_t data) { struct OscopeMsg *pack; atomic { pack = (struct OscopeMsg *) msg[currentMsg].data; pack ‐ >data[packetReadingNumber++] = data; readingNumber++; dbg(DBG_USR1, "data_event\n"); if (packetReadingNumber == BUFFER_SIZE) { post dataTask(); } if (data > 0x0300) call Leds.redOn(); else call Leds.redOff(); return SUCCESS; }

13 HANBACK ELECTRONICS CO., LTD. 저자권 보호됨 2015-10-20 13 OscilloscopeM.nc OscilloscopeM.nc (4) task void dataTask() { struct OscopeMsg *pack; atomic { pack = (struct OscopeMsg *)msg[currentMsg].data; packetReadingNumber = 0; pack ‐ >lastSampleNumber = readingNumber; } pack ‐ >channel = 1; pack ‐ >sourceMoteID = TOS_LOCAL_ADDRESS; if (call DataMsg.send(TOS_UART_ADDR, sizeof(struct OscopeMsg), &msg[currentMsg])) { atomic { currentMsg ^= 0x1; } call Leds.yellowToggle(); } event result_t DataMsg.sendDone (TOS_MsgPtr sent, result_t success) { return SUCCESS; }

14 HANBACK ELECTRONICS CO., LTD. 저자권 보호됨 2015-10-20 14 Oscilloscope Lab.

15 HANBACK ELECTRONICS CO., LTD. 저자권 보호됨 2015-10-20 15 Oscilloscope lab. 1 Starts cygwin. Move to folder as follows make zigbex cd /opt/tinyos ‐ 1.x/contrib/zigbex cd Oscilloscope

16 HANBACK ELECTRONICS CO., LTD. 저자권 보호됨 2015-10-20 16 Oscilloscope 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\Oscilloscope\ build \ zigbex

17 HANBACK ELECTRONICS CO., LTD. 저자권 보호됨 2015-10-20 17 Oscilloscope lab. 3 Java application –When it is configured correctly, –Move to /opt/tinyos ‐ 1.x/tools/java in Cygwin –Type as follows export MOTECOM=serial@COM1:57600 cd /opt/tinyos ‐ 1.x/tools/java java net.tinyos.oscope.oscilloscope

18 HANBACK ELECTRONICS CO., LTD. 저자권 보호됨 2015-10-20 18 Oscilloscope result Result


Download ppt "HANBACK ELECTRONICS CO., LTD. 저자권 보호됨 Light Sense Lab. Read data from light(photo diode) sensor, display using oscilloscope."

Similar presentations


Ads by Google