Search icon CANCEL
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Conferences
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
Intel Edison Projects

You're reading from   Intel Edison Projects Build exciting IoT projects with Intel Edison

Arrow left icon
Product type Paperback
Published in May 2017
Publisher Packt
ISBN-13 9781787288409
Length 264 pages
Edition 1st Edition
Languages
Concepts
Arrow right icon
Author (1):
Arrow left icon
Avirup Basu Avirup Basu
Author Profile Icon Avirup Basu
Avirup Basu
Arrow right icon
View More author details
Toc

Table of Contents (7) Chapters Close

Preface 1. Setting up Intel Edison 2. Weather Station (IoT) FREE CHAPTER 3. Intel Edison and IoT (Home Automation) 4. Intel Edison and Security System 5. Autonomous Robotics with Intel Edison 6. Manual Robotics with Intel Edison

Using Intel Edison to push data by using the MQTT protocol

As previously mentioned, this short section will show users how to push data from Edison to an Android device using the MQTT protocol. The following screenshot depicts the workflow:

Workflow of pushing data from the Edison to the Android application

From the preceding illustration, it is clear that we first obtain readings from the temperature sensor and then use the MQTT broker to push the readings to the Android application.

Firstly, we are going to connect the temperature sensor to Edison. Make a reference of the circuit from Chapter 2, Weather Station (IoT). After it is connected, fire up your editor to write the following Node.js code:

var mraa = require('mraa'); var mqtt = require('mqtt'); var B=4275;

var R0=100000;

var client = mqtt.connect('mqtt://iot.eclipse.org');
function sendData()

{

var tempPin=new mraa.Aio(0);

//Processing...
lock icon The rest of the chapter is locked
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at R$50/month. Cancel anytime