Prelab1 1.What is IoT? Ans. The Internet of Things (IoT) describes the network of physical objects- “things”—that are embedded with sensors, software, and other technologies for the purpose of connecting and exchanging data with other devices and systems over the internet. These devices range from ordinary household objects to sophisticated industrial tools. Applications of IOT: 1.Smart Home 2.Smart Agriculture 3.Smart Parking 4.Smart Transport 5.Smart Cities. 2. What is a sensor? Identify some sensors used in smart homes. Ans. A device which detects or measures a physical property and records, indicates, or otherwise responds to it. Some sensors used in smart homes are Temperature sensors, Ultrasonic sensors. 3. What is an actuator? What are the types of actuators? Ans. An actuator is a component of a machine that is responsible for moving and controlling a mechanism or system, for example by opening a valve. In simple terms, it is a "mover". An actuator requires a control device (controlled by control signal) and a source of energy. The three main types of actuators are pneumatic (air pressure), hydraulic (fluid pressure) and electric. 4. What is the role of things and the internet in IoT? Ans. The Internet of Things (IoT) is a term that refers to the connection of physical devices to the internet, allowing them to "talk" to each other in order to collect and exchange data. This data can then be used to make decisions and take actions without any manual input from a user. 5. Draw the high-level architecture of IOT. Ans. 6.Write about I2C and SPI protocol. Ans. I2C stands for the inter-integrated controller. This is a serial communication protocol that can connect low-speed devices. It is a master-slave communication in which we can connect and control multiple slaves from a single master. In this, each slave device has a specific address. SPI stands for the Serial Peripheral Interface. It is a serial communication protocol that is used to connect low-speed devices. It was developed by Motorola in the mid-1980 for inter-chip communication. 7.What are the applications of buzzer and push buttons? Ans. Typical applications include siren, alarm device, fire alarm, air defense alarm, burglar alarm, timer, etc. It is widely used in household appliances, alarm system, automatic production line, low-voltage electrical equipment, electronic toys, game machines and other products and industries. Experiment 1: 1. Programming the Raspberry Pi to blink RED LED glow AIM: To program Raspberry Pi to blink RED LED. THEORY: ETS IoT KIT has 3 RGB LEDs which has been connected to raspberry pi through MCP23017. SOURCE CODE: import sys import time sys. path.append("/home/pi/Adafruit-Raspberry-Pi-Python-Code- legacy/Adafruit_MCP230XX") from Adafruit_MCP230XX import Adafruit_MCP230XX mcp=Adafruit_MCP230XX(busnum=1,address=0x20,num_gpios=16) mcp.config(0,mcp.OUTPUT) mcp.config(1,mcp.OUTPUT) mcp.config(2,mcp.OUTPUT) mcp.config(3,mcp.OUTPUT) mcp.config(4,mcp.OUTPUT) mcp.config(5,mcp.OUTPUT) mcp.config(6,mcp.OUTPUT) mcp.config(7,mcp.OUTPUT) mcp.config(8,mcp.OUTPUT) while(True): mcp.output(0,1) mcp.output(3,1) mcp.output(6,1) time.sleep(1) mcp.output(0,0) mcp.output(3,0) mcp.output(6,0) time.sleep(1) OUTPUT: The three LED’s glow red for 1 second and gets off for 1 second and again glows. 2.Programming the Raspberry Pi to detect push button AIM: To program Raspberry Pi to detect whether push button is pressed or not. THEORY: ETS IoT KIT has 2 PUSH BUTTON which has been connected to raspberry pi through MCP23017. SOURCE CODE: import sys import time sys.path.append("/home/pi/Adafruit-Raspberry-Pi-Python-Code- legacy/Adafruit_MCP230XX") from Adafruit_MCP230XX import Adafruit_MCP230XX mcp=Adafruit_MCP230XX(busnum=1,address=0x20,num_gpios=16) mcp.config(9,mcp.INPUT) mcp.pullup(9,1) mcp.config(10,mcp.INPUT) mcp.pullup(10,1) while(True): print("PIN 9="+str(mcp.input(9))) print("PIN 10="+str(mcp.input(10))) time.sleep(2) OUTPUT: For every two seconds the status of pushbutton is printed on monitor. Case 1: When both pushbuttons are pressed PIN 9=1 PIN 10=1 Case 2: When only pushbutton on left side is pressed PIN 9=1 PIN 10=0 Case 3: When only pushbutton on right side is pressed PIN 9=0 PIN 10=1 Case 4: When no pushbutton is pressed PIN 9=0 PIN 10=0 Prelab 2 1.What is the functionality of IoT gateway? Ans. An IoT gateway can act as a central hub and perform the necessary translations to allow inter-device communications. Device-to-Cloud Communications: IoT devices commonly send data to cloud-based infrastructure for processing and use in applications. 2.The number of addresses can be achieved with IPv6 addressing__________ Ans. IPv6 uses 128-bit (2^128) addresses, allowing 3.4 x 1038 unique IP addresses. This is equal to 340 trillion trillion trillion IP addresses. 3. Determine the IoT levels for designing home automation Ans. IOT level 1 is used for designing IOT devices for home automation. 4. Which communication protocols are used for M2M local area networks Ans. Some of the most widely used protocols in M2M are MQTT, CoAP, OMA LWM2M. Experiment 2 1. Programming the Raspberry Pi to buzzer AIM: To program the Raspberry Pi to ring the buzzer. THEORY: ETS IoT KIT has a BUZZER which has been connected to raspberry pi through MCP23017. SOURCE CODE: import sys import time sys.path.append("/home/pi/Adafruit-Raspberry-Pi-Python-Code- legacy/Adafruit_MCP230XX") from Adafruit_MCP230XX import Adafruit_MCP230XX mcp=Adafruit_MCP230XX(busnum=1,address=0x20,num_gpios=16) mcp.config(11,mcp.OUTPUT) while(True): mcp.output(11,1) time.sleep(2) mcp.output(11,0) time.sleep(2) OUTPUT: The buzzer will ring for a second and it gets off and again rings after a second. This process continues until the program is running on the Raspberry Pi. 2.Programming the Raspberry Pi to implement (i) the glow all green LEDs when a push button is pressed (ii) the glow all red LEDs when a push button is pressed (iii) if user presses both buttons at a time, then buzzer should on AIM: To program the Raspberry Pi such that (i)All LED’s glow green when push button is pressed. (ii)All LED’s glow red when push button is pressed. (iii)The buzzer gets on when both the push buttons are pressed at same time. THEORY: LED ETS IoT KIT has 3 RGB LEDs which has been connected to raspberry pi through MCP23017. Push Button ETS IoT KIT has 2 PUSH BUTTON which has been connected to raspberry pi through MCP23017 Buzzer ETS IoT KIT has a BUZZER which has been connected to raspberry pi through MCP23017. (i) SOURCE CODE: import sys import time sys.path.append("/home/pi/Adafruit-Raspberry-Pi-Python-Code- legacy/Adafruit_MCP230XX") from Adafruit_MCP230XX import Adafruit_MCP230XX mcp=Adafruit_MCP230XX(busnum=1,address=0x20,num_gpios=16) mcp.config(9,mcp.INPUT) mcp.pullup(9,1) mcp.config(10,mcp.INPUT) mcp.pullup(10,1) mcp.config(1,mcp.OUTPUT) mcp.config(4,mcp.OUTPUT) mcp.config(7,mcp.OUTPUT) while(true): if(mcp.input(9) or mcp.input(10)): mcp.output(1,1) mcp.output(4,1) mcp.output(7,1) else: mcp.output(1,0) mcp.output(4,0) mcp.output(7,0) OUTPUT: All the three LED glow in green color when either of the push button is pressed. (ii) SOURCE CODE: import sys import time sys.path.append("/home/pi/Adafruit-Raspberry-Pi-Python-Code- legacy/Adafruit_MCP230XX") from Adafruit_MCP230XX import Adafruit_MCP230XX mcp=Adafruit_MCP230XX(busnum=1,address=0x20,num_gpios=16) mcp.config(9,mcp.INPUT) mcp.pullup(9,1) mcp.config(10,mcp.INPUT) mcp.pullup(10,1) mcp.config(0,mcp.OUTPUT) mcp.config(3,mcp.OUTPUT) mcp.config(6,mcp.OUTPUT) while(true): if(mcp.input(9) or mcp.input(10)): mcp.output(0,1) mcp.output(3,1) mcp.output(6,1) else: mcp.output(0,0) mcp.output(3,0) mcp.output(6,0) OUTPUT: All the three LED glow in red color when either of the push button is pressed. (iii) SOURCE CODE: import sys import time sys.path.append("/home/pi/Adafruit-Raspberry-Pi-Python-Code- legacy/Adafruit_MCP230XX") from Adafruit_MCP230XX import Adafruit_MCP230XX mcp=Adafruit_MCP230XX(busnum=1,address=0x20,num_gpios=16) mcp.config(9,mcp.INPUT) mcp.pullup(9,1) mcp.config(10,mcp.INPUT) mcp.pullup(10,1) mcp.config(11,mcp.OUTPUT) while(true): if(mcp.input(9) and mcp.input(10)): mcp.output(11,1) else: mcp.output(11,0) OUTPUT: The buzzer gets on when both the push buttons are pressed at same time and will remain or get turned off in any other case. Prelab 3 1. Give an application scenario where ultrasonic sensor can be used. Ans. The ultrasonic sensor can be used in automatic cars to detect the distance between car and any other object on the road. 2. What are the two modes numbering I/O pins in RPi? Which one is preferable? Ans. the two modes used for addressing the pins in Raspberry Pi are: GPIO and BCM. BCM channel changes as version number changes so, GPIO is preferable. 3. Draw the basic functional block diagram of BME280 humidity and temperature sensor 4.Give the details of BME 280 sensor? What are the ranges supported by this sensor? Ans. The BME280 device is a digital barometric pressure sensor and is a slightly upgraded version of the BMP180. This is available on a small module which provides access to the sensor via the I2C interface. The I2C address of BME280 sensor in ETS IoT KIT is 0x76.The operational temperature range of the BME280 is -40 to 85 °C. 5. Draw the connection diagram to BME280 Experiment 3 1. Programming open-source board to read data from onboard Temperature, Pressure & Humidity sensor (BME280) AIM: To program the open-source board to read data from onboard temperature, pressure and humidity using BM280 sensor. THEORY: ETS IoT KIT has an ENVIRONMENTAL Sensor which has been connected to raspberry pi through I2C. It will show the value of TEMPERATURE, PRESSURE and HUMIDITY. The I2C address of BME280 sensor in ETS IoT KIT is 0x76. SOURCE CODE: import sys sys.path.append('/home/pi/ETS_IOT_KIT_demo/DemoCode/BM280') import BM280 as BME while True: temperature,pressure,humidity=BME.readBME280All() print("Temperature :"+str(temperature)) print("Pressure :"+str(pressure)) print("Humidity :"+str(humidity)) OUTPUT: Temperature :26.71 Pressure :951.254102412 Humidity :35.0968483115 Temperature :26.7 Pressure :951.25079809 Humidity :35.1283420684 Prelab 4 1.What is sensor? List different types of Analog and digital sensors Ans. A sensor is a device that measures or detects a physical quantity or environmental condition, such as temperature, pressure, light, sound, motion, or humidity, and converts the signal into an electrical or digital output that can be processed by a computer or electronic system. Analog sensors: Thermistor - measures temperature changes through changes in electrical resistance Strain gauge - measures deformation or strain in an object due to an applied force Pressure sensor - measures changes in pressure or force Light dependent resistor (LDR) - measures changes in light intensity Accelerometer - measures changes in acceleration Digital sensors: Magnetic sensor - detects magnetic fields and changes in magnetic fields Motion sensor - detects motion and changes in motion Proximity sensor - detects the presence or absence of nearby objects pH sensor - measures the acidity or basicity of a liquid Gas sensor - detects the presence of specific gases in the environment 2.What is role of mcp3008? Ans.The MCP3008 is an analog-to-digital converter (ADC) chip that allows a microcontroller or computer to convert analog signals from sensors or other analog sources into digital data that can be processed and analyzed. 3.What is PIR and applications of PIR sensor. PIR stands for Passive Infrared Sensor. It is an electronic sensor that can detect the presence of objects, animals, or people by detecting changes in the infrared radiation emitted by them.PIR sensors are commonly used in security systems, motion-activated lighting systems, and other applications that require detection of movement or presence of people or objects. 4.What is pi to pi communication? Ans.Pi to Pi communication refers to the process of exchanging data between two Raspberry Pi devices, either directly through a physical connection or through a network connection. 5.How to generate server MAC address. Ans. To generate a MAC address for a server, you can follow these general steps: 1.Determine the organizationally unique identifier (OUI) for the manufacturer of the NIC. The OUI is the first three bytes of the MAC address and is assigned by the Institute of Electrical and Electronics Engineers (IEEE). A list of OUIs is available from the IEEE website. 2.Generate a random value for the last three bytes of the MAC address. These bytes are used to create a unique identifier for the NIC. 3.Combine the OUI and the random value to create a complete MAC address. Experiment 4 1. Programming open-source board to interface with PIR sensor. AIM: To program open-source board to interface with PIR sensor. THEORY: A passive infrared sensor (PIR sensor) is an electronic sensor that measures infrared (IR) light radiating from objects in its field of view. They are most often used in PIR-based motion detectors. The connections are made as follows: SOURCE CODE: import time import sys sys.path.append('/home/pi/Adafruit-Raspberry-Pi-Python-Code-legacy/Adafruit_MCP230XX') from Adadfruit_MCP230XX import Adafruit_MCP230XX mcp=Adafruit_MCP230XX(busnum=1,address=0x20,num_gpios=16) mcp1=Adafruit_MCP230XX(busnum=1,address=0x21,num_gpios=16) mcp1.config(0,mcp.INPUT) mcp.config(11,mcp.OUTPUT) mcp.pullup(0,1) while(True): i=mcp1.input(0) time.sleep(2) if(i==1): print('Person Detected') mcp.output(11,1) #Buzzer starts buzzing time.sleep(2) #Buzzer sounds for 2 seconds mcp.output(11,0) #Buzzer is turned off else: print('Person Not Detected') OUTPUT: Case 1: When a person or an object approaches the PIR sensor then on monitor, we get display as “Person Detected” and buzzer rings for 2 seconds. Case 2: When person or object is not near the sensor then on monitor, we get display as “Person Not Detected” and buzzer doesn’t ring. 2. Programming open-source board to interface with ultrasonic sensor. AIM: To program open-source board to interface with ultrasonic sensor. THEORY: Ultrasonic sensors “are based on the measurement of the properties of acoustic waves with frequencies above the human audible range,” often at roughly 40 kHz.They typically operate by generating a high-frequency pulse of sound, and then receiving and evaluating the properties of the echo pulse. SOURCE CODE: import time import sys import RPi.GPIO as GPIO GPIO.setwarnings(False) GPIO.setmode(GPIO.BOARD) GPIO_TRIGGER=16 GPIO_ECHO=18 GPIO.setup(GPIO_TRIGGER,GPIO.OUT) GPIO.setup(GPIO_ECHO,GPIO.IN) GPIO.output(GPIO_TRIGGER,False) i=1 time.sleep(0.5) while(True): GPIO.output(GPIO_TRIGGER,True) time.sleep(0.00001) GPIO.output(GPIO_TRIGGER,False) while(GPIO.input(GPIO_ECHO)==0): start=time.time() while(GPIO.input(GPIO_ECHO)==1): stop=time.time() elapsed=stop-start distance=elapsed*34300 distance=distance/2 print(“Distance of Object is”+str(distance)) time.sleep(5) i+=1 OUTPUT: When an object or obstacle is placed at a distance of 10 cm from the sensor then the output will be: Distance of Object is 10 Prelab 5 1.Write the applications of servo motor Ans. Servo motors are widely used in various applications where precise control of position, velocity, and acceleration is required. Here are some common applications of servo motors: 1.Robotics 2.CNC machines 3.Aerospace industry 4.Industrial automation 2. Draw the pin mapping of servo motor Ans. 3. Classify the different motors available. Ans. Motors can be classified into different types based on several factors, including the type of power source, operating principle, and application. Here are some common classifications of motors: 1.AC motors 2.DC motors 3.Brushed DC motors 4.Brushless DC motors 5.Stepper motors 6.Servo Motors 4. Differentiate between Servo motor and DC motor. Ans. A servo motor is a rotatory actuator that allows for a precise control of angular position, velocity and acceleration. A DC motor is a type of electrical machine that uses electrical energy to convert it into mechanical energy for driving a mechanical load. 5. How does Tinkercad allow design of circuits? Ans. Tinkercad's Circuits editor has a similar layout to its 3D design editor. We'll find a large window on the left for creating our design. On the right side we'll see a panel filled with components we can drag and drop into the workspace to create our circuit. Experiment 5 1. Programming open-source board to interface with moisture sensor for Agriculture based applications. AIM: To program open-source board to interface with moisture sensor for Agriculture based applications. THEORY: Soil Moisture Sensor is a simple breakout for measuring the moisture in soil and similar materials. The soil moisture sensor is pretty straight forward to use. The two large exposed pads function as probes for the sensor, together acting as a variable resistor. The more water that is in the soil means the better the conductivity between the pads will be and will result in a lower resistance, and a higher SIG out. SOURCE CODE: import time import Adafruit_GPIO.SPI as SPI import Adafruit_MCP3008 CLK=23 MISO=21 MOSI=19 CS=25 mcp=Adafruit_MCP3008.MCP3008(clk=CLK,cs=CS,miso=MISO,mosi=MOSI) SPI_PORT=0 SPI_DEVICE=0 mcp=Adafruit_MCP3008.MCP3008(spi=SPI.SpiDev(SPI_PORT,SPI_DEVICE)) while(True): i=mcp.read_adc(0) t=i p=(100-((t/1023.0)*100)) print('Moisture Content :',p) time.sleep(3) OUTPUT: Moisture Content :17.899 Moisture Content :17.499 Moisture Content :17.599 Moisture Content :17.399 Prelab 6 1.How to measure accuracy of soil moisture sensor? Ans. The accuracy of a soil moisture sensor can be measured by comparing its readings to actual soil moisture measurements obtained through a different method, such as gravimetric soil moisture analysis or time domain reflectometry (TDR). By comparing the sensor readings to actual moisture content values obtained through a different method, you can determine the accuracy of the soil moisture sensor and make any necessary adjustments to ensure more accurate readings. 2. What is the difference between volumetric water content(VWC) and gravimetric water content( GWC)? Ans. Volumetric water content (VWC) is the ratio of the volume of water held in the soil to the total volume of the soil. It is expressed as a percentage or decimal value, and represents the amount of water available for plants to use. Gravimetric water content (GWC) is the ratio of the mass of water held in the soil to the mass of the dry soil. It is also expressed as a percentage or decimal value, and represents the amount of water in a given mass of soil. 3. After installing the sensor probes, there is some variability between readings even though they are all buried at the same depth why? Ans. There are several factors that can contribute to variability between soil moisture sensor readings, even when they are installed at the same depth. Here are some possible reasons: 1.Soil heterogeneity 2.Sensor placement 3.Sensor calibration 4.Environmental factors 4. Difference between EC-5 and ECH20 sensors. Ans. The main differences between the EC-5 and ECH2O soil moisture sensors are: 1.Measurement method: The EC-5 uses time domain reflectometry (TDR) to measure soil moisture, while the ECH2O uses capacitance. 2.Accuracy: The EC-5 is generally considered more accurate than the ECH2O, particularly in soils with high clay content or electrical conductivity. 3.Cost: The EC-5 is generally more expensive than the ECH2O. 4.Maintenance: The ECH2O requires periodic calibration, while the EC-5 is typically more durable and requires less maintenance. Experiment 6 1.Programming open-source board to interface with actuators (servo motor). AIM: To program open-source board to interface with actuators (servo motor). THEORY: The servo motor is most commonly used for high technology devices in the industrial application like automation technology. It is a self-contained electrical device that rotate parts of a machine with high efficiency and great precision. The output shaft of this motor can be moved to a particular angle. Servo motors are mainly used in home electronics, toys, cars, airplanes, etc. SOURCE CODE: import RPI import RPI.GPIO as GPIO import time GPIO.setmode(GPIO.BOARD) GPIO.setup(22,GPIO.OUT) pwm=GPIO.PWM(22,100) pwm.start(5) angle1=10 duty1=float(angle1)/10+2.5 angle2=160 duty2=float(angle2)/10+2.5 ck=0 while(ck<=5): pwm.changeDutyCycle(duty1) time.sleep(0.8) pwm.changeDutyCycle(duty2) time.sleep(0.8) ck=ck+1 time.sleep(1) GPIO.cleanup() OUTPUT: The actuator i.e., the servo motor rotates 100 degrees. Prelab 7 1.What are the applications of bluetooth protocol? Ans. Bluetooth protocol has a wide range of applications in various industries such as mobile and computer devices, automotive, healthcare, and entertainment. It is used for wireless data transfer, audio streaming, and remote control functionalities between devices. 2. What are bluetooth profiles? Ans. Bluetooth profiles are a set of rules and protocols that define how different Bluetooth devices communicate with each other. They specify the functionalities and features supported by a device, such as hands-free calling, music streaming, or data transfer. By following the same profile, devices can work together seamlessly, regardless of the manufacturer. 3. How is bluetooth security implemented? Ans. Bluetooth security is implemented through authentication, encryption, and authorization mechanisms. Authentication verifies the identity of the device, encryption secures the data transmission, and authorization restricts access to certain functionalities. Bluetooth also supports different security modes and pairing methods, such as PIN codes or NFC, to ensure a secure connection between devices. 4. Can we use bluetooth products on airlines? Ans. Yes, it is possible to use Bluetooth products on airlines. But all airlines don’t give permission to use them. 5. What are the improvements of BLE 4.0 ? Ans. BLE 4.0 (Bluetooth Low Energy) brought significant improvements over its predecessor, including lower power consumption, faster connection establishment, increased range, and support for new applications such as indoor location tracking, health monitoring, and smart home automation. 6. Write the communication models used in Bluetooth device Ans. The Bluetooth protocol uses two communication models: the Master-Slave model and the Peer-to-Peer model. In the Master-Slave model, one device acts as the master and initiates the connection with one or more slave devices. In the Peer-to-Peer model, two devices can initiate the connection and communicate with each other without the need for a master device. 7. Write the features of all BLE classes. Ans. There are three classes of Bluetooth Low Energy (BLE) devices, each with different power requirements and range capabilities: Class 1: This class has the highest power output of up to 100 mW, allowing for a range of up to 100 meters. It is mainly used in industrial and commercial applications. Class 2: This class has a power output of up to 2.5 mW, with a range of up to 10 meters. It is the most common class used in consumer electronics such as smartphones, headphones, and smartwatches. Class 3: This class has the lowest power output of up to 1 mW, with a range of up to 1 meter. It is primarily used in wearable devices and medical sensors that require minimal power consumption. Experiment 7 1.Demonstrate communication protocol Bluetooth AIM: To demonstrate communication protocol Bluetooth THEORY: Commands to configure the bluetooth sudo apt-get install bluetooth sudo apt-get install bluez sudo apt-get install python-bluez sudo bluetoothctl power on agent on default-agent discoverable on scan on SOURCE CODE: Server program(Server.py) import time import sys import bluetooth server_sock=bluetooth.BluetoothSocket(bluetooth.RFC) port=1 server_sock.bind((" ",port)) server_sock.listen(1) client_sock,address=server_sock.accept() print("Accepted connection from ",address) while(True): data=client_sock.recv(1024) print("received [%s]"% data) text=raw_input("ENTER YOUR MESSAGE:") client_sock.send(text) client_sock.close() server_sock.close() Client program(Client.py) import time import bluetooth bd_addr="B8 :27 :EB :5A :15 :EF" port=1 sock=bluetooth.BluetoothSocket(bluetooth.RFCOMM) sock.connect((bd_addr,port)) while True: text=raw_input("ENTER YOUR MESSAGE:") sock.send(text) data=sock.recv(1024) print("received[%s] %data) time.sleep(1) sock.close() OUTPUT: Server.py Accepted connection from B8 :27 :EB :5A :15 :EF HI I AM CLIENT ENTER YOUR MESSAGE: HI I AM SERVER Client.py ENTER YOUR MESSAGE: HI I AM CLIENT HI I AM SERVER Prelab 8 1.What is the range supported by Zigbee? Ans. Zigbee's transmission range varies depending on the frequency band and environmental factors but generally has a range of up to 10-100 meters and can be extended with mesh networking. 2. Compare Zigbee and Bluetooth. Ans. Zigbee and Bluetooth are both wireless communication technologies with different strengths and weaknesses. Zigbee has a longer range, lower power consumption, and supports mesh networking, making it suitable for industrial and smart home automation, while Bluetooth has a higher data rate and is widely used in consumer electronics. 3. What is mesh network and how is it useful? Ans. A mesh network is a topology where nodes communicate with neighboring nodes to relay data and extend the range of the network. It's useful because it allows for more robust and resilient infrastructure, easy network expansion, self-healing capabilities, and is ideal for large areas or environments where traditional networks may not be feasible or cost- effective. 4. How do we configure Zigbee node as coordinator? Ans. To configure a Zigbee node as a coordinator, you need to connect the Zigbee module to the computer, set the node type to "coordinator" using a terminal program, set the network parameters, and save the configuration to the module's memory. 5. Write five application areas where Zigbee can be used. Ans. Here are five application areas where Zigbee can be used: 1.Smart home automation: Zigbee can be used to create a network of devices for controlling lights, temperature, security systems, and other home appliances. 2.Industrial automation: Zigbee can be used in industrial automation for monitoring and controlling machinery and equipment. 3.Healthcare: Zigbee can be used for remote patient monitoring, tracking medical equipment, and improving patient safety. 4.Energy management: Zigbee can be used in energy management systems to monitor and control energy consumption in homes, buildings, and factories. 5.Retail: Zigbee can be used in retail environments for tracking inventory, monitoring customer behavior, and optimizing store layouts. Experiment 8 1.Demonstrate zigbee protocol. AIM: To demonstrate zigbee protocol. THEORY: In this experiment one of the ZigBee must be configured as a coordinator and another must be configured as an end device and other as Router. To configure a ZigBee, an application called as XCTU is used. The ZigBee is connected to computer via USB port. Steps to configure a ZigBee as a coordinator or end device or router are: 1.Connect the ZigBee to computer using the USB port. 2.Open the application XCTU on computer and set the below parameters to given values. (i) For coordinator: Id: 2015 (Some number can be taken but it should same for coordinator and end device). CE: Enabled NI: COORD SP: 1F4 (ii) For End_device: Id: 2015 DH: 0 DL: 0 NI: END_DEVICE SP: 1F4 SM: Cyclic sleep SO: 2 (iii)For Router: Id: 2015 DH: 0 DL: 0 NI: ROUTER SP: 1F4 Now connect the three ZigBees to Raspbeery Pi. SOURCE CODE: For COORDINATOR node: import time import serial s=serial.Serial(port=’/dev/ttyUSB0’, baudrate=9600 , parity=serial.PARITY_NONE, stopbits=serial.STOPBITS_ONE, bytesize=serial.EIGHTBITS,timeout=1) while(1): x=s.readline().strip() print(x) For END_DEVICE node : import time import serial ser=serial.Serial(port=’/dev/ttyUSB0;,baudrate=9600,parity=serial.PARITY_NONE,stopbits= serial.STOPBITS_ONE,bytesize=serial.EIGHTBITS,timeout=1) c=0 while True: x=raw_input(‘Enter text to send to coordinator:’) ser.write(x) time.sleep(1) For ROUTER node: import time import serial ser=serial.Serial(port=’/dev/ttyUSB0;,baudrate=9600,parity=serial.PARITY_NONE,stopbits= serial.STOPBITS_ONE,bytesize=serial.EIGHTBITS,timeout=1) c=0 while True: x=raw_input(‘Enter text to send to coordinator:’) ser.write(x) OUTPUT: END_DEVICE: Enter text to send to coordinator: HI, I AM END DEVICE SPEAKING! COORDINATOR: HI, I AM END DEVICE SPEAKING! END_DEVICE: Enter text to send to coordinator: PRINT THIS DATA ON BEHALF OF ME😊 COORDINATOR: PRINT THIS DATA ON BEHALF OF ME😊 ROUTER: Enter text to send to coordinator: HI, I AM ROUTER SPEAKING! COORDINATOR: HI, I AM ROUTER SPEAKING! Prelab 9 1.What is the range supported by zigbee? Ans. Zigbee supports a range of up to 10-100 meters in typical indoor environments, depending on the specific Zigbee device and the surrounding physical environment. The range can be extended by using mesh networking, which allows Zigbee nodes to relay data to other nodes and expand the coverage area of the network. 2. Identify the countries where zigbee is prominently used and for what applications. Ans. Zigbee is used in various countries for a wide range of applications. Here are some examples: United States: Zigbee is used for smart home automation, industrial automation, and building automation. China: Zigbee is used for home automation, smart cities, and energy management. Japan: Zigbee is used for home automation, healthcare, and industrial automation. Germany: Zigbee is used for industrial automation, building automation, and smart cities. United Kingdom: Zigbee is used for smart home automation, healthcare, and energy management. 3. What is cloud MQTT? Ans. Cloud MQTT is a cloud-based message broker that enables communication between devices and applications using the MQTT (Message Queuing Telemetry Transport) protocol. It provides a scalable and reliable way to send and receive messages between devices and applications in real-time, and it can be used for a variety of IoT applications, such as home automation, industrial automation, and smart cities. 4. What is Mosquitto? Ans. Mosquitto is an open-source message broker that implements the MQTT (Message Queuing Telemetry Transport) protocol. It provides a lightweight and efficient way to send and receive messages between devices and applications in real-time, making it ideal for IoT applications. Mosquitto is often used in combination with other open-source tools like Node- RED and InfluxDB to build end-to-end IoT solutions. 5. Does cloud MQTT support websockets. Ans. Yes, Cloud MQTT does support websockets. Websockets provide a standard mechanism for web browsers and servers to exchange data in real-time, which can be useful for building web-based IoT applications that use MQTT as the messaging protocol. Cloud MQTT allows clients to connect using websockets in addition to the standard MQTT protocol, which enables web browsers to communicate with MQTT-enabled devices and applications. Experiment 9 1.Demonstrate MQTT protocol. AIM: To demonstrate MQTT protocol. THEORY: SOURCE CODE: MQTT Subscriber Program: import paho.mqtt.client as mqtt def on_connect(client,userdata,flags,rc): print(“Connected with MQTT server”+str(rc)) client.subscribe(“iot/home”) def on_message(client,userdata,msg): print(msg.topic+ “ ” +str(msg.payload)) client=mqtt.Client() client.on_connect=on_connect client.on_message=on_message client.connect(“test.mosquitto.org”,1883,60) client.loop_forever() MQTT Publisher Program: import paho.mqtt.publish as publish import BME280Lib as BME t,h,m=BME.readBME280All() publish.single(“iot/home”, ”Temperature: %d” %t, hostname=”test.mosquitto.org”) print(“DONE”) OUTPUT: MQTT Subscriber Program: Connected with MQTT server Temperature: 25 MQTT Publisher Program: Done Prelab 10 1.Write the steps to create a thingspeak cloud account. Ans. To create a ThingSpeak cloud account, follow these steps: 1.Go to the ThingSpeak website at https://thingspeak.com/ and click the "Get Started for Free" button. 2.Fill out the registration form with your personal information, including your email address and password. 3.Once you've filled in all the required fields, click the "Create Account" button to complete the registration process. 4.You will receive an email from ThingSpeak asking you to confirm your email address. Follow the link provided in the email to confirm your email address and activate your account. 5.After activating your account, you can log in to ThingSpeak with your email address and password and start using the service. 2. What is the purpose of Write API key? Ans. A Write API key is a unique identifier that grants access to write data to a specific ThingSpeak channel. It is used to securely authorize applications or devices to push data to a ThingSpeak channel using HTTP POST or GET requests. The Write API key allows developers to automate the process of data logging and analysis by integrating ThingSpeak with IoT devices, sensors, and other applications. 3. What is the purpose of READ API KEY? Ans. A Read API key is a unique identifier that grants access to read data from a specific ThingSpeak channel. It is used to securely authorize applications or devices to retrieve data from a ThingSpeak channel using HTTP GET requests. The Read API key allows developers to integrate ThingSpeak data with other applications, such as mobile apps, websites, or analytics tools, to create custom dashboards and visualizations. 4. What is a channel in Thingspeak cloud? Ans. In ThingSpeak cloud, a channel is a virtual container that stores and organizes data collected from various sources, such as sensors, devices, or web services. Each channel consists of multiple fields, which represent individual data points that can be logged and analysed over time. 5. Write the applications of cloud computing. Ans. Cloud computing has a wide range of applications across various industries and domains. Here are some of the common applications of cloud computing: 1. Data storage and backup 2. Software as a Service (SaaS) 3. Platform as a Service (PaaS) 4. Infrastructure as a Service (IaaS) 5. Internet of Things (IoT) Experiment 10 1.Write a python program to upload weather information details in thingspeak cloud account. AIM: To write a python program to upload weather information details in thingspeak cloud. THEORY: Steps: 1.Visit www.thingspeak.org and create an account. 2.Login into the portal. 3.Create a new channel named “BME Sensor”. 4.Create the sensor variables/ fields. 5.Copy write API key. SOURCE CODE: import sys import BME280Lib as BME import sys import urllib.request as ur import time sys.path.append(‘/home/pi/ETS_IOT KIT demo/DemoCode/BME280’) while(True): t,p,h=bme.readBME280All() print(t,p,h) st=’https://api.thingspeak.com/update?api_key=Y4SX1SX0BCOH75GS&field1=’+str(t )+’&field2=’+str(p)+’&field3=’+str(h) f=ur.urlopen(st) time.sleep(2) OUTPUT: 26.71 951.254102412 35.0968483115 26.7 951.25079809 35.1283420684
Enter the password to open this PDF file:
-
-
-
-
-
-
-
-
-
-
-
-