0% found this document useful (0 votes)
113 views

IoT Application Development Using MIT App Inventor To Collect and Analyze Sensor Data

Uploaded by

sarah
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
113 views

IoT Application Development Using MIT App Inventor To Collect and Analyze Sensor Data

Uploaded by

sarah
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 3

2019 IEEE International Conference on Big Data (Big Data)

IoT Application Development Using MIT App


Inventor to Collect and Analyze Sensor Data
Thilanka Munasinghe Evan W. Patton Oshani Seneviratne
Information Technology and Web Science MIT App Inventor Institute for Data Exploration Applications
Rensselaer Polytechnic Institute Massachusetts Institute of Technology Rensselaer Polytechnic Institute
Troy, NY, USA Cambridge, MA, USA Troy, NY, USA
[email protected] [email protected] [email protected]

Abstract—The rapid development of low-cost sensors, smart students, teachers, developers, hobbyists, and entrepreneurs
devices, communication networks, and learning algorithms has to develop apps for collaboration, productivity, personal use,
enabled data-driven decision making in large-scale systems. recreation, learning, social good, and community activism. The
However, the development platforms for such Internet of Things
(IoT) applications and collecting the data in a cohesive, yet simple ease of use of the system as a tool for making has contributed
manner is not very well understood. MIT App Inventor [1] is to its success and over 10 million people have used MIT App
an open-source, user-friendly interface to develop mobile appli- Inventor worldwide to create 43 million projects.
cations and has been used by over ten million users worldwide.
We have added IoT capability to the MIT App Inventor platform B. Android Things
where people can build applications using various sensors and
IoT platforms such as Raspberry Pi [2] and Android Things [3] to Android Things is a lightweight version of Android pub-
collect the data through mobile applications. This poster paper lished by Google that can be flashed onto different hardware
presents a realization of easy to program IoT applications in prototyping boards, such as the Raspberry Pi 3, Intel Edison,
the mobile application space with a focus on collecting data and NXP Pico i.MX7D. Android Things extends the core
from the connected sensors. We have integrated the Android Android framework with additional APIs that allow apps to
Things platform with the MIT App Inventor and introduced
the existing MIT App Inventor community to the IoT based integrate with new types of hardware not found on mobile
App development. This integration allows not only the seasoned devices. Apps for embedded devices bring developers closer
developers, but also the novice developers to make interesting to hardware peripherals and drivers than phones and tablets.
IoT applications with minimal programming knowledge. By integrating the IoT capabilities of Android Things with
Index Terms—Internet of Things, Android Things, Data Col- MIT App Inventor, we eliminate the need for heavy and
lection, MIT App Inventor, Sensor Data, Embedded Devices
complex programming code by simply enabling the visual and
I. I NTRODUCTION interactive block-based drag and drop programming tools to
create IoT applications. In the case of input sensors connected
The Internet of Things (IoT) is recognized as a next frontier
to the Raspberry Pi device or any other Android Things
of the future of technology. This phenomenon is evidenced
supported device, the data from these sensors can be relayed
by both the commercial and research interest in this space.
to the phone app or to an external storage device for the post
The ability to be interconnected through low-cost networks
or real-time data analysis purposes to obtain useful insights
for smart devices becomes easier as the microprocessors get
to make decisions. The integration of these two technologies
faster, smaller, and energy-efficient. It is expected that we
(MIT App Inventor and Android Things) with a simple, user-
will have over 24 billion connected devices in the year 2020,
friendly environment enables a larger audience of developers
and IoT will become a trillion-dollar global industry [4].
to create applications that can collect a vast amount of data in
Democratizing access to the wealth of data generated by these
the fast-growing IoT space.
devices remains a challenge that needs to be addressed.
II. BACKGROUND C. Messaging Support for IoT applications
A. MIT App Inventor We realize the connection between the IoT sensors and the
MIT App Inventor [1] is an open-source app-building plat- mobile app from MIT App Inventor using the Message Queu-
form that allows users to drag-and-drop visual objects to create ing Telemetry Transport (MQTT). MQTT is a light-weight
an application that can run on the Android system as a means publish/subscribe messaging protocol created by IBM around
of democratizing mobile app development. Application behav- 1998 [5]. It is an Machine to Machine (M2M) Connectivity
ior is provided by piecing together blocks in a visual blocks- Protocol with Synchronous messaging and Asynchronous mes-
based programming language. MIT App Inventor is used by saging abilities. The OASIS consortium has now standardized
the MQTT 5 specification for IoT [6]. MQTT supports topic-
based publish/subscribe that flow in either direction. Devices
978-1-7281-0858-2/19/$31.00 ©2019 IEEE attached to the pins of the IoT board such as AndroidThings

