You are on page 1of 6

SCHOOL OF ENGINEERING & TECHNOLOGY

DEPARTMENT OF ELECTRICAL & ELECTRONICS ENGINEERING

INTERNSHIP REPORT ON

Submitted By
Vedhesh murthy (1960818)

Performed At

CHRIST UNIVERSITY
(FROM: 15 may 2021 – 14 june 2021)

Under the Guidance of:


Submitted by:

Mr. Parag jose


Professor Vedhesh murthy
E-moility R & D centre B. Tech- Department of EEE
Department of EEE Roll. No- 1960818
Faculty of Engineering Christ Deemed to be University
Christ University Bangalore
Certificate:
ACKNOWLEDGEMENT

I wish to express my deepest gratitude towards Christ University. for giving me an


opportunity to be a part of their esteemed organization and enhance my knowledge
by granting permission to do my summer training project under their guidance.

I am grateful to Mr Parag jose, my guide, for his invaluable guidance and


cooperation during the course of the project. He provided me with his assistance
and support whenever needed that has been instrumental in completion of this
project.

I would like to thank my Department of Electrical & Electronics Engineering,


School of Engineering & Technology , Christ (Deemed to be University) for
making this experience of summer training. The learning from this experience has
been immense and would be cherished throughout life.

At last but not the least I would also like to express gratitude to my parents for their
continuous motivation and support.

Vedhesh murthy
B. Tech- Department of EEE
Roll. No- 1960818
School of Engineering & Technology
Christ (Deemed to be University), Bangalore
Implementation of MQTT Protocol

Project Aim:
To get temperature information from the publisher, and send that information
to the subscriber.
Theory:
MQTT is an open and simple client server publish/subscribe message transport
protocol designed for machine-to-machine communication between different
devices in environments of high latency and low network bandwidth.
MQTT is a protocol with a special publish/subscribe implementation. Devices
are not directly talking to each other. Instead, communication is structured
into topics and handled over a central server (broker).
In this protocol, there will one broker, containing the topics, then the publisher,
it can be sensors, phone etc., sends the information to the topics, then the
subscriber subscribes the desired topics, and the subscriber gets the subscribed
information over MQTT broker via internet.

Implementation Tools:
Python, Google colab

Code:
• Publisher:
import paho.mqtt.client as mqtt
from random import randrange, uniform
import time
mqttBroker ="mqtt.eclipseprojects.io"
client = mqtt.Client("Temperature Inside")
client.connect(mqttBroker)
while True:
randNumber = uniform(20.0, 21.0)
client. Publish("TEMPERATURE", randNumber)
print("Just published " + str(randNumber) + " to topic TEMPERATURE")
time.sleep(1)
• Subscriber:
import paho.mqtt.client as mqtt
import time

def on message(client, userdata, message):


print("received message: " ,str(message.payload.decode("utf-8")))

mqttBroker ="mqtt.eclipseprojects.io"

client = mqtt.Client("Smartphone")
client.connect(mqttBroker)

client.loop_start()

client.subscribe("TEMPERATURE")
client.on_message=on_message

time.sleep(30)
client.loop_stop()

Output:
• Publisher:
• Subscriber:

Procedure:
1. Open Google Colab.
2. Enter the above python code for publisher and subscriber in the
Google Colab, then execute.
3. Then we get the published temperature values, then we get the
subscribers message and the value required.
Result:
The above project on implementation of MQTT is done, an example we
took as temperature values published and subscribed, and verified the
output.

You might also like