Training Report on INTERNET OF THINGS (IOT) Submitted in partial fulfillment of the requirements for the award of the degree of BACHELOR OF TECHNOLOGY in ELECTRONICS AND COMMUNICATION Submitted By: Sanyam Jain 2817291 Batch: 2017-2021) Panipat Institute of Engineering & Technology, (Affiliated to Kurukshetra University Kurukshetra, India) Samalkha, Panipat (2019-2020) 1 CANDIDATE’S DECLARATION I hereby declare that the work presented in this training report entitled “Internet of Things (I.O.T)”, submitted in partial fulfillment of the requirement for the award of the degree of Bachelor of Technology in Electronics and Communication, submitted to Panipat Institute of Engineering & Technology, Kurukshetra University, Kurukshetra, India is an authentic record of my own work carried out during the period from 17 June 2019 to 23 July 2019 under the guidance of Mr. Vipul Ror . The work reported in this project report has not been submitted by me for the award of any other degree or diploma. Date: 23 July 2019 Student’s name: Sanyam Jain Place: Delhi Roll No.: 2817291 2 CERTIFICATE This is to certify that the summer training report (ECE-315N) entitled “Internet of Things (I.O.T)” done by Sanyam Jain, Roll No. 2817291 is an authentic work carried out by him at Sofcon India pvt. ltd. under my guidance. The matter embodied in this training title/ project work has not been submitted earlier for the award of any degree or diploma to the best of my knowledge and belief. Date: 23 July 2019 Company Mentor Name: Mr. Vipul Ror () 3 Acknowledgement Working in the Sofcon India Pvt Ltd was interesting. During these six-weeks summer training, I learnt a lot on Internet of Things, hands-on experience of Arduino , Raspberry pi, languages like python, html and php. I thank Mr. Vipul Ror for guiding me so well during my training. Therefore I am grateful to the people working in Sofcon for the chance to make this experiment. Further on, I want to thank the students and trainees in the Sofcon who made this demanding time joyful but always efficient. Sanyam Jain 4 5 List of Figures Figure 1.1 Figure Name Page no. Figure 1.2 Figure 1.3 Figure 2.1 Figure 2.2 The figures must be numbered as (chapter number.figure number). Suppose chapter number is 2 and figure in the chapter 2 is 3 then figure must be numbered as Figure 2.3 6 List of Tables Table 1.1 Table Name Page no Table 1.2 Table 2.1 The tables must be numbered as (chapter number.table number). Suppose chapter number is 1 and table in the chapter 1 is 1 then table must be numbered as Table 1.1 7 List of Graphs Graph 1.1 Graph Name Page no Graph 1.2 The graphs should be numbered as (chapter number.graph number). Suppose chapter number is 2 and graph in the chapter 2 is 3 then graph must be numbered as Graph 2.3 8 Abbreviations AE Analogy-based Estimation AHF Attribute Hiding Factor AIF Attribute Inheritance Factor List all the abbreviations you have used in the project report/thesis/dissertation etc. 9 CONTENTS (16 PTS.) Candidate's Declaration i Certificate ii Acknowledgement iii Abstract iv List of Figures v List of Tables vi List of Graphs vii Abbreviations viii CHAPTER NO DESCRIPTION Chapter 1: INTRODUCTION PAGE NO. 1 1.1 1 1.2 4 1.3 6 1.4 8 Chapter 2: 14 How to write references? 10 A. References The heading of the References section must not be numbered. Please use Regular and Italic styles to distinguish different fields as shown in the References section. Number the reference items consecutively in square brackets (e.g. [1]). When referring to a reference item, please simply use the reference number, as in [2]. Do not use “Ref. [3]” or “Reference [3]” except at the beginning of a sentence, e.g. “Reference [3] shows …”. Multiple references are each numbered with separate brackets (e.g. [2], [3], [4]–[6]). Examples of reference items of different categories shown in the References section include: • example of a book in [1] • example of a book in a series in [2] • example of a journal article in [3] • example of a conference paper in [4] • example of a patent in [5] • example of a website in [6] • example of a web page in [7] [1] [2] [3] [4] [6] Examples of REFERENCES S. M. Metev and V. P. Veiko, Laser Assisted Microtechnology, 2nd ed., R. M. Osgood, Jr., Ed. Berlin, Germany: Springer-Verlag, 1998. J. Breckling, Ed., The Analysis of Directional Time Series: Applications to Wind Speed and Direction, ser. Lecture Notes in Statistics. Berlin, Germany: Springer, 1989, vol. 61. S. Zhang, C. Zhu, J. K. O. Sin, and P. K. T. Mok, “A novel ultrathin elevated channel lowtemperature poly-Si TFT,” IEEE Electron Device Lett., vol. 20, pp. 569–571, Nov. 1999. M. Wegmuller, J. P. von der Weid, P. Oberson, and N. Gisin, “High resolution fiber distributed measurements with coherent OFDR,” in Proc. ECOC’00, 2000, paper 11.3.4, p. 109. [5] R. E. Sorace, V. S. Reinhardt, and S. A. Vaughn, “High-speed digital-to-RF converter,” U.S. Patent 5 668 842, Sept. 16, 1997. (2002) The IEEE website. [Online]. Available: http://www.ieee.org/ Guidelines for Training report The following guidelines must be followed in preparing the training report: 11 Good quality white executive bond paper A4 size should be used for typing and duplication. Care should be taken to avoid smudging while duplicating the copies. Page Specification: (Written paper and source code) Left margin – 1.5" Right margin – 1" Top margin – 1" Bottom margin – 1" Page numbers - All text pages as well as Program source code listing should be numbered at the bottom center of the pages. Normal Body Text: Font Size: 12, Times New Roman, 1½ Spacing, Justified. 6 point above and below para spacing Paragraph Heading: Font Size: 14, Times New Roman, Underlined, Left Aligned. 6 point above & below spacing. Chapter Heading: Font Size: 16, Times New Roman, Centre Aligned, 12 point above and below spacing. Coding (if any): Font size: 10, Courier New, Normal Binding: Project Report should be typed on one side of the page and binding should be spiral of the report. Figures & Graph: Figures and its caption should be center aligned. Figure caption should be of font size: 12, Times New Roman, 1½ Spacing, 6 point above & below spacing. Tables: Table content and its caption should be center aligned, font size: 12, Times New Roman; Caption should have 1½ Spacing, 6 point above & below spacing. Sequence of pages First Page Candidate declaration certificate should consists of names and roll numbers of student Second Page The Second page should contain a training certificate provided by the company where training has undergone. Third Page The third page may include the Acknowledgement Fourth The Fourth page should contain an abstract of the Project report. The candidate may emphasise here his contributions. 12 Fifth, Sixth and Seventh In this page, list of figures, list of tables, list of graphs and photographs and notation must be provided and abbreviations. Important Note: All the above pages are to be numbered in Roman numerals of lower case. Ex. i, ii, iii, iv,… The document/chapter pages must be numbered using numbers i.e. 1, 2, 3…… All the pages numbered in Roman numerals are to be placed before “Content Page” and document/chapter pages numbered in natural numbers are to be placed after the “Content Page”. 13 INTRODUCTION TO THE TOPIC 1.1 What is IOT ? IOT is a system where physical devices are connected to each other with sensors within and these items are in turn connected to the internet via wireless connection. Internet of things will Connect non-living things with living thingsthe vision of IOT is to connect everything starting from industrial equipment to everyday objects. The sorts of things extent from gas turbines to vehicles to utility meters. It can likewise incorporate living beings, for example, plants, ranch creatures and individuals. For instance, the Cow Tracking Project in Essex utilizes information gathered from radio situating labels to screen dairy animals for ailment and track conduct in the group. Fundamentally anything you can connect a sensor and availability to can take an interest in the new associated biological communities. Use sensors for data connection- The physical articles that are being associated will have one or more sensors. Every sensor will screen a particular condition, for example, area, vibration, movement and temperature. In IoT, these sensors will associate with each other and to frameworks that can comprehend or present data from the sensor's information bolsters. These sensors will give new data to an organization's frameworks and to individuals. Before, individuals conveyed with individuals and with machines. In very simple words, IOT, most commonly known as internet-of- things, is a network of devices connected together in order to exchange information. The devices are embedded with software, sensors and network connectivity which will help them to collect and exchange data. The whole infrastructure creates an opportunity for the machines to communicate with each other. The 28 devices can be anything starting from cellphones, headphones, washing machines or any electronic devices. 14 Overall, IOT is a giant network of connected devices and the relationship will be between people-people, people-things and things to things. 1.2 Why IOT is a popular topic ? IOT products are aimed at automating our lives. All the lights will be switched of as soon as you step out of the house, your warehouse will send notifications as soon it gets short of certain products and what not. There are numerous points of interest of joining IoT into our lives, which can help people, organizations, and society once a day. For people this new idea can come in numerous structures including wellbeing, security, monetarily, and consistently arranging. The joining of IOT into the human services framework could end up being inconceivably gainful for both an individual and a general public. A chip could be actualized into every person, taking into consideration healing centers to screen the indispensable indications of the patient. By following their crucial signs, it could show regardless of whether genuine appraisal is vital. With the majority of the data that is accessible on the Internet, it can likewise unnerve individuals into trusting they require more care than what is truly required. Healing centers as of now battle to survey and deal with the patients that they have. By observing individual's wellbeing, it will permit them to judge who needs essential consideration. The Internet of Things can likewise help individuals with their own wellbeing. ADT, which is a home security framework, permits people to screen their security frameworks at home through their telephones, with the capacity to control it. IOT can likewise work as a device that can spare individuals cash inside their family units. In the event that their home apparatuses can convey, they can work in a vitality effective way. At last, IOT can help individuals with their ordinary arrangements. 15 By permitting physical gadgets to impart, it is taking the information that is separately gathered, sharing it, and afterward making an interpretation of the data into approaches to make our present frameworks more productive. The Smart Home Devices and the Future : Smart home automation and IoT are creating a lot of buzz in the IT industry. Daily lives have been made simpler, better, and more comfortable with the increasing number of smart homes and connected devices. 16 By 2020, it is expected t hat the global smart home market will reach around 40 billion dollars. Now, these smart home devices range from anything like smart kettles, refrigerators, and dryers to air conditioners and a range of safety and security devices, like alarm systems and circuit security cameras. CLIENT-SEVER COMPUTING: A server host runs one or more server programs which share their resources with clients. 17 A client does not share a n y of its resources, but requests a serv er's content or service function. Clients therefore initiate communication sessions with servers which await incoming requests. Examples of computerapplications that use the client–server model are Email, network printing, and the World Wide Web. AC TO DC VOLTAGE CONVERSION: (220V TO 5V) 18 If VB >= VE THEN ACTIVE MODE else OFF MODE 19 Python Example: calculator using python from tkinter import * def delete(): ent.set("") def clear(): x=var.get() l=len(x) y=x[0:l-1] ent.set(y) def prt(num): l=len(var.get()) var.insert(l,num) def equal(): ent.set(eval(var.get())) root=Tk() 20 root.title("calculator") ent=StringVar() var=Entry(root,textvariable=ent,justify="left") var.grid(row=0,column=0) var7=Button(root,text=" 7 ",command =lambda:prt('7')).grid(row=1,column=0) var8=Button(root,text=" 8 ",command = lambda:prt('8')).grid(row=1,column=1) var9=Button(root,text=" 9 ",command = lambda:prt('9')).grid(row=1,column=2) var10=Button(root,text=" + ",command=lambda:prt('+')).grid(row=1,column=3) var4=Button(root,text=" 4 ",command = lambda:prt('4')).grid(row=2,column=0) var5=Button(root,text=" 5 ",command = lambda:prt('5')).grid(row=2,column=1) var6=Button(root,text=" 6 ",command = lambda:prt('6')).grid(row=2,column=2) var11=Button(root,text=" - ",command=lambda:prt('-')).grid(row=2,column=3) var1=Button(root,text=" 1 ",command = lambda:prt('1')).grid(row=3,column=0) var2=Button(root,text=" 2 ",command = lambda:prt('2')).grid(row=3,column=1) var3=Button(root,text=" 3 ",command = lambda:prt('3')).grid(row=3,column=2) var12=Button(root,text=" * var13=Button(root,text=" delete var0=Button(root,text=" var15=Button(root,text=" var16=Button(root,text=" 0 = / ",command=lambda:prt('*')).grid(row=3,column=3) ",command=clear).grid(row=4,column=0) ",command = lambda:prt('0')).grid(row=4,column=1) ",command=equal).grid(row=4,column=2) ",command=lambda:prt('/')).grid(row=4,column=3) var17=Button(root,text="clear all",command=delete).grid(row=5,column=0) mainloop() Output: 21 22 23 RASPBERRY PI Raspberry Pi is neither a microprocessor or microcontroller , it is a single board computer which contains a SOC (System On Chip - Has multicore processor,GPU,ROM,I/O Peripherals inside it.),DDR RAM memory, Ethernet port, USB host,micro HDMI on it. Raspberry Pi is a credit-card sized computer with low cost, which plugs into a computer monitor or TV, and to operate it, a user can use a standard keyboard and mouse to operate it. Raspberry Pi is a series of single-board computers and it is developed by the Raspberry Pi Foundation in the United Kingdom. This is developed to promote and create awareness of basic computer science in schools across the world. The latest version of Raspberry Pi computer is Raspberry Pi 3 Model B, which is very tiny credit card size computer. This can be used efficiently just by connecting mouse, keyboard, display, power supply, micro SD card along with installing Linux Distribution in it and that makes a fully-fledged computer where the user can run all the applications from word processors and spreadsheets to games. Raspberry Pi 3 is an online and open source website creation tool written in PHP language. It is the most popular open source Content Management System. The Raspberry Pi 3 Model B is the first Raspberry Pi model to be open-source from the get-go. The Raspberry Pi 3 is a quad-core and it is much faster and capable than its previous Raspberry Pi models. The advantages of Raspberry Pi 3 Model B overs its predecessor: The new board in Raspberry Pi 3 Model B is capable of playing 1080p MP4 video at 60 frames per second, which boost the Pi’s media center credentials. The Raspberry Pi 3 comes with built-in Wi-Fi and Bluetooth which helps to also support the wireless internet out of the box. The Pi 3 board supports remote updates to Pi and also sharing images of operating system between multiple computer machines like booting process can 24 be directly done by using a USB-attached hard drive or pen drive and also by supporting booting from a network-attached file system. PIN DIAGRAM OF RASPBERRY PI MODEL 25 26 Some Operating Systems That Can Be Run on Raspberry Pi NOOBS The Raspberry Pi supports several OSes and as such usually comes without one. Most of the time, however, it ships with an SD card that includes NOOBS (New Out Of the Box Software) – an OS that includes of a variety of Operating Systems from which you can choose which to or you to choose which to run on your Raspberry Pi setup. RASPBIAN It is a Debian-based engineered especially for the Raspberry Pi and it is the perfect general-purpose OS for Raspberry users. It employs the Openbox stacking window manager and the Pi Improved Xwindows Environment Lightweight coupled with a number of pre-installed software which includes Minecraft Pi, Java, Mathematica, and Chromium. Raspbian is the Raspberry foundation’s official supported OS and is capable of accomplishing any task you throw at it. UBUNTU CORE It is the version of Ubuntu designed for Internet of Things applications. Ubuntu is the most popular Linux-based Operating System in the world with over 20+ derivatives and given that it has an active and welcoming forum, it will be easy to get up and running with Ubuntu Snappy Core on your Raspberry Pi. LINUTOP OS It is a secure raspbian-based web kiosk and digital signage player. it is dedicated to professionals with the need to deploy public internet stalls and digital signage solutions using raspberries.this os is perfect if you run hotels, restaurants, shops, city halls, offices, museums, etc. and it is compatible with raspberry pi b, b+ and 2. \ 27 Some Programming Languages Ported to the Raspberry Pi Scratch. Scratch is an entry-level programming language that comes as standard with the Raspberry Pi distribution, Raspbian. ... Python. Python is one of the primary programming languages hosted on the Raspberry Pi. ... HTML5. ... JavaScript. ... JQuery. ... Java. ... C programming language. ... C++ INPUT-OUTPUT PROGRAMMING STEPS FOR RASPBERRY Pi i) ii) iii) iv) v) vi) vii) Import the library >> import RPi.GPIO as var Import time library >>import time Set GPIO set mode >> var.setmode(var.BOARD) Set pin as i/p or o/p >> var.setup(pinadd, var.OUT) >> var.setup(pinadd, var.IN,pull_up_down=var.PUD_UP) Set warning (optional) >>var.setwarnings(false) Make pin high or low >>var.output(pinadd, var.HIGH) Check for input condition >>if var.inpur=(pinno)==var.LOW : LED BLINKING PROGRAM USING PYTHON import RPi.GPIO as led import time led.setmode (led.BOARD) 28 led.setwarnings(False) led.setup(3,led.OUT) led.setup(5,led.OUT) while True: led.output(3,led.HIGH) led.output(5,led.LOW) time.sleep(1) led.output(3,led.LOW) led.output(5,led.HIGH) 29 30 ARDUINO An Arduino is a microcontroller motherboard. A microcontroller is a simple computer in that, only one program can be run at a time. It is very easy to use. Arduino is an open-source and prototype platform which is based on software and hardware. It is easy to use. Arduino is the overall microcontroller motherboard and it has ready-made software called Arduino IDE (Integrated Development Environment), this software is used to write and upload the computer program code to the physical board. Some of the features of Arduino are as listed below: Microcontroller motherboard in Arduino is capable to read the analog /digital input signals from different sensors and then convert those signals into an output process like turning LED on/off, activating a motor, etc. The user can control the functions of a board by sending signals (set of instructions) to the microcontroller board using Arduino IDE software. Arduino does not require any extra piece of hardware/programmer whenever to want to load a new piece of program to the board. It can be done by using a USB cable. Since Arduino IDE uses an easier version of C++, it is very easy to learn the programming language to program. Why Arduino Boards ? Arduino board has been used for making different engineering projects and different applications. The Arduino software is very simple to use for beginners, yet flexible adequate for advanced users. It runs windows, Linux and Mac. Teachers and students in the schools utilize it to design low cost scientific instruments to verify the principles of physics and chemistry. There are numerous other microcontroller platforms obtainable for physical computing. The Netmedia’s BX-24, Parallax Basic Stamp, MIT’s Handyboard, Phidget and many others present related functionality. Arduino also makes simpler the working process of microcontroller, but it gives some advantages over other systems for teachers, students and beginners. 31 32 FIGURE : PIN DIAGRAM OF ARDUINO UNO RASPBERRY PI vs ARDUINO Both Raspberry Pi 3 vs Arduino are popular choices in the market; let us discuss some of the major Difference Between Raspberry Pi 3 vs Arduino: 1. The Raspberry Pi 3 is a series of single Board Computer. The single board consists of a fully functional computer with its dedicated memory, processor and it runs an operating system (runs on Linux). Whereas Arduino is a Microcontroller board and this board is not as powerful as Raspberry Pi 3 single board computers, but a microcontroller board can be great for quick setups. 2. The Raspberry Pi 3 is so faster than the Arduino, means Raspberry Pi 3 has 1.2 GHz whereas Arduino has only 16 MHz.This helps to process the tasks like playing videos, surfing the web, listening to music, etc. very fast compared to Arduino. 3. Arduino is a simple approach and more attractive for building a project. The Arduino has a convenient and user-friendly time interfacing with analog sensors, motor, or other components, whereas Raspberry Pi 3 has a very 33 complicated path to get sensor readings such as installing software, libraries, etc. 4. The Raspberry Pi 3 is designed to run operating systems whereas Arduino is not designed to run on operating systems. 34 Data transmission Data transmission refers to the process of transferring data between two or more digital devices. Data is transmitted from one device to another in analog or digital format. Basically, data transmission enables devices or components within devices to speak to each other. How does data transmission work between digital devices? Data is transferred in the form of bits between two or more digital devices. There are two methods used to transmit data between digital devices: serial transmission and parallel transmission. Serial data transmission sends data bits one after another over a single channel. Parallel data transmission sends multiple data bits at the same time over multiple channels. What is serial transmission? When data is sent or received using serial data transmission, the data bits are organized in a specific order, since they can only be sent one after another. The order of the data bits is important as it dictates how the transmission is organized when it is received. It is viewed as a reliable data transmission method because a data bit is only sent if the previous data bit has already been received. Serial transmission has two classifications: asynchronous and synchronous. Asynchronous Serial Transmission Data bits can be sent at any point in time. Stop bits and start bits are used between data bytes to synchronize the transmitter and receiver and to ensure that the data is transmitted correctly. The time between sending and receiving data bits is not constant, so gaps are used to provide time between transmissions. The advantage of using the asynchronous method is that no synchronization is required between the transmitter and receiver devices. It is also a more cost effective method. A disadvantage is that data transmission can be slower, but this is not always the case. Synchronous Serial Transmission Data bits are transmitted as a continuous stream in time with a master clock. The data transmitter and receiver both operate using a 35 synchronized clock frequency; therefore, start bits, stop bits, and gaps are not used. This means that data moves faster and timing errors are less frequent because the transmitter and receiver time is synced. However, data accuracy is highly dependent on timing being synced correctly between devices. In comparison with asynchronous serial transmission, this method is usually more expensive. When is serial transmission used to send data? Serial transmission is normally used for long-distance data transfer. It is also used in cases where the amount of data being sent is relatively small. It ensures that data integrity is maintained as it transmits the data bits in a specific order, one after another. In this way, data bits are received in-sync with one another. What is parallel transmission? When data is sent using parallel data transmission, multiple data bits are transmitted over multiple channels at the same time. This means that data can be sent much faster than using serial transmission methods. Advantages and Disadvantages of Using Parallel Data Transmission The main advantages of parallel transmission over serial transmission are: it is easier to program; and data is sent faster. Although parallel transmission can transfer data faster, it requires more transmission channels than serial transmission. This means that data bits can be out of sync, depending on transfer distance and how fast each bit loads. A simple of example of where this can be seen is with a voice over IP (VOIP) call when distortion or interference is noticeable. It can also be seen when there is skipping or interference on a video stream. When is parallel transmission used to send data? Parallel transmission is used when: a large amount of data is being sent; the data being sent is time-sensitive; 36 and the data needs to be sent quickly. A scenario where parallel transmission is used to send data is video streaming. When a video is streamed to a viewer, bits need to be received quickly to prevent a video pausing or buffering. Video streaming also requires the transmission of large volumes of data. The data being sent is also timesensitive as slow data streams result in poor viewer experience. COMMUNICATION PROTOCOLS: UART INTERFACE Following are the features of UART interface. • The full name is Universal Asynchronous Receiver/Transmitter. • UART supports lower data rate. 37 • Receiver need to know baudrate of the transmitter before initiation of reception i.e. before communication to be established. • UART is simple protocol, it uses start bit (before data word), stop bits (one or two, after data word), parity bit (even or odd) in its base format for data formatting. Parity bit helps in one bit error detection. ➨UART Packet = 1 start bit(low level), 8 data bits including parity bit, 1 or 2 stop bit(high level) • Data is transmitted byte by byte. • UART generates clock internally and synchronizes it with data stream with the help of transition of start bit. • It is also referred by RS232 . • For long distance communication, 5V UART is converted to higher voltages viz. +12V for logic 0 and -12V for logic 1. SPI INTERFACE As shown in the figure one slave is connected with one master device. Clock is generated by master device for synchronization of data transfer. It is also possible to connected more than one slave device with single master for communication. SPI interface operates in either half or full duplex mode. SPI is the short form of Serial Peripheral interface. The figure-2 depicts SPI interface between master and slave devices. 38 It has four main lines as described below. MOSI - Master Output Slave Input, it is used to transfer data from master device to slave device. MISO - Master Input Slave Output, it is used to transfer data from slave device to master device. SCLK - Serial Clock, it is clock output from master and used for synchronization. SS - Slave Select, it is used by master device to select one slave out of multiple slaves. It inserts active low signal to select the particular slave device. I2C INTERFACE • I2C stands for "inter-IC bus". It is also used as I2C for simplicity. • I2C is a low speed and two wire serial data connection bus used in IC(Integrated Circuit). • It is used to run signals between ICs mounted on the same PCB (Printed Circuit Board). • It uses only two lines between multiple masters and multiple slaves viz. SDA (Serial Data) and SCL (Serial Clock). • I2C supports various data rates as per versions from 100 Kbps, 400 Kbps, 1 Mbps to 3.4 Mbps • It is synchronous communication like SPI and unlike UART. Hence there is 39 common clock signal between masters and slaves. • It uses start and stop bits and ACK bit for every 8 bits of data transfer. Rules of Serial Transmission The asynchronous serial protocol has a number of built-in rules - mechanisms that help ensure robust and error-free data transfers. These mechanisms, which we get for eschewing the external clock signal, are: Data bits, Synchronization bits, Parity bits, and Baud rate. Through the variety of these signaling mechanisms, you'll find that there's no one way to send data serially. The protocol is highly configurable. The critical part is making sure that both devices on a serial bus are configured to use the exact same protocols. Baud Rate The baud rate specifies how fast data is sent over a serial line. It's usually expressed in units of bits-per-second (bps). If you invert the baud rate, you can find out just how long it takes to transmit a single bit. This value determines how long the transmitter holds a serial line high/low or at what period the receiving device samples its line. Baud rates can be just about any value within reason. The only requirement is that both devices operate at the same rate. One of the more common baud rates, especially for simple stuff where speed isn't critical, is 9600 bps. Other "standard" baud are 1200, 2400, 4800, 19200, 38400, 57600, and 115200. The higher a baud rate goes, the faster data is sent/received, but there are limits to how fast data can be transferred. You usually won't see speeds exceeding 115200 - that's fast for most microcontrollers. Get too high, and you'll begin to see errors on the receiving end, as clocks and sampling periods just can't keep up. 40 Bit Rate Actual rate of transfer of Bits per second Framing the data Each block (usually a byte) of data transmitted is actually sent in a packet or frame of bits. Frames are created by appending synchronization and parity bits to our data. Data chunk The real meat of every serial packet is the data it carries. We ambiguously call this block of data a chunk, because its size isn't specifically stated. The amount of data in each packet can be set to anything from 5 to 9 bits. Certainly, the standard data size is your basic 8-bit byte, but other sizes have their uses. A 7bit data chunk can be more efficient than 8, especially if you're just transferring 7-bit ASCII characters. Synchronization bits The synchronization bits are two or three special bits transferred with each chunk of data. They are the start bit and the stop bit(s). True to their name, these bits mark the beginning and end of a packet. There's always only one start bit, but the number of stop bits is configurable to either one or two (though it's commonly left at one). The start bit is always indicated by an idle data line going from 1 to 0, while the stop bit(s) will transition back to the idle state by holding the line at 1. Parity bits Parity is a form of very simple, low-level error checking. It comes in two flavors: odd or even. To produce the parity bit, all 5-9 bits of the data byte are added up, and the evenness of the sum decides whether the bit is set or not. For example, assuming parity is set to even and was being added to a data byte like 0b01011101 , which has an odd number of 1's (5), the parity bit would be set to 1 . Conversely, if the parity mode was set to odd, the parity bit would be 0. UART VS USART: UART > Universal Asynchronous Receiver Transmitter USART > Universal Synchronous Asynchronous Receiver Transmitter 41 A UART generates its data clock internally to the microcontroller and synchronizes that clock with the data stream by using the start bit transition. There is no incoming clock signal that is associated with the data, so in order to properly receive the data stream the receiver needs to know ahead of time what the baud rate should be. A USART can be set up to run in synchronous mode. In this mode the sending peripheral will generate a clock that the receiving peripheral can recover from the data stream without knowing the baud rate ahead of time. The use of the external clock allows the data rate of the USART to be much higher than that of a standard UART, reaching up to rates of 4 Mbps. 42 SOFTWARES CAYENNE It is an app for smartphones and computers that allows you to control the Raspberry Pi and soon also the Arduino through the use of an elegant graphical interface and a solid nice communication protocol. The features are: Add and remotely control sensors, motors, actuators, GPIO boards, and more Customizable dashboards with drag-and-drop widgets for connection devices Create triggers and threshold alerts for devices, events, and actions Schedule one-time or multi-device events for easy automation Quick and easy setup - connect your Pi in minutes Step 1: Sign Up to Cayenne Step 2: Download the App and Install Cayenne STEP 3: To download and install myDevices Cayenne on your Pi, use the Terminal on your Pi or SSH. Run the following commands: wget https://cayenne.mydevices.com/dl/rpi_4ithnypn 7p.sh sudo bash rpi_4ithnypn7p.sh -v 43 Step 4: See Your Device on Cayenne Dashboard You can personalize the Dashboard of Cayenne by using the widgets. The default Dashboard have CPU, Temp and RAM widget . These are the values of your Raspberry Pi. You can see the temp and the work flow of Raspberry pi. Then you can see the GPIO schedule. In the GPIO you can set every pin of GPIO of Raspberry. You can set the pin like Output or Input. Then you can activate the pin or read the value of the pin. The two values are HIGH or LOW. This is valid for Input and Output. Proteus is a simulation and design software tool developed by Labcenter Electronics for Electrical and Electronic circuit design. It also possess 2D CAD drawing feature. It deserves to bear the tagline “From concept to completion†. About Proteus It is a software suite containing schematic, simulation as well as PCB designing. 44 ISIS is the software used to draw schematics and simulate the cir cuits in real time.The simulation allows human access during run time,thus pr oviding real time simulation. ARES  is used for PCB designing.It has the feature of viewing o tput in 3D view of the designed PCB along  with components. The designer can also develo p 2D drawings for the product. PROTEUS AND ARDUINO For simulation of Arduino in Proteus , get the hex file from Arduino software and add it in your Proteus Arduino board. Once the hex file is uploaded in the Arduino then run your Arduino Proteus Simulation and if everything goes fine then your program will run successfully as shown in below figure: PythonAnywhere is an online integrated development environment (IDE) and web hosting service (Platform as a service) based o programming language 45 the Python It provides in-browser access to server-based Python and Bash commandline interfaces, along with a code editor with syntax highlighting. Program files can be transferred to and from the service using the user's browser. Web applications hosted by the service can be written using any WSGIbased application framework. PythonAnywhere has various versions of Python installed, and each version has its associated version of Flask. Flask is a real time server. Command to import flask library >>python –m pip install flask MIT App Inventor It is an intuitive, visual programming environment that allows everyone even children to build fully functional apps for smartphones and tablets. Those new to MIT App Inventor can have a simple first app up and running in less than 30 minutes. 46 47 48 49