IoT Architecture


Created: 7/6/2015
Author: Rama Mannava, Xerxes Patel and Karthik Vutukuru

The purpose of this article is to setup the client and broker architecture in IoT. In this setup, Raspberry Pi is used as Broker with MQTT installed on it. MQTT is an open source, light weight messaging protocol developed by IBM. MQTT will enable the communication between clients and broker. Arduino which is open source hardware is used as client. An LED light is used in Arduino to visually show an alert that a message is received by the broker. Arduino is programmed in such a way that LED is switched on or off based on the message received. In a live example, an Arduino can be viewed as a traffic Camera and Raspberry Pi as Broker, the traffic camera sends updates to Broker, which in turn sends updates to all stations alerting about road traffic conditions to achieve higher value.
First Setup your Raspberry by following the steps below:

1. Connect the Raspberry Pi Kit with the preloaded SD card to an external monitor through HDMI and power the Raspberry Pi through micro USB. Choose how to setup the Raspberry Pi, it is recommended to use the “Recommended Settings”. Connect the Raspberry Pi to the Network either through Ethernet or WiFi dongle.

2. Install MQTT on Raspberry Pi by issuing following commands in a terminal.
curl -O
sudo apt-key add mosquitto-repo.gpg.key
rm mosquitto-repo.gpg.key
cd /etc/apt/sources.list.d/
sudo wget
sudo apt-get update
sudo apt-get upgrade
sudo apt-get install mosquitto mosquitto-clients

3. Subscribe to a MQTT topic
mosquito_sub –h your_IP_Address –t topic_name

4. To publish to a topic
mosquito_pub –h your_IP_Address –t Topic_name –m “Your_Message”

Secondly, setup the Arduino as below:

1. Download and Install the Arduino software and download pubsub client( ), unzip the file and copy files in to Arduino Libraries folder.

2. Open the Arduino Uno Kit, and connect the Arduino as shown below:

3. Program the Arduino using a sample sketch in the link ( ).Note: Change the IP address to your Raspberry Pi’s IP address.

4. Load the code on to Arduino .

5. Open a terminal on Raspberry Pi with the command,
mosquito_sub –h your_IP_Address –t led

6. Reset your Arduino to see the “Hello World” message on your terminal.

7. Now with a command “on” or “off” you would be able to see LED light turning on or off.

Credits: Chuck Tang.


2015-10-18T02:56:07+00:00Internet of Things|