0% found this document useful (0 votes)
44 views46 pages

Jay Internship Report

The internship report by Jay Kumar P Patel focuses on 'Artificial Intelligence using Raspberry Pi' as part of his Bachelor of Engineering in Electronics and Communication Engineering. It includes a detailed overview of the Elecsis InfoTech company, the tasks performed during the internship, and the applications of AI in various fields. The report highlights the integration of AI with Raspberry Pi for projects such as smoke detection and motor control, showcasing practical applications of theoretical concepts learned during the course.

Uploaded by

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

Jay Internship Report

The internship report by Jay Kumar P Patel focuses on 'Artificial Intelligence using Raspberry Pi' as part of his Bachelor of Engineering in Electronics and Communication Engineering. It includes a detailed overview of the Elecsis InfoTech company, the tasks performed during the internship, and the applications of AI in various fields. The report highlights the integration of AI with Raspberry Pi for projects such as smoke detection and motor control, showcasing practical applications of theoretical concepts learned during the course.

Uploaded by

impact2017batch
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

VISVESVARAYA TECHNOLOGICAL UNIVERSITY

“Jnana Sangama”, BELAGAVI – 590 014, KARNATAKA, INDIA

Internship Report
ON

“ARTIFICIAL INTELLIGENCE USING RASPBERRY PI”

Submitted in partial fulfillment of the requirement for the degree of

BACHELOR OF ENGINEERING
IN
ELECTRONICS AND COMMUNICATION ENGINEERING
SUBMITTED BY:

JAY KUMAR P PATEL [USN: 1IC17EC005]


Under the guidance of
Ms. Disha BG
Assistant Professor Dept. of ECE

IMPACT COLLEGE OF ENGINEERING AND APPLIED SCIENCES


Kodigehalli, Sahakaranagar Post, Bengaluru- 560 092
IMPACT COLLEGE OF ENGINEERING AND
APPLIED SCIENCES
KODIGEHALLI, SAHAKARANAGAR, BENGALURU- 560 092
(Affiliated to Visvesvaraya Technological University, Belagavi)

DEPARTMENT OF ELECTRONICS AND COMMUNICATION


ENGINEERING

CERTIFICATE
This is to certify that the internship report entitled
“ARITIFICIAL INTELLIGENCE USING RASPBERRY PI”

has been successfully completed by

JAY KUMAR P PATEL[USN:1IC17EC005]

Under our supervision and guidance in partial fulfillment for the award of Bachelor of
Engineering in 8th semester B.E. of the Visvesvaraya Technological University, Belagavi
during the year 2021-22. This technical seminar report has been approved as it satisfies the
academic requirements in respect of Internship synopsis for the Bachelor of Engineering
Degree in Electronics and Communication.

Signature of Guide Signature of HOD Signature of Principal

Assistant Professor Dept. of ECE HOD Dept. of ECE Principal ICEAS


ACKNOWLEDGEMENT

We are grateful to our chairman Dr. Paul Mathulla for having provided us with excellent
facilities in the college during our courses.

We are indebted to the president Dr. Alice Abraham and to the principal Dr. A. N. Khaleel
Ahmed of I.C.E.A.S for providing us with the resources needed to take up this internship
work.

We are grateful to our Head of the Department Mr. Santosh K for his kind support, guidance
and motivation during the course of the Internship work.

We are also deeply indebted to my project guide Ms. Disha BG, Asst. Professor, ECE, for
her guidance and constant encouragement during my course of internship synopsis and for
co- operation in successful completion of the report.

Guidance and deadlines play a very important role in the successful completion of the seminar
on time. We convey our regards for having constantly monitored the development of the
seminar and setting up precise deadlines.

Finally, a note to thanks to the department of Electronics and Communication Engineering,


both teaching and non–teaching staff for their co-operation extended to us.

JAY KUMAR P PATEL


[1IC17EC]
CONTENTS

ABSTRACT ......................................................................................................................01

1. CHAPTER 1

COMPANY PROFILE ............................................................................................... 02


1.1 History of Company .......................................................................................... 02

1.2 About Company ................................................................................................. 02

1.3 Elecsis InfoTech Services.................................................................................. 03

1.4 Management ...................................................................................................... 04

1.5 Process ............................................................................................................... 04

1.6 Department ........................................................................................................ 05

1.7 Current Elecsis InfoTech Status ........................................................................ 07

2. CHAPTER 2

INTRODUCTION ....................................................................................................... 08

OBJECTIVE ................................................................................................................ 09

3. CHAPTER 3

TASKS PERFORMED………………………………………………………………10
3.1 Accomplishment of Week 1 ………………………………………………......10

3.1.1 Introduction to Raspberry Pi .................................................................... 10


3.1.2 Raspberry Pi 3 On-chip Hardware ........................................................... 12
3.1.3 Data Science ............................................................................................. 14
3.1.4 Machine Learning..................................................................................... 14
3.1.5 Deep Learning .......................................................................................... 15
3.1.6 Artificial Intelligence ............................................................................... 16
3.2 Accomplishment of week 2 ................................................................................. 18

3.2.1 Virtual Network Computing (VNC) ........................................................ 18


3.2.2 Blinking of LED ....................................................................................... 20
3.2.3 Blinking of Even and Odd LED’s ............................................................ 21
3.2.4 Interfacing of LCD and PI Cam to Capture and Save Images ................. 22

3.3 Accomplishment of week 3 ................................................................................. 28

3.3.1 DC Motor to Rotate Clockwise and Anti-Clockwise Using Switch ........ 28


3.3.2 GSM Interfaced with Raspberry Pi to Make a Call ................................. 31
3.3.3 Smoke Sensor Interfaced with Raspberry Pi for Smoke Detection ......... 34

3.4 Accomplishment of week 4................................................................................. 36

3.4.1 Project on Automatic Stopping of Robot using IR Sensor, Smoke Sensor


Technology ............................................................................................... 36

4. CHAPTER 4

CONCLUSION ........................................................................................................... 40

FUTURE SCOPE ........................................................................................................ 40


FIGURES

1. CHAPTER 3

3.1. Raspberry PI .................................................................................................. 11


3.2. Raspberry PI 3 On-chip Hardware ................................................................ 13
3.3. LED ............................................................................................................... 20
3.4. LED Interfaced to Raspberry PI.................................................................... 21
3.5. Blinking of Even and Odd LED’s ................................................................. 22
3.6. LCD Display ................................................................................................. 23
3.7. PI Cam Interfaced with Raspberry PI ........................................................... 24
3.8. Interfacing of LCD and PI Cam to Capture and Save Images ..................... 27
3.9. DC Motor ...................................................................................................... 28
3.10. DC Motor Interfaced with Raspberry PI to Rotate Clockwise and Anti-
Clockwise Using Switch ............................................................................... 31
3.11. GSM Module ................................................................................................ 32
3.12. GSM Interfaced with Raspberry PI to Make a Call ..................................... 33
3.13. Smoke or Gas Sensor ................................................................................... 34
3.14. Detection of Smoke Using Smoke Sensor Interfaced with Raspberry PI ... 35
3.15. Automatic Stopping of Robot using IR Sensor, Smoke Sensor
Technology……........................................................................................... 39

