This Internet of things project describes how Arduino sends push notification to Android smartphone. As example, we will build an alarm system based on Arduino and Android, this is an interesting example of Internet of things (IoT) and the aim of this project is building an alarm using an infrared sensor (PIR) connected to Arduino board that sends push messages to Android smartphone. This project mixes different technologies and platforms and we make them working together!

The alarm system uses two platforms that help simplifying the project:

Temboo

Parse.com

Arduino sends push notification: IoT project overview

Before diving into the IoT project where Arduino sends push notification, it is useful to describe these two platforms.Temboo is a platform that has a set of “connectors” that can be used to exchange data with other platforms or service providers (i.e eBay, Yahoo! Weather, Google and so on). The interesting part of Temboo is that it is compatible with Arduino board, so that these connectors can be exported on Arduino.Parse.com is the platform we used in the last post to send android push messages.

The main overview of the internet of things project is shown below:

As it is clear, there are several parts that build the IoT project. The first part is Arduino board with PIR sensor that is used to detect movements. Arduino runs a Temboo agent that sends data to Parse platform. This agent is triggered when one of the Arduino digital input gets HIGH. The Temboo platforms is used to create the agent without writing too much code lines.
Using Temboo choreo, Arduino can send JSON data directly to Parse.com that in turns send a push message to our smart phone.

Arduino Sketch

The first step is setting up the Arduino sketch that uses PIR sensor and testing it. This step is very simple, we have to connect the sensor to Arduino board using three wires: Power, Ground and Signal.

The sensor is very simple, the output gets high when it detects movements. For this example, we can suppose it is connected to digital pin 8.

To check that our sensor works correctly and it is connected in the right way to Arduino board so that it detects movements, try to load this code into arduino:

Now runs the code and move your hand in front of the sensor and give a look at the serial monitor to check if it works!
Now the Arduino component is ready!

Temboo choreo

The next step is setting up the agent that connects Arduino board to Parse.com. In this case, we need an Ethernet shield to connect Arduino to internet. I’ve used Wiznet W5500. Once you have created your account, it is time to configure your Temboo chores. We want to connect Arduino to Parse so we check Parse -> Push Notification. Parse choreos requires some information before using it:

Application ID

RestAPI Key

These two parameters are used to connect the agent to Parse.com. You can find these info in Parse.com:

You have to copy the required key into Temboo:

We are ready. If you want you can try to send a notification from Temboo to Parse.com.
Now set the trigger that controls the agent:

At the end, Temboo will create the Arduino code ready to use!! Finally, copy and paste the code into your Arduino IDE.
The code generated by Temboo is shown below:

Configure Parse.com channel and build Android app

Temboo requires we use a Parse channel to send our notifications. We have then to modify our Android app to use a channel to listen to incoming notification. If you don’t know how to write an android app that handles push messages you can read my previous post describing how to send android push messages with Parse.com.

About The Author

I'm an electronic engineer with over 15 years of
experience in computer programming. I'm the author of the book "Android things projects". I'm a MVB at DZone and DZone Guide Author. I have contributed to the IoT guide. I'm the technical reviewer of the book Internet of Things with Arduino Blueprints(published by PacktPub). I love creating IoT projects using Arduino, Raspberry Pi,
Android, and other platforms. I am interested in the convergence
between IoT and the mobile applications. I'm SCEA, SCWCD, and SCJP
certified.
Follow on: Twitter | Linkedin

Get more stuff

Subscribe to our mailing list and get interesting stuff and updates to your email inbox.

Sign up for our Newsletter

Enter your email and stay on top of things,

Get SwA updates delivered to your inbox. Article, tips, source code

×

By continuing to use the site, you agree to the use of cookies. more information

The cookie settings on this website are set to "allow cookies" to give you the best browsing experience possible. If you continue to use this website without changing your cookie settings or you click "Accept" below then you are consenting to this.