Evaluating a BASIC Approach to Sensor Network Node Programming
Total Page:16
File Type:pdf, Size:1020Kb
Evaluating A BASIC Approach to Sensor Network Node Programming J. Scott Miller Peter A. Dinda Robert P. Dick [email protected] [email protected] [email protected] Northwestern University Northwestern University University of Michigan Abstract 1 Introduction Sensor networks have the potential to empower domain Wireless sensor networks (WSNs) can be viewed as experts from a wide range of fields. However, presently they general purpose distributed computing platforms defined by are notoriously difficult for these domain experts to program, their spatial presence and an emphasis on environment mon- even though their applications are often conceptually simple. itoring. The most prominent applications of sensor networks We address this problem by applying the BASIC program- have thus far included monitoring applications with a variety ming language to sensor networks and evaluating its effec- of requirements, although WSNs need not be limited to these tiveness. BASIC has proven highly successful in the past in tasks. While WSNs are currently of great research interest, it allowing novices to write useful programs on home comput- is ultimately communities and users outside of these areas— ers. Our contributions include a user study evaluating how application domain experts—that have the most to gain from well novice (no programming experience) and intermediate the functionality that WSNs can provide. We focus on ap- (some programming experience) users can accomplish sim- plication domain experts who are programming novices and ple sensor network tasks in BASIC and in TinyScript (a prin- not WSN experts. Our goal is to make the development of cipally event-driven high-level language for node-oriented WSN applications by such individuals and groups tractable programming) and an evaluation of power consumption is- and, ideally, straightforward. sues in BASIC. 45–55% of novice users can complete simple To deliver the power of wireless sensor networks into the tasks in BASIC, while only 0–17% can do so in TinyScript. hands of such application domain experts, the barrier to entry In both languages, users generally are most successful using must be modest. In terms of raw hardware, this point has al- imperative loop-oriented programming. The use of an inter- ready mostly been reached, provided custom hardware is not preter, such as our BASIC implementation, has little impact needed. However, through our interaction with a civil engi- on the power consumptionof applicationsin which computa- neering group that is designing, implementing, and deploy- tional demands are low. Further, when in final form, BASIC ing an autonomous (structural) crack monitoring applica- can be compiled to reduce power consumption even further. tion [17, 9], we have become convinced that sensor network programming languages and systems have not yet reached Categories and Subject Descriptors this point. Current languages require knowledge of either very low-level systems development (including the details of D.2 [Software Engineering]: Metrics; C.3 [Special- sensor hardware and embedded system design), or high-level Purpose and Application-Based Systems]: Real-time and programming concepts and abstractions that are not obvious Embedded Systems to most application domain experts. We have observed that application domain experts have little programming experi- General Terms ence, most of which is with with simple single-threaded im- Human Factors, Languages, Measurement perative programming models. It cannot be assumed that an application domain expert who stands to benefit from a WSN possesses a background Keywords in embedded systems development, can devote time to a pro- BASIC, Cyber-Physical Systems, Sensor Networks gramming curriculum, or has the funds to hire an embedded systems expert. Even if such an expert is available, the ca- pabilities of a sensor network are tightly coupled to its hard- ware and software design, making any disconnect between the application domain expert and embedded systems expert Permission to make digital or hard copies of all or part of this work for personal or a barrier to achieving the domain expert’s goals. classroom use is granted without fee provided that copies are not made or distributed for profit or commercial advantage and that copies bear this notice and the full citation It is vital that application domain experts not be confused on the first page. To copy otherwise, to republish, to post on servers or to redistribute with traditional application developers. A Unix, Windows, to lists, requires prior specific permission and/or a fee. SenSys’09, November 4–6, 2009, Berkeley, CA, USA. or web developer may be able to stretch his capabilities to Copyright 2009 ACM 978-1-60558-748-6 ...$5.00 write a WSN application. For example, someone familiar 155 with writing Microsoft Windows applications in C++ or C# early 1980s in engaging extreme novices—even children— already has some of the conceptual framework needed to in programming, and the similarities between the home com- grasp event-driven programming in a C-like language on a puter platforms of that era and the sensor network nodes of sensor network node. From our experiences with application today, we consider the use of BASIC as a WSN node pro- domain experts in the broad area of structural crack moni- gramming language. Our specific contributions follow. toring, we have come to the conclusion that experts gener- • We surveyed domain experts and sensor network experts ally start with less programming background than applica- to compare their programming backgrounds. tion programmers. For this reason, it is unlikely that pro- • We ported a small BASIC interpreter to a modern sensor gramming languages and concepts that have found strong network node and OS, extending the language and adoption and demonstrated productivity gains in the WSN or implementation with easy-to-understand features for general software development communities will give appli- communication, power management, sensing, and cation domain experts similar results. We can only assume actuation. The semantics of the language were refined that the application domain expert will remain a perpetual 1 using observations of the successes and struggles of novice , or, at best, an intermediate programmer. novice and intermediate programmers using it. To evaluate the programming backgrounds of domain ex- • We created a simple integrated development environment perts, we conducted a survey of graduate students and fac- (IDE) and tutorial for our extended BASIC, both ulty working both in the sensor network domain as well as targeting the kinds of users described earlier. domain experts in areas that can benefit from the monitoring • We evaluated our extended BASIC, IDE, and tutorial by capabilities of modern sensor networks. Our results, which conducting a rigorous user study involving novice and we present in Section 3, show that while the sensor network intermediate programmers. experts generally have substantial programming experience • We also evaluated TinyScript, a high-level, event-driven across a range of general-purpose programming languages, node-level programming language for sensor networks domain experts reported limited experience with a smaller using exercises identical to those used to evaluate BASIC. set of programming languages. • We measured the computational and power costs The sensor network research communityhas made several involved in using our interpreter. efforts to simplify the development of WSN applications by creating a range of languages and programming systems de- Beyond letting us evaluate the utility of our BASIC, the user studies noted above also provide a useful characterization of signed specifically for the platform (see Section 2 for more). 2 These languages span a number of programming paradigms user reaction to TinyScript, and prototypes for future work. and each targets a different type of developer. We found the following. Our work continues and expands upon this direction by • The programming background of domain experts is bringing less-experienced programmers, including applica- considerably different from that of sensor network tion domain experts as previously described, into the core of experts. Their background is similar to the intermediate the language design and implementation “loop” via rigorous participants in our study. user studies. We run user studies to (1) evaluate how our tar- • Novice users are able to use our system to implement get users respond to different languages and systems, (2) de- simple sensor network programs on MicaZ motes that termine how quickly and correctly they can complete tasks include data acquisition, communication, and actuation. using each language and how power-efficient the solutions • While results are task-dependent, 45–55% of novice are, and (3) inform future language, system, and interface users are likely to complete simple tasks in BASIC, while design for these users. only 0–17% are likely to do so in TinyScript. This paper reports on our efforts to apply user studies to • Participants with programming experience (intermediate the problem of making WSNs easy to program by appli- users) had similar rates of success using BASIC and cation domain experts. We focus on the problem of pro- TinyScript. gramming individual nodes, including sensing, sending in- • Many participants struggled with developing applications formation back to a centralized aggregator, and node-based using an event-driven programming model.