TABLE

1. CHAPTER 3

3.1. Features of Different Version of Raspberry Pi ................................................. 12


ARTIFICIAL INTELLIGENCE USING RASPBERRY PI 2021-22

ABSTRACT
Artificial intelligence (AI) is exhibited by artificial entity, a system is generally assumed to be
a computer. AI systems are now in routine use in economics, medicine, engineering and the
military, as well as being built into many common home computer software applications,
traditional strategy games like computer chess and other video games. Researchers tried to
explain the brief ideas of AI and its application to various fields. It cleared the concept of
computational and conventional categories. It includes various advanced systems such as
Neural Network, Fuzzy Systems and Evolutionary computation. AI is used in typical problems
such as Pattern recognition, Natural language processing and more. This system is working
throughout the world as an artificial brain. Intelligence involves mechanisms, and AI research
has discovered how to make computers carry out some of them and not others. If doing a task
requires only mechanisms that are well understood today, computer programs can give very
impressive performances on these tasks. Such programs should be considered “somewhat
intelligent”. It is related to the similar task of using computers to understand human
intelligence AI involves studying the problems the world presents to intelligence rather than
studying people or animals. AI researchers are free to use methods that are not observed in
people or that involve much more computing than people can do. We discussed conditions for
considering a machine to be intelligent. We argued that if the machine could successfully
pretend to be human to a knowledgeable observer, then you certainly should consider it
intelligent characteristics from human intelligence, and applying these as algorithms in a
computer friendly way. A more or less flexible and efficient approach can be taken depending
on the requirements established which influences hoe artificial intelligent behavior appears.

DEPT OF ECE, ICEAS 1


ARTIFICIAL INTELLIGENCE USING RASPBERRY PI 2021-22

Chapter 1.
COMPANY PROFILE
ELECSIS INFOTECH

1.1. HISTORY OF COMPANY


Elecsis infotech & Consulting was found in year 2017 by a team with 4+ years of experience
in embedded systems domain. Elecsis infotech focuses globally on Automotive embedded
technologies, Corporate Training & Consulting. The professionals with industrial experience
in embedded technology, real time software, process control and industrial electronics held the
company. The company is the pioneers in design and development of Single Board Computers,
Compilers for micro-controllers within India. Talented professional in the field of embedded
hardware, software design and development toil to reach its excellence.

1.2. ABOUT COMPANY


ELECSIS was formed by professionals with formal qualifications and industrial experience in
the fields of embedded systems, real-time software, process control and industrial electronics.
The company is professionally managed and supported by qualified experienced specialists
and consultants with experience in embedded systems – including hardware and software.
Initially, the company Developed system software tools; these include C Compilers for micro-
controllers and other supporting tools such as assembler, linker, simulator and Integrated
Development Environment. Later Single Board Computers (SBCs) – were developed and are

DEPT OF ECE, ICEAS 2


ARTIFICIAL INTELLIGENCE USING RASPBERRY PI 2021-22

still manufactured. Such hardware boards support a broad range of processors – including 8
bits, 16- and 32-bit processor. Since 2018, company also started offering design and
development services. This includes a complete spectrum of activities in product development
life cycle that is idea generation, requirement gathering to prototype making, testing and
manufacturing. Company has so far provided product design services for various sectors which
include the Industrial automation, Instrumentation, Automotive, Consumer and Defense
sector.

1.3. ELECSIS INFOTECH SERVICES


ELECSIS INFOTECH focuses globally on automotive embedded technologies, Corporate
Training & Consulting.

EXPERTISE IN EMBEDDED SOFTWARE DEVELOPMENT


• Microcontroller Drivers.
• Boot loader and System software.
• CAN, LIN and other serial communication software.
• Model based software development: Modelling, Simulation, Auto coding and Reverse
Engineering.
• AUTOSAR Configuration and generation.

AUTOMOTIVE DOMAIN EXPERTISE, PROCESS QUALITY


• Body Control Module.
• Power Electronics, DCDC Convertors.
• HVAC Systems.
• Cluster and Head-Up Display systems.
• Driver Information systems.
• Seat Modules.

DEPT OF ECE, ICEAS 3


ARTIFICIAL INTELLIGENCE USING RASPBERRY PI 2021-22

TECHNOLOGIES
• Microcontrollers 8, 16, 32 bits.
• Embedded C, Python, IoT (PHP Front End & MY SQL Back End) Wireless – Bluetooth,
GPS, GPRS, Wi-Fi.
• Communication protocols – SPI, I2c, CAN, LIN.
• Mat Lab Sim Link, Xilinx, Model Sim, LabView.

1.4. MANAGEMENT
The Management team has mixture of Technical and Business development expertise with 4+
years of experience in the Information Technology Field.

1.5. PROCESS
At Elecsis Infotech we utilize our resources and expertise to ensure that your product
development project flows smoothly. We will maintain close communication with you
throughout the project to ensure that your project is proceeding consistent with your needs. To
provide you a complete, robust and cost-effective solution we implement our projects in the
following manner.
Stage 1: Inquiry
This is an initial discussion between you and our Business Development Manager to share our
general skills and capabilities to see if we might be a good fit for your project needs.
Stage 2: Requirement Analysis
This is a detailed discussion with our team and you. The purpose of this discussion is for us to
get an in depth understanding of your project needs and for you to get a firm understanding of
our specific technical capabilities in areas needed for your project. Typically, this discussion
will involve appropriate members of your team, our Business Development Manager, our
engineers, and a Project Manager.

DEPT OF ECE, ICEAS 4


ARTIFICIAL INTELLIGENCE USING RASPBERRY PI 2021-22

Stage 3: Proposal / Statement of Work


Based on the information we have received in the Requirement Analysis stage; we may
mutually agree to create a detailed project proposal or Statement of Work (SOW) for your
project. This Statement of Work will define project scope, activities, deliverables, schedule,
costs, and proposed business terms. We will work closely with you to create and refine a
Statement of Work that will satisfy your needs.
Stage 4: Project Kick Off
Once it has reached agreement on the Statement of Work, Embedded Technology Labs will
then assemble all the people and resources needed to start the project.