978-1-7281-0858-2/19/$31.00 ©2019 IEEE 6157

Authorized licensed use limited to: Universiti Tun Hussein Onn Malaysia. Downloaded on January 14,2022 at 08:45:15 UTC from IEEE Xplore. Restrictions apply.
and RaspberryPi will either act as publishers or subscribers, E. App Inventor Component Configuration
and the resulting messages can be consumed by the app. Before using the AndroidThingsBoard component, you need
to initialize the component with certain board parameters
III. MIT A PP I NVENTOR C OMPONENTS FOR A NDROID
such as “identifier”, “hardwarePlatform,” “messagingHost,”
T HINGS
“messagingPost” to make sure the board and the corresponding
A. Android Things Extension App Inventor component will work together as shown in the
We have created an App Inventor extension for Android Figure 1.
Things. This extension includes the following four components
that can be easily configured in an MIT App Inventor project.
The main component necessary is the ‘AndroidThingsBoard’
component. The devices connected to the board can be mod-
eled using the peripheral components such as ‘AndroidThings-
GPIO’ (Android Things General Purpose Input Output), ‘An-
droidThingsPWM’(Android Things Pulse Width Modulation)
and ‘AndroidThingsTemperatureSensor’(Temperature Sensor
Component supporting Android Things).
Fig. 1. AndroidThings board initialization component.
B. AndroidThingsBoard
This is a non-visible MIT App Inventor component that Similarly, the client components such as the AndroidThings-
models the Android Things Board. It is responsible for relay- GPIO, AndroidThingsPwm, and the AndroidThingsTempera-
ing messages between the IoT devices connected to the board tureSensor must be registered. For example, Figure 2 shows
and the MIT App Inventor app. In order to set up an Android the most important properties, events and methods of the
Things board, first, we need to flash the Android Things Image AndroidThingsTemperatureSensor component.
to the board, and this is a one-time setup on the board that We have created several IoT applications using the Rasp-
we need to complete. Depending on the type of board we are berry Pi board using the App Inventor Android Things ex-
planning to use, we need to download and install the correct tension, which is shown in the application section below.
flash image. Make sure the board is connected to WiFi because The reason that we used Raspberry Pi as the device because
otherwise, the IoT devices will not be able to communicate it is a very inexpensive single-board computer that is the
with the phone app. size of a credit card, and currently, it is the most common
Android Things device among developers. The first Raspberry
C. Android Things Support App Pi model, also known as the Raspberry Pi 1, was released in
February 2012 in basic Model A and a higher specification
The official MIT App Inventor distribution provides an
Model B. Later, more sophisticated models were introduced
Android app called the Companion App that supports real-
with higher performances. As of the year 2019, the Raspberry
time testing during development. In a similar vein, we have
Pi 4 model is out on the market with very impressive com-
introduced a Support App that bridges MIT App Inventor
puting and memory resources.
and the Android Things standard development kit libraries to
provide essential communication support between the mobile
app and the Android Things supported device such as Rasp-
berry Pi. A unique identifier is needed to tether the phone
app and the device. For simplicity, this support app generates
that identifier, which is cached in a file and reused to avoid
having to enter a new identifier every time the framework is
restarted. We use the Android Things App Inventor Support
App to facilitate the sending and receiving of messages to
and from MIT App Inventor apps that use the Android Things Fig. 2. AndroidThings Temperature Sensor Component.
components.

D. Setting up an MQTT Broker IV. E XAMPLE APPLICATION THAT COLLECTS


