iotlabclm_2025
iotlabclm_2025
B. DESCRIPTION
1. PREREQUISITES:
• DSP (BEC502, Python tool was used to simulate in DSP experiments)
• Microcontrollers (BEC405A)
• Microcontrollers Lab (BECL456A)
• Computer Organization and Architecture (BEC306C)
2. BASE COURSE:
• Embedded C Basics(21EC481)
3. COURSE OUTCOMES:
At the end of the course, the student will be able to;
1. Understand internet of Things and its hardware and software components
2. Interface I/O devices, sensors & communication modules
3. Remotely monitor data and control devices
4. Develop real life IoT based projects
4. RESOURSES REQUIRED:
• Raspberry Pi 4, Broadcom BCM2711, Quad core Cortex-A72 (ARM v8) 64-bit SoC @
1.8GHz, SDRAM-4GHz, 40pin GPIO
• LED, Switch, Relay, Motor, Bluetooth, DHT11, OLED
• Python Interpreter, Thonny IDE
• Adafruit package, Thingspeak cloud, MQTT broker, SQLite DB
6. GENERAL INSTRUCTIONS:
• -
7. CONTENTS:
Expt
Title of the Experiments RBT CO
No.
1 (i)To interface LED/Buzzer with Arduino/Raspberry Pi and write a L3 CO2
program to ‘turn ON’ LED for 1 sec after every 2 seconds.
(ii) To interface Push button/Digital sensor (IR/LDR) with
Arduino/Raspberry Pi and write a program to ‘turn ON’ LED when
push button is pressed or at sensor detection.
2 (i)To interface DHT11 sensor with Arduino/Raspberry Pi and write a L3 CO2
program to print temperature and humidity readings.
(ii)To interface OLED with Arduino/Raspberry Pi and write a program
to print temperature and humidity readings on it
3 To interface motor using relay with Arduino/Raspberry Pi and write a L3 CO2
program to ‘turn ON’ motor when push button is pressed
4 To interface Bluetooth with Arduino/Raspberry Pi and write a program L3 CO2
to send sensor data to smartphone using Bluetooth
5 To interface Bluetooth with Arduino/Raspberry Pi and write a program L3 CO2
to turn LED ON/OFF when '1'/'0' is received from smartphone using
Bluetooth
6 Write a program on Arduino/Raspberry Pi to upload temperature and L3 CO1,CO3
humidity data to thingspeak cloud. ,CO4
7 Write a program on Arduino/Raspberry Pi to retrieve temperature and L3 CO1,CO3
humidity data from thingspeak cloud.
8 To install MySQL database on Raspberry Pi and perform basic SQL L3 CO2
queries.
9 Write a program on Arduino/Raspberry Pi to publish temperature data L3 CO1,CO2
to MQTT broker. CO3,CO4
10 Write a program to create UDP server on Arduino/Raspberry Pi and L3 CO2
respond with humidity data to UDP client when requested.
11 Write a program to create TCP server on Arduino/Raspberry Pi and L3 CO2
respond with humidity data to TCP client when requested.
12 Write a program on Arduino/Raspberry Pi to subscribe to MQTT L3 CO1
broker for temperature data and print it
13 Open ended experiment – 1 L3 CO2,CO3
14 Open ended experiment – 2 L3 CO2,CO3
8. REFERENCE:
1. Vijay Madisetti, Arshdeep Bahga, Internet of Things. "A Hands on Approach", University
Press
2. Dr. SRN Reddy, Rachit Thukral and Manasi Mishra, "Introduction to Internet of Things: A
-
C. EVALUATION SCHEME
For CBCS 2021 scheme:
1. Laboratory Components: 38 Marks (Observation Writeup – 4 Marks + Lab Conduction –
15 Marks + Viva-Voce – 4 Marks + Record Writing – 15 Marks).
-
D1. ARTICULATION MATRIX
Mapping of CO to PO
POs
COs 1 2 3 4 5 6 7 8 9 10 11 12
1.Understand internet of Things and its 2 2 2 2 2 - - - 2 - 1 2
hardware and software components
2.Interface I/O devices, sensors & 2 2 2 2 2 - - - 2 - 1 2
communication modules
3.Remotely monitor data and control 2 2 2 2 2 - - - 2 - 1 2
devices
4.Develop real life IoT based projects 2 2 2 2 2 - - - 2 - 1 2
9. CIRCUIT DIAGRAM :
-
1. EXPERIMENT NO:2
2. TITLE:
(i)To interface DHT11 sensor with Arduino/Raspberry Pi and write a program to print temperature
and humidity readings.
(ii)To interface OLED with Arduino/Raspberry Pi and write a program to print temperature and
humidity readings on it
3. LEARNING OBJECTIVES:
• To understand the working of DHT11 sensor
• To understand I2C communication
4. AIM:
• To interface DHT11 sensor with Arduino/Raspberry Pi and write a program to print
temperature and humidity readings
• To interface OLED with Arduino/Raspberry Pi and write a program to print temperature and
humidity readings on it
7. FORMULA / CALCULATIONS:
• -
8. PROGRAM:
#2.a
import Adafruit_DHT
sensor = Adafruit_DHT.DHT11
pin = 18#GPIO 18 of Rpi
# Try to grab a sensor reading. Use the read_retry method which will retry up
# to 15 times to get a sensor reading (waiting 2 seconds between each retry).
while True:
humidity, temperature = Adafruit_DHT.read_retry(sensor, pin)
print('Temp={0:0.1f}*C Humidity={1:0.1f}%'.format(temperature, humidity))
-
1. EXPERIMENT NO:3
2. TITLE: TO INTERFACE MOTOR USING RELAY WITH ARDUINO/RASPBERRY PI AND
WRITE A PROGRAM TO ‘TURN ON’ MOTOR WHEN PUSH BUTTON IS PRESSED
3. LEARNING OBJECTIVES:
• Understand the working of Relay module
• Drive DC motor using relay module
4. AIM:
• To interface motor using Relay with Raspberry Pi and turn Motor on when push button is
pressed
5. MATERIAL / EQUIPMENT REQUIRED:
• Raspberry pi-4
• Switch module, Relay, DC motor, Regulated Power Supply(5V,3A)
• Python Interpreter, Thonny IDE
6. THEORY:
• Relay:An electro mechanical device which acts as dynamic path selectors for signals and
power.The Relay unit contains a relay coil made up of insulated wire on a metal core and a
metal armature with one or more contacts. Relay works on electromagnetic principle. When
a voltage is applied to the relay coil, current flows through the coil, which in turn generates
a magnetic field. The magnetic field attracts the armature core and moves the contact point.
The movement of the contact point changes the power/signal flow path.
7. FORMULA / CALCULATIONS:
• -
8. PROGRAM:
import time
import RPi.GPIO as GPIO
GPIO.setwarnings(False)
GPIO.setmode(GPIO.BCM)
GPIO.setup(17,GPIO.IN,GPIO.PUD_UP)
GPIO.setup(18,GPIO.OUT)
while True:
state=GPIO.input(17)
if state==False:
GPIO.output(18,GPIO.HIGH)
time.sleep(2)
GPIO.output(18,GPIO.LOW)
time.sleep(1)
else:
GPIO.output(18,GPIO.LOW)
time.sleep(1)
1. EXPERIMENT NO:4
2. TITLE: TO INTERFACE BLUETOOTH WITH ARDUINO/RASPBERRY PI AND WRITE A
PROGRAM TO SEND SENSOR DATA TO SMARTPHONE USING BLUETOOTH
3. LEARNING OBJECTIVES:
• To interface Bluetooth device with Rpi and communicate with smartphone
• Understand serial communication between Rpi and HC-05
4. AIM:
• To interface Bluetooth with Raspberry pi and write a program to send sensor data to
smartphone using Bluetooth
5. MATERIAL / EQUIPMENT REQUIRED:
• Raspberry pi-4
• HC-05
• The HC-05 is a popular Bluetooth module that allows wireless communication between
devices. Here are some key points about the HC-05 Bluetooth module
• The HC-05 is designed for serial communication and is often used to enable Bluetooth
connectivity in electronic projects. It can be used for wireless communication between
microcontrollers, Arduino boards, and other devices
• The HC-05 can operate in two main modes: AT command mode and transparent
communication mode. In AT command mode, you can configure the module using AT
commands sent through a serial interface. In transparent mode, the module acts as a bridge,
transmitting data between connected devices
• Pins: Vcc, Gnd, Tx, Rx, State, En
• The default baud rate for communication with the HC-05 is usually 9600 bps, but it can be
configured using AT commands.
• The HC-05 can be paired with other Bluetooth devices such as smartphones, tablets, or other
Bluetooth-enabled devices. Once paired, data can be exchanged wirelessly.
• You can configure the HC-05 using AT commands to change settings such as the device
name, PIN code, and baud rate
7. FORMULA / CALCULATIONS:
• -
8. PROGRAM:
import time
import serial
ser = serial.Serial('/dev/ttyS0', baudrate = 9600, parity=serial.PARITY_NONE,
stopbits=serial.STOPBITS_ONE, bytesize=serial.EIGHTBITS, timeout=1)
counter=0
while True:
ser.write(b'Write counter: %d \n'%(counter))
print('Printed')
time.sleep(1)
counter += 1
9. BLOCK / CIRCUIT / MODEL DIAGRAM / REACTION EQUATION:
1. EXPERIMENT NO:5
2. TITLE: TO INTERFACE BLUETOOTH WITH ARDUINO/RASPBERRY PI AND WRITE A
PROGRAM TO TURN LED ON/OFF WHEN '1'/'0' IS RECEIVED FROM SMARTPHONE
USING BLUETOOTH
3. LEARNING OBJECTIVES:
• To interface Bluetooth device with Rpi and communicate with smartphone
• Understand serial communication between Rpi and HC-05
4. AIM:
• To interface Bluetooth with Arduino/Raspberry Pi and write a program to turn LED
ON/OFF when '1'/'0' is received from smartphone using Bluetooth
5. MATERIAL / EQUIPMENT REQUIRED:
• Raspberry pi-4
• HC-05, Led Module
• Python Interpreter, Thonny IDE
6. THEORY / HYPOTHESIS:
• The HC-05 is a popular Bluetooth module that allows wireless communication between
devices. Here are some key points about the HC-05 Bluetooth module
• The HC-05 is designed for serial communication and is often used to enable Bluetooth
connectivity in electronic projects. It can be used for wireless communication between
microcontrollers, Arduino boards, and other devices
• The HC-05 can operate in two main modes: AT command mode and transparent
communication mode. In AT command mode, you can configure the module using AT
commands sent through a serial interface. In transparent mode, the module acts as a bridge,
transmitting data between connected devices
• Pins: Vcc, Gnd, Tx, Rx, State, En
• The default baud rate for communication with the HC-05 is usually 9600 bps, but it can be
configured using AT commands.
• The HC-05 can be paired with other Bluetooth devices such as smartphones, tablets, or other
Bluetooth-enabled devices. Once paired, data can be exchanged wirelessly.
• You can configure the HC-05 using AT commands to change settings such as the device
name, PIN code, and baud rate
1. EXPERIMENT NO:6
2. TITLE: WRITE A PROGRAM ON ARDUINO/RASPBERRY PI TO UPLOAD
TEMPERATURE AND HUMIDITY DATA TO THINGSPEAK CLOUD
3. LEARNING OBJECTIVES:
• Understand thingspeak cloud platform
• Understand how to publish sensor data into thingspeak cloud using python and thingspeak
write API key.
4. AIM:
• Read DT11 sensor data into python environment
• Publish DHT11 sensor data to thingspeak cloud using python program and write API key
5. MATERIAL / EQUIPMENT REQUIRED:
• Raspberry pi-4
• DHT-11
• Python Interpreter, Thonny IDE, Thingspeak cloud
6. THEORY:
• ThingSpeak is an Internet of Things (IoT) platform that allows users to collect, analyze, and
visualize data from sensors or other devices. It provides a platform for building IoT
applications and services without requiring extensive programming knowledge. ThingSpeak
is often used in projects involving home automation, environmental monitoring, and various
other IoT applications.
Features of thingspeak
• Channels: Data is organized into channels, where each channel represents a set of data from
a particular source or device
• Fields: Each channel has multiple fields that correspond to different data parameters. For
example, in a weather monitoring project, you might have fields for temperature, humidity,
and pressure
• APIs: ThingSpeak provides APIs (Application Programming Interfaces) that allow
developers to interact with the platform programmatically. This enables the integration of
ThingSpeak with various hardware platforms and programming languages
7.FORMULA / CALCULATIONS:
• -
8. PROGRAM:
import sys
import urllib.request as urllib2
from time import sleep
import Adafruit_DHT
sensor = Adafruit_DHT.DHT11
pin = 4#GPIO 4 of Rpi
myAPI = 'XXXXXX'
baseURL = 'https://api.thingspeak.com/update?api_key=%s' % myAPI
def DHT11_data():
# Reading from DHT22 and storing the temperature and humidity
humi, temp = Adafruit_DHT.read_retry(sensor, pin)
return humi, temp
break
9. BLOCK DIAGRAM:
1. EXPERIMENT NO:7
2. TITLE: WRITE A PROGRAM ON ARDUINO/RASPBERRY PI TO RETRIEVE
TEMPERATURE AND HUMIDITY DATA FROM THINGSPEAK CLOUD
3. LEARNING OBJECTIVES:
• Understand thingspeak cloud platform
• Understand how to read published sensor data into python environment using thingspeak
read API keys
4. AIM:
• To write python program to read sensor data from the thingspeak cloud and display the
same on the python command prompt
5. MATERIAL / EQUIPMENT REQUIRED:
• Raspberry pi-4
• Python Interpreter, Thonny IDE, Thingspeak cloud
6. THEORY:
• ThingSpeak is an Internet of Things (IoT) platform that allows users to collect, analyze, and
visualize data from sensors or other devices. It provides a platform for building IoT
applications and services without requiring extensive programming knowledge. ThingSpeak
is often used in projects involving home automation, environmental monitoring, and various
other IoT applications
7. FORMULA / CALCULATIONS:
8. PROGRAM:
import urllib.request as urllib2
import json
web=urllib2.urlopen('https://api.thingspeak.com/channels/XXXX/feeds.json?
api_key=XXXXX&results=2')
j=web.read().decode()
data=json.loads(j)
print(data)
print(data['feeds'][0]['field1'])#first temp entry
print(data['feeds'][0]['field2'])#first hum entry
9. BLOCK / CIRCUIT / MODEL DIAGRAM / REACTION EQUATION:
• -
10. OBSERVATION TABLE / LOOKUP TABLE / TRUTH TABLE:
• -
11. GRAPHS / OUTPUTS:
• -
12. RESULTS & CONCLUSIONS:
• Sensor data in the thingspeak cloud is read into the local machines python command prompt
13. LEARNING OUTCOMES :
• Understand the use of thingspeak read API key
14. APPLICATION AREAS:
• -
15. REMARKS:
• -
-
1. EXPERIMENT NO:8
2. TITLE: TO INSTALL SQLITE3 DATABASE ON RASPBERRY PI AND PERFORM BASIC
SQL QUERIES.
3. LEARNING OBJECTIVES:
• To install sqlite3 database in Raspberry-pi
• To understand basic SQL queries including creating DB, creating table, inserting records,
dropping table etc.
• To push random data created using random package into the database using python script
• To read the random data present in DB using python script
4. AIM:
• To install sqlite3 database on Raspberry pi and perform basic operations
• To write python script to perform basic SQL queries
• To read DB content using python scripts
5. MATERIAL / EQUIPMENT REQUIRED:
• Raspberry pi-4
• Python Interpreter, Thonny IDE, sqlite3
6. THEORY:
• SQLite3 is a lightweight, embedded relational database management system (RDBMS) that
is widely used in various applications and software development projects. It is known for its
simplicity, ease of use, and self-contained nature, making it a popular choice for mobile
apps, desktop applications, and embedded systems.
• Command to install sqlite3 in RPI:Open the terminal in RPI and type the following
command
• pi@raspberry: sudo apt-get install sqlite3
• Open the terminal and follow the Commands to create DB, Table and insert records in
sqlite3 DB:
# Open or create a new database file
• sqlite3 mydatabase.db
# Create a table
• CREATE TABLE users (name TEXT, age INTEGER);
# Insert data
• INSERT INTO users (name, age) VALUES ('John Doe', 30);
# Query data
• SELECT * FROM users;
# Exit the SQLite shell
.quit
7. FORMULA / CALCULATIONS:
• -
8. PROGRAM:
#Python program to create database and push random data into the database
import sqlite3
import random
def dht11():
t=random.randint(28,35)
h=t+30
return t,h
-
1. EXPERIMENT NO:10
2. TITLE: PROGRAM TO CREATE UDP SERVER ON RASPBERRY PI AND RESPOND
WITH HUMIDITY DATA TO UDP CLIENT WHEN REQUESTED
3. LEARNING OBJECTIVES:
• To design udp server for establishing communication between server and client
• To design udp client for establishing communication between server and client
4. AIM:
• Program to create udp server on RPI-4 for data transfer
• Program to create udp client on RPI-4 for data transfer
5. MATERIAL / EQUIPMENT REQUIRED:
• Raspberry-pi-4, Thonny IDE
6. THEORY / HYPOTHESIS:
• TCP/IP, which stands for Transmission Control Protocol/Internet Protocol, is a suite of
communication protocols used for interconnecting network devices on the internet. It
provides the foundation for data communication in networks, enabling computers to
communicate and share resources
• Components of TCP/IP: Application, Transport, Network, Data-link layer and Physical
7. FORMULA / CALCULATIONS:
• -
8. PROCEDURE / PROGRAMME / ACTIVITY:
#udp_server.py
import socket
host="127.0.0.1"
port=8080
server= socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
server.bind((host,port))
msg,addr=server.recvfrom(1024)
print(msg.decode('utf-8'))
server.sendto("Hello client!".encode('utf-8'),addr)
#udp_client.py
import socket
host="127.0.0.1"
port=8080
client=socket.socket(socket.AF_INET,socket.SOCK_DGRAM)
client.sendto("Hello Server!".encode('utf-8'),(host,port))
print(client.recvfrom(1024)[0].decode('utf-8'))
9. BLOCK / CIRCUIT / MODEL DIAGRAM / REACTION EQUATION:
• -
10. OBSERVATION TABLE / LOOKUP TABLE / TRUTH TABLE:
1. EXPERIMENT NO:11
2. TITLE: PROGRAM TO CREATE UDP SERVER ON RASPBERRY PI AND RESPOND
WITH HUMIDITY DATA TO UDP CLIENT WHEN REQUESTED
3. LEARNING OBJECTIVES:
• To design tcp server for establishing communication between server and client
• To design tcp client for establishing communication between server and client
4. AIM:
• Program to create tcp server on RPI-4 for data transfer
• Program to create tcp client on RPI-4 for data transfer
5. MATERIAL / EQUIPMENT REQUIRED:
• Raspberry-pi-4, Thonny IDE
6. THEORY / HYPOTHESIS:
• TCP/IP, which stands for Transmission Control Protocol/Internet Protocol, is a suite of
communication protocols used for interconnecting network devices on the internet. It
provides the foundation for data communication in networks, enabling computers to
communicate and share resources
• Components of TCP/IP: Application, Transport, Network, Data-link layer and Physical
layer
• In the transport layer TCP protocol is used for transporting data. TCP is responsible for
ensuring the reliable and ordered delivery of data between devices on a network.It breaks
down large messages into smaller packets, numbers them, and sends them to the destination.
The receiving end reassembles these packets into the original message and ensures their
correct order.
7. FORMULA / CALCULATIONS:
• -
8. PROCEDURE / PROGRAMME / ACTIVITY:
#tcp_server.py
import socket
server=socket.socket(socket.AF_INET, socket.SOCK_STREAM)
server.bind(('127.0.0.1',8080))
server.listen()
while True:
client,address=server.accept()
print(f"Connected to {address}")
print(client.recv(1024).decode('utf-8'))
client.send("Hello client!".encode('utf-8'))
print(client.recv(1024).decode('utf-8'))
client.send("Bye!".encode('utf-8'))
client.close()
#tcp_client.py
import socket
client=socket.socket(socket.AF_INET,socket.SOCK_STREAM)
client.connect(("127.0.0.1",8080))
client.send("Hello server!".encode('utf-8'))
print(client.recv(1024).decode('utf-8'))
client.send("Bye!".encode('utf-8'))
print(client.recv(1024).decode('utf-8'))
9. BLOCK / CIRCUIT / MODEL DIAGRAM / REACTION EQUATION:
•
10. OBSERVATION TABLE / LOOKUP TABLE / TRUTH TABLE:
• -
11. GRAPHS / OUTPUTS:
• -
12. RESULTS & CONCLUSIONS:
• Implemented tcp_server and tcp_client for data communication within the local system
• Implemented tcp_server and tcp_client for data communication between two devices
13. LEARNING OUTCOMES :
• Understand the basics of tcp/ip protocol for data communication
1. EXPERIMENT NO:9
2. TITLE: WRITE A PROGRAM ON ARDUINO/RASPBERRY PI TO PUBLISH
TEMPERATURE DATA TO MQTT BROKER.
3. LEARNING OBJECTIVES:
• To understand the commands used for programming MQTT mosquito broker
• To understand the commands to publish data into MQTT broker
4. AIM:
• Python program to publish data to MQTT broker
5. MATERIAL / EQUIPMENT REQUIRED:
• Raspberry-pi-4, Thonny IDE
6. THEORY / HYPOTHESIS:
• MQTT, or Message Queuing Telemetry Transport, is a lightweight and open-source
messaging protocol designed for efficient communication between devices in situations
where bandwidth is limited or network conditions may be unreliable. It was originally
developed by IBM in the late 1990s and has become a widely adopted standard for the
Internet of Things (IoT), home automation, and other applications.
• Features of MQTT
• Publish/Subscribe Model: MQTT follows a publish/subscribe messaging pattern. Devices
communicate through a central entity called the broker. Clients can publish messages to
specific topics, and other clients can subscribe to those topics to receive the messages
• MQTT broker(server):The MQTT broker is a server that manages the communication
between devices. It receives messages from publishers and routes them to subscribers based
on topic subscriptions.
• MQTT client: An MQTT client is a device or application that connects to the broker to
either publish messages, subscribe to topics, or both. Clients can act as both publishers and
subscribers.
• Topics: Messages are published to topics, which act as communication channels. Clients
can subscribe to specific topics to receive relevant messages
Steps to install Mosquitto open source MQTT broker into Raspberry Pi
• Open the terminal and type the following commands
• pi@raspberrypi>>sudo apt-get install mosquitto mosquitto-clients
• After installation, to run the mosquitto MQTT broker type
• pi@raspberrypi>>sudo systemctl enable mosquitto.service
• Open two terminals one for subscriber and other one for publisher
• In one of the terminal type the command
• pi@raspberrypi>>mosquitto_sub -d -t “binary/updates”
• In other terminal type the command
• pi@raspberrypi>>mosquitto_pub -d -t “binary/updates” -m “MQTT subscriber
7. FORMULA / CALCULATIONS:
• -
8. PROCEDURE / PROGRAMME / ACTIVITY:
# Import package
import paho.mqtt.client as mqtt
# Define Variables
MQTT_HOST = "192.168.1.25"#RPI IP address use ifconfig to access it.
MQTT_PORT = 1883 #MQTT port address
MQTT_KEEPALIVE_INTERVAL = 5
MQTT_TOPIC = "hello/world"
MQTT_MSG = "Hello MQTT"
1. EXPERIMENT NO:12
2. TITLE: WRITE A PROGRAM ON ARDUINO/RASPBERRY PI TO SUBSCRIBE TO MQTT
BROKER FOR TEMPERATURE DATA AND PRINT IT
3. LEARNING OBJECTIVES:
• To understand the commands used for programming MQTT mosquito broker
• To understand the commands to subscribe topic using MQTT broker
4. AIM:
• Python program to subscribe a topic using MQTT broker
5. MATERIAL / EQUIPMENT REQUIRED:
• Raspberry-pi-4, Thonny IDE
6. THEORY / HYPOTHESIS:
• MQTT, or Message Queuing Telemetry Transport, is a lightweight and open-source
messaging protocol designed for efficient communication between devices in situations
where bandwidth is limited or network conditions may be unreliable. It was originally
developed by IBM in the late 1990s and has become a widely adopted standard for the
Internet of Things (IoT), home automation, and other applications.
7. FORMULA / CALCULATIONS:
1. EXPERIMENT NO:13
2. TITLE: GUI DESIGN TO CONTROL LED INTERFACED TO RASPBERRY-PI USING
TKINTER(OPEN ENDED EXPERIMENT-1)
3. LEARNING OBJECTIVES:
• To understand the basics of tkinter widgets
• To program button widget
4. AIM:
• Python program to control led using tkinter package
5. MATERIAL / EQUIPMENT REQUIRED:
• Raspberry-pi-4, Thonny IDE, tkinter
6. THEORY / HYPOTHESIS:
• Tkinter is a standard GUI toolkit in Python used for creating desktop applications. It
provides various widgets like Label, Frame, Button, Entry etc.
7. FORMULA / CALCULATIONS:
• -
8. PROCEDURE / PROGRAMME / ACTIVITY:
from tkinter import *
import RPi.GPIO as GPIO
GPIO.setwarnings(False)
GPIO.setmode(GPIO.BOARD)
GPIO.setup(3,GPIO.OUT)
def ledon():
GPIO.output(3,GPIO.HIGH)
def ledoff():
GPIO.output(3,GPIO.LOW)
root=Tk()
root.title('GUI based LED control using tkinter')
root.geometry('320x240')
l1=Label(root, text='GUI based LED ccontrol')
l1.pack()
b1=Button(root,text='LED ON',command=ledon)
b1.pack()
b2=Button(root,text='LED OFF',command=ledoff)
b2.pack()
root.mainloop()
9. BLOCK / CIRCUIT / MODEL DIAGRAM / REACTION EQUATION:
• -
10. OBSERVATION TABLE / LOOKUP TABLE / TRUTH TABLE:
• -
11. GRAPHS / OUTPUTS:
1. EXPERIMENT NO:13
2. TITLE: VOICE BASED HOME AUTOMATION USING QPYTHON AND TCP
SERVER/CLIENT PROTOCOL(OPEN ENDED EXPERIMENT-2)
3. LEARNING OBJECTIVES:
• Write python programs in android smartphones
• Communicate between Rpi and Smartphone using voice commands
4. AIM:
• Python program to control appliances connected to Raspberry pi using voice commands
5. MATERIAL / EQUIPMENT REQUIRED:
• Raspberry-pi-4, Thonny IDE, Qpython
6. THEORY / HYPOTHESIS:
• Qpython is a python interpreter for Android devices. It allows us to run python scripts and
projects directly on Android phone or tablet.
7. FORMULA / CALCULATIONS:
• -
8. PROCEDURE / PROGRAMME / ACTIVITY:
#tcp_server.py(to be executed in RPI)
import socket
import time
import RPi.GPIO as GPIO
GPIO.setwarnings(False)
GPIO.setmode(GPIO.BOARD)