1.6. DEPARTMENT
TECHNICAL DEPARTMENT
HARDWARE DESIGN
Once upon a time, new product design and development in the field of electronics was
hardware design. Today this isn’t the case. Circuit design – be it analog or digital circuit design
is only part of the equation. An electronic system may include an embedded microcontroller
or a microprocessor requiring programming, a field programmable gate array (FPGA) coded
in a hardware description language such as Verilog or VHDL, and lots of software in C,
assembly language, Java, or any of a dozen other popular languages. If nothing else, for
instrumentation, low-noise analogy systems, and high-speed digital design, electronic design
is bound also to encompass PCB layout, since the copper and fiberglass of a printed circuit
board can be very much a part of the circuit itself at extreme frequencies or extreme low signal
levels. But although electronic hardware is only a part of the total electronic product, it has
better not the weak link in the chain. So, anyone offering electronic product development had
best be not only good at it, but also able to see where it fits in the bigger picture Gone also are
the days when engineering design services could be “soloed” and electrical engineering
companies could operate in comparative vacuums and simply throw their work over the wall

DEPT OF ECE, ICEAS 5


ARTIFICIAL INTELLIGENCE USING RASPBERRY PI 2021-22

at each other. All parties involved in the Endeavour (which should be, from the start, a top-
down design effort) have to be aware of what’s happening on the other side of the hardware-
software boundary, manufacturability question, or applications programming interface (API)
Elecsis Infotech provides complete hardware design solutions that encompass:
• Block-level design
• Component selection
• Schematic capture
• Multi-layer PCB layout
Elecsis Infotech design systems and boards based on analogy circuits, digital circuits and
subsystems, microprocessors, microcontrollers, FPGAs, DSPs and SOCs. Creating schematics
using Capture tools, simulation of the hardware and design of multi-layer PCBs are some of
the aspects of Embedded Hardware Design. They gather initial technical and functional
requirements, design schematic diagrams and multilayer printed circuit boards, attempt to
comply with the environmental safety requirements and ROHS. All development stages are
additionally analyzed by the technical experts, which minimizes error risks.

SOFTWARE DESIGN
Elecsis Infotech aim is always to provide total solutions to our clients. Therefore, along with
embedded solutions we also develop system software for user and instrument interface to a PC
on multiple platforms and interface technologies.
They develop custom application software such as:
• Device Driver Development.
• Web enabling any product.
• Data base management.
• Interface to wireless modems etc.
Embedded Technology Labs is also proficient in development of device drivers for interfacing
custom hardware to computers with various operating systems. We can assist our clients in
custom protocol stack development as well. They venture into the deeply embedded space and

DEPT OF ECE, ICEAS 6


ARTIFICIAL INTELLIGENCE USING RASPBERRY PI 2021-22

locate the fault so that you don't have to. (Unless you want to, in which case, we can be your
guide.) If you only want to work in the upper levels of application space, we'll give you the
API's and the measurable milestones in their development that'll keep your overall project on
track. We're fast and efficient in our coding, and we want to give you the metrics you need to
track the progress of your embedded development.

1.7. CURRENT ELECSIS INFOTECH STATUS


Present the company is involved with developing the GPS Training system for two wheels
with our associated partners also more focusing on Corporate Trainings on AUTOMOTIVE
EMBEDDED and Focused on providing ASIC solutions that involves Design and Verification
IP’s And Functional Verification of Designs.

DEPT OF ECE, ICEAS 7


ARTIFICIAL INTELLIGENCE USING RASPBERRY PI 2021-22

Chapter 2.
INTRODUCTION
Artificial intelligence (AI) is the intelligence of machines and the branch of computer science
that aims to create it. AI textbooks define the field as "the study and design of intelligent
agents" where an intelligent agent is a system that perceives its environment and takes actions
that maximize its chances of success. John, who coined the term in 1956, defines it as "the
science and engineering of making intelligent machines." Artificial intelligence is a branch of
science which deals with helping machines find solutions to complex problems in a more
human-like fashion. This generally involves borrowing characteristics from human
intelligence, and applying these as algorithms in a computer friendly way. A more or less
flexible and efficient approach can be taken depending on the requirements established which
influences hoe artificial intelligent behavior appears. AI is generally associated with computer
science, but it has many important links with other fields such as math, psychology, biology,
philosophy, among many others. Our ability to combine knowledge from all these fields will
ultimately benefit our progress in quest of creating an intelligent artificial being.
Artificial intelligence includes:

• Games playing: programming computers to play games such as chess and checkers.

• Expert systems: programming computers to make decisions in real-life situations (for


example, some expert systems help doctors diagnose diseases based on symptoms).

• Natural language: programming computers to understand natural human languages.

• Neural networks: Systems that simulate intelligence by attempting to reproduce the


types of physical connections that occur in animal brains.

• Robotics: programming computers to see and hear and react to other sensory stimuli.

DEPT OF ECE, ICEAS 8


ARTIFICIAL INTELLIGENCE USING RASPBERRY PI 2021-22

OBJECTIVE
• To have an appreciation for and understanding of both the achievements of AI and the
theory underlying those achievements. To have an appreciation for the engineering
issues underlying the design of AI systems.

• To have a basic proficiency in a traditional AI language including an ability to write


simple to intermediate programs and an ability to understand code written in that
language.

• To have an understanding of the basic issues of knowledge representation and blind


and heuristic search, as well as an understanding of other topics such as minimax,
resolution, etc. that play an important role in AI programs.

• To have a basic understanding of some of the more advanced topics of AI such as


learning, natural language processing, agents and robotics, expert systems, and
planning.

DEPT OF ECE, ICEAS 9


ARTIFICIAL INTELLIGENCE USING RASPBERRY PI 2021-22

Chapter 3.
TASKS PERFORMED
3.1. ACCOMPLISHMENT OF WEEK 1
Tasks Assigned: Introduction to Raspberry Pi, Raspberry Pi 3 On-chip Hardware, Data
Science, Machine Learning, Deep Learning, Artificial intelligence.

3.1.1 INTRODUCTION TO RASPBERRY PI

• Raspberry Pi is a small single board computer. By connecting peripherals like


Keyboard, mouse, display to the Raspberry Pi, it will act as a mini personal computer.

• Raspberry Pi is popularly used for real time Image/Video Processing, IoT based
applications and Robotics applications.

• Raspberry Pi is slower than laptop or desktop but is still a computer which can provide
all the expected features or abilities, at a low power consumption.

• Raspberry Pi Foundation officially provides Debian based Raspbian OS. Also, they
provide NOOBS OS for Raspberry Pi. We can install several Third-Party versions of
OS like Ubuntu, Arch Linux, RISC OS, Windows 10 IOT Core, etc.

• Raspbian OS is official Operating System available for free to use. This OS is efficiently
optimized to use with Raspberry Pi. Raspbian have GUI which includes tools for
Browsing, Python programming, office, games, etc.

• We should use SD card (minimum 8 GB recommended) to store the OS (operating


System).

• Raspberry Pi is more than computer as it provides access to the on-chip hardware i.e.
GPIOs for developing an application. By accessing GPIO, we can connect devices like
LED, motors, sensors, etc. and can control them too.

DEPT OF ECE, ICEAS 10


ARTIFICIAL INTELLIGENCE USING RASPBERRY PI 2021-22

• It has ARM based Broadcom Processor SoC along with on-chip GPU (Graphics
Processing Unit).

