Demo Abstract: SEAL-Blockly: Sensor Network Visual Programming Using a Web Browser Janis Judvaitis1 , Atis Elsts12 , and Leo Selavo12 1
Faculty of Computing, University of Latvia, 19 Raina Blvd., Riga, LV 1586, Latvia 2 Institute of Electronics and Computer Science, 14 Dzerbenes Str, Riga, LV 1006, Latvia
[email protected],{atis.elsts,leo.selavo}@edi.lv
Abstract. In this demonstration we present SEAL-Blockly, a visual programming tool which allows users to develop a wireless sensor network (WSN) applications like assembling a picture puzzle, using graphical blocks. While domain-specific languages for WSN is a well explored area, visual programming is less so. Compared to textual programming, it provides a more constrained environment in which syntax errors are avoided, as well as allows to see the whole program at a glance. Since SEALBlockly is implemented in JavaScript, the application development takes place in a web browser. Together with the accompanying PC-side software SEAL-Blockly enables users to compile their WSN applications and install them on sensor nodes. It is beneficial for novice users such as computer science students and non-programmers that are learning the basics of WSN programming, as well as accelerates application prototyping for experienced users. Keywords: visual programming, programming languages
1
Introduction
Wireless sensor network programming is difficult to learn for novice users, because it encompasses complexities both of embedded system programming and network programming. There is an awareness in the WSN research community of the need to ease the WSN development. However, programming using a web browser and visual programming tools is not a well-explored option in the context of WSN. We build on these previous solutions and introduce SEAL-Blockly, a visual sensor application development tool that is controlled exclusively using web interface (Fig. 1).
2
Architecture and technical details
In April 2012 Google released a web-based, graphical programming editor called Blockly [2]. It allows to assemble simple programs using given code blocks like a puzzle elements by dragging and dropping them on the sketchbook. The code
2
J. Judvaitis, A. Elsts, L. Selavo
Fig. 1: SEAL-Blockly development environment Web browser
Blockly SEAL blocks TinyOS
Code generation
SEAL IDE
SEAL code
TinyOS
Development PC
Platform-independent compilation
C code
TinyOS
Microcontroller
Platform-specific compilation
Executable
TinyOS
Fig. 2: System architecture blocks are then translated to one of JavaScript, Python, and Dart programming languages. Before Blockly there was App Inventor [1], which in turn was based on visual programming language Scratch [7]. However, Blockly is implemented in JavaScript, therefore the user can program using just a web browser and avoid additional software installation. SEAL-Blockly is an implementation of SEAL [4] programming language using Blockly code blocks. SEAL is a domain-specific language for WSN application description, developed with the objective to make WSN application programming accessible for novice users. SEAL is currently implemented on top of MansOS [5] WSN operating system. The architecture of the system is presented in Fig. 2. The basic idea is to translate each SEAL-Blockly block to a specific element of SEAL language. The
SEAL-Blockly: Sensor Network Visual Programming
3
Fig. 3: Sense-and-send application in SEAL-Blockly
Fig. 4: Listener application in SEAL-Blockly translated code is then automatically processed by SEAL IDE, which functions as a proxy between the hardware serial ports and the JavaScript running on user’s web browser. During the demonstration a concrete use case for SEAL-Blockly is shown: a node that periodically reads light sensor, and a node that manipulates a LED, depending on the remote light intensity. A sink node attached to a PC collects the data. This mimics the basic functionality of a practical WSN application scenario: automatic street light control system. The first SEAL-Blockly module (Fig. 3) implements logic that reads light sensor and broadcasts the measured value to the wireless medium. The second module (Fig. 4) listens to the wireless medium for the light values; it turns the red led on or off based on the value and a threshold.
3
Related work
Splish [6] is a visual programming environment that enables icon-based visual programming allowing users to develop programs for Arduino boards. It is platform independent since it is developed with JavaFX. Its target audience are students and computer non-professionals, and it is targeted on physical computing rather than WSN programming. BlocklyDuino [3] is Blockly adapted for Arduino programming. It uses higher level abstractions than C++ on which Arduino programming is based. BlocklyDuino gives blocks for controlling buttons, servos, LEDs, various sensors etc. Code is generated directly in a web browser and must be manually copied to file in order to compile or upload the result. Although several visual programming tools and languages exist, there are no visual programming tools aimed specifically at WSN applications. The tools
4
J. Judvaitis, A. Elsts, L. Selavo
previously discussed are tied to Arduino platform, which has two drawbacks: first, it is not well tailored (neither in hardware nor in software) for the specific requirements of WSN; second, it uses C++: a programming language of forbidding complexity.
4
Discussion
SEAL-Blockly has the potential to fully cover all of the SEAL programming language functionality, which in turn is applicable to real-world WSN applications. Both languages provide similar abstraction levels, therefore the cognitive effort required to switch between them is reduced. A user can preview his code in a browser, and, if a proxy server is running, upload the program to attached sensor nodes with a single click of a button. Since SEAL-Blockly restricts the user to predefined blocks, novices can easily see what kind of blocks are available, and build their applications without going through the trouble of memorizing a multitude of functions and parameters. They are also free from concerns about parenthesis and other syntactical constructions. All of this allows the users to concentrate on the application logic rather than on the coding itself, making their first programming experience more engaging and productive, since they can observe the results more quickly.
5
Conclusion
SEAL-Blockly is a valuable tool for novice programmers willing to learn WSN programming basics, and for experienced users willing to accelerate application prototyping using just a web interface rather than a full toolchain.
Acknowledgements This work was supported by European Regional Development Fund, Project No. 2010/0317/2DP/2.1.1.1.0/10/APIA/VIAA/142.
References 1. App Inventor for Android. http://code.google.com/p/ app-inventor-for-android/ 2. Blockly. http://code.google.com/p/blockly/ 3. Blockly + Arduino + Grove = Blocklyduino. http://blog.gasolin.idv.tw/2012/ 10/blockly-arduino-grove-blocklyduino-pre.html 4. Elsts, A., Selavo, L.: A User-Centric Approach to Wireless Sensor Network Programming Languages. In: Proc. SESENA’12 (2012) 5. Elsts, A., Strazdins, G., Vihrov, A., Selavo, L.: Design and Implementation of MansOS: a Wireless Sensor Network Operating System. Scientific Papers, University of Latvia 787, 79–105 (2012) 6. Kato, Y.: Splish: A Visual Programming Environment for Arduino to Accelerate Physical Computing Experiences. In: Proc. Eighth International Conference on Creating, Connecting and Collaborating through Computing (2010) 7. Resnick, M., Maloney, J., Monroy-Hernndez, A., Rusk, N., Eastmond, E., Brennan, K., Millner, A., Rosenbaum, E., Silver, J., Silverman, B., Kafai, Y.: Scratch: Programming for All. In: Communications of the ACM (2009)