{"id":15398529,"url":"https://github.com/jryans/wavelet-tinyos","last_synced_at":"2026-01-24T02:03:01.157Z","repository":{"id":23203442,"uuid":"26560171","full_name":"jryans/wavelet-tinyos","owner":"jryans","description":"Distributed Wavelet Transform for Wireless Sensor Networks: TinyOS Implementation","archived":false,"fork":false,"pushed_at":"2014-11-12T22:54:50.000Z","size":3996,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-04-23T23:59:46.593Z","etag":null,"topics":["mote","tinyos","wavelet","wireless-sensor-network"],"latest_commit_sha":null,"homepage":"","language":"Matlab","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"bsd-3-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/jryans.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2014-11-12T22:54:27.000Z","updated_at":"2018-01-10T23:12:10.000Z","dependencies_parsed_at":"2022-08-05T21:00:31.086Z","dependency_job_id":null,"html_url":"https://github.com/jryans/wavelet-tinyos","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jryans%2Fwavelet-tinyos","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jryans%2Fwavelet-tinyos/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jryans%2Fwavelet-tinyos/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jryans%2Fwavelet-tinyos/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jryans","download_url":"https://codeload.github.com/jryans/wavelet-tinyos/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":250535030,"owners_count":21446506,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["mote","tinyos","wavelet","wireless-sensor-network"],"created_at":"2024-10-01T15:44:27.456Z","updated_at":"2026-01-24T02:03:01.094Z","avatar_url":"https://github.com/jryans.png","language":"Matlab","readme":"# Distributed Wavelet Transform for Wireless Sensor Networks: TinyOS Implementation\n\n**Author:** J. Ryan Stinnett (\u003cjryans@rice.edu\u003e)\nDSP Group, Rice University\n\n## Overview\n\nThis project implements data compression for wireless sensor networks\n(WSNs) by using a distributed wavelet transform. This compression system\nlowers the number of devices which need to transmit data to a base\nstation, and thus reduces power consumption and increases the average\nlifetime of the network.\n\n## Implementation\n\nCode running on the WSN devices, or \"motes\", was written in nesC for TinyOS and\ntested on Crossbow's MicaZ platform. Before working on the transform itself, I\ncreated several components that provide essential system services. The first of\nthese was a suite of networking components. As the focus of this project is not\non routing protocols, I opted for simplicity by using basic broadcast and\nunicast protocols. The broadcast protocol waits for packets with a sequence\nnumber larger than the last sequence number received, and then repeats those\nnew packets a set number of times. The unicast protocol uses a static routing\ntable to determine the next hop for a given packet.\n\nAbove these protocols, I built a multi-packet fragmentation and reassembly\nservice. It allows for bidirectional communication of any data size. TinyOS 1.x\nuses a fixed data length of 29 bytes, so expanding beyond this limit in a\nreusable manner simplifies code significantly. By using small descriptor\nrecords, this system can even rebuild data structures that use pointers or\nvariable-length arrays. These techniques were used to send the initial wavelet\ntransform parameters to the motes and also to request statistical data from\nthe motes about network traffic.\n\nThe distributed wavelet transform\u003csup\u003e[[1](#ref1)]\u003c/sup\u003e is the core application\nrunning on top of these and other standard TinyOS system services. Currently\nonly a spatial transform across the mote network has been implemented, but a\ntransform in the time domain will be added soon. To ensure that each mote runs\neach scale of the transform at the same time, a finite state machine with\nfixed-length delays between each state is used. The scheme assumes clock\nsynchronization between motes. A clock synchronization protocol specific to WSNs\nhas already been proposed.\u003csup\u003e[[2](#ref2)]\u003c/sup\u003e\n\nTo achieve data compression, each mote compares its value against a list of\ntarget values from the sink, which are arranged in decreasing order. Each mote\ncompares its results from the current round of the wavelet transform with the\ntarget values. The first target value that is less than the result value\ndetermines the transmission band. Each mote assigned to a specific band\ntransmits its data back to the sink at roughly the same time. When the sink\ndetermines it has received enough values to reconstruct a good approximation of\nthe original data, it broadcasts a stop message to prevent further bands from\nbeing transmitted. This message also includes updated target values that will\nbe used during the next transform round.\n\nFor the sink node, I created a variety of support tools in both Java and MATLAB.\nIt took several revisions to design a good scheme for mote communication in Java\nthat could support all of the various system tools as well as the wavelet\ntransform itself. With that in place, these tools simply try to provide a\nlogical user interface to the various options and functions of the motes.\n\n## Challenges\n\nThough there are many things I learned while working on this project, what stood\nout in my mind the entire time was the importance of thoroughly debugging code\nand including as many tests and checks to ensure proper operation. When writing\ncode that runs purely on modern PCs, it is easy to be sloppy about such things\nbecause you can always attach a debugger and resolve the issue. When working\nwith the motes, you can't debug code directly on the motes themselves. Also,\nthey are dependent on messages from other devices, so inspecting the code on one\ndevice may not be enough to see the whole issue. Luckily, TinyOS includes\nTOSSIM, which can simulate an entire mote network on a PC. This tool has helped\nresolve bugs countless times.\n\nWhen I started working on the multi-packet transmission system, I quickly\ndiscovered that my understanding of pointers in C needed improvement. I found\ngreat tutorials online that helped me grasp the relationship between pointers\nand arrays, without which I doubt I could have gotten the system to work at\nall. It is this relationship that I exploited to rebuild hierarchical data\nstructures from a simple data stream.\n\nTo verify good network operation, we wanted to capture various metrics about the\nmessages that pass through each mote. One of these metrics is the median of\nthe received signal strength. Ordinarily, one would need to store every\nmeasurement to find the median, but that is not a practical on these motes with\nsuch limited memory. I originally tried to use the mote's flash storage to hold\nall the values, but that became too complex for such a simple question. Instead,\nI used a compact technique for estimating the median from only a few\nvalues\u003csup\u003e[[3](#ref3)]\u003c/sup\u003e, which can remain entirely in memory.\n\nAnother issue I encountered was with sensor values that would intermittently be\nfar larger than was even possible for the sensor itself. After looking more\nclosely at documentation, I found that on the MicaZ, one of the sensors shares\nan interrupt line with the radio. If a packet is received while trying to read\nthis sensor, its value will be corrupted. This issue itself would have been easy\nenough to work around, but it was compounded by conflicting files in the TinyOS\ntree I was using, which prevented the correct system files from being used.\n\nOverall, this project has given me extensive, hands-on experience with the\ndifficulties of embedded development. While the problems are often very\nfrustrating at times, there is always a solution to be found if you look hard\nenough.\n\n## References\n\n1.  \u003cspan id=\"ref1\"\u003e\u003c/span\u003eR. Wagner, R. Baraniuk, S. Du, D.B. Johnson,  \n    and A. Cohen. An Architecture for Distributed Wavelet Analysis and\n    Processing in Sensor Networks. In *Proceedings of the Fifth\n    international Conference on information Processing in Sensor\n    Networks* (Nashville, Tennessee, USA, April 19 - 21, 2006). IPSN\n    '06. ACM Press, New York, NY, 243-250.\n    ([pdf](http://www.ece.rice.edu/%7Erwagner/ipsn06.pdf) |\n    [ps](http://www.ece.rice.edu/%7Erwagner/ipsn06.ps))\n2.  \u003cspan id=\"ref2\"\u003e\u003c/span\u003eS. PalChaudhuri, A.K. Saha, and D.B. Johnson.\n    Adaptive Clock Synchronization in Sensor Networks. In *Proceedings\n    of the Third international Symposium on information Processing in\n    Sensor Networks* (Berkeley, California, USA, April 26 - 27, 2004).\n    IPSN '04. ACM Press, New York, NY, 340-348.\n    ([pdf](http://monarch.cs.rice.edu/monarch-papers/ipsn2004.pdf))\n3.  \u003cspan id=\"ref3\"\u003e\u003c/span\u003eR. Jain and I. Chlamtac. The P2 algorithm for\n    dynamic calculation of quantiles and histograms without storing\n    observations. *Commun. ACM* 28, 10 (Oct. 1985), 1076-1085.\n\n## Future Plans\n\nWhile data compression using the wavelet transform is complete, there\nare still many features and improvements that could still be added. A\nsummary of the most important of these follows:\n\n-   Time domain transforms for further compression\n-   Separate wavelet core from system services for reuse\n-   Rework networking systems to save resources and improve\n    compatibility with other routing protocols\n-   Support any number of abstract inputs, instead of two fixed sensors  \n-   Make Java objects easier to call from within MATLAB\n\n## Recognition\n\nI never would have been able to complete this project with the advice\nand support from [Ray Wagner](http://www.ece.rice.edu/~rwagner/) and\n[Dr. Baraniuk](http://www.ece.rice.edu/~richb/), as well as numerous\nothers. Thanks again for all the help!\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjryans%2Fwavelet-tinyos","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjryans%2Fwavelet-tinyos","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjryans%2Fwavelet-tinyos/lists"}