• The CPU speed of Raspberry Pi varies from 700 MHz to 1.2 GHz. Also, it has on-board
SDRAM that ranges from 256 MB to 1 GB.

• Raspberry Pi also provides on-chip SPI, I2C, I2S and UART modules.

There are different versions of Raspberry Pi available as listed below:

1. Raspberry Pi 1 Model A
2. Raspberry Pi 1 Model A+
3. Raspberry Pi 1 Model B
4. Raspberry Pi 1 Model B+
5. Raspberry Pi 2 Model B
6. Raspberry Pi 3 Model B
7. Raspberry Pi Zero

Fig 3.1: Raspberry Pi

DEPT OF ECE, ICEAS 11


ARTIFICIAL INTELLIGENCE USING RASPBERRY PI 2021-22

Out of the above versions of Raspberry Pi, more prominently use Raspberry Pi and their
features are as follows:

Raspberry Pi Raspberry Pi 2 Raspberry Pi 3 Raspberry Pi


Features
Model B+ Model B Model B Zero

SoC BCM2835 BCM2836 BCM2837 BCM2835

Quad Cortex
CPU ARM11 Quad Cortex A7 ARM11
A53

Operating
700 MHz 900 MHz 1.2 GHz 1 GHz
Frequency

512 MB 1 GB 1 GB 512 MB
RAM
SDRAM SDRAM SDRAM SDRAM

250 MHz Video 250 MHz Video 400 MHz Video 250 MHz Video
GPU
Core IV Core IV Core IV Core IV

Storage Micro-SD Micro-SD Micro-SD Micro-SD

Ethernet Yes Yes Yes No

Wi-Fi and
Wireless No No No
Bluetooth

Table 3.1: Features of Different Version of Raspberry Pi

3.1.2 RASPBERRY PI 3 ON-CHIP HARDWARE

• HDMI (High-Definition Multimedia Interface): It is used for transmitting


uncompressed video or digital audio data to the Computer Monitor, Digital TV, etc.
Generally, this HDMI port helps to connect Raspberry Pi to the Digital television.
• CSI Camera Interface: CSI (Camera Serial Interface) interface provides a connection

DEPT OF ECE, ICEAS 12


ARTIFICIAL INTELLIGENCE USING RASPBERRY PI 2021-22

in between Broadcom Processor and Pi camera. This interface provides electrical


connections between two devices.

Fig 3.2: Raspberry Pi 3 On-chip Hardware

• DSI Display Interface: DSI (Display Serial Interface) Display Interface is used for
connecting LCD to the Raspberry Pi using 15-pin ribbon cable. DSI provides fast High-
resolution display interface specifically used for sending video data directly from GPU
to the LCD display.
• Composite Video and Audio Output: The composite Video and Audio output port
carries video along with audio signal to the Audio/Video systems.
• Power LED: It is a RED colored LED which is used for Power indication. This LED
will turn ON when Power is connected to the Raspberry Pi. It is connected to 5V directly
and will start blinking whenever the supply voltage drops below 4.63V.
• ACT PWR: ACT PWR is Green LED which shows the SD card activity.

DEPT OF ECE, ICEAS 13


ARTIFICIAL INTELLIGENCE USING RASPBERRY PI 2021-22

3.1.3. DATA SCIENCE


Data science is an interdisciplinary field that uses scientific methods, processes, algorithms
and systems to extract knowledge and insights from noisy, structured and unstructured data,
and apply knowledge and actionable insights from data across a broad range of application
domains. Data science is related to data mining, machine learning and big data. Data science
is a "concept to unify statistics, data analysis, informatics, and their related methods" in order
to "understand and analyses actual phenomena" with data. It uses techniques and theories
drawn from many fields within the context of mathematics, statistics, computer science,
information science, and domain knowledge. However, data science is different from
computer science and information science. Turing Award winner Jim Gray imagined data
science as a "fourth paradigm" of science (empirical, theoretical, computational, and now
data-driven) and asserted that "everything about science is changing because of the impact of
information technology" and the data deluge.

3.1.4. MACHINE LEARNING (ML)


Machine learning (ML) is the study of computer algorithms that can improve automatically
through experience and by the use of data. It is seen as a part of artificial intelligence. Machine
learning algorithms build a model based on sample data, known as "training data", in order to
make predictions or decisions without being explicitly programmed to do so. Machine learning
algorithms are used in a wide variety of applications, such as in medicine, email filtering,
speech recognition, and computer vision, where it is difficult or unfeasible to develop
conventional algorithms to perform the needed tasks.
A subset of machine learning is closely related to computational statistics, which focuses on
making predictions using computers; but not all machine learning is statistical learning. The
study of mathematical optimization delivers methods, theory and application domains to the
field of machine learning. Data mining is a related field of study, focusing on exploratory data
analysis through unsupervised learning. Some implementations of machine learning use data
and neural networks in a way that mimics the working of a biological brain. In its application

DEPT OF ECE, ICEAS 14


ARTIFICIAL INTELLIGENCE USING RASPBERRY PI 2021-22

across business problems, machine learning is also referred to as predictive analytics.

3.1.5. DEEP LEARNING


Deep learning (also known as deep structured learning) is part of a broader family of machine
learning methods based on artificial neural networks with representation learning. Learning
can be supervised, semi-supervised or unsupervised. Deep-learning architectures such as deep
neural networks, deep belief networks, deep reinforcement learning, recurrent neural networks
and convolutional neural networks have been applied to fields including computer vision,
speech recognition, natural language processing, machine translation, bioinformatics, drug
design, medical image analysis, material inspection and board game programs, where they
have produced results comparable to and in some cases surpassing human expert performance.

DEPT OF ECE, ICEAS 15


ARTIFICIAL INTELLIGENCE USING RASPBERRY PI 2021-22

Artificial neural networks (ANNs) were inspired by information processing and distributed
communication nodes in biological systems. ANNs have various differences from biological
brains. Specifically, neural networks tend to be static and symbolic, while the biological brain
of most living organisms is dynamic (plastic) and analogue. The adjective "deep" in deep
learning refers to the use of multiple layers in the network. Early work showed that a linear
perceptron cannot be a universal classifier, but that a network with a non-polynomial activation
function with one hidden layer of unbounded width can. Deep learning is a modern variation
which is concerned with an unbounded number of layers of bounded size, which permits
practical application and optimized implementation, while retaining theoretical universality
under mild conditions. In deep learning the layers are also permitted to be heterogeneous and
to deviate widely from biologically informed connectionist models, for the sake of efficiency,
trainability and understandability, whence the "structured" part.

3.1.6. ARTIFICIAL INTELLIGENCE


