0% found this document useful (0 votes)
62 views53 pages

IOT Decode Copy Sppu

Iot decode for students

Uploaded by

movieskatta7641
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF or read online on Scribd
0% found this document useful (0 votes)
62 views53 pages

IOT Decode Copy Sppu

Iot decode for students

Uploaded by

movieskatta7641
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF or read online on Scribd
You are on page 1/ 53
Punic 1} Communication Protocols | and loT Challenges | 3.4: IEE 802.11 Q.1 What is WLA standard. : ‘Ans. : © Wireless Local Area Network (WLAN) has data transfer speeds ranging from 1 to 54 Mbps. WLAN signal can be broadcast to cover ay area ranging in size from @ small office to a large. campus. Mos commonly, a WLAN access point: provides access within a radius of 65 to 300 feet. e IEEE 802.11 standard for WLANs. «The 802.11 specifications were developed specifically for Wireless Local Area Networks (WLANs) by the IEEE and include four subsets of Ethernet-based protocol standards : 802.11, 802.11a, 802.11, and 802.11g. ¢ 802.11 operated in the 2.4 GHz range and was the original specification of the 802.11 IEEE standards. This specification delivered 1 to 2 Mbps using a technology known as Phase-Shift Keying (PSK) modulation. 6 GHz range with data rates commonly i 1a uses the data 802.11b and 802.119 N ?. Explain 802.11, ¢ 802.11a operates in the 5 - the 6 Mbps, 12 Mbps, or 24 Mbps range. Because 802. Orthogonal Frequency Division Multiplexing (OFDM) standard, transfer rates can be as high as 54 Mbps. © The 802.11b standard operates in the 2.4 GHz range with UP 2 11 Mbps data rates and is backward compatible with the 021! standard, 802.11b uses a technology known as Complementary © Keying (CCK) modulation. (3-1) —_ Intemet of Things 3-2 Communication Protocols and IoT Challenges Intemet of Things 3-3 Communication Protocole and IoT Challenges « s02.11g is the most recent IEEE 802.11 draft standard and operates in the 2.4 GHz range with data rates as high as 54 Mbps over a limited distance. 7 Q3 Explain wireless LAN protocols. Ans. 14. Multiple Access with Collision Avoidance (MACA) © MACA protocol solved hidden, exposed terminal. Send Ready-to-Send 2 Explain hidden and exposed terminal problem. (RTS) and Clear-To-Send (CTS) first. RTS, CTS helps determine wio Ams. t is else is in range or busy (Collision avoidance). Om ® den Terminal Problem soi ca hear bol And C, but A and C can't hear ‘each other, 2 3 Fig. 0.3.1 MACA 5 phen” sath asain it happens when : Nea c 2 © MACA uses exchange of two short messages : Request To Send (RTS), see ee ee le A | and Clear To Send (CTS). - js transmitting to B. : : eee Fig 2 t Hleden slate «They are fixed size, When A wishes to transmit to B, it sends an RTS tation "A" is hidden from a ‘ message. RTS message contains duration of proposed trnsmission. If B knows that the channel is fee, it responds with 2 CTS message. (CTS also contains duration of proposed communication). Any station that hears the RTS message, defers all communication for ‘some time until the associated CTS message has been finished. A CTS message ‘defers commurication for the duration of the time indicated in the CTS message. « Wien A is transmitting data, C con go ahead and access the chansél Node B's CTS message may not be heard by A. Station B found thst the channel was already busy. RTS packet might collide. Fig. 0:2.2 Exposed station SPA docs not receive a CTS, it imes-out and schedules the packet 0° J+ camer ~ iapformatian: 2: eee ve cansmission: MACA uses-the binary exponential back-off algorithm fo f : vrhect the retransmission time. B's CTS message collides at C lisio , “ects would cause Cto be unaware of the pending, communicaioe between nodes A and B. © To avoid collision, st collision occurs at the receiver not transmitter. crt St “A Gulde for Engineering Siude Internet of Things _3-4 _ Communication Protocote and tor Cha tallenges 2. Multiple Access with Collision Avoidance fo; ate nce for Wireless LANs + Receiver responds with Acknowledgment (ACK) Other nodes in receiver's range leam that channel is “ is available. Nos hearing RTS, but not CTS do not know if transmission will con = + MACAW uses Data Sending (DS) packet, sent by sender after CTS to inform such nodes of svocessfil handshake, after data reception, receiving Q4 Write a short note on IEEE 802.15.4 access technology. FSP ISPPU, May-19, End Sem, Marks 5] Ans. : + 802.154 is an IEEE standard for PHY and MAC layers upon which. further networking and communication protocols are built, Networking standards built upon 802.15.4 include Thread and Zighee. * The IEEE 802.15.4 protocol is designed’ for enabling communication between compact and inexpensive low power embedded devices that need a long battery life. © IEEE 802.15.4 is simple packet data protocol for lightweight’ wireless networks. Channel access is via Carrier Sense Multiple Access with collision avoidance’ and optional time slotting. It provides multi-level security, © Characteristic of 802.15.4°: 1. Data rates of 250 kbps, 20 kbps and 40 kbps. 2. Star or peer-to-peer operation. 3. Support for low latency devices. 4. CSMA-CA channel access. 5. Dynamic device addressing. Fully hand-shaked protocol for transfer reliability. a Low power consumption. 8 16 channels in the 2.4 GHz ISM band, 19 gy 915 MHz ISM band and one channel in the Europe, band, Internet of Things __3-$__ Communication Proteeslsantior tay, + The IEEE 802.15.4 supports two classes of devices : Fully 5. Devices (FFD), which have full network fimetionalities and the Functional Devices (RFD), which possess limited functi « All Personal Area Networks (PAN) consists of at least one acts as the PAN coordinator which is responsible for maix PAN. REDs are responsible for directly obtaining dar: sa environment and sending them to a PAN coordinate. orale, ‘* IEEE 802.15.4 defines four types of frames : = a) Beacon frames, ©) Acknowledgement frames, Q.5 What are the functions of physical and MAC Ia Ans. L + Functions of physical layer : b) MAC command fame: 4) Data frames. Activation and deactivation of the radio transceiver. 2. Energy detection within the current channel. 3. 4, 5. 6 Link quality indication for received packets Clear channel assessment for CSMA-CA. Channel frequency selection. Data transmission and reception. «The IEEE 802.15.4 MAC layer is responsible for : LQ 2 3. 4 Ss 6 Joining and leaving the PAN; Carrier Sense Multiple Access with Collision (CSMA-CA) for channel access; u Guaranteed Time Slot (GTS) tansmissions; Establishing a reliable link between two peer MAC exsits Beacon transmissions for a coordinator; Synchronization to the beacons. —— Inter of Tangs 06 Wests Ask: + All co-diateew Tee cont "pening fr + Normally, spine ates 9 ¢ +The Access sing # a7 Wi to com sand) = Blu Bh Bh a cE pl emerofTrings 3° Communication Protocols and oT Challenges ‘qs What is beacon enable mode ? ses: * All TEEE $0215.t+based nenvorks use, Pescons from a artecinator when joining devices to the network: ser co-ordinator sends out a periodic train of beacon signals containing Tiranation that allows network modes to synchronise | their communications. A beacon also contains information on the dats “pending for the different nodes of the network. « Normally, ‘wo successive beacons mark the beginning and end of @ superframe. A superframe contains 16 timeslots that ean be used Py sie to communicate over the network. Fig, Q.6.1 shows superframe. Contention Access Period (CAP) (TT Fig. 0.6.1 Supertrame s Tue total time interval of these timeslots is called the Contention “Access Period (CAP), during which nodes can attempt to communicate using slotted CSMA/CA. Bluetooth and ZigBee 7 Write short note on Bluetooth. ‘Ans. + « Bluetooth is a wireless technology that enables a wireless device cc communicate in the 2.4 GHz Industrial Scientific and Medical (ISM band). eBluctooth is @ short range, low cost and low power wireless ‘communication standard. « Bluetooth supports point-to-point and point-to-multipoint connections « Bluetooth operates in the 2.4 GHz Industrial, Scientific and Medical (SM) band at a maximum data rate of 720 Kops. It uses ftequency hopping spread spectrum that divides the frequency band yielding Internet of Things __3-7__ Communication Protocols and IoT Challenges 79 channels, The modulation used is a Gaussi a jan-shaped Frequency Shift Keying (GFSK) modulation scheme. my ‘Bluetooth uses TDD (Time Division Duplex) to perform, full-dsplex communication. The master defines slots.of time and allocates one slét per slave. ‘© Bluetooth is organized in master-slave mode. The topology supports 1 master, 7 slaves and.up to 255 slaves in parked mode. The master defines the ‘clock and time slots for all nodes. ‘¢ A master can request to change his role with a slave, at which point the slave becomes the master and the master becomes the slave. For example : A head phone starts the communication as a masts, bi it prefers to be the slave. « Two basic topologies are possible in Bluctooth : Piconet and Seazemet Topology. “= Bluetooth devices have three modes to save power exergy in transmission inactive state : Sniff moée, hold mode and parked mode. 8 What is ZigBee ? List its features. ‘Ans. : ¢ ZigBee is an open, global, packet-based protocol designed to provide an easy-to-use architecture for secure, reliable, low power wireless networks. Flow or process control equipment can be place axywhere end still communicate with the rest of the system. It ea also be moved, since the network doesn't care about-the physical location of sensor, pump or valve, Features - rersvehastic addressing : A device is assigned a random’ address and Emnuunced. Mechanism for address conflict resohnion. Parens node don't need to maintain assigned address table. 2. Link management : Each node maintains quality of links to neighbors. Link quality is used as link cost in routing. 3. Frequency agility : Nodes experience interference report to channel ‘manager, which then selects another channcl. “A Gulde for Engineering Students COD 7 Gale for Engineering Soden: 8 Communication Protacols and JoT Challenges mma tig 88 eerie tk + ath vote ba tent cami power and | Sensitivity. Paths may be asymmetric. . power management : Routers and covrdinafors use main power, End davies use batteries. a9 Explain the functions of ZigBee coordinator. «Function of ZigBee coordinator : 1. It forms a network. 2. it establishes the -802.15.4 chanel on which the network will operate. 45, Ik esablishes the extended and short PAN ID for the network. 4 decides on the stack profile to use (compile or nin-time option) 5, It acts as the trust center for secure applications and networks 6 1 tt acts as the arbiter for End-Device-Bind (a commissioning option). It acts as a router for mesh routing. 8, It acts as the top of the tree, if tree routing enabled. Q.40 Explain the following with ZigBee network ? 1. Forming 2 Network 2. Joining a Network 3. Network Communication ‘Ans.: 1, Forming a Network ‘¢ The coordinator initiates network formation. « After forming the network, the coordinator can function as a router and can accept requests fom other devices wishing to join the network. 2 ‘© Depending ‘on the stack and application profile used, the coordinator right also perform additional duties after network formation. 2. Joining a Network +A device finds a network by scanning channels. © When a device finds a network with the correct stack profile that is ‘open to joining, it can request to join that network. * A device sends its join request to one of the network's router nodes and the device receiving the request can then use the callback to accept the request or deny it. Internet of Things 3-9 Comiunication Protocols an 107 Cag gs Inter oft 3, Network Communication +All nodes that communicate on a network transit and 1 the same channel, or frequency. “se * ZigBee uses a Personal Area Nework Mentifer (PAN 1D) « 5. Ui idenify a netvork ths provides a way fortwo newer to son the same channel while still maintaining separate taffic flow. REP Q.A1 Write short note on ZigBee-AODV. a ‘Ans. + Another routing protocol in ZigBee is a route discovery pec 7 similar to Ad-hoc On-demand Distance Vector Routing. * AODY jis a reactive protoccl, ie, the network stays silest uti y connection is requested. If a node wants to communicate with sno 3 fone, it broadcasts a request to its neighbors who re-rcute the mee; and safeguard the node from which they received the 7 ‘+ If a node receives a message and it has an emuy comesending to estination in its routing table, it renums a RREP chough everse-path to the requesting node. So, the source sends its dra through this path to the destination with the minimum munber of hops. ‘+ In ZAODY, when a node desires to send data to another node withs: ‘having the related routing information, it buffers the data and then initiates a route discovery process to find the optimal path for the destination: 1, Routing Table (RT) 2. Route Discovery Table (RDT) 3, Route Request Command Frame (RREQ) 4. Route Reply Command Frame (RREP) 4s'The ZigBee routing algorithm uses a path cost metic for rout comparison during route discovery and maintenance. RREQ 1, The source node broadcasts a route request (RREQ) packet 2, Ifa intermediate router receives an new RREQ, it add RDT ext rebroadcast the RREQ. “A Guide for Engineering Suen “A Guide or Engineering Ses Intemet of Things _ 3-10 __Communteation Protocols and loT Challenges 3. Ifa intermediate router receives an old RREQ. it shall compare the Forward Cost in the RREQ to the one stored in the RDT entry. If the Cost is less, the router shall update the RDT entry and “" rebroadcast the RREQ again. 5. Using Source Address and Route Request ID, the RREQ can be uniquely identified. RREP 1. The destination node receives the RREQ, it responds by unicasting a route reply (REP) packet to its neighbor from which it received the RREQ. 2, The destina:ion will choose the routing path with the lowest cost and then send a route reply. 3. Finally, when the RREP reaches the originator, the route discovery process is finished. « ZAODV can effegtively reduce the transmission delay. However, the procedure of flooding RREQ wastes significant amount of bandwidth, memory and device energy, and might cause a "broadcast storm" problem. 2.12 What is use of APS layer in ZigBee ? ‘Ans. : « Application Support Sublayer (APS) is responsible for : 1. “Binding tables 2. Message forwarding between bound devices 3. Group address definition and management 4, Address’ mapping from 64-bit extended addresses to 16-bit NWK addresses 5. Fragmeation and reassembly of packets 6. Reliable data transport. «The key to interfacing devices at the need/service level is the concept of binding. Binding tables are kept by the coordinator and all routers in the network. The binding table maps a source address and source endpoint to one or more destination addresses and endpoints. The cluster ID for a bound set of devices will be the same. Internet of Things 3-11 __ Communication Protocols and IoT Challenges * APS layer is responsible for providing a data service to the application and ZigBee device profiles. It also provides 2 management service to ‘maintain binding links and the storage of the binding table itself. * ZigBee's security services include methods for key establishment and transport, device management, and frame protection, The ZigBee specification detines security for the MAC, network and APS layers Security for applications is typically provided through Application Profiles. ‘* The APS layer allows frame security to be based on link keys or the network key. Encryption can be applied at three different levels, the MAC layer, Network layer and the Application Support (APS) layer. A ZigBee frame will contain fields from all of these layers encapsulated within oné another, and each later can encrypt its data payload. © The APS layer is also responsible for providing applications and the ‘ZDO with key establishment, key wansport, and device mmagement services. Fig. Q.I2.1 shows Zighee frame with senuity on the APS level. Application of securty sute adés auxitary Fig. 0.12.4 Zigbee frame with security on the APS level The APS sublayer is key establishment services provide the mechanism by which a ZigBee device may derive a shared’secret Key, with another ZigBee device. Key ostablishment involves two entities, an initiator device and a responder device, and is prefaced by a tust-provisioning step. Guide for Engineering Sudenss “A Guide for Engineering Students Insane ofTigge "8:28 _Coimuntaton Protos nd te Chatenge .4 IP Based Protocol —_ 2.13 Draw and explain in detail IPv4 header format. Ans. © The IP datagram consists of a header followed ty 1 number‘of bytes of data. Fig. Q.13.1 shows header format of IPv4. All v4 packers use the 20 bytes header. we Lae] | ee er Sos catia Foret ass Destinaton adéress (32 bits) Pad (arabia lengthy Fig. 0.13.1 : iPv4 header format ‘* Version field indicates the version of IP used to build the header. (Current version is 4. + Meader Length indicates the length of the IP header in 32 bits words This field allows IPv4 to use options if required, but as it is encoded as 3 4 bits field, the IPv4 header cannot be longer than 64 bytes. © Type of service : The service type is an indication of the quality of service requested for this IP datagram. + Protocol field indicates the transport layer protocol that must process the packet's payload at the destination. Common values for this field are 6 for TCP and 17 for UDP. “A Gilde for Engineering Suadents os Internet of Things -13_ Communication Protocols and ta tof Things 3-9 MIT Cans * Length field indicates the total length of the entire IPv4 packer and payload) in bytes. This implies that an IPv4 packer longer than 65535 bytes. * Fragment offset is used to reassemble the full datagram. Toe yy, this field contains the number of 64-bit segments (header bytes counted) contained in earlier fragments. If this is the frst ( fragment, this field contains a value of zero. + Flags @ bits) : Only two of the bits are curently defined : 4 Fragments) and DF (Don't Fragment). ‘+ More Fragments (ME) flag is a single bit in the Flag field wet the Fragment Offset for the fragmentation and reconsmuction The More Fragments flag bit is set, it means that it is x fragment of a packet. When a receiving host sees a packer =: the MF = 1, it examines the Fragment Offset to see where is to be placed in the reconstructed packet. When 2 rex receives a frame with the MF = 0 and a non-zero value " offset, it places that fragment as the last part of the recensn= packet, cag, + Don't Fragment (DF) flag is 2 single bit in the Flag that fragmentation of the packet is not allowed. If the Dea: Faz flag bit is set, then fragmentation of this packet is NOT pemmizsi router needs to fragment a packet to allow it to be passed downs the Data Link layer but the DF bit is set to 1, then the ror discard this packet. + Time-To-Live (TTL) is an S-bit binsy remaining "Ii fone each time the packet is processed by a router (that is, ext When the value becomes zero, the router discards or drops te put and itis removed from the nenwork data flow. * Source address field that contains the IPv4 address of the source * Destination address field that contains the [Pvt address of destination host. “A Guide for Enginerng Sole patemet of Things ___ 3214 _ Communication Protocols and et eters. "checksum that protests only the [Pvt header against transmission crs. Checksum is for the information contained in the header. If the fender checksum does not match the contents, the datagram is discarded. . « Options (variable) : Encodes the options requested by the sending user. «sPadding (variable) : Used to ensure that the datagram header is a multiple of 32 bits « Data (variable) : The data field must be an integer multiple of 8 bits. ‘The maximum length of the datagram (data field plus header) is 65,535 octets. Q.14 What do you mean private and public address ? . ‘Ans. + « IPv4 addresses are further classified as either public or private. Public IP addresses are ones that are exposed to the Intemet, Any other computers on the Intemet can potentially communicate with them. « Private IP addresses are hidden from the Intemet and ariy other networks. They are usually behind an IP proxy or firewall device. + Private addresses'are as follows Class Starting address End of range Class A 10.0.0.0 + 10.255.255.285 Class B 172.16.0.0 172.331.255.255. Class Co 192.168.0.0 192.168.255.255 Q.15)Compare IPv4 and IPv6. Iv 21. | Header size is 32,bits, 1k cannot support autoconfiguratios Q.46 Explain IPV6 address space and transmission modes. EB [SPPU s May-19, End Sem, Marks 8) ‘Aas. : + IPV6 allows three types of addresses : Unicast, Anycast and Multicast. * Unicast : An identifier for a single interface, A packet sent to 2 unicast address is delivered to the interface identified by that address. ‘ Anyeast : An identifier for a set of interfaces. A packet sent to an anycast address is delivered to one of the interfaces identified by the address. ‘* Multicast : An identifier. for a set of interfaces. A packet sent to = multicast address is delivered to all interfaces identified by that address. ‘The first field of any IPV6 address is the variable - length format prefix, which identifies various categories of address. + IPv6 is multicasting, which provides efficient network operations. * IPv6 addresses are 128 bits in length, Addresses are assigned to individual interface on nodes, not tothe node themselves. ‘s IPv6 addresses are assigned to interfaces, rather than to nodes, in recognition that a node can have more than one interface. A single interface may have multiple unique unicast addresses. The first field of any IPv6 address is. the variable length format prefix, which identifies various categories of addresses. Guide for Engineering Stes A ule for Engineering Staden's : ‘ommunication Protocols and ToT Chat, Internet of Things 3-16 Communication Protocols and IoT Chailenges Internet of Things eat cs Merges . low label : It is 24 bits field that is designed to provide spex, + A new notation hus been devised for writing 16-byte addresses. They nar ellis ee |e eae ia are written as eight groups of four Hexadecimal digits with colors Payload length : The 16 bits payload length eld dees =, between the groups, like this a base head 000 : 0000 : 0000 : 0000 : 0123 : 4567 : 89AB : CDEF length of the IP datagram excluding the base header. tn: . 3 : : i * | 5. Next header : It is an 8 bits field defining the header that foton Q.17 Describe IPV6 packet format and compare IPv4 & IPv6 ; the base header in the datgran, pegtere SE_CEPPU, My-29, End Sein, Marks 8] | 6. Hop limit : This 8 bits hop limit field serves the same picpese Ans. : * Fig. Q.17.1 the IPV6 datagram header format. Each packet ig Se crreeaanastied Composed of a mandatory base header followed by the payload, 7. Source address : The source address field is a 128 bits ix | 4bits | 4 bits | 8 bits T 8 bits I 8 bits I ! ‘address that identifies the original. Fiow label Destination address : It is 128 bits Intemet address the: ws: identifies the final destination of the datagram. 7 Q.18 Compare IPy4 and IPV6 headers. Source address ‘Ans. : : Payload length Hop limit Destination address —IPV6 headers | — “Py has a header of 20-60 bytes. IPV6 has header of 40 bytes Sxzt The source and destination Pv Source and destination IPvs adé-ase [addresses are 32 bit binary manbers are 128 bit binary numbers. “hyd header includes space Gor Iba options : Fig. Q.17.1 : IPv6 header Q.19 Write a short note on Goals and header stacks of SLOWPAN. * The payload consists of two parts : Optional and data. EP [SPU : May-29, End Sem. Marts 8] 1. Versions : This 4 bits field defines the version number of the IP. Ans. : Goals : - The value is 6 for IPv6: . ane * Define adaptation (frag/reassembly) layer to match [Pv6 MTU 2. Priority : The 4 bits priority field defines the priority of the Ly Packet with respect to-traffic congestion. * Specify methods to do IPV6 stateless address auto configuration. Gecone A Guide for Engineering Students ecoor 4 Gu te for Engineering Sete Internet of Things 3-18 Communication Protocols and loT Challenges + Specify/use header compression schemes, * Specify implementation considerations and best methods of an IPv6 stack. ‘+ Methods for meshing on LoWPAN below IP. Header Stacks : * SLOWPAN uses ‘stacked headers and analogous to IPv6, extension headers, 6LoWPAN headers define the capability of each sub-header. + Three sub-headers are defined Mesh addressing, fragmentation and header compression, «Fig. Q.19.1 shows 6LoWPAN stacked headers, jeoat4 | WPeHeader | ay Header'| “compression |_| 'P¥0 Payload [502154] pao ee ed ee re 7 ae [ieades [it 98 28 48 Minimal UDP / 6LOWPAN (16-bit addressing) Fig. 0.20.1 Header compression *« Fig. Q.20.1 shows header compression. «The former exploits the fact that some IPV6 header fields (e.g., IDs and datagram length) are derivable from the link layer header and an optimistic expectation that several IPv6 header fields will be set to ‘ypical values. ‘© The latter requires 6LOWPAN nodes to share context that allows to substitute address prefixes or complete addresses by a short identifier. * Subsequently, GLOWPAN HC has served as the basis for header compression over the 6Lo technologies. 6LoWPAN HC has needed some tailoring to the specific characteristics of cach technology, with the exception of IEEE 1901.2, which does not need any changes; since it endorses, the IEEE 802.15.4 MAC frame and address formats, \ 28 \pplication Layer Protocols Protocol (CoAP) is a specialized web constrained nodes and constrained (c.g, ‘A Guide for Engineering Students os” Internet of Things __3-21 __ Communication Protocols and loT Chat, * CoAP is designed for simplicity, low overhead and multicast suppen . resource-constrained environments. = CoAP is a web protocol that runs over the UDP for IoT. Daag, ‘Transport Layer Security (DTLS) is used to protect CoAP transmissic # The protocol is designed for Machine-To-Machine (M2M) applica. such as smart energy and building automation. = CoAP provides a request / response interaction model beryee application endpoints, supports built-in discovery of services includes key concepts of the Web such as URIs x to casily interface with 1g specialized re for integration with ts such as multicast soz, strained environments Il low power sensors, sit ed t0 be controlled or suzenis rotocol that is intended for we s, such as Wireless Sensory Nex resource-const (WSN) nodes, The key features of CoAP CoAP is a RESTful Get, Put, Post and Delete : Confirmable, Non-Confirmabls, ack), A Guide for Engine met of Things 3? eee naertt pisadvantages * » Consraints associated with DTLS. ‘vo standardized framework for authorization and access control. for CoAP exists as of now. No explicit support for real-time IoT application at present. 97% Define MQTT ? Esplain MQTT characteristics. ‘Ans: + Message Queue Telemetry Transport (MQTT) is Open Connectivity for Mobile, M2M and IoT. MQIT is designed for high latency, tow-bandwidth or unreliable networks. ‘The design principle minimizes the network bandwidth and device resource requirements. @MQTT is @ lightweight broker-based publish / subscribe messaging protocol designed to be open, simple, lightweight and easy to implement. MATT characteristics 1, Ligatweight message queueing and transport protocol, 2. Asynchronous communication model with messages (events), 3. Low overhead (@ bytes header) for low network ‘bandwidth applications. 4. Publish / Subscribe (PubSub) model. 5, Decoupling of data producer (publisher) and data consumer (Subscriber) through topics (message queues). 6. Simple protocol, aimed at low complexity, low power and low footprint implementations. 7. Rurs on connection-oriented transport (TCP). 8. MQTT caters for (wireless) network disruptions. 2.24 Explain MQTT publish/subscribe framework. Ans. : © Fig. Q24.1 shows MQTT publish / subscribe framework. + A producer publishes a message (publication) on a topic (subject). A consumer subscribes (makes 2 subscription) for messages on a topic (subject). internet of ihings «3-23 Communication Protocols and IoT Challenges Puncher Fig. @.24.1 MQTT publish/subscribe framework © A message server (called BROKER) matches publications to subscriptions. If none of them match the message is discarded after modifjing the topic. If one or more matches the message is delivered to each matching consumer after modifying the topic. The MQTT messages are delivered asynchronously (*push") through publish subscribe architecture. * The MQTT protocol works by exchanging 2 series of MQIT control packets in a defined way. # Each control packet has a specific purpose and every bit in the packet is carefully crafted to reduce the data transmized over the network. © A MQIT topology has 2 MQIT server and a MQIT client. MQTT client and server communicate through different control packets. Table below briefly describes each of these control packets. ‘A Guide for Engineering Students “A Guide for Engineering Sodenss Internet of Things 3-24 Communication Protocols and loT Challenget *MQTT control packet headers are Kept as small as possible, Each MQIT control packet consist of three parts, a fixed header, variable header and payload, + Each MQTT control packet has a 2 byte fixed header. Not all the control packet have the variable headers and payload. ‘+ A variable header contains the packet identifier if used by the control Packet. A payload up to 256 MB could be attached in the packets. ‘¢ Having a small header overhead makes this protocol appropriate for IoT. by lowering the amount of data transmitted over constrained networks. 2.25 Explain the difference between CoAP and MQTT. leret of Things 1-25 __ Communication Protocots and ioT Cra, © 9.26 What Is AMQP ? Explain architecture of AMQP. . Ans: * Advanced Message Queuing Protocol (AMQP) is « ,, layer protocol for message-oriented middleware environments an open protocol for asynchronous message queuing + AMOP is an open standard, binary application layer protocatda for message-oriented middleware ic, AMQP protocol sass. messaging using Producers, Brokers and Consumers and increases loose coupling and scalability. esa, * A protocol to communicate between clients and messaging mide servers (brokers). The broker is the AMQP Server. ‘* AMQP supports both publish-subscribe model and ‘communication, routing and queuing. * AMQP divides the brokering task derween exchanges and Queues, where the first is a router that accepts incoming messas decides which queues to route the messages 10, and the mesa stores messages and sends them to message consum= ‘+ AMOP supports username and password authentication as wel authorization. It also suppons TLS encryption: Fig Q2: AMQP architecture. Fig, Q.26.1 AMQP architecture + Exchange : Receives messages from publisher primarily based poz? and routes them to message queues. : as 7 Guide for Englaetrng Suen, A Guide for Enginering Be internet of TINS —_— = a Message ‘a the eating client software, + Binding queue + Stores messages until they may thoroughly. process { States the contiection between the message queue and the ‘change. : 3.6 : Wireless Medium Access Issue ‘attributes are consider while designing good MAC protocol for WSN ? Ans. networks, the following attributes must be considered 1 + To design 2 good MAC protocol for the wireless sensor The first attribute is the energy efficiency, We have to define energy efficient protocols in order.to prolong the network lifetime. Other important attributés are scalability and adaptability. to changes. Changes in network size, node density “and topology should be handled rapidly and effectively for a successful adaptation. A good MAC protocol should gracefully accommodate such network changes. Other typical important attributes such as latency, throughput and bandwidth utilization may be secondary in sensor networks. (925 What do you mean routing protocols ? Explain basic classification of routing protoccl. Ans. ‘© The routing protocols define how nodes will communicate with each other and how the information will be disseminated through the network. The basic classification of routing protocols is shown in Fig. Q28.1. 1. Node centric : In node centric protocols the destination node is specified with some numeric identifiers and this is not expected type of communication in Wireless sensor networks. LEACH is a routing protocol that organizes the cluster such that the energy is equally divided in all the sensor nodes in the network. 2. In data centric routing the sink node queries 10 specific regions to collect data of some specific characteristics so naming scheme based on attributes is necessary to describe the characteristics of data eT perrng Stents “A Gude for Engh Internet of Things 3-27 Communication Pro! WSN Rng pctecoss o——_—.,——, Node centric 0: : outing protocol eng BE Semariees| Eeeecrane] Fig. 0.28.1 3. Source-initiated : In these types of protocols tte source code advertises when it has data to share and then the rate is gocaed from the source side to the destination. Examples is SPDN. 4, Destination-initiated : Protocols are called desizatice citaed protocols when the path seup generation crigmess Som destination node. Examples are Directed Diffusion (DD) xd LEAC (229/Bbun seer ante tpnymet ‘Ans. © Depending on the application requivemests, sensor deployment can be either random or deterministic, © Random deployment is normally adopted in large “where the sensor nodes are scattered randomly For instance, sensors can be dropped ftom an aiphine to a noe =e hard-o-access area. « Random deployment is more applicable in dangerous and saccesibie _ environments, Deterministic deployment is commonly adopted ip scl © medium-scale applications, where the number and pesiten of the sensor nodes can be predetermined in advance. The sensors can be ccployct either manually or by robots, A regular and symmenis eploymentiplacement patter is usually adopeed i= such epleyent methods. fe Deterministic deployment is suitable tuman-fiendly environments. comelled 2x4 cay Internet of Things 3-28 Communication Protocols and loT Challenges G30 Write short note on data aggregation and dissemination. a ‘Ans: 6 ns. : + In the eviergy-constrained sensor network environments, it is Uasuitable in numerous aspects of battery power, processing ability, storage capacity and communication bandwidth, for each node to transmit data to the sink node. * To avoid the above mentioned problems, data aggregation techniques hhave been invoduced. Data aggregation is the process of integrating multiple copies of information into one copy, which is effective and able to meet user needs in middle sensor nodes. ‘+ The introduction of data aggregation benefits both from saving energy and obtaining accurate information. The energy consumed in transmitting data is much greater than that in processing data in sensor networks. «Therefore, with the node's local computing and storage capacity, data aggregating operations are made to remove large quantities of redundant information, so as to minimize the amount of transmission and save energy. As a resuk, monitoring the data of the same object requires the collaborative work of multiple sensors which effectively improves the accuracy and the reliability of the information obtained. «The performance of date aggregation protocol is closely related 10 the network topology. It is then possible to anslyze some data aggregation protocols according to star, tee, and chain network topologies us seen in Fig. Q.30.1. @ O-o--2 ® (a) Star WSN topology (oy Trae WEN topology {6) Chain WSN topology Fig. Q.30.1 Data aggregation is any process in which information is gathered and expressed in a summary form for purposes such as statistical analysis Gate for Englucertng Stabs Internet of Things 3-29 ‘Aggregated data is normally found ins data warchowe. 1 hhodes can also eliminate redundancies in the daa neighboring nodes before transferring the final data package «* Data agaregation technology could save energy and improv while sacrificing performance in other areas. On one process, looking for aggteezting arrival of accuracy, the data transfer aggregation operations and waiting for likely to increase in the average latency of the network “¢ On the other hand, compared to conventional networks. sexs: have higher data loss rates. Data aggregation could sign data redundancy but lose more information the robustness of the sensor network. Communteation Protocols and foT Craig loT Platform and its Programming Internet of Things 4-2 IoT Platform and its Programming avoiding the microcontroller from the damage. Additionally, some of the pins of an Arduino include specific functions. Arduino Pin Description e comes with built-in, LED connected though pin 13. “| UGH LOW vatue tothe pis will tum it ON/OFF 4.1 : Introduction to Arduino G4 What is an Arduino ? Explain its feature, Ans.: © Arduino is an open-source clectronies platform based on easy-to-use hardware and software. « Arduino boards are able to read inputs - light on a sensor, a finger on a button, or a Twitter message and tum it into ah output - activating a ‘motor, turning on an LED, publishing something online. * The Arduino Uno can be powered vie 1 external power supply. The power source is selected automatically USB connection or with an Features : ¢ Support fast computations, ARM based MCU © AVR micro-controller clock is ATSAMSX8I © Operating input voltages is 3.3 Volt «It uses EEPROM, SRAM and Flash memory © It also support USB and UART 2 Briefly discuss pin of Arduino, ‘Ans. : + The pins on the Arduino can he configured as either inputs or outputs, Uno R3 includes 14-digital pins which can be used as an input otherwise output by using the functions like pin Mode (), digital Read(), and digital Write(. These pins can operate with SV, and every digital pin can give or receive 20mA, and includes a 20k to 50k ohm pull up resistor, The maximum current on any pin is 40mA which cannot surpass for Tis a3V input / supply voltage pin tthe Arduino Board ‘rough @ USB port, USB (SV), Vin (7V to 20¥) pin, or DC. power jacicare the 3 ays to provide the. ou 16 Mere voltage provided damages the board. ND. Ground pins. ‘Used to the program running on the boerd. is (35,6910, 11) is provided by PWM which provi “| ouput PWM. SPL Ieis kiowm as Serial Peripheral Taterface." es Four pins 10(S8), 11(MOSI), 120MISO), 13(SCX) provide SPI ese communication withthe help of SPI brary “Analog Reference (AREF) pin is used fot providing . voltage-to the anslog inputs. TW ‘Ad, AS pins are used for Two-Wire Interface (TW). TW communication is accessed throvgh wite library. | used of serial commbnication, Re tis used to receive data. 4.2 : Raspberry Pi Q.3 What is Raspberry Pi? ‘Ams, : Raspberry Pi is the name of a series of single-board computers made by the Raspberry Pi Foundation. The original Pi had a: single core eo “A Guide for Engineering Sudents =e Internet of Things 4-3 ToT Platform and its Programming 700 MHz CPU and just 256 MB RAM, and the latest model has a quad-core 1.4 GHz CPU with | GB RAM. Q4 What are the different Raspberry Pi model types ? ‘Ans. = The Raspberry Pi models are of two types 1. Model A (introduced later as a hardware-reduced model) 2. Model B (Introduced first and is the full hardware model} QS Describe features of Raspberry Pi board. Ani i 1 Features of Raspberry Pi board (Model B - 2 Version) : 7 Second generation Raspberry Pi has an upgraded Broadcom BCM2836_ processor, which is a powerful ARM Cortx-A7_ based Guad-core processor that runs at 900 MHz. The board also features an increase in memory capacity to 1 GB. 2. Ethemet port 3. ‘Two USB pons : ‘Two video output options : HDMI or composite $. 3.5 mm audio output jack 26-pin GPIO header with 0.1" spaced male pins that are compatible with our 2x13 ‘stackable female headers and the female ends of our ‘Premium jumper wires. . 7. Display Serial Interface (DSI) 15 way flat flex cable connector with ‘two data lanes and a clock lane. Q6 How is Raspberry Pi is different from a desktop computer ? Ams": + In Raspberry Pi, operating system is installed on SD card whereas in desktop computer, operating system is installed in hard disk. # Raspberry Pi does not have their own CPU and RAM. + Processing power of Raspberry Pi is lea ax compared. to desktop computers. ‘* Raspberry Pi uses less power than desktop computers. A Gulte for Engineering Students | B IoT Platform and its Programmi Internet of Things 4-4 arming 7 Explain difference between Model A and Model B of Raspbern, ri. Ans. : Difference between Model A and Model B of Raspberry P; Parameters Model A Model B 1 GPU wpe VideoCore IV VideoCore1¥ | USB port a z Menon | 256 MB save Ethernet port | No Ethernet port 10/100 SoC Type | Broadcom BCM263700 | _ Broadcom BOMDESTED Number OF 4 z ] Cores | ‘Type Ik is hardware-reduced model | Tris full bardware moa] Q.8 What is Raspberry Pi ? Explain about its versions and varioas interfaces in detail. EGP [SPPU : May-t9, End Sem, Ans: © A Raspbemy Pi is a credit card-sized compu: designed for education, inspired by the 1981, BBC Micro. ‘* Creator Eben Upton's goal was to create a low-cost device improve programming skills and hardware understands pre-university level, * The Raspberry Pi is slower than a modem laptop or desktop but is st complete Linux computer and can provide all the expect that implies, at a low-power consumption level. Versions Remarks | Raspberry Pil |e The original Raspbery Pi bad 256 MB of RAM, wii {increased to $12 MB in a later revision. o It has a 26-way GPIO connector. Pi Zero +. The Pi Zero includes the GPIO connect, but the bese pins are not soldered. Raspberry Pi? Je The Raspbemy Pi 2 swapped the single-core procesor & much faster quad-core processor and increased “| memory to 1 GB RAM. 1 Guide for Engincering Sader nteret of Tings 4-5 Iof Platform and its Programming Raspoery Pi3. |e The Raspberry Pi 3 changes the processor to an even more powerful 64-bit processor. It also adds Wi-Fi and bluetooth which previously needed! to be added as a USB device Je The Raspberry Pi 3 Model B was launched in February 2016 © To get the Raspberry Pi working an SD card needs to be prepared with the Linux operating system installed. Raspbemy Pi users have made meny creative and impressive projects using this device. It can also be programmed to assist in ‘housekeeping! your network by functioning as NAS, LDAP server, web server, media server, DNS server ete. ‘The Raspberry Pi Foundation recommends Python. Any language which will compile for ARMv6 can be used. It installed by default on the Raspberry Pi: C, C++, Java, Scratch and Ruby. 9 Draw and explain Raspberry Pi block diagram and its components. Sa [SPPU : May-29, End Sem, Marks 8) Fig. 0.9.1 Block diagram ~ Ans. : Fig. Q9.1 shows the Raspberry Pi board. cree ooo WT Gnefor Brgmeerng Sasori Intemet of Things 4-6 IoT Platform and its Programming ©The Raspberry Pi does not have a separate CPU, RAM or GPU. Instead they are all squeezed into one component called a system on chip or SoC unit. © Respberry Pi is open hardware with the, exception of its primary chip, the Broadcomm SoC which runs the main components of the board - CPU, graphics, memory, USB controller ete. « All of these Raspberry Pi models share the following features : 1. Operating systems : Raspbin RaspBMC, Arch Linux, Rise OS, Open ELEC Pidora 2, Video output : HDMI Composite RCA 3. Supported resolutions : 640x350 to 1920x1200, including 1080p, PAL and NTSC standards 4. Power source : Micro USB ‘Components Description Processor | Raspberry Pi uses an ARM processor which is also installed in a wide variety of mobile phones. Je This CPU is single core, however “it does bave | corprocessor to perform floating point calculations. Memory Je. Model B Raspberry Pi has $12 MB SDRAM (Synchronots| Dynamic RAM). |+ It store programs that are currently being run in the CPU. USB ports Je Board has two USB ports. USB port can provide a current ‘upto 100 ma. jo Using powered hub, itis possible to connect more devices. HDMI Output |» High Definition Multimedia Interface (HDMI) supports high-qiality digit video and audio through a single cable. }¢ It is also possible to connect a computer monitor with a DV1| connection to HDMI using @ converter. Composite |e It support composite video output with RCA jack and also| ‘Video Output | support PAL and NTSC. fi . 1 Guldefor Engineering Suderes wy Internet of Things a7 ToT Platform and its Programming Js The TVDAC pin can be used to output compo: video Audio Ouput |» Audio output jack is 3.5 mm. This Jack is used for providing sudio output to, old| television along with the RCA jack for video Both models have a total of 26 GPIO pins, organized into fone pin header, named the Pl header oPI0 Pins | ‘* The newer Raspbemy Pi adds 8 more GPIO pins in a new| pin header called PS ‘Not all the GPIO pins are programmable, Some of them are 5.0 VDC or 3.3 VDC positive power pins, some of them are negative ground pins and a few of them are marked DNC (€o not connect). i ‘The PI header has'17 programmable pins and the PS header adds 4 more. Reading from various environmental sensors. Writing output to de motors, LEDs for status. Power Input |e Micro-USB connector is used for power input. ‘Status LED |e It has five status LED. cst /* Camera Serial Interface (CSI) can be wsed to connect a camera module to Raspberry: Pi. SD Card Slot Je This card is used for loading operating system. Q.10 What is the use of GPIO pins ? Ans. : + The Raspberry Pi comes with a set of 26 exposed vertical pins on the board. These pins are a General Purpose Input/Output(GP10) interface that is purposely not linked to any specific native function on the Raspberry Pi board. * Instead, the GPIO pins are there explicitly for the end user to have low-level hardware access directly to the board for the purposes of attaching other hardware boards, peripherals, LCD display screens and other hardware devices to the Pi. ‘A Gulde for Engineering Suctents Intemet of Things 4-8 Io} Platform and ts Programm, © The Raspberry Pi draws its power from a microUSB port and re nicro USB to AC adapter, Because the Pi is @ micro computer ans, simply a cell phone getting a battery topped off, you need to we as suality charger with stable power delivery that provides a consitens V with at least 700 mA minimum output for older model units ans > A for the Pi 3. 4.3 : Raspberry Pi Interface Q.11 Write short note on GPIO of Raspberry Pi. Ams. * GPIO stands for General Purpose InpuyOutput (GPIO) can te input, an output or operate as a serial port Tx data line, The Pi allow you to interface the Pi to the real world. ‘+ Raspberry Pi is a 40-pin expansion header. The pins are mu 1 to 40, with the even numbers on the outside edge of the bo shown below. hires ¢ + There are 4 different types of GPIO pins on the Raspberry Pi three may be used as GPIO or special purposes. 1. Green : These are generic GPIO pins without a special 2. Blue : These pins may operate as GPIO or used as an I2C bus 3. Orange : These pins may operate as GPIO or used for UAR 4. Purple : These pins may operate as GPIO or used as an SPI bss ‘+ In total there are 24 GPIO ports. Although any GPIO pins may be when possible the green pins should be used first. * There are several different types of pins in the expansion header 1. Light Red : Connected to the Pi's $V ‘rail, provides 2 conse: +5.0V, 2, Dark Red : Connected to the Pi’s 3.3 V rail, provides a co +33V. 3. Black : Connected to the Pi's ground, provides a consistent OY. 4. Yellow : 12C bus dedicated to expansion boards “A Guide for Engineering SH Intemet of Things ‘“ Ent __Name_ 01 33v0C Power a aero | TS eT Son SoHE] oe ZT POUGFD.-SET| OO | —w e-—# vs =e = ne sO (x00) PIONS 10 Lit chow ere ce @@ [ero cennerow ae 13 GPCR (GFIO. GEN2) | @ gy SSPE GFO. EN] OG | arose 37 3.3V DC Power i Tar eroinren meas —] SS Fre a = = Tx son erin | 88 | aor [Boer | OS | amen a : $8 eee a gor = een 83 Seren 29 ous ‘37 GPIO26 ook (GrIOz0 3 |______Srigaa 3s Bo ‘eiozt 40 Fig. Q.11.1 GPIO pin diagram « All the remaining pins are known ss the General Purpose Input/Output (GPIO). The GPIO is a generic pin on a circuit whose behaviour, including whether it is an input or output, may be controlled by the user at iunstime, ‘+ The GPIO pins are connected to the +3.3 V rails. When used for input they are able to read vcltages. When used for output they may be set 10 =3.3V (high) er 0 V Cow), GPIO in Python : © The easiest way to control the GPIO pins is using the RPi.GPIO Python library. Installing the litrary is easy if you follow RPi.GPIO installation guide. Once installed using the pins is as easy as import RPi.GPIO as GPIO # Use GPIO numbers not pin numbers GPIO.setmode(GPIO.BCM) Internet of Things # sat up the GPIO channels - one GPIO.setup(7, GPIO.IN) GPIO.setupl@, GPIO.OT) # input from GPIO7 input_value = GPIO.inputt7) # output to GPIO8 OPIO.output(@, Tre) . @ In this example we use GPIO7 (pin 26) ard GPI08 (pin 24) 42 What is GND ia GPIO ? © GND means ground pits. Ground GPIO pins ae i 0, 344 and 39. Ans. numbers 6, 9, 14, 20, Q.43 Define Raspberry Pi hardware. ; ‘Ans. : Raspberry Pi hardware includes ARM processor, GPU, RAM at USB por. ats What i ase of SPI and I2C iserfcss 02 Raspberry #7 ‘Ans. : Three types of interface is supported by Raspberry PL 41, Serial 4 It uses serial peripherals for serial commumication. 1s Transmit (Tx) and Receive (Rx) pis is used the secial communication 2. Serial Peripheral Interface (S?1) ‘SPI is a communication proweol used wo mansfir Gem bere rmicro-computers like the Raspberry Pt and peripheral devices, These peripheral devices may be either sensors or actuators. 4 SBI uses 4 separate connections to communicate with the target device. ‘These connections are the serial Clock (CLK), Master Inpet Slave Ourpur (MISO), Master Ourpet Slave Teper (MOSD) and Chip Seiect 8). (A Gulde for Engineering Studenss “A Guide for Engineering Students Intemet of Things 4-11 16T Platform andits Programming * Te clock pin sense pulses at a regular frequency, the speed at which ‘the Raspberry Pi and SPI device agree to transfer data to each other, * Fer the ADC, clock pulses are sampled on their rising edge, on the ‘emsition from low to high, 3 The MISO pin is a-data pin used for the masier to receive data from ‘the ADC, Data is read from the bus after every clock pulse, {* The MOST pin sends data ffom the Raspbemy Pi to the ADC. The ADC ‘will take the value of the bus on the rising edge of the clock. This ‘means the value must be set before the clock is pulsed. * The chip select line chooses which particular SPI device is in we. If {here are multiple SPI devices, they can all share the same CLK, MOS and MISO. 3. 12c * BC is « communication protocol thatthe Raspberry Pi can use to speak fen, Cmbedded devices (temperature sensors, displays, accelerometers, ete). * RC is a useful bus that allows data exchange between microcontrollers and peripherals with a minimum of wiring. * RC is a two wire bus, the connections aie called SDA (Setial Data) and SCL (Serial Clock). Each I2C bus has’ one or more misters (Respbemy Pi) and one or more slave devices; lke the VO Expander, * As the same data and clock lines are shared between multiple slaves, We need some way to choose which device tv vommunleate with. Q.18 Describe features of SPI. Ans. :_ ¢ The SPI has the following features : 1, 16-bit shift register 2. I6-bit Receive buffer register (SPIBUF) and 16-bit Receive buffer emulation alias register (SPIEMU) 3, 16-bit Transmit data register (SPIDATO) and 16-bit Trassmit data and format selection register (SPIDAT1) 4. 8-bit baud clock generator 4:12 __IoT Platform and is Prop Internet of Things ee 5, Serial clock (SPICLK) VO pin 6. Slave in, master out (SPISIMO} VO pin 7, Slave out, master in (SPISOMD) V/O pin me 8, Multiple slave chip select (SPISCS{A)) VO pins (& pin mode gy, 9, Programmable SPI clock ffequeney range 10, Programmable character length (2 to 16 bits) 11. Programmable clock phase (delay or no delay) 12,Prograramable clock polarity (sigh or low) 3 capabilt TDMA ripper (ete sutton vet) 15. Up to 66 MHz operation introduction to Python Program with Raspberry Q.46 How Raspberry Pi controls LED ? of connecting LED to Raster ‘Ans. : Fig. Q.16.1 shows diagmm of sing ony ‘The LED will initially be off because the GPIO pins are initsiae inputs at power-on, ry i Fig. Q.16.1 Diagram of connecting LED to raspbet") ‘A Guide for Engincering Students mae A Gide for Ene i Internet of Things Jo orn ed its Programme « Install Python 2 Nbrary RpiGPIO. A library tat will ie : 88 control the GPIC pins. Instatl commands sude spt?get update sudo apt?get instail python?dev sudo apt?get install python?rpi.gpio ¢ Simple LED circuit is shown below : r i Yoo 33Y— am Anode = Cathode 2002S sro pn —! ©), Fig, 0.16.2 oC a ra Celot tt ft fic. r ealealoadlen = Saba Fig. 0.48.3 © Current flows from the anode (+) to cathode (-}. Anode is longer pin and cathode is shorter pin. . © Open up IDLE, the Python programming software end ereate a New file, Save it as led:py. and input the code from che code listing. What the code does is first tell Python to use the GPIO module so we can connect to the GPO pins, by importing the moduie, Intemet of Things 4-14 oT Platform and its Programming @ We then import the time module so we can create 2 delay between commands, We then tell the code to treat the GPIO pins as tb they are on the board and to tum the seventh pin into an output number + We altemate between True and False so that it turns the pin on and off Once its cycled a few times, it will print the message ‘Done’ into IDLE and finally tum off the GPIO pins. Import RPI.GPIO as GPIO Import time GP1O.setmode(GPIO.BOARD) GPI0.setup(7, GPIO.OUT) GPIO.output(7,True) time.sleop(1) GPIO.output(7,False) time.sloop(t) GPIO.output(7,True) time.sleop(t) GPIO.output(7.False) print’Done” GPIO.cleanup) Task 1: - ‘Tum LED on for 2 seconds and off for 1 secend, loop forever. Code is given below : In this example, we use diagram (b), ie. controlling the LED by controlling the voltage at the anode (+). import RPL.GPIO as GPIO import timo : def main( ): GPIO.cleanup() GPIO.setmode(GPIO.BOARD) # to.use Raspberry Pi board pin numbers GPIO.setup(11, GPIO.OUT) . # sot up GPIO output channel A Gvide for Engineering Students "A Guide for Engineering Sten Internet of Things eos er perenne Snloraas of Tetngs 4:16 _1oTPatfor edits Pepin ae “she first-stage bootloader has not yet initialized your ARM ce ‘GPIO.ourput(11, GPIOLaw), the second-stage bootloader also has to run on the GPU (Gy. # set RPI board pit 11 low. Tum off LED. Processing Unit). time.sleep(1) GPIO.curput(11, GPIO.HIGH) # sot RPi board pin 11 high. Tum on LED. tme.sleep(2) main( ) + Example : Display digit on 7-segment LED. It is most direct way to control dispiay : 1. Connect pin 3/8 of 7-seg-LED to Vee 2. Connect the other § pins to § GPIO pins 3. Configure the 8 GPIO pins as out + For example : display "2". Tum.on segments A, B,D, E, G and tum off segments C, F, DP. Set A, B, D, E, G to LOW and set C, F, DP to HIGH. Set Pin 7, 6, 2, 1, 10 LOW and Set pin 4, 9, 5 HIGH Q.17 What is Raspbian OS ? ‘Ans. : Raspbian is a free operating system based on Debian optimized for the Raspberry Pi hardware. «An operating system is the set of basic programs and utilities that make your Raspberry Pi run, ~ ‘+ However, Raspbian provides more than a pure OS, it comes with over 35,000 packages, pre-compiled software bundled in a nice format for easy. installation on your Raspberry Pi. As Raspbian is a Linux operating system it has good security features, has excellent networking capabilities. ‘© Raspbian is. highly. optimized for the low-performance ARM CPUs. Q.18 Explain boot sequence of Raspberry Pi. Raspbemy Pi. line's Ans. : When you power on your Raspberry Pi, the first bits of code to fun is stored in a ROM chip in the SoC and is built into the Pi during manufacturing. This is called the first-stage boot-loader. “A Gulde for Engineering Students + The bootloader.bn file is loaded into the 128K 4 way set associate cache of the GPU and then executed. ‘This enables the RAM mma startelf which is also in your SD Card. «This is the third-stage bootloader and is also the most impor. the firmware for the GPU, meaning it comtains the settings cr case, has instructions to load the settings from configitxt which in the SD Card. ‘© Boot sequence is as follows : 1. At power-up or reset, the ARM CPU is offline. 2.. A small RISC core in the GPU begins to execute SoC Roy (first-stage boot loader) ‘The GPU initializes the SD card hardware. |. The GPU looks at the first FAT32 partition in the SD meta 5. The second-stage boot-loader firmware nam loaded into the GPU. ‘The GPU control passes to the loaded bootcode.bin fimmszr ~ The file startelf is loaded by the GPU into RAM fon card. 8. An additional file, fixup.dat, is used to configure th partition between GPU and ARM CPU. SDR: 9. The file configaxt is examined for configuration peomee = need to be processed. 10. Information found in emdline.tet is presumably also ase! startelf. 11. The GPU allows the ARM CPU to execute the program 12, The module startelf runs on the ARM CPU, with inix about the kemel to be loaded, 13, The kemel is loaded and execution control passes to it Ss _ . A Gee for Engine \ Internet of Things 47 } Q48 Draw diagram and write algorithm and python code to control PP [SPPU + May-19, End Sem, Marks 8] t LED using Raspberry Pi. Ans. + Interfacing of light sensor with Raspberry Pi ‘ Unlike some other devices the Raspberry Pi does not have any analogue inputs. All 17 of its GPIO pins are digital. They can output high and iow levels or read high and iow levels. 4+ For .sensors that act as a variable resistor such as LDRs (Light Dependent Resistors) or thermistors (temperature sensors) there is a simple solution. Tt allows you to measure 2 number of levels using @ single GPIO pin. In the case of a light sensor this allows you to measure different light levels. +» Fig Q.19.1 shows diagram of connecting an LDR to Raspberry Pi. Fig. Q.19.1 : Diagram of connecting an LDR to Raspberry Pi + Following are steps : 1, First connect pin number 1 (3.3V) to the positive rail on the breadboard. JoT Platform and its Programming Internet of Things 4-18 Io Platform and its Programming 2. Next connect pin number 6 (ground) to the ground rail on breadboard. 3. Now place the LDR sensor onto the board and have a wite go fom ‘one end to the positive rail. 4, On the other side of the LDR sensor place 2 wite leading back to the Raspberry Pi. Hook this to pin mmber 7. 'S. Finally place the capacitor from the wire to the negative rail on he breadboard. Make sure you have the negative vi of the capacitor in the negative rail. * Fig Q.19.2 shows circuit diagram for above configuration. Fig. 0.19.2 : Circuit diagram fer LDR Sequence of events. : 1. Set the GPIO pin as an oupur and set it Low, This discharges any charge in the capacitor and ensures that both sides of the capacitor = ov. Set the GPIO pin as an input. This starts a Sow of curent through the resistors and through the capacitor to ground. The voltage across the capacitor starts: to rise. The time ft wakes is proportional to de resistance of the LDR. 3. Monitor the GPIO pin and read iti value, Increment a counter while we wait 4. At some point the capacitor voltage will increase enough to be considered as a high by the GPIO pin (approx 2 V). The time taken is proportional to the light level seen by the LDR. 5, Set the GPIO pin as an output and repeat the process as required. “A Guide for Engineering Sudens “A Guide for Engineering Suen 4-19 lo Platform and its Programming # Rei ding an analogue sensor with a single GPIO pin import RPL.GPIO as GPIO, time # Tell the GPIO ubrary to use # Broadcom GPI0 references GPIO.setmode(GPIo.Bem) # Define function to measure charge timo # Discharge capacitor GPIO.setup(PiPin, GPIO,OUT) GPIO.output(PiPin, GPIO.LOW) time.sleep(0.1) GPIO.setup(PiPin, GPIO.IN) # Count loops until voltage across # capacitor reads high on GPIO While (GPIO.input(PiPin) == GPI0.LOW) measurement += 1 retum measurement # Main program loop while True : : Print RCtime(4) # Measure timing using GPIO4 4:20 Io Platform ard ts Prosrany, Internet of Things 20 Explain Linux on Raspberry Pi. ve ike oper tems for the R»| ‘Ans. : ¢ There are several unix like operating systems f ts there is an operating system called RISC OS that has its origin ae developers of the first ARM chips. «The Raspberry Pi foundation recommends the use of the fol) Linux Distributions 1, Debian 7 2. Raspbian 3. Arch Linux ARM 4. QtonPi ‘+ Raspbian is a free operating system based on Debian optimized for 4 Raspberry Pi (RPI) hardware. + The deftult command prompt on the Pi consists of four compeses shown in Fig. Q.20.1 working directory Pi@raspverypl - s t hostname type ater this Fig. 0.20.4 : Command prompt * Raspbian is the desired operating system for the Raspberry Pi. Ino to download and install the operating system onto our Raspbeny A you will need Respbian, Win32DiskImager and USR. memery-s reader. 1, Download both Raspbion and Win32DiskImager end sme somewhere easily accessible. 2. Plug the USB memory card reader into your computer. 3. Open Win32Diskimager, 4, Find the location of the image file and the memory card 5. Click "Write". SS TA Gulefor Engncoing Se “A Guide for Engineering Sudents InemetofTaings a-tttog Platforms and its Et Plt ands Pregranming Logging In = + Now it is time to tum on our DMI lead, Ethernet cable, mo the power lead. Raspberry Pi, When the mem ory card, use and keyboard are plugged i in, plug in . ee Bey do this, our screen should be biack and filled wth white text. This will ime we tum on our Raspberry Pi * Wait until your screen reads “raspberrypi login :* Username = pi [ENTER] Password = raspberry [ENTER] be visible every ti : Introduction to Arduino Programming Q.21 What is basic code of Arduino 2? Ans. : Arduino programs run on two basic sections : void setup( ) { //setup motors, sensors etc } void loop() { // get information from sensors 1/ sond commands to motors ) 1, Setup : The setup section is used for assigning input and outputs (Examples : Motors, LED's, sensors etc) to ports on the Arduino, It also specifies whether the device is OUTPUT or INPUT. To do this we use the command "pinMode void setup() { pinMode(9, OUTPUT); i toop Tio Ino> como steers asm excaned peti Tho section of code inside the curly brackeis is repeated depending on the value of variables. // 9s port number “A Gul for Engineering Stden’s a | Internet of Things 4-22 lot Platform an its Progamming Q.22 What is the digitalWrite Q ? Ans. : The digitalRead () function will read the HIGH/LOW value from the digital pin and the digitalWrite ( function is used, 10 set the HIGH/LOW value of the digital pin, difference between digitalRead and Q.23 Write syntax of pinMode (). . Ans. 1 ¢ The specific pin number is set as the INPUT or OUTPUT in the pinMode () function. ‘© The Syntax : pinMode (pin, mode) Where, pin : It is the pin number. We can select the pin number accérding to the requirements, Mode : We can set the mode as INPUT or QUTPUT according to the corresponding pin number. END... —_——— A Guide for Engineering Students ( (wav loT Physical Servers and Cloud Offerings 51: Introduction to Cloud Storage ‘Model and Communication APIs 4 Define cloud computing ? Explain. components of cloud ‘computing. ‘Ans: © NIST definition of cloud : Cloud computing is a pay-per-use ‘model for enabling available, convenient, on-demand ‘network access to @ shared pool of configurable compuiting resources (e.g., networks, servers, ssorage, applications, services) that ‘can be rapidly provisioned and released with minimal management effort or service-provider interaction. ‘Components of Cloud Computing + Cloud computing solutions are made up of several elements. Fig. Q.1.1 shows cloud components 1. Clients : Mobile, terminals or regular computers, 2. Benefits : Lower hardware costs, ‘lower IT costs, security, data security, less power consumption, ease of repair or replacement, less noise. 3, Data centers : Collection of servers where the application to subscribe is howsed. It could be @ large room in the basement of your building ot a room full of servers on the other side of the _ world, 4. Virtualizing servers : Software can’ be installed allowing multiple insumces of virtual servers to be’ used and a dozen virtual servers an run on one physical server. 5. Distributed servers : Servers don't all have to be housed in the seme location. It can be in geographically disparate locations. If ‘something were to happen at one site, causing a failure, the service a 6-1) Internet of Things 5-2 Internet Client computers ae oe Distributed servers Fig. 0.1.1 Cloud components would still be accessed through another si more hardware, they can add them at enother 5 Q.2 Explain characteristics of cloud computing. ‘Ans. : Charactoristics of Cloud Computing 1. On-demand self-service : A consumer can computing capabilities, such as server sime and needed without requiring human interaction ¥ provider. 2, Ubiquitous network access : Capabilities a sult network and sccessed through standard mechani by heterogeneous thin or thick client platfoms. 3. Location-independent resource pooling : The resources are pooled to serve all consumers wes model, with different physical and virwal rece assigned and reassigned according to consumer dent 4, Rapid elasticity : Capabilities canbe mri, ® provisioned to quickly scale up, and rapidly reless}° down, a? Internet of Things S-2 ToT Pin rysical Sey mrvers and Cloud Offerings 4 Pay, per tee + Combis ech "8 Internet of Things 5-6 of Physical Servers and Cloud Offerings service, or advertising-ba: ee ee 8 me bai metered, 2 i ea Billing model to meee ea pas i ad 2 Explain PaaS characteristic and benefit. wns. +» Platform as a Service is another application deliv ery taodel and ‘also known as cloud-ware. Supplies all the rescurces required to build Q.3. What is software as a service ? E: ? Explain cl 7 sas. s sions and services completely from the Intemet, without having to ‘Ans. : © Software as a Servic ervice (SaaS) is a wi appl over the Intemet as a 5 ‘ay Of delivering applicatio ervice. Instead of instal ve download or it Taiemet¥ Secine -yoemairlinet * Series ice; Arplnon dvi development, testing, deploymest, and. hosting, team collaboration, web service integration, database complex software and hardware management. ry, storage, stat> management, ad integration, security, scalabil SaaS applications are sometimes cali ometimes called web-base software, of hosted software entice person comand versioning e The public cloud provider ma + PaaS is closely related to Saa vers a pl ch 10 ihe es pn hte ts | “arene frware, i middleware, application software and seeuri binipeirr nacrarns SaaS customers can dramatically lower costs, 7 So @ This model jnvolves software encapsulated and offered as = service fom which higher levels of service may then be tuk The use ‘customer, or client in this model is the one building applicetoss = In this model, the user, client-or consumer runs an application from @ then run on the provider's infrastructure. cloud infrastructure. Through an interface such as a web browser, the Client or user may access this application from a variety of devices with the capability 0 ¢: © This in tum provides customers and clients opraxming wols sad «The complete application is offered as on demand service. This saves applications onto the cloud iniastructzxe using the client from having to invest in any software licenses or servers up Taeguages, which the provider uppors. ° front and can save the provider money since they are maintaining and . = aon providing only a single application. i : SS re! ban ey eee ecwork, Servers of sometimes over the hosting environment isel= Jatform as a Service include Google's Arp Enginé Cheracteristics of SaaS : 1. Software applications or services are s! © Some examples of PI tored remotely. In most cases, machine, all they require is in some cases, a browser certain services. 4, Network-based management and access’ 19 commercially available software from central locations rather than 3 ‘each customer's site, enabling customers to access applications remotely via the Intemet. a one-tormany model, as opposed 10 5.-Application delivery from ae ot ee en “A Guide for Engineering Ss cee g these services and in/add-en for 2, Pay contrary to billing Management and supervising tools host run time environment 2. A user can then access these services or software applications via the | Internet. | or Foree.com ‘a user does not have to install anything onto thei: host | # PaaS consists of following components | + 1 Browser based development studio ‘2 web browser to acces may require additional plug 4, Seamless deployment f© F Guide for Engineering Stadents

You might also like