TEMPERATURE SENSOR DATA
To set up an Android Things Board as an MQTT broker,
we recommend installing Mosquitto [7]. To control the devices One straightforward applications is monitoring the tempera-
and sensors connected to the Android Things Board via the ture of a room or any place remotely, which has many advan-
Internet with this approach, the board must have a public IP tages. Temperature data can be collected using temperature
address. Alternatively, we can use one of the public MQTT sensors that are connected to the device. Similarly, we can
brokers, such as iot.eclipse.org. If we wish to secure the monitor the temperature of the home, and turn on and off the
payloads, we must use SSL ports. air-conditioning or the heater as needed, remotely, only when

6158

Authorized licensed use limited to: Universiti Tun Hussein Onn Malaysia. Downloaded on January 14,2022 at 08:45:15 UTC from IEEE Xplore. Restrictions apply.
required. The functionalities of the Application is to monitor
the temperature.
On the mobile phone, we introduce a button (Button1) that
will start the temperature monitoring process. Once that button
is pressed, the Android Things Temperature sensor will start
monitoring the temperature. In the next step, as shown in
Figure 4, we have introduced a simple process to change the
color of the phone screen based on the temperature reading,
which is shown in the Figure 5 We have introduced two
temperature thresholds such as “Hot Threshold” and “Cold
Threshold”. The mobile phone user can change the threshold
values as desired. If the temperature value is higher than the
user entered threshold value for Hot Temperature, then the
mobile phone screen background color will change to the red
color. If the current temperature reading from the sensor is
below the cold threshold value, the screen background color
will change to the blue color, and if the sensor reading value
is in between the hot and cold temperature threshold values,
then the phone background color will change to green.

Fig. 3. AndroidThings Temperature Monitor.

Fig. 5. Temperature Sensing Mobile App Configuration.

R EFERENCES
[1] S. C. Pokress and J. J. D. Veiga, “MIT App Inventor: Enabling personal
mobile computing,” arXiv preprint arXiv:1310.2830, 2013.
[2] M. Richardson and S. Wallace, Getting started with Raspberry PI. ”
O’Reilly Media, Inc.”, 2012.
[3] Google. Android things. [Online]. Available: \url{https://developer.
Fig. 4. AndroidThings Temperature Sensor Component. android.com/things}
[4] M. Hung, “Leading the iot, gartner insights on how to lead in a connected
C ONCLUSION world,” Gartner Research, pp. 1–29, 2017.
[5] U. Hunkeler, H. L. Truong, and A. Stanford-Clark, “MQTT-S—A pub-
This short poster paper presented the novel design and lish/subscribe protocol for Wireless Sensor Networks,” in 2008 3rd
implementation of Android Things integration with the MIT International Conference on Communication Systems Software and Mid-
dleware and Workshops (COMSWARE’08). IEEE, 2008, pp. 791–798.
App Inventor and demonstrated the viability of the technology [6] OASIS. MQTT Version 5.0 - OASIS standard. [Online]. Available:
using a sample app. The integration of the two technologies \url{https://docs.oasis-open.org/mqtt/mqtt/v5.0/mqtt-v5.0.html}
enables Interest Driven Innovation in the fast-growing IoT [7] R. A. Light et al., “Mosquitto: server and client implementation of the
MQTT protocol.” J. Open Source Software, vol. 2, no. 13, p. 265, 2017.
space. The simplicity and user-friendliness of using MIT
App Inventor components make IoT applications to empower
ordinary people to become innovators. As a result of that, a
new frontier of innovators will emerge as their interests grow
on solving problems, finding suitable data driven solutions to
problems they face in their day to day lives. More information
on these IoT sensors is available at http://thilankam.github.io/
mit-app-inventor.
ACKNOWLEDGMENT
The authors would like to thank for the guidance given by
Prof. Hal Abelson, Andrew McKinney, William Byrne, Jose
Dominguez, Jeffrey Schiller, and other MIT App Inventor team
members while carrying out this project. The first author was
supported by a Google Summer of Code 2016 & 2017 grant.

6159

Authorized licensed use limited to: Universiti Tun Hussein Onn Malaysia. Downloaded on January 14,2022 at 08:45:15 UTC from IEEE Xplore. Restrictions apply.

You might also like