Artificial intelligence (AI) is intelligence demonstrated by machines, as opposed to the natural
intelligence displayed by humans or animals. Leading AI textbooks define the field as the
study of "intelligent agents": any system that perceives its environment and takes actions that
maximize its chance of achieving its goals. Some popular accounts use the term "artificial
intelligence" to describe machines that mimic "cognitive" functions that humans associate with
the human mind, such as "learning" and "problem solving", however this definition is rejected
by major AI researchers.
AI applications include advanced web search engines (i.e., Google), recommendation systems
(used by YouTube, Amazon and Netflix), understanding human speech (such as Siri or Alexa),
self-driving cars (e.g., Tesla), and competing at the highest level in strategic game systems
(such as chess and go), As machines become increasingly capable, tasks considered to require
"intelligence" are often removed from the definition of AI, a phenomenon known as the AI
effect. For instance, optical character recognition is frequently excluded from things
considered to be AI, having become a routine technology.

DEPT OF ECE, ICEAS 16


ARTIFICIAL INTELLIGENCE USING RASPBERRY PI 2021-22

Artificial intelligence was founded as an academic discipline in 1956, and in the years since
has experienced several waves of optimism, followed by disappointment and the loss of
funding (known as an "AI winter"), followed by new approaches, success and renewed
funding. AI research has tried and discarded many different approaches during its lifetime,
including simulating the brain, modelling human problem solving, formal logic, large
databases of knowledge and imitating animal behavior. In the first decades of the 21st century,
highly mathematical statistical machine learning has dominated the field, and this technique
has proved highly successful, helping to solve many challenging problems throughout industry
and academia.
The various sub-fields of AI research are centered around particular goals and the use of
particular tools. The traditional goals of AI research include reasoning, knowledge
representation, planning, learning, natural language processing, perception and the ability to
move and manipulate objects. General intelligence (the ability to solve an arbitrary problem)
is among the field's long-term goals. To solve these problems, AI researchers use versions of
search and mathematical optimization, formal logic, artificial neural networks, and methods
based on statistics, probability and economics. AI also draws upon computer science,
psychology, linguistics, philosophy, and many other fields.

The field was founded on the assumption that human intelligence "can be so precisely
described that a machine can be made to simulate it". This raises philosophical arguments
about the mind and the ethics of creating artificial beings endowed with human-like
intelligence. These issues have been explored by myth, fiction and philosophy since antiquity.

DEPT OF ECE, ICEAS 17


ARTIFICIAL INTELLIGENCE USING RASPBERRY PI 2021-22

3.2. ACCOMPLISHMENT OF WEEK 2


Task Assigned: Introduction to Virtual Network Computing (VNC), blinking of LED,
blinking of series of LED from left to right and vice versa, LCD and IR Object detection.

3.2.1. VIRTUAL NETWORK COMPUTING (VNC)


