Home / essay help / essays for sale / mylmu connect

mylmu connect

ELEC-698 SS: Wireless Sensor Networks, EECS, LMU Spring 2016

1 of 9

LAB ASSIGNMENT 7

Single-Hop Network for Sensing Luminosity Objective:

• To program two wireless sensor nodes that measure luminosity and send the measurements to a sink in a single-hop manner

Required Hardware:

• MIB520 USB Interface Board • 3 IRIS Wireless Sensor Nodes • 2 MD100CB Sensor Boards • 4 AA Batteries • USB Cable • PC

Required Software:

• Linux Ubuntu • Eclipse SDK • TinyOS

Procedure:

1. Set up the development system as instructed in steps 1 through 9 of lab assignment 1. 2. Create a TinyOS project to implement your SensingLuminosity application as instructed in step

10 of lab assignment 1. The name of your project should be SensingLuminosityYourFirstName (e.g., the instructor’s project title would be SensingLuminosityGustavo).

3. Create the source files of your project as indicated in step 11 of lab assignment 1. The names of the module and configuration files should be as follows:

• Module file: “SensingLuminosityC” • Configuration file: “SensingLuminosityAppC” • Header file: “SensingLuminosity” • Makefile

The source code of the previous three files can be found in the last pages of this document. The source code of the module file SensingLuminosityC is not complete. You need to complete it as explained in the next step.

4. The module controls the operation of the application. It starts the radio at boot time, and it starts a periodic timer when the radio has been initialized. A measurement of the luminosity is requested every time the timer fires, and once all the measurements that can fit in one packet have been obtained, the packet is transmitted. The code is not complete in the events Timer.fired() and ReadLuminosity.readDone(error_t error, uint16_t sample). The missing code is supposed to request the luminosity measurements and store the completed measurements respectively. You need to review all the source code in the module and configuration files in order to be able to complete the source code. Tip: You can access the TinyOS source files in the TinyOS libraries to find out how you can request and process a completed measurement. The TinyOS project, which includes the

ELEC-698 SS: Wireless Sensor Networks, EECS, LMU Spring 2016

2 of 9

libraries, is available at https://github.com/tinyos/tinyos-main. You can use the search tool. For example, you can search for “interface Read” and “DemoSensorC”.

5. To program the wireless sensor nodes, the two ports assigned to the MIB520 board need to be set with read and write attributes as instructed in step 15 of lab assignment 1. Important: You will need to repeat this step anytime you disconnect and connect the MIB520 board back to the PC.

6. Now, install the project on two nodes using the node IDs assigned by the instructor and verify

that they work as expected using the Oscilloscope application as indicated in step 7. Also, you need to make the constant AM_LUMINOSITY different from that one of your classmates. Otherwise, your Oscilloscope will show measurements of not only your project but those of other students who have the same AM_LUMINOSITY value. You should AM_LUMINOSITY equal to one of the node IDs assigned to you in lab assignment 3 plus 0x90. Important: You need to connect the MDA100CB sensor board to the node after you program it and before you turn it on. The sensor board has the photoresistor to measure luminosity.

7. Install the BaseStation application in one of your nodes. 8. Download into your src folder the following two files available on MyLMU Connect:

• Oscilloscope.h • java.zip

Make sure all values in Oscilloscope.h match the corresponding values in SensingLuminosity.h. Pay special attention to AM_OSCILLOSCOPE in Oscilloscope.h. It needs to be equal to AM_LUMINOSITY in SensingLuminosity.h. Uncompress the file java.zip. Uncompressing java.zip generates a folder called java. Using the Ubuntu file manager, go to the uncompressed java folder and right click on the file called run. Select the option Properties. A window will open. Go to the tab called Permissions and make sure that the checkbox called Execute is checked. Close the properties window. Now go back to the terminal window and open a new tab by clicking on File -> Open Tab. Go to the uncompressed java folder. Compile the Oscilloscope application by executing the following two commands:

• make clean • make

To run the Oscilloscope application, you need to run the SerialForwarder first. The SerialForwarder is a server application that is part of TinyOS. You should connect it to the Base Station with the command below. Once connected to the Base Station, client applications can connect to the SerialForwarder. All client applications that connect, will receive a copy of the stream of packets that the BaseStation listens to. In this lab assignment, you will connect only one client. This is the Oscilloscope application. Open a new tab in your terminal window as indicated previously and execute the following command (the Base Station must be connected):

