Book contents
- Frontmatter
- Contents
- List of Code examples
- Preface
- Acknowledgements
- Programming hints, condensed
- Part I TinyOS and nesC
- Part II Basic programming
- Part III Advanced programming
- 8 Advanced components
- 9 Advanced wiring
- 10 Design patterns
- 11 Concurrency
- 12 Device drivers and the hardware abstraction architecture (HAA)
- 13 Advanced application: SoundLocalizer
- Part IV Appendix and references
- References
- Index
13 - Advanced application: SoundLocalizer
Published online by Cambridge University Press: 05 August 2012
- Frontmatter
- Contents
- List of Code examples
- Preface
- Acknowledgements
- Programming hints, condensed
- Part I TinyOS and nesC
- Part II Basic programming
- Part III Advanced programming
- 8 Advanced components
- 9 Advanced wiring
- 10 Design patterns
- 11 Concurrency
- 12 Device drivers and the hardware abstraction architecture (HAA)
- 13 Advanced application: SoundLocalizer
- Part IV Appendix and references
- References
- Index
Summary
In this chapter, we look at the design and implementation of SoundLocalizer, a somewhat more complex sensor network application. SoundLocalizer implements a coordinated event detection system where a group of motes detect a particular event – a loud sound – and then communicate amongst themselves to figure out which mote detected the event first and is therefore presumed closest to where the event occurs. To ensure timely event detection, and accurately compare event detection times, this application needs to use some low-level interfaces from the platform's hardware abstraction and hardware presentation layers (HAL, HPL, as described in the previous chapter). As a result, this application is not directly portable – we implement it here for micaz motes with an mts300 sensor board. In the design and implementation descriptions below, we discuss how the application and code are designed to simplify portability and briefly describe what would be involved in porting this application to another platform.
The HAL and HPL components used by SoundLocalizer offer lower-level interfaces (interrupt-driven, controlled by a Resource interface, etc.) than the high-level HIL components we used to build the AntiTheft application of Chapter 6. As a result, SoundLocalizer's implementation must use atomic statements and arbitration to prevent concurrency-induced problems, as we saw in Chapter 11.
The complete code for SoundLocalizer is available from TinyOS's contributed code directory (under “TinyOS Programming”).
Sound Localizer design
Figure 13.1 shows a typical setup for the SoundLocalizer application. A number of detector motes are placed on a surface a couple of feet apart. When the single coordinator mote is switched on, it sends a series of radio packets that let the detector motes synchronize their clocks.
- Type
- Chapter
- Information
- TinyOS Programming , pp. 221 - 238Publisher: Cambridge University PressPrint publication year: 2009