VNC stands for Virtual Network Computing. It is a cross-platform screen sharing system that
was created to remotely control another computer. This means that a computer’s screen,
keyboard, and mouse can be used from a distance by a remote user from a secondary device
as though they were sitting right in front of it. VNC works on a client/server model. A server
component is installed on the remote computer (the one you want to control), and a VNC
viewer, or client, is installed on the device you want to control from. This can include another
computer, a tablet, or a mobile phone. When the server and viewer are connected, the server
transmits a copy of the remote computer’s screen to the viewer. Not only can the remote user
see everything on the remote computer’s screen, but the program also allows for keyboard and
mouse commands to work on the remote computer from afar, so the connected user has full
control (after being granted permission from the remote computer. VNC was created in
Cambridge in the late 1990s by the founders of Real VNC, and was commercialized in 2002
when the company was established.

VNC SERVER
A server is a piece of computer hardware or software that provides capabilities for other
programs called “clients.” This is called the client-server model, whereas a server can provide
services such as data or resource sharing to one or multiple clients. One server can serve
multiple clients in this way, and one single client can use multiple servers. A client will send
a request to a server, which then sends a response back to the client. A computer with VNC
Server software installed can be accessed and controlled from a different device in a different
location. The software allows a broadcast of the device desktop to a secondary device with

DEPT OF ECE, ICEAS 18


ARTIFICIAL INTELLIGENCE USING RASPBERRY PI 2021-22

VNC Viewer installed. Connected VNC Viewer users send a request, and then (with
permission) can see the same thing as the person sitting in front of the remote computer.

VNC VIEWER
A viewer, on the other hand, is a program that renders the contents of a digital file on screen.
VNC Viewer is used for local computers and mobile devices you want to control from. A
device such as a computer, tablet, or smart phone with VNC Viewer software installed can
access and take control of a computer in another location. It is a graphical desktop sharing
system that allows a user to remotely control the desktop of a remote computer (running VNC
Server) from your device, and it transmits the keyboard and mouse or touch events to VNC
Server, so that once you are connected, you have control over the computer you’ve accessed.
If you’re using your mobile phone, for example, you would be able to use the computer you’ve
remotely accessed as though you were sitting right in front of it.

VNC CONNECT REMOTE ACCESS SOFTWARE: THE EVOLUTION OF VNC


In 2016, Real VNC launched their latest VNC-based remote access product: VNC Connect.
This software combines the convenience of a cloud service with the flexibility of offline
connectivity (also known as direct) and provides an optimized strategy for every size business.
Since its initial release, the product has continued to evolve, with features such as high-speed
streaming and remote audio being added to the mix, along with continual tweaks to further
refine the product to meet the needs of our customers. VNC Connects key features include
intuitive remote control, cross-platform support, attended and unattended access, file transfer,
multilingual support, online team management and virtual desktop management under Linux.
Its sessions are encrypted end-to-end using up to 256-bit AES encryption providing multi-
factor authentication, single-sign on (SSO), granular access control and rich session
permissions.

DEPT OF ECE, ICEAS 19


ARTIFICIAL INTELLIGENCE USING RASPBERRY PI 2021-22

3.2.2. BLINKING OF LED

Fig 3.3: LED


A light-emitting diode (LED) is a semiconductor light source that emits light when current
flows through it. Electrons in the semiconductor recombine with electron holes, releasing
energy in the form of photons. The color of the light (corresponding to the energy of the
photons) is determined by the energy required for electrons to cross the band gap of the
semiconductor. White light is obtained by using multiple semiconductors or a layer of light-
emitting phosphor on the semiconductor device.

SOFTWARE CODE

#define led 5;
void setup( )
{
pinMode(5, OUTPUT);
}
void loop ( )
{
digitalWrite (5, HIGH);
delay (5000);
digitalWrite (5, LOW);
delay (3000);
}

DEPT OF ECE, ICEAS 20


ARTIFICIAL INTELLIGENCE USING RASPBERRY PI 2021-22

FINAL OUTPUT

Fig 3.4: LED Interfaced to Raspberry Pi

3.2.3. BLINKING OF EVEN AND ODD LED’S


SOFTWARE CODE

import RPi.GPIO as GPIO


from time import sleep
LED0 = 8
LED1 = 10
LED2 = 11
LED3 = 12
LED4 = 13
LED5 = 15
GPIO.setmode(GPIO.BOARD)
GPIO.setup(LED0,GPIO.OUT)
GPIO.setup(LED1,GPIO.OUT)
GPIO.setup(LED2,GPIO.OUT)
GPIO.setup(LED3,GPIO.OUT)
GPIO.setup(LED4,GPIO.OUT)
GPIO.setup(LED5,GPIO.OUT)

while True:
GPIO.output(8,GPIO.HIGH)
GPIO.output(11,GPIO.HIGH)
GPIO.output(13,GPIO.HIGH)
GPIO.output(10,GPIO.LOW)
GPIO.output(12,GPIO.LOW)
GPIO.output(15,GPIO.LOW)

DEPT OF ECE, ICEAS 21


ARTIFICIAL INTELLIGENCE USING RASPBERRY PI 2021-22

sleep(1)
GPIO.output(10,GPIO.HIGH)
GPIO.output(12,GPIO.HIGH)
GPIO.output(15,GPIO.HIGH)
GPIO.output(8,GPIO.LOW)
GPIO.output(11,GPIO.LOW)
GPIO.output(13,GPIO.LOW)
sleep(1)

FINAL OUTPUT

Fig 3.5: Blinking of Even and ODD LED’s

3.2.4. INTERFACING OF LCD & PI CAM TO CAPTURE AND SAVE IMAGES

LCD
LCD (Liquid Crystal Display) is a type of flat panel display which uses liquid crystals in its
primary form of operation. LEDs have a large and varying set of use cases for consumers and
businesses, as they can be commonly found in smartphones, televisions, computer monitors
and instrument panels. LCDs were a big leap in terms of the technology they replaced, which
include light-emitting diode (LED) and gas-plasma displays.

DEPT OF ECE, ICEAS 22


ARTIFICIAL INTELLIGENCE USING RASPBERRY PI 2021-22

LCDs allowed displays to be much thinner than cathode ray tube (CRT) technology. LCDs
consume much less power than LED and gas-display displays because they work on the
principle of blocking light rather than emitting it. Where an LED emits light, the liquid crystals
in an LCD produces an image using a backlight. As LCDs have replaced older display
technologies, LCDs have begun being replaced by new display technologies such as OLEDs.

Fig 3.6: LCD display.


PI CAM

This 5-megapixel sensor with OV5647 camera module is capable of 1080p video and still
images that connect directly to your Raspberry Pi. This is the plug-and-play-compatible latest
version of the Raspbian operating system, making it perfect for time-lapse photography,
recording video, motion detection and security applications. Connect the included ribbon cable
to the CSI (Camera Serial Interface) port on your Raspberry Pi, and you are good to go! The
board itself is tiny, at around 25mm x 23mm x 9mm and weighing in at just over 3g, making
it perfect for mobile or other applications where size and weight are important. The sensor has
a native resolution of 5 megapixel, and has a fixed focus lens on board. In terms of still images,
the camera is capable of 2592 x 1944-pixel static images, and also supports 1080p30, 720p60
and 640x480p90 video.

DEPT OF ECE, ICEAS 23


ARTIFICIAL INTELLIGENCE USING RASPBERRY PI 2021-22

Fig 3.7: PI Cam Interfaced with Raspberry Pi.

SOFTWARE CODE

from picamera import PiCamera


import RPi.GPIO as GPIO
from time import sleep

# Define GPIO to LCD mapping


LCD_RS = 16
LCD_E = 12
LCD_D4 = 11
LCD_D5 = 10
LCD_D6 = 7
LCD_D7 = 8
IR = 18

# Define some device constants


LCD_WIDTH = 16 # Maximum characters per line
LCD_CHR = True
LCD_CMD = False

LCD_LINE_1 = 0x80 # LCD RAM address for the 1st line


LCD_LINE_2 = 0xC0 # LCD RAM address for the 2nd line

# Timing constants

DEPT OF ECE, ICEAS 24


ARTIFICIAL INTELLIGENCE USING RASPBERRY PI 2021-22

E_PULSE = 0.0005
E_DELAY = 0.0005
def main():
# Main program block
GPIO.setwarnings(False)
GPIO.setmode(GPIO.BOARD)
GPIO.setup(IR, GPIO.IN)
GPIO.setup(LCD_E, GPIO.OUT) # E
GPIO.setup(LCD_RS, GPIO.OUT) # RS
GPIO.setup(LCD_D4, GPIO.OUT) # DB4
GPIO.setup(LCD_D5, GPIO.OUT) # DB5
GPIO.setup(LCD_D6, GPIO.OUT) # DB6
GPIO.setup(LCD_D7, GPIO.OUT) # DB7

# Initialise display
lcd_init()
cam = PiCamera()
while True:
a = GPIO.input(18)
if a == False:
# Send some test
lcd_string(" OBJECT ",LCD_LINE_1)
lcd_string(" DETECTED ",LCD_LINE_2)
sleep(2)
lcd_display(0x01,LCD_CMD)

cam.start_preview()
sleep(2)
cam.capture("Desktop/Demo1.png")
cam.stop_preview()

def lcd_init():
lcd_display(0x28,LCD_CMD) # Selecting 4 - bit mode with two rows
lcd_display(0x0C,LCD_CMD) # Display On,Cursor Off, Blink Off
lcd_display(0x01,LCD_CMD) # Clear display

sleep(E_DELAY)

def lcd_display(bits, mode):


# Send byte to data pins
# bits = data
# mode = True for character

DEPT OF ECE, ICEAS 25


ARTIFICIAL INTELLIGENCE USING RASPBERRY PI 2021-22

# False for command

GPIO.output(LCD_RS, mode) # RS

# High bits
GPIO.output(LCD_D4, False)
GPIO.output(LCD_D5, False)
GPIO.output(LCD_D6, False)
GPIO.output(LCD_D7, False)
if bits&0x10==0x10:
GPIO.output(LCD_D4, True)
if bits&0x20==0x20:
GPIO.output(LCD_D5, True)
if bits&0x40==0x40:
GPIO.output(LCD_D6, True)
if bits&0x80==0x80:
GPIO.output(LCD_D7, True)

# Toggle 'Enable' pin


lcd_toggle_enable()

# Low bits
GPIO.output(LCD_D4, False)
GPIO.output(LCD_D5, False)
GPIO.output(LCD_D6, False)
GPIO.output(LCD_D7, False)
if bits&0x01==0x01:
GPIO.output(LCD_D4, True)
if bits&0x02==0x02:
GPIO.output(LCD_D5, True)
if bits&0x04==0x04:
GPIO.output(LCD_D6, True)
if bits&0x08==0x08:
GPIO.output(LCD_D7, True)

# Toggle 'Enable' pin


lcd_toggle_enable()

def lcd_toggle_enable():
# Toggle enable
sleep(E_DELAY)
GPIO.output(LCD_E, True)

DEPT OF ECE, ICEAS 26


ARTIFICIAL INTELLIGENCE USING RASPBERRY PI 2021-22

sleep(E_PULSE)
GPIO.output(LCD_E, False)
sleep(E_DELAY)

def lcd_string(message,line):
# Send string to display
message = message.ljust(LCD_WIDTH," ")

lcd_display(line, LCD_CMD)

for i in range(LCD_WIDTH):
lcd_display(ord(message[i]),LCD_CHR)

if __name__ == '__main__':

try:
main()
except KeyboardInterrupt:
pass
finally:
lcd_display(0x01, LCD_CMD)
GPIO.cleanup()
cam.release()

FINAL OUTPUT

Fig 3.8: Interfacing of LCD & PI Cam To Capture and Save Images.

DEPT OF ECE, ICEAS 27


ARTIFICIAL INTELLIGENCE USING RASPBERRY PI 2021-22

3.3. ACCOMPLISHMENT OF WEEK 3


TASK ASSIGNED: DC motor to rotate clockwise and anti-clockwise using switch, GSM
interfaced with Raspberry Pi to make a call, Smoke sensor interfaced with Raspberry Pi for
detection of smoke.

3.3.1. DC MOTOR TO ROTATE CLOCKWISE AND ANTI-CLOCKWISE USING


SWITCH

DC MOTOR
A DC motor is any motor within a class of electrical machines whereby direct current electrical
power is converted into mechanical power. Most often, this type of motor relies on forces that
magnetic fields produce. Regardless of the type, DC motors have some kind of internal
mechanism, which is electronic or electromechanical. In both cases, the direction of current
flow in part of the motor is changed periodically. The speed of a DC motor is controlled using
a variable supply voltage or by changing the strength of the current within its field windings.
While smaller DC motors are commonly used in the making of appliances, tools, toys, and
automobile mechanisms, such as electric car seats, larger DC motors are used in hoists,
elevators, and electric vehicles. A 12v DC motor is small and inexpensive, yet powerful
enough to be used for many applications. Because choosing the right DC motor for a specific
application can be challenging, it is important to work with the right company. A prime
example is MET Motors, which has been creating high-quality permanent magnet DC motors
for more than 45 years.

Fig 3.9: DC Motor

DEPT OF ECE, ICEAS 28


ARTIFICIAL INTELLIGENCE USING RASPBERRY PI 2021-22

SOFTWARE CODE

import RPi.GPIO as GPIO


from time import sleep

GPIO.setmode(GPIO.BOARD)
GPIO.setup(22,GPIO.IN,pull_up_down=GPIO.PUD_UP)

GPIO.setup(10,GPIO.OUT)
GPIO.setup(11,GPIO.OUT)
GPIO.setup(12,GPIO.OUT)
GPIO.setup(13,GPIO.OUT)
count=0
GPIO.output(10,GPIO.LOW)
GPIO.output(12,GPIO.LOW)
GPIO.output(11,GPIO.LOW)
GPIO.output(13,GPIO.LOW)

def forward():
GPIO.output(10,GPIO.HIGH)
GPIO.output(12,GPIO.HIGH)
GPIO.output(11,GPIO.LOW)
GPIO.output(13,GPIO.LOW)

def backward():
GPIO.output(11,GPIO.HIGH)
GPIO.output(13,GPIO.HIGH)
GPIO.output(10,GPIO.LOW)
GPIO.output(12,GPIO.LOW)
def left():
GPIO.output(10,GPIO.HIGH)
GPIO.output(13,GPIO.HIGH)
GPIO.output(11,GPIO.LOW)
GPIO.output(12,GPIO.LOW)

def right():
GPIO.output(11,GPIO.HIGH)
GPIO.output(12,GPIO.HIGH)
GPIO.output(10,GPIO.LOW)
GPIO.output(13,GPIO.LOW)

def stop():

DEPT OF ECE, ICEAS 29


ARTIFICIAL INTELLIGENCE USING RASPBERRY PI 2021-22

GPIO.output(10,GPIO.HIGH)
GPIO.output(12,GPIO.HIGH)
GPIO.output(11,GPIO.HIGH)
GPIO.output(13,GPIO.HIGH)

while True:
a = GPIO.input(22)
if a == True:
count=count+1
sleep(1)
if count==1:
forward()
if count==2:
for i in range(2):
backward()

if count==3:
for i in range(3):
left()

if count==4:
for i in range(4):
right()

if count==5:
count = 0
for i in range(5):
stop()

DEPT OF ECE, ICEAS 30


ARTIFICIAL INTELLIGENCE USING RASPBERRY PI 2021-22

FINAL OUTPUT

Fig 3.10: DC Motor Interfaced with Raspberry Pi to Rotate Clockwise and Anti-
Clockwise Using Switch.

3.3.2. GSM INTERFACED WITH RASPBERRY PI TO MAKE A CALL

GSM
A GSM modem or GSM module is a device that uses GSM mobile telephone technology to
provide a wireless data link to a network. GSM modems are used in mobile telephones and
other equipment that communicates with mobile telephone networks. They use SIMs to
identify their device to the network.

DEPT OF ECE, ICEAS 31


ARTIFICIAL INTELLIGENCE USING RASPBERRY PI 2021-22

Fig 3.11: GSM Module.

SOFTWARE CODE

import serial
import RPi.GPIO as GPIO
import os, time

GPIO.setmode(GPIO.BOARD)

# Enable Serial Communication


port = serial.Serial("/dev/ttyUSB0", baudrate=9600, timeout=1)

# Transmitting AT Commands to the Modem


# '\r\n' indicates the Enter key

port.write(str.encode('AT'+'\r\n'))
rcv = port.read(10)
print (rcv)
time.sleep(1)

port.write(str.encode('ATE0'+'\r\n')) # Disable the Echo


rcv = port.read(10)
print (rcv)
time.sleep(1)

port.write(str.encode('AT+CMGF=1'+'\r\n')) # Select Message format as Text mode


rcv = port.read(10)
print (rcv)

DEPT OF ECE, ICEAS 32


ARTIFICIAL INTELLIGENCE USING RASPBERRY PI 2021-22

time.sleep(1)

port.write(str.encode('AT+CNMI=2,1,0,0,0'+'\r\n')) # New SMS Message Indications


rcv = port.read(10)
print (rcv)
time.sleep(1)

port.write(str.encode('AT'+'\r'))
print(port.read(20))
time.sleep(1)
port.write(str.encode('ATE0\r'))
print(port.read(10))
port.write(str.encode('ATD9066773211;\r'))
port.write(str.encode('ATH\r'))
time.sleep(10)

FINAL OUTPUT

Fig 3.12: GSM Interfaced with Raspberry Pi to Make a Call.

DEPT OF ECE, ICEAS 33


ARTIFICIAL INTELLIGENCE USING RASPBERRY PI 2021-22

3.3.3. SMOKE SENSOR INTERFACED WITH RASPBERRY PI FOR DETECTION


OF SMOKE

SMOKE SENSOR

A smoke detector or sensor is a device that senses smoke, typically as an indicator of fire.
Commercial smoke detectors issue a signal to a fire alarm control panel as part of a fire alarm
system. Household smoke detectors, also known as smoke alarms, generally issue an audible
or visual alarm from the detector itself or several detectors if there are multiple devices
interlinked. Smoke detectors are usually housed in plastic enclosures, typically shaped like a
disk about 150 millimetres (6 in) in diameter and 25 millimetres (1 in) thick, but shape and
size vary. Smoke can be detected either optically (photoelectric) or by physical process
(ionization). Detectors may use one or both sensing methods. Sensitive alarms can be used to
detect and deter smoking in banned areas. Smoke detectors in large commercial and industrial
buildings are usually connected to a central fire alarm system. Domestic smoke detectors range
from individual battery-powered units to several interlinked units with battery backup. With
interlinked units, if any of them detects smoke, all of the alarms will trigger. This happens
even if household power has gone out.

Fig 3.13: Smoke/Gas Sensor.

DEPT OF ECE, ICEAS 34


ARTIFICIAL INTELLIGENCE USING RASPBERRY PI 2021-22

SOFTWARE CODE

import RPi.GPIO as GPIO


GPIO.setmode(GPIO.BOARD)
GPIO.setup(8,GPIO.IN)
GPIO.setup(10,GPIO.OUT)

while True:
if(GPIO.input(8)==0):
GPIO.output(10,GPIO.HIGH)
else:
GPIO.output(10,GPIO.LOW)

FINAL OUTPUT

Fig 3.14: Detection of Smoke Using Smoke Sensor Interfaced with Raspberry Pi.

DEPT OF ECE, ICEAS 35


ARTIFICIAL INTELLIGENCE USING RASPBERRY PI 2021-22

3.4. ACCOMPLISHMENT OF WEEK 4

Mini Project: Project on Automatic Stopping of Robot using IR Sensor, Smoke Sensor
Technology.

3.4.1. AUTOMATIC STOPPING OF ROBOT USING IR SENSOR, SMOKE SENSOR


TECHNOLOGY

HARDWARE REQUIREMENTS

• Raspberry Pi.
• IR Sensor.
• Smoke Sensor.
• GSM module.
• DC motor.
• Motor driver.
• Wires for connectivity.

SOFTWARE REQUIREMENTS

• Python 3.6.

SOFTWARE CODE

import serial
import RPi.GPIO as GPIO
import os, time

GPIO.setmode(GPIO.BOARD)
GPIO.setup(5,GPIO.OUT)#DC
GPIO.setup(7,GPIO.OUT)
GPIO.setup(15,GPIO.OUT)
GPIO.setup(16,GPIO.OUT)
GPIO.output(5,GPIO.LOW)

DEPT OF ECE, ICEAS 36


ARTIFICIAL INTELLIGENCE USING RASPBERRY PI 2021-22

GPIO.output(7,GPIO.LOW)
GPIO.output(15,GPIO.LOW)
GPIO.output(16,GPIO.LOW)

GPIO.setup(11,GPIO.IN)#IR input

GPIO.setup(12,GPIO.IN) #smoke

# Enable Serial Communication


port = serial.Serial("/dev/ttyUSB0", baudrate=9600, timeout=1)

# Transmitting AT Commands to the Modem


# '\r\n' indicates the Enter key
def forward():
GPIO.output(5,GPIO.HIGH)
GPIO.output(15,GPIO.HIGH)
GPIO.output(7,GPIO.LOW)
GPIO.output(16,GPIO.LOW)

def stop():
GPIO.output(5,GPIO.HIGH)
GPIO.output(15,GPIO.HIGH)
GPIO.output(7,GPIO.HIGH)
GPIO.output(16,GPIO.HIGH)

port.write(str.encode('AT'+'\r\n'))
rcv = port.read(10)
print (rcv)
time.sleep(1)

port.write(str.encode('ATE0'+'\r\n')) # Disable the Echo


rcv = port.read(10)
print (rcv)
time.sleep(1)

port.write(str.encode('AT+CMGF=1'+'\r\n')) # Select Message format as Text mode


rcv = port.read(10)
print (rcv)
time.sleep(1)

port.write(str.encode('AT+CNMI=2,2,0,0,0'+'\r\n')) # New SMS Message Indications


rcv = port.read(10)

DEPT OF ECE, ICEAS 37


ARTIFICIAL INTELLIGENCE USING RASPBERRY PI 2021-22

print (rcv)
time.sleep(1)

port.write(str.encode('AT+CMGL="ALL"\r\n'))
rcv = port.read(10)
print (rcv)
time.sleep(1)

while True:
data = port.readline()
data = data.decode('utf-8').rstrip()
#print(data)
if data == 'go':
print('msg recved')
forward()
while True:
data = port.readline()
data = data.decode('utf-8').rstrip()
a = GPIO.input(11)
if a == False:
stop()
time.sleep(1)
forward()

if(GPIO.input(12)==0):
stop()
time.sleep(1)
forward()

if data == 'stop':
print('stopped')
stop()
break

DEPT OF ECE, ICEAS 38


ARTIFICIAL INTELLIGENCE USING RASPBERRY PI 2021-22

FINAL OUTPUT

Fig 3.15: Interfacing of IR Sensor, Smoke Sensor, GSM Module and DC Motor with
Raspberry Pi to Stop Motor.

DEPT OF ECE, ICEAS 39


ARTIFICIAL INTELLIGENCE USING RASPBERRY PI 2021-22

Chapter 4.
CONCLUSION
The internship opportunity I had with Elecsis Infotech was a great chance for learning the
global technologies and also learnt the advanced works and how the Elecsis Infotech gave
important role in the Technologies. Basically, the internship was on Artificial intelligence
using Raspberry Pi where we learnt about the projects such LED, IR sensor, LCD, PI Cam,
GSM and Relay. Which help me out in gaining knowledge. We had an opportunity to explore
our ideas about Robotics. I am thankful to everyone who made this internship possible.

FUTURE SCOPE
In the next 10 years technologies in narrow fields such as speech recognition will continue to
improve and will reach human levels. In 10 years, AI will be able to communicate with humans
in unstructured English using text or voice, navigate (not perfectly) in an unprepared
environment and will have some rudimentary common sense (and domain-specific
intelligence). We will recreate some parts of the human (animal) brain in silicon. The
feasibility of this is demonstrated by tentative hippocampus experiments in rats. There are two
major projects aiming for human brain simulation, Cortex and IBM Blue Brain. There will be
an increasing number of practical applications based on digitally recreated aspects human
intelligence, such as cognition, perception, rehearsal learning, or learning by repetitive
practice. Robots take over everyone’s jobs: The development of meaningful artificial
intelligence will require that machines acquire some variant of human consciousness. Systems
that do not possess self-awareness and sentience will at best always be very brittle. Without
these uniquely human characteristics, truly useful and powerful.

DEPT OF ECE, ICEAS 40

You might also like