• java net.tinyos.sf.SerialForwarder –comm serial@/dev/ttyUSB1:iris Finally, go back to the tab for the Oscilloscope and execute the following command:

• ./run 9. Verify that the nodes are measuring luminosity with the Oscilloscope. First, you need to set the

vertical scale of the Oscilloscope from 0 to 4000, and then cover the photoresistor with your hand and check whether the measurements drop. The previous upper limit of 4000 may need to be changed depending on the amount of light in the laboratory.

10. Take a snapshot of the Oscilloscope application showing variations on the luminosity of the two sensor nodes. Take a picture with your cellphone showing how you changed the amount of lighthttps://github.com/tinyos/tinyos-main

ELEC-698 SS: Wireless Sensor Networks, EECS, LMU Spring 2016

3 of 9

on the photo resistor. You need to include these pictures in the section on experimental evaluation of your report.

11. Obtain the signature from the instructor to show that all steps where completed successfully.

______________________________________________________ Instructor’s Signature Date

12. Shut down the system as follows:

• Close all open files in Eclipse • Close all open folders of your project in Eclipse • Close your project in Eclipse • Exit Eclipse: File -> Exit • Exit the terminal window: enter the command exit • Close any other programs such as file manager, Internet browser, etc. • Press the Ubuntu button at the right top of the screen • Select the Shut down option

Report: The lab report needs to include the following sections: title, abstract, introduction (i.e., problem statement and relevance of the problem), system description (i.e., what hardware and software are used, how they connect and interact, and what can be done with the whole system), proposed solution (e.g., flow chart) including source code and its explanation, experimental evaluation, and conclusions. The report needs to be submitted in the IEEE format, available at http://www.ieee.org/publications_standards/publications/authors/author_templates.html The title should be “Lab Assignment 7: Single-Hop Network for Sensing Luminosity” The introduction needs to:

• summarize the objective of the assignment in one paragraph • explain in one paragraph why you think it is important to learn how to meet that objective, i.e.,

what do you think you are learning from this assignment? how is it useful? • give an outline of the report in one paragraph; for example, the outline could start with “This

report is organized as follows. In Section II, a description of the hardware and software used is provided. Section III describes the solution that was implemented to install the nesC application …”

The system description needs to describe the architecture of the system including software and hardware. You need to explain the purpose of each hardware and software element and the purpose of the system as a whole. Make sure you include the MDA100CB sensor board in your explanation. The proposed solution needs to explain in your own words the C and nesC code in the header, module, and configuration files. Also, all the steps followed to install and verify the correct operation of the code need to be explained in your own words. These steps correspond to those of the procedure listed in this assignment. Therefore, you need to explain each step in your own words.http://www.ieee.org/publications_standards/publications/authors/author_templates.html

ELEC-698 SS: Wireless Sensor Networks, EECS, LMU Spring 2016

4 of 9

The experimental evaluation needs to explain how you evaluated experimentally that the objective stated in the introduction was actually met. This explanation needs to include all the steps you followed. Finally, you need to report what the results were. You should show proof of the results. In this case, you should include the pictures you took when you ran the Oscilloscope application. The conclusions should be a one-paragraph summary of the whole lab assignment. The abstract should be a one-paragraph summary of the following sections: objective of the assignment, system description, proposed solution, experimental evaluation. Finally, you need to attach to your report the signed lab guide in order to show that you completed the whole procedure in the lab.

ELEC-698 SS: Wireless Sensor Networks, EECS, LMU Spring 2016

5 of 9

SensingLuminosityC.nc #include “Timer.h” #include “SensingLuminosity.h” module SensingLuminosityC{

