Book Image

Mastering IOT

By : Colin Dow, Perry Lea
Book Image

Mastering IOT

By: Colin Dow, Perry Lea

Overview of this book

The Internet of Things (IoT) is the fastest growing technology market. Industries are embracing IoT technologies to improve operational expenses, product life, and people's well-being. We’ll begin our journey with an introduction to Raspberry Pi and quickly jump right into Python programming. We’ll learn all concepts through multiple projects, and then reinforce our learnings by creating an IoT robot car. We’ll examine modern sensor systems and focus on what their power and functionality can bring to our system. We’ll also gain insight into cloud and fog architectures, including the OpenFog standards. The Learning Path will conclude by discussing three forms of prevalent attacks and ways to improve the security of our IoT infrastructure. By the end of this Learning Path, we will have traversed the entire spectrum of technologies needed to build a successful IoT system, and will have the confidence to build, secure, and monitor our IoT infrastructure. This Learning Path includes content from the following Packt products: Internet of Things Programming Projects by Colin Dow Internet of Things for Architects by Perry Lea
Table of Contents (34 chapters)
Title Page
Copyright
About Packt
Contributors
Preface
Free Chapter
1
The IoT Story
Index

Connecting to cloud services using JavaScript


For our project, we will build a JavaScript client and connect it to an MQTT Broker. We will both Publish and Subscribe to a topic named test. We will then write a small simple program on Raspberry Pi to publish to the topic named test. What this code will demonstrate is how easy it is to send and receive messages using MQTT.

Take a look at the following diagram to see what we will accomplish with this project:

Setting up a CloudMQTT account

The first step is to set up an MQTT Broker. We may do this by installing one locally using the Mosquitto platform (www.mosquitto.org). What we will do instead is set up a cloud-based MQTT Broker using the website www.cloudmqtt.com.

To set up an account:

  1. In your browser, navigate to www.cloudmqtt.com.
  2. Click on Log in at the top-right corner.
  3. In the Create an account box, type in your email address:
  1. You will be sent an email to that email address asking you for confirmation. You can complete the confirmation process...