uses{ interface Boot; interface Leds; interface Timer<TMilli>; interface Read<uint16_t> as ReadLuminosity; interface SplitControl as RadioControl; interface AMSend; interface Receive; } } implementation{ message_t mymessage; bool busy; mydataformat_t mydata; uint8_t currentsamplenum; bool dontcount; void report_problem() { call Leds.led2Toggle(); } void report_transmission() { call Leds.led0Toggle(); } void report_reception() { call Leds.led1Toggle(); } task void sendpacket() { if (sizeof(mydata) > call AMSend.maxPayloadLength()) { report_problem(); } else { memcpy(call AMSend.getPayload(&mymessage, sizeof(mydata)),

&mydata, sizeof(mydata)); if (call AMSend.send(AM_LUMINOSITY, &mymessage, sizeof(mydata)) == SUCCESS) { busy = TRUE; } } } event void Boot.booted(){ mydata.samplingperiod = DEFAULT_PERIOD; mydata.nodeid = TOS_NODE_ID; if (call RadioControl.start() != SUCCESS){ report_problem(); } } event void RadioControl.startDone(error_t error){ if (error != SUCCESS){ report_problem(); } else { call Timer.startPeriodic(mydata.samplingperiod); currentsamplenum = 0; } } event void RadioControl.stopDone(error_t error){}

ELEC-698 SS: Wireless Sensor Networks, EECS, LMU Spring 2016

6 of 9

SensingLuminosityC.nc (cont.) event void Timer.fired() { if (currentsamplenum < NUMSAMPLES) { // Request a measurement of the luminosity, and if the request is not granted, // report the problem using the function report_problem(). } else { if (!busy) { post sendpacket(); } currentsamplenum = 0; if (!dontcount) { mydata.count++; } dontcount = FALSE; } } event void ReadLuminosity.readDone(error_t error, uint16_t sample) { // Check whether the measurement was done successfully. If it was not, make the sample // equal to the highest possible number it can take on and report the problem using the // function report_problem(). If it was, store the measurement in the corresponding // location. currentsamplenum++; } event void AMSend.sendDone(message_t * txmessage, error_t error) { if (error != SUCCESS) { report_problem(); } else { report_transmission(); } busy = FALSE; } event message_t * Receive.receive(message_t * rxmessage, void * payload, uint8_t payloadsize) { mydataformat_t * rxpayload = payload; if (rxpayload->nodeid == NODE_ID1 || rxpayload->nodeid == NODE_ID2) { report_reception(); if (rxpayload->version > mydata.version) { mydata.version = rxpayload->version; mydata.samplingperiod = rxpayload->samplingperiod; call Timer.startPeriodic(mydata.samplingperiod); } if (rxpayload->count > mydata.count) { mydata.count = rxpayload->count; dontcount = TRUE; } } return rxmessage; } }

ELEC-698 SS: Wireless Sensor Networks, EECS, LMU Spring 2016

7 of 9

SensingLuminosityAppC.nc #include “SensingLuminosity.h” configuration SensingLuminosityAppC{ } implementation{ components SensingLuminosityC, MainC, ActiveMessageC, LedsC, new TimerMilliC() as Timer, new DemoSensorC() as PhotoSensor, new AMSenderC(AM_LUMINOSITY), new AMReceiverC(AM_LUMINOSITY); SensingLuminosityC.Boot -> MainC; SensingLuminosityC.RadioControl -> ActiveMessageC; SensingLuminosityC.AMSend -> AMSenderC; SensingLuminosityC.Receive -> AMReceiverC; SensingLuminosityC.Timer -> Timer; SensingLuminosityC.ReadLuminosity -> PhotoSensor; SensingLuminosityC.Leds -> LedsC; }

ELEC-698 SS: Wireless Sensor Networks, EECS, LMU Spring 2016

8 of 9

SensingLuminosity.h #ifndef SENSING_LUMINOSITY_H #define SENSING_LUMINOSITY_H enum { NUMSAMPLES = 5, DEFAULT_PERIOD = 64, AM_LUMINOSITY = 0x93, NODE_ID1 = 1, NODE_ID2 = 2, BASESTATION_ID = 0 }; typedef nx_struct mydataformat { nx_uint16_t version; nx_uint16_t samplingperiod; nx_uint16_t nodeid; nx_uint16_t count; nx_uint16_t samples[NUMSAMPLES]; } mydataformat_t; #endif /* SENSING_LUMINOSITY_H */

ELEC-698 SS: Wireless Sensor Networks, EECS, LMU Spring 2016

9 of 9

Makefile COMPONENT=SensingLuminosityAppC SENSORBOARD=mda100 include $(MAKERULES)

About eduhawks

Check Also

rank these bonds from most ionic to most covalent in character.

Rank these bonds from most ionic to Most covalent in character Br-F Ca-F F-F Cl-F …