Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
0% found this document useful (0 votes)
0 views

IoT-Based Missile Detection and Direction Control System using ESP32

The document outlines a project focused on an IoT-based missile detection and directional control system utilizing the ESP32 microcontroller and various sensors for environmental monitoring and obstacle detection. It details the embedded systems concept, hardware and software descriptions, and the project's implementation, advantages, and future prospects. The thesis is structured into chapters covering introduction, embedded systems, hardware and software descriptions, project details, and results/conclusions.
Copyright
© © All Rights Reserved
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
0 views

IoT-Based Missile Detection and Direction Control System using ESP32

The document outlines a project focused on an IoT-based missile detection and directional control system utilizing the ESP32 microcontroller and various sensors for environmental monitoring and obstacle detection. It details the embedded systems concept, hardware and software descriptions, and the project's implementation, advantages, and future prospects. The thesis is structured into chapters covering introduction, embedded systems, hardware and software descriptions, project details, and results/conclusions.
Copyright
© © All Rights Reserved
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
You are on page 1/ 89

INDEX

TOPICS

 Certificates………………………………………………………
 Acknowledgement…………………………………………........

CHAPTER 1: INTRODUCTION

1.1 Introduction of the project ………………………………

1.2 Project overview……………………………………………..

1.3 .Thesis……………………………………………

CHAPTER 2: EMBEDDED SYSTEMS

2.1 Introduction to embedded systems…………………………

2.2 Need of embedded systems……………………………………...

2.3 Explanation of embedded systems……………………………...

2.4 Applications of embedded systems……………………………

CHAPTER 3: HARDWARE DESCRIPTION

3.1 Introduction with block diagram………………………

3.2 Microcontroller……………………………………………….

3.3 Regulated power supply……………………………………...

3.4 LED indicator……….………………………………………...


3.5 ESP32 cam………………………………………………………...

3.6 Ultrasonic sensor.………………………………………………………

3.7 Dc motor………………………………………………………
3.8 Laser………………………………………………………….
3.9 Srevo………………………………………………………….

CHAPTER 4: SOFTWARE DESCRIPTION

4.1 Express PCB………………………………………………………

4.2 IDE Compiler…………………………………………………….

4.3 Proteus software………………………………………

4.4 Procedural steps for compilation, simulation and dumping…

CHAPTER 5: PROJECT DESCRIPTION

CHAPTER 6: ADVANTAGES, DISADVANTAGES AND APPLICATIONS

CHAPTER 7: RESULTS, CONCLUSION, FUTURE PROSPECTS

REFERENCES
CHAPTER 1: INTRODUCTION

1.1Introduction:

This project presents an IoT-based missile detection and directional control system using the
ESP32 microcontroller. The system integrates multiple sensors, including a DHT11 for
temperature and humidity monitoring, gas detection, and dual ultrasonic sensors for obstacle
detection and proximity sensing. A servo motor mimics a radar scanning mechanism, while
directional control is achieved through motor outputs. Real-time data and system status are
accessible remotely via a Telnet server. The system aims to serve as a low-cost prototype for
automated surveillance and defensive response systems.

In today's world, smart surveillance and defense systems are essential for national security and
sensitive zone protection. This project implements a basic smart missile detection system
integrated with IoT functionalities. It uses an ESP32 controller to manage sensors, motor drivers,
and a servo-based scanning mechanism. The system transmits real-time data over Wi-Fi to a
connected Telnet client, allowing remote control of directional movements and monitoring of
environmental conditions and threats like gas presence or object proximity.

1.2 Project Overview:

An embedded system is a combination of software and hardware to perform


a dedicated task. Some of the main devices used in embedded products are Microprocessors and
Microcontrollers.
Microprocessors are commonly referred to as general purpose processors as
they simply accept the inputs, process it and give the output. In contrast, a microcontroller not
only accepts the data as inputs but also manipulates it, interfaces the data with various devices,
controls the data and thus finally gives the result.

The “IoT-Based Missile Detection and Direction Control System using ESP32 ” using
ATMEGA328 microcontroller is an exclusive project which is used to switch on/off the
electrical devices using mobile phone.

We can use this project to reduce deaths due current shocks at homes, industries, fields and also
to on/off the devices from any place in the world.

1.3 Thesis:

The thesis explains the implementation of “IoT-Based Missile Detection and


Direction Control System using ESP32 ” using ATMEGA328 microcontroller. The

organization of the thesis is explained here with:

Chapter 1 Presents introduction to the overall thesis and the overview of the project. In the
project overview a brief introduction of IOT, SR04, laser, servo and DC motor system and its
applications are discussed.

Chapter 2 Presents the topic embedded systems. It explains the about what is embedded
systems, need for embedded systems, explanation of it along with its applications.

Chapter 3 Presents the hardware description. It deals with the block diagram of the project
and explains the purpose of each block. In the same chapter the explanation of microcontrollers,
ESP32 cam, Esp8266, power supplies are considered.

Chapter 4 Presents the software description. It explains the implementation of the project using
Arduino studio software.

Chapter 5 Presents the project description along with IOT decoder interfacing to
microcontroller.

Chapter 6 Presents the advantages, disadvantages and applications of the project.


Chapter 7 Presents the results, conclusion and future scope of the project.

CHAPTER 2: EMBEDDED SYSTEMS

2. Embedded Systems:

An embedded system is a computer system designed to perform one or a few


dedicated functions often with real-time computing constraints. It is embedded as part of a
complete device often including hardware and mechanical parts. By contrast, a general-purpose
computer, such as a personal computer (PC), is designed to be flexible and to meet a wide range
of end-user needs. Embedded systems control many devices in common use today.

Embedded systems are controlled by one or more main processing cores that are
typically either microcontrollers or digital signal processors (DSP). The key characteristic,
however, is being dedicated to handle a particular task, which may require very powerful
processors. For example, air traffic control systems may usefully be viewed as embedded, even
though they involve mainframe computers and dedicated regional and national networks between
airports and radar sites. (Each radar probably includes one or more embedded systems of its
own.)

Since the embedded system is dedicated to specific tasks, design engineers can
optimize it to reduce the size and cost of the product and increase the reliability and
performance. Some embedded systems are mass-produced, benefiting from economies of scale.

Physically embedded systems range from portable devices such as digital watches
and MP3 players, to large stationary installations like traffic lights, factory controllers, or the
systems controlling nuclear power plants. Complexity varies from low, with a single
microcontroller chip, to very high with multiple units, peripherals and networks mounted inside a
large chassis or enclosure.
In general, "embedded system" is not a strictly definable term, as most systems
have some element of extensibility or programmability. For example, handheld computers share
some elements with embedded systems such as the operating systems and microprocessors which
power them, but they allow different applications to be loaded and peripherals to be connected.
Moreover, even systems which don't expose programmability as a primary feature generally need
to support software updates. On a continuum from "general purpose" to "embedded", large
application systems will have subcomponents at most points even if the system as a whole is
"designed to perform one or a few dedicated functions", and is thus appropriate to call
"embedded". A modern example of embedded system is shown in fig: 2.1.

Fig 2.1:A modern example of embedded system

Labeled parts include microprocessor (4), RAM (6), flash memory (7).Embedded
systems programming is not like normal PC programming. In many ways, programming for an
embedded system is like programming PC 15 years ago. The hardware for the system is usually
chosen to make the device as cheap as possible. Spending an extra dollar a unit in order to make
things easier to program can cost millions. Hiring a programmer for an extra month is cheap in
comparison. This means the programmer must make do with slow processors and low memory,
while at the same time battling a need for efficiency not seen in most PC applications. Below is a
list of issues specific to the embedded field.
2.1.1 History:

In the earliest years of computers in the 1930–40s, computers were sometimes


dedicated to a single task, but were far too large and expensive for most kinds of tasks performed
by embedded computers of today. Over time however, the concept of programmable controllers
evolved from traditional electromechanical sequencers, via solid state devices, to the use of
computer technology.

One of the first recognizably modern embedded systems was the Apollo Guidance
Computer, developed by Charles Stark Draper at the MIT Instrumentation Laboratory. At the
project's inception, the Apollo guidance computer was considered the riskiest item in the Apollo
project as it employed the then newly developed monolithic integrated circuits to reduce the size
and weight. An early mass-produced embedded system was the Automatics’ D-17 guidance
computer for the Minuteman missile, released in 1961. It was built from transistor logic and had
a hard disk for main memory. When the Minuteman II went into production in 1966, the D-17
was replaced with a new computer that was the first high-volume use of integrated circuits.

2.1.2 Tools:

Embedded development makes up a small fraction of total programming. There's


also a large number of embedded architectures, unlike the PC world where 1 instruction set rules,
and the Unix world where there's only 3 or 4 major ones. This means that the tools are more
expensive. It also means that they're lowering featured, and less developed. On a major
embedded project, at some point you will almost always find a compiler bug of some sort.
Debugging tools are another issue. Since you can't always run general programs
on your embedded processor, you can't always run a debugger on it. This makes fixing your
program difficult. Special hardware such as JTAG ports can overcome this issue in part.
However, if you stop on a breakpoint when your system is controlling real world hardware (such
as a motor), permanent equipment damage can occur. As a result, people doing embedded
programming quickly become masters at using serial IO channels and error message style
debugging.

2.1.3 Resources:

To save costs, embedded systems frequently have the cheapest processors that can
do the job. This means your programs need to be written as efficiently as possible. When dealing
with large data sets, issues like memory cache misses that never matter in PC programming can
hurt you. Luckily, this won't happen too often- use reasonably efficient algorithms to start, and
optimize only when necessary. Of course, normal profilers won't work well, due to the same
reason debuggers don't work well.
Memory is also an issue. For the same cost savings reasons, embedded systems
usually have the least memory they can get away with. That means their algorithms must be
memory efficient (unlike in PC programs, you will frequently sacrifice processor time for
memory, rather than the reverse). It also means you can't afford to leak memory. Embedded
applications generally use deterministic memory techniques and avoid the default "new" and
"malloc" functions, so that leaks can be found and eliminated more easily. Other resources
programmers expect may not even exist. For example, most embedded processors do not have
hardware FPUs (Floating-Point Processing Unit). These resources either need to be emulated in
software, or avoided altogether.
2.1.4 Real Time Issues:

Embedded systems frequently control hardware, and must be able to respond to


them in real time. Failure to do so could cause inaccuracy in measurements, or even damage
hardware such as motors. This is made even more difficult by the lack of resources available.
Almost all embedded systems need to be able to prioritize some tasks over others, and to be able
to put off/skip low priority tasks such as UI in favor of high priority tasks like hardware control.

2.2 Need For Embedded Systems:

The uses of embedded systems are virtually limitless, because every day new
products are introduced to the market that utilizes embedded computers in novel ways. In recent
years, hardware such as microprocessors, microcontrollers, and FPGA chips have become much
cheaper. So when implementing a new form of control, it's wiser to just buy the generic chip and
write your own custom software for it. Producing a custom-made chip to handle a particular task
or set of tasks costs far more time and money. Many embedded computers even come with
extensive libraries, so that "writing your own software" becomes a very trivial task indeed. From
an implementation viewpoint, there is a major difference between a computer and an embedded
system. Embedded systems are often required to provide Real-Time response. The main
elements that make embedded systems unique are its reliability and ease in debugging.
2.2.1 Debugging:
Embedded debugging may be performed at different levels, depending on the
facilities available. From simplest to most sophisticate they can be roughly grouped into the
following areas:
 Interactive resident debugging, using the simple shell provided by the embedded
operating system (e.g. Forth and Basic)
 External debugging using logging or serial port output to trace operation using either a
monitor in flash or using a debug server like the Remedy Debugger which even works for
heterogeneous multi core systems.
 An in-circuit debugger (ICD), a hardware device that connects to the microprocessor via
a JTAG or Nexus interface. This allows the operation of the microprocessor to be
controlled externally, but is typically restricted to specific debugging capabilities in the
processor.
 An in-circuit emulator replaces the microprocessor with a simulated equivalent,
providing full control over all aspects of the microprocessor.
 A complete emulator provides a simulation of all aspects of the hardware, allowing all of
it to be controlled and modified and allowing debugging on a normal PC.
 Unless restricted to external debugging, the programmer can typically load and run
software through the tools, view the code running in the processor, and start or stop its
operation. The view of the code may be as assembly code or source-code.
Because an embedded system is often composed of a wide variety of elements,
the debugging strategy may vary. For instance, debugging a software(and microprocessor)
centric embedded system is different from debugging an embedded system where most of the
processing is performed by peripherals (DSP, FPGA, co-processor). An increasing number of
embedded systems today use more than one single processor core. A common problem with
multi-core development is the proper synchronization of software execution. In such a case, the
embedded system design may wish to check the data traffic on the busses between the processor
cores, which requires very low-level debugging, at signal/bus level, with a logic analyzer, for
instance.
2.2.2 Reliability:

Embedded systems often reside in machines that are expected to run continuously
for years without errors and in some cases recover by themselves if an error occurs. Therefore
the software is usually developed and tested more carefully than that for personal computers, and
unreliable mechanical moving parts such as disk drives, switches or buttons are avoided.
Specific reliability issues may include:
 The system cannot safely be shut down for repair, or it is too inaccessible to repair.
Examples include space systems, undersea cables, navigational beacons, bore-hole
systems, and automobiles.
 The system must be kept running for safety reasons. "Limp modes" are less tolerable.
Often backups are selected by an operator. Examples include aircraft navigation, reactor
control systems, safety-critical chemical factory controls, train signals, engines on single-
engine aircraft.
 The system will lose large amounts of money when shut down: Telephone switches,
factory controls, bridge and elevator controls, funds transfer and market making,
automated sales and service.
A variety of techniques are used, sometimes in combination, to recover from
errors—both software bugs such as memory leaks, and also soft errors in the hardware:
 Watchdog timer that resets the computer unless the software periodically notifies the
watchdog
 Subsystems with redundant spares that can be switched over to
 software "limp modes" that provide partial function
 Designing with a Trusted Computing Base (TCB) architecture[6] ensures a highly secure
& reliable system environment
 An Embedded Hypervisor is able to provide secure encapsulation for any subsystem
component, so that a compromised software component cannot interfere with other
subsystems, or privileged-level system software. This encapsulation keeps faults from
propagating from one subsystem to another, improving reliability. This may also allow a
subsystem to be automatically shut down and restarted on fault detection.
 Immunity Aware Programming

2.3 Explanation of Embedded Systems:

2.3.1 Software Architecture:

There are several different types of software architecture in common use.


 Simple Control Loop:

In this design, the software simply has a loop. The loop calls subroutines, each of
which manages a part of the hardware or software.

 Interrupt Controlled System:

Some embedded systems are predominantly interrupt controlled. This means that
tasks performed by the system are triggered by different kinds of events. An interrupt could be
generated for example by a timer in a predefined frequency, or by a serial port controller
receiving a byte. These kinds of systems are used if event handlers need low latency and the
event handlers are short and simple.

Usually these kinds of systems run a simple task in a main loop also, but this task
is not very sensitive to unexpected delays. Sometimes the interrupt handler will add longer tasks
to a queue structure. Later, after the interrupt handler has finished, these tasks are executed by
the main loop. This method brings the system close to a multitasking kernel with discrete
processes.

 Cooperative Multitasking:

A non-preemptive multitasking system is very similar to the simple control loop


scheme, except that the loop is hidden in an API. The programmer defines a series of tasks, and
each task gets its own environment to “run” in. When a task is idle, it calls an idle routine,
usually called “pause”, “wait”, “yield”, “nop” (stands for no operation), etc.The advantages and
disadvantages are very similar to the control loop, except that adding new software is easier, by
simply writing a new task, or adding to the queue-interpreter.

 Primitive Multitasking:

In this type of system, a low-level piece of code switches between tasks or threads
based on a timer (connected to an interrupt). This is the level at which the system is generally
considered to have an "operating system" kernel. Depending on how much functionality is
required, it introduces more or less of the complexities of managing multiple tasks running
conceptually in parallel.
As any code can potentially damage the data of another task (except in larger
systems using an MMU) programs must be carefully designed and tested, and access to shared
data must be controlled by some synchronization strategy, such as message queues, semaphores
or a non-blocking synchronization scheme.

Because of these complexities, it is common for organizations to buy a real-time


operating system, allowing the application programmers to concentrate on device functionality
rather than operating system services, at least for large systems; smaller systems often cannot
afford the overhead associated with a generic real time system, due to limitations regarding
memory size, performance, and/or battery life.

 Microkernels And Exokernels:

A microkernel is a logical step up from a real-time OS. The usual arrangement is


that the operating system kernel allocates memory and switches the CPU to different threads of
execution. User mode processes implement major functions such as file systems, network
interfaces, etc.

In general, microkernels succeed when the task switching and intertask


communication is fast, and fail when they are slow. Exokernels communicate efficiently by
normal subroutine calls. The hardware and all the software in the system are available to, and
extensible by application programmers. Based on performance, functionality, requirement the
embedded systems are divided into three categories:

2.3.2 Stand Alone Embedded System:

These systems takes the input in the form of electrical signals from transducers or
commands from human beings such as pressing of a button etc.., process them and produces
desired output. This entire process of taking input, processing it and giving output is done in
standalone mode. Such embedded systems comes under standalone embedded systems

Eg: microwave oven, air conditioner etc..

2.3.3 Real-time embedded systems:


Embedded systems which are used to perform a specific task or operation in a
specific time period those systems are called as real-time embedded systems. There are two types
of real-time embedded systems.

 Hard Real-time embedded systems:

These embedded systems follow an absolute dead line time period i.e.., if the
tasking is not done in a particular time period then there is a cause of damage to the entire
equipment.

Eg: consider a system in which we have to open a valve within 30 milliseconds. If this
valve is not opened in 30 ms this may cause damage to the entire equipment. So in such cases we
use embedded systems for doing automatic operations.

 Soft Real Time embedded systems:

These embedded systems follow a relative dead line time period i.e.., if the task is
not done in a particular time that will not cause damage to the equipment.

Eg: Consider a TV remote control system ,if the remote control takes a few
milliseconds delay it will not cause damage either to the TV or to the remote control. These
systems which will not cause damage when they are not operated at considerable time period
those systems comes under soft real-time embedded systems.

2.3.4 Network communication embedded systems:

A wide range network interfacing communication is provided by using embedded


systems.

Eg:

 Consider a web camera that is connected to the computer with internet can be used
to spread communication like sending pictures, images, videos etc.., to another
computer with internet connection throughout anywhere in the world.

 Consider a web camera that is connected at the door lock.

Whenever a person comes near the door, it captures the image of a person and
sends to the desktop of your computer which is connected to internet. This gives an alerting
message with image on to the desktop of your computer, and then you can open the door lock
just by clicking the mouse.

Fig 2.2: Network communication embedded systems

2.3.5 Different types of processing units:

The central processing unit (c.p.u) can be any one of the following
microprocessor, microcontroller, digital signal processing.

 Among these Microcontroller is of low cost processor and one of the main advantage of
microcontrollers is, the components such as memory, serial communication interfaces,
analog to digital converters etc.., all these are built on a single chip. The numbers of
external components that are connected to it are very less according to the application.

 Microprocessors are more powerful than microcontrollers. They are used in major
applications with a number of tasking requirements. But the microprocessor requires
many external components like memory, serial communication, hard disk, input output
ports etc.., so the power consumption is also very high when compared to
microcontrollers.

 Digital signal processing is used mainly for the applications that particularly involved
with processing of signals
2.4 APPLICATIONS OF EMBEDDED SYSTEMS:

2.4.1 Consumer applications:

At home we use a number of embedded systems which include microwave oven,


remote control, vcd players, dvd players, camera etc….

Fig2.3: Automatic coffee makes equipment

2.4.2 Office automation:

We use systems like fax machine, modem, printer etc…

Fig2.4: Fax machine Fig2.5: Printing machine

2.4.3. Industrial automation:

Today a lot of industries are using embedded systems for process control. In
industries we design the embedded systems to perform a specific operation like monitoring
temperature, pressure, humidity ,voltage, current etc.., and basing on these monitored levels we
do control other devices, we can send information to a centralized monitoring station.
Fig2.6: Robot

In critical industries where human presence is avoided there we can use robots
which are programmed to do a specific operation.

2.4.5 Computer networking:

Embedded systems are used as bridges routers etc..

Fig2.7: Computer networking

2.4.6 Tele communications:

Cell phones, web cameras etc.


Fig2.8: Cell Phone Fig2.9: Web camera

CHAPTER 3: HARDWARE DESCRIPTION

3.1 Introduction:

In this chapter the block diagram of the project and design aspect of independent
modules are considered. Block diagram is shown in fig: 3.1:
FIG 3.1: Block diagram of IoT-Based Missile Detection and Direction Control System
using ESP32

The main blocks of this project are:

1. Micro controller

2. Reset

3. Crystal oscillator

4. Servo motor

5. Regulated power supply (RPS)

6. LED Indicator
7. ESP32 CAM

8. DC Motor

9. Laser

10. Ultrasonic sensor(SR04)

3.2 Micro controller:

NODEMCU

NodeMCU is an open source development board and firmware based in the widely used
ESP8266 -12E Wi-Fi module. This is also an open source IOT platform. This module is
programmed with the simple and powerful LUA programming language or Arduino IDE. With
just a few lines of code it allows to establish a Wi-Fi connection and define input/output pins
accordingly by turning the ESP8266 into a web server and a lot more. It is the Wi-Fi equivalent
of Ethernet module. With its USB-TTL, the NodeMCU Development board supports directly
flashing from USB port. It combines features of WIFI Access point and station +
microcontroller. These features make the NodeMCU extremely powerful tool for Wi-Fi
networking. It can be used as access point and/or station, host a webserver or connect to internet
to fetch or upload data.

This is where NodeMCU comes handy that incorporates a built-in WiFi support, giving
an easy pathway to design IoT applications as per your technical requirements.
Fig: NODE-MCU

INTRODUCTION TO NODEMCU

NodeMCU is an open-source firmware and development kit that plays a vital role in
designing your own IoT product using a few Lua script lines.

Multiple GPIO pins on the board allow you to connect the board with other peripherals and
are capable of generating PWM, I2C, SPI, and UART serial communications.

 The interface of the module is mainly divided into two parts including both Firmware and
Hardware where former runs on the ESP8266 Wi-Fi SoC and later is based on the ESP-
12 module.

The firmware is based on Lua – A scripting language that is easy to learn, giving a simple
programming environment layered with a fast scripting language that connects you with a well-
known developer community.
And open source firmware gives you the flexibility to edit, modify and rebuilt the existing
module and keep changing the entire interface until you succeed in optimizing the module as per
your requirements.
 USB to UART converter is added on the module that helps in converting USB data to
UART data which mainly understands the language of serial communication.

Instead of the regular USB port, MicroUSB port is included in the module that connects it
with the computer for dual purposes: programming and powering up the board.

 The board incorporates status LED that blinks and turns off immediately, giving you the
current status of the module if it is running properly when connected with the computer.

The ability of module to establish a flawless WiFi connection between two channels makes it
an ideal choice for incorporating it with other embedded devices like Raspberry Pi.

NODEMCU FEATURES
 Open-source
 Arduino-like hardware

 Status LED

 Micro-USB port

 Reset/Flash buttons

 Interactive and Programmable

 Low cost

 ESP8266 with inbuilt wifi

 USB to UART converter

 GPIO pins

NODEMCU PINOUT
General-purpose input/output (GPIO) is a pin on an IC
(Integrated Circuit). It can be either input pin or output pin, whose
behavior can be controlled at the run time.

NodeMCU Development kit provides access to these GPIOs of


ESP8266. The only thing to take care is that NodeMCU Dev kit
pins are numbered differently than internal GPIO notations of
ESP8266 as shown in below figure and table. For example, the D0
pin on the NodeMCU Dev kit is mapped to the internal GPIO pin 16
of ESP8266.

NodeMCU DevKit GPIOs

Below table gives NodeMCU Dev Kit IO pins and ESP8266 internal GPIO pins mapping

Pin Names on NodeMCUESP8266 Internal GPIO


Development Kit Pin number

D0 GPIO16

D1 GPIO5

D2 GPIO4

D3 GPIO0
Pin Names on NodeMCUESP8266 Internal GPIO
Development Kit Pin number

D4 GPIO2

D5 GPIO14

D6 GPIO12

D7 GPIO13

D8 GPIO15

D9/RX GPIO3

D10/TX GPIO1

D11/SD2 GPIO9

D12/SD3 GPIO10

Fig. NODE-MCU PINOUT

There is a candid difference between Vin and VU where former is the regulated voltage that
may stand somewhere between 7 to 12 V while later is the power voltage for USB that must be
kept around 5 V.

The GPIO’s shown in blue box (1, 3, 9, 10) are mostly not used for GPIO purpose on Dev Kit

ESP8266 is a system on a chip (SoC) design with components like the processor chip. The processor has
around 16 GPIO lines, some of which are used internally to interface with other components of the SoC,
like flash memory.

Since several lines are used internally within the ESP8266 SoC, we have about 11 GPIO pins remaining
for GPIO purpose.
Now again 2 pins out of 11 are generally reserved for RX and TX in order to communicate with a host PC
from which compiled object code is downloaded.

Hence finally, this leaves just 9 general purpose I/O pins i.e. D0 to D8.

As shown in above figure of NodeMCU Dev Kit. We can see RX, TX, SD2, SD3 pins are not mostly
used as GPIOs since they are used for other internal process. But we can try with SD3 (D12) pin which
mostly like to respond for GPIO/PWM/interrupt like functions.

Note that D0/GPIO16 pin can be only used as GPIO read/write, no special functions are supported on it.

That must be kept around 5 V.

As mentioned above, a cable supporting micro USB port is used to connect the board. As you
connect the board with a computer, LED will flash. You may need some drivers to be installed
on your computer if it fails to detect the Node-MCU board.

Note: We use Arduino IDE software for programming this module. It is important to note that
the pin configuration appearing on the board is different from the configuration we use to
program the board on the software i.e. when we write code for targeting pin 16 on the Arduino
IDE, it will actually help is laying out the communication with the D0 pin on the module.

Following figure the shows the pin configuration to use in Arduino IDE.
Fig. NODE-MCU configuration

Power Up Node-MCU

With reference to above image from the pin-out image above, there are five ground pins and
three 3 pins on the board. The board can be powered up using the following three ways.

USB Power. It proves to an ideal choice for loading programs unless the project you aim to
design requires separate interface i.e. disconnected from the computer.

Provide 3.3V. This is another great option to power up the module. If you have your own off-
board regulator, you can generate an instant power source for your development kit.

Power Vin. This is a voltage regulator that comes with the ability to support up to 800 mA. It
can handle somewhere between 7 to 12 V. You cannot power the devices operating at 3.3 V, as
this regulator unable to generate as low as 3.3V.

ADVANTAGES

 Inexpensive module.
 Good on-board processing power to handle Sensors.
 More powerful processor than Arduino.
APPLICATIONS

 IoT Sensors and Controllers.


 Home Automation.
 Agricultural Robot.
 Sensor Networks.
 Industrial Wireless Control.
 Multiple DIY projects.

3.3 REGULATED POWER SUPPLY:

3.3.1 Introduction:

Power supply is a supply of electrical power. A device or system that


supplies electrical or other types of energy to an output load or group of loads is called a power
supply unit or PSU. The term is most commonly applied to electrical energy supplies, less often
to mechanical ones, and rarely to others.

A power supply may include a power distribution system as well as primary or


secondary sources of energy such as

 Conversion of one form of electrical power to another desired form and voltage, typically
involving converting AC line voltage to a well-regulated lower-voltage DC for electronic
devices. Low voltage, low power DC power supply units are commonly integrated with the
devices they supply, such as computers and household electronics.
 Batteries.

 Chemical fuel cells and other forms of energy storage systems.

 Solar power.

 Generators or alternators.
3.3.2 Block Diagram:

Fig 3.3.2 Regulated Power Supply

The basic circuit diagram of a regulated power supply (DC O/P) with led
connected as load is shown in fig: 3.3.3.
Fig 3.3.3 Circuit diagram of Regulated Power Supply with Led connection

The components mainly used in above figure are

 230V AC MAINS
 TRANSFORMER
 BRIDGE RECTIFIER(DIODES)
 CAPACITOR
 VOLTAGE REGULATOR(IC 7805)
 RESISTOR
 LED(LIGHT EMITTING DIODE)
The detailed explanation of each and every component mentioned above is as follows:

Transformation: The process of transforming energy from one device to another is called
transformation. For transforming energy we use transformers.

Transformers:
A transformer is a device that transfers electrical energy from one circuit to
another through inductively coupled conductors without changing its frequency. A
varying current in the first or primary winding creates a varying magnetic flux in the
transformer's core, and thus a varying magnetic field through the secondary winding. This
varying magnetic field induces a varying electromotive force (EMF) or "voltage" in the
secondary winding. This effect is called mutual induction.

If a load is connected to the secondary, an electric current will flow in the


secondary winding and electrical energy will be transferred from the primary circuit through the
transformer to the load. This field is made up from lines of force and has the same shape as a bar
magnet.

If the current is increased, the lines of force move outwards from the coil. If the
current is reduced, the lines of force move inwards.

If another coil is placed adjacent to the first coil then, as the field moves out or in,
the moving lines of force will "cut" the turns of the second coil. As it does this, a voltage is
induced in the second coil. With the 50 Hz AC mains supply, this will happen 50 times a second.
This is called MUTUAL INDUCTION and forms the basis of the transformer.

The input coil is called the PRIMARY WINDING; the output coil is the
SECONDARY WINDING. Fig: 3.3.4 shows step-down transformer.

Fig 3.3.4: Step-Down Transformer

The voltage induced in the secondary is determined by the TURNS RATIO.


For example, if the secondary has half the primary turns; the secondary will have
half the primary voltage.

Another example is if the primary has 5000 turns and the secondary has 500 turns,
then the turn’s ratio is 10:1.

If the primary voltage is 240 volts then the secondary voltage will be x 10 smaller
= 24 volts. Assuming a perfect transformer, the power provided by the primary must equal the
power taken by a load on the secondary. If a 24-watt lamp is connected across a 24 volt
secondary, then the primary must supply 24 watts.

To aid magnetic coupling between primary and secondary, the coils are wound on
a metal CORE. Since the primary would induce power, called EDDY CURRENTS, into this
core, the core is LAMINATED. This means that it is made up from metal sheets insulated from
each other. Transformers to work at higher frequencies have an iron dust core or no core at all.

Note that the transformer only works on AC, which has a constantly changing
current and moving field. DC has a steady current and therefore a steady field and there would be
no induction.

Some transformers have an electrostatic screen between primary and secondary.


This is to prevent some types of interference being fed from the equipment down into the mains
supply, or in the other direction. Transformers are sometimes used for IMPEDANCE
MATCHING.

We can use the transformers as step up or step down.

Step Up transformer:

In case of step up transformer, primary windings are every less compared to


secondary winding.

Because of having more turns secondary winding accepts more energy, and it
releases more voltage at the output side.

Step down transformer:


Incase of step down transformer, Primary winding induces more flux than the
secondary winding, and secondary winding is having less number of turns because of that it
accepts less number of flux, and releases less amount of voltage.

Battery power supply:

A battery is a type of linear power supply that offers benefits that traditional
line-operated power supplies lack: mobility, portability and reliability. A battery consists of
multiple electrochemical cells connected to provide the voltage desired. Fig: 3.3.5 shows Hi-
Watt 9V battery

Fig 3.3.5: Hi-Watt 9V Battery

The most commonly used dry-cell battery is the carbon-zinc dry cell battery. Dry-
cell batteries are made by stacking a carbon plate, a layer of electrolyte paste, and a zinc plate
alternately until the desired total voltage is achieved. The most common dry-cell batteries have
one of the following voltages: 1.5, 3, 6, 9, 22.5, 45, and 90. During the discharge of a carbon-
zinc battery, the zinc metal is converted to a zinc salt in the electrolyte, and magnesium dioxide
is reduced at the carbon electrode. These actions establish a voltage of approximately 1.5 V.

The lead-acid storage battery may be used. This battery is rechargeable; it consists
of lead and lead/dioxide electrodes which are immersed in sulfuric acid. When fully charged, this
type of battery has a 2.06-2.14 V potential (A 12 volt car battery uses 6 cells in series). During
discharge, the lead is converted to lead sulfate and the sulfuric acid is converted to water. When
the battery is charging, the lead sulfate is converted back to lead and lead dioxide A nickel-
cadmium battery has become more popular in recent years. This battery cell is completely sealed
and rechargeable. The electrolyte is not involved in the electrode reaction, making the voltage
constant over the span of the batteries long service life. During the charging process, nickel
oxide is oxidized to its higher oxidation state and cadmium oxide is reduced. The nickel-
cadmium batteries have many benefits. They can be stored both charged and uncharged. They
have a long service life, high current availabilities, constant voltage, and the ability to be
recharged. Fig: 3.3.6 shows pencil battery of 1.5V.

Fig 3.3.6: Pencil Battery of 1.5V

RECTIFICATION:

The process of converting an alternating current to a pulsating direct current is


called as rectification. For rectification purpose we use rectifiers.

Rectifiers:

A rectifier is an electrical device that converts alternating current (AC) to direct


current (DC), a process known as rectification. Rectifiers have many uses including as
components of power supplies and as detectors of radio signals. Rectifiers may be made of solid-
state diodes, vacuum tube diodes, mercury arc valves, and other components.

A device that it can perform the opposite function (converting DC to AC) is


known as an inverter.

When only one diode is used to rectify AC (by blocking the negative or positive
portion of the waveform), the difference between the term diode and the term rectifier is merely
one of usage, i.e., the term rectifier describes a diode that is being used to convert AC to DC.
Almost all rectifiers comprise a number of diodes in a specific arrangement for more efficiently
converting AC to DC than is possible with only one diode. Before the development of silicon
semiconductor rectifiers, vacuum tube diodes and copper (I) oxide or selenium rectifier stacks
were used.

Bridge full wave rectifier:

The Bridge rectifier circuit is shown in fig: 3.3.7, which converts an ac voltage to
dc voltage using both half cycles of the input ac voltage. The Bridge rectifier circuit is shown in
the figure. The circuit has four diodes connected to form a bridge. The ac input voltage is applied
to the diagonally opposite ends of the bridge. The load resistance is connected between the other
two ends of the bridge.

For the positive half cycle of the input ac voltage, diodes D1 and D3 conduct,
whereas diodes D2 and D4 remain in the OFF state. The conducting diodes will be in series with
the load resistance RL and hence the load current flows through RL.

For the negative half cycle of the input ac voltage, diodes D2 and D4 conduct
whereas, D1 and D3 remain OFF. The conducting diodes D2 and D4 will be in series with the
load resistance RL and hence the current flows through RL in the same direction as in the previous
half cycle. Thus a bi-directional wave is converted into a unidirectional wave.

Input Output

Fig 3.3.7: Bridge rectifier: a full-wave rectifier using 4 diodes

DB107:
Now -a -days Bridge rectifier is available in IC with a number of DB107. In our
project we are using an IC in place of bridge rectifier. The picture of DB 107 is shown in fig:
3.3.8.

Features:

 Good for automation insertion


 Surge overload rating - 30 amperes peak

 Ideal for printed circuit board

 Reliable low cost construction utilizing molded

 Glass passivated device

 Polarity symbols molded on body

 Mounting position: Any

 Weight: 1.0 gram

Fig 3.3.8: DB107

Filtration:

The process of converting a pulsating direct current to a pure direct current using
filters is called as filtration.

Filters:
Electronic filters are electronic circuits, which perform signal-processing
functions, specifically to remove unwanted frequency components from the signal, to enhance
wanted ones.

Introduction to Capacitors:

The Capacitor or sometimes referred to as a Condenser is a passive device, and


one which stores energy in the form of an electrostatic field which produces a potential (static
voltage) across its plates. In its basic form a capacitor consists of two parallel conductive plates
that are not connected but are electrically separated either by air or by an insulating material
called the Dielectric. When a voltage is applied to these plates, a current flows charging up the
plates with electrons giving one plate a positive charge and the other plate an equal and opposite
negative charge. This flow of electrons to the plates is known as the Charging Current and
continues to flow until the voltage across the plates (and hence the capacitor) is equal to the
applied voltage Vcc. At this point the capacitor is said to be fully charged and this is illustrated
below. The construction of capacitor and an electrolytic capacitor are shown in figures 3.3.9 and
3.3.10 respectively.

Fig 3.3.9:Construction Of a Capacitor Fig 3.3.10:Electrolytic


Capaticor

Units of Capacitance:
Microfarad (μF) 1μF = 1/1,000,000 = 0.000001 = 10-6 F

Nanofarad (nF) 1nF = 1/1,000,000,000 = 0.000000001 = 10-9 F

Pico farad (pF) 1pF = 1/1,000,000,000,000 = 0.000000000001 = 10-12 F

Operation of Capacitor:

Think of water flowing through a pipe. If we imagine a capacitor as being a


storage tank with an inlet and an outlet pipe, it is possible to show approximately how an
electronic capacitor works.

First, let's consider the case of a "coupling capacitor" where the capacitor is used
to connect a signal from one part of a circuit to another but without allowing any direct current to
flow.

If the current flow is alternating between zero and a


maximum, our "storage tank" capacitor will allow the current
waves to pass through.

However, if there is a steady current, only the initial short


burst will flow until the "floating ball valve" closes and stops
further flow.

So a coupling capacitor allows "alternating current" to pass through because the


ball valve doesn't get a chance to close as the waves go up and down. However, a steady current
quickly fills the tank so that all flow stops.

A capacitor will pass alternating current but (apart from an initial surge) it will not
pass d.c.
Where a capacitor is used to decouple a circuit, the effect is
to "smooth out ripples". Any ripples, waves or pulses of
current are passed to ground while d.c. Flows smoothly.

Regulation:

The process of converting a varying voltage to a constant regulated voltage is


called as regulation. For the process of regulation we use voltage regulators.

Voltage Regulator:

A voltage regulator (also called a ‘regulator’) with only three terminals appears to
be a simple device, but it is in fact a very complex integrated circuit. It converts a varying input
voltage into a constant ‘regulated’ output voltage. Voltage Regulators are available in a variety
of outputs like 5V, 6V, 9V, 12V and 15V. The LM78XX series of voltage regulators are
designed for positive input. For applications requiring negative input, the LM79XX series is
used. Using a pair of ‘voltage-divider’ resistors can increase the output voltage of a regulator
circuit.

It is not possible to obtain a voltage lower than the stated rating. You cannot use a
12V regulator to make a 5V power supply. Voltage regulators are very robust. These can
withstand over-current draw due to short circuits and also over-heating. In both cases, the
regulator will cut off before any damage occurs. The only way to destroy a regulator is to apply
reverse voltage to its input. Reverse polarity destroys the regulator almost instantly. Fig: 3.3.11
shows voltage regulator.
Fig 3.3.11: Voltage Regulator

Resistors:

A resistor is a two-terminal electronic component that produces a voltage across its


terminals that is proportional to the electric current passing through it in accordance with Ohm's
law:

V = IR

Resistors are elements of electrical networks and electronic circuits and are ubiquitous in
most electronic equipment. Practical resistors can be made of various compounds and films, as
well as resistance wire (wire made of a high-resistivity alloy, such as nickel/chrome).

The primary characteristics of a resistor are the resistance, the tolerance, maximum
working voltage and the power rating. Other characteristics include temperature coefficient,
noise, and inductance. Less well-known is critical resistance, the value below which power
dissipation limits the maximum permitted current flow, and above which the limit is applied
voltage. Critical resistance is determined by the design, materials and dimensions of the resistor.

Resistors can be made to control the flow of current, to work as Voltage dividers,
to dissipate power and it can shape electrical waves when used in combination of other
components. Basic unit is ohms.

Theory of operation:

Ohm's law:
The behavior of an ideal resistor is dictated by the relationship specified in Ohm's
law:

V = IR

Ohm's law states that the voltage (V) across a resistor is proportional to the
current (I) through it where the constant of proportionality is the resistance (R).

Power dissipation:

The power dissipated by a resistor (or the equivalent resistance of a resistor


network) is calculated using the following:
Fig 3.3.12: Resistor Fig 3.3.13: Color Bands In Resistor
3.4. LED:

A light-emitting diode (LED) is a semiconductor light source. LED’s are used as


indicator lamps in many devices, and are increasingly used for lighting. Introduced as a practical
electronic component in 1962, early LED’s emitted low-intensity red light, but modern versions
are available across the visible, ultraviolet and infrared wavelengths, with very high brightness.
The internal structure and parts of a led are shown in figures 3.4.1 and 3.4.2 respectively.

Fig 3.4.1: Inside a LED Fig 3.4.2: Parts of a LED

Working:

The structure of the LED light is completely different than that of the light bulb.
Amazingly, the LED has a simple and strong structure. The light-emitting semiconductor
material is what determines the LED's color. The LED is based on the semiconductor diode.

When a diode is forward biased (switched on), electrons are able to recombine
with holes within the device, releasing energy in the form of photons. This effect is called
electroluminescence and the color of the light (corresponding to the energy of the photon) is
determined by the energy gap of the semiconductor. An LED is usually small in area (less than
1 mm2), and integrated optical components are used to shape its radiation pattern and assist in
reflection. LED’s present many advantages over incandescent light sources including lower
energy consumption, longer lifetime, improved robustness, smaller size, faster switching, and
greater durability and reliability. However, they are relatively expensive and require more
precise current and heat management than traditional light sources. Current LED products for
general lighting are more expensive to buy than fluorescent lamp sources of comparable output.
They also enjoy use in applications as diverse as replacements for traditional light sources in
automotive lighting (particularly indicators) and in traffic signals. The compact size of LED’s
has allowed new text and video displays and sensors to be developed, while their high switching
rates are useful in advanced communications technology. The electrical symbol and polarities of
led are shown in fig: 3.4.3.

Fig 3.4.3: Electrical Symbol & Polarities of LED

LED lights have a variety of advantages over other light sources:

 High-levels of brightness and intensity


 High-efficiency

 Low-voltage and current requirements

 Low radiated heat

 High reliability (resistant to shock and vibration)

 No UV Rays

 Long source life


 Can be easily controlled and programmed

Applications of LED fall into three major categories:

 Visual signal application where the light goes more or less directly from the LED to the
human eye, to convey a message or meaning.
 Illumination where LED light is reflected from object to give visual response of these
objects.

 Generate light for measuring and interacting with processes that do not involve the
human visual system.

3.5 ESP32-CAM Development Board

INTRODUCTION

ESP32-CAM is a low-cost ESP32-based development board with onboard camera, small in size. It
is an ideal solution for IoT application, prototypes constructions and DIY projects.

The board integrates WiFi, traditional Bluetooth and low power BLE , with 2 high-
performance 32-bit LX6 CPUs. It adopts 7-stage pipeline architecture, on-chip sensor, Hall
sensor, temperature sensor and so on, and its main frequency adjustment ranges from 80MHz
to 240MHz.

Fully compliant with WiFi 802.11b/g/n/e/i and Bluetooth 4.2 standards, it can be used as a
master mode to build an independent network controller, or as a slave to other host MCUs to add
networking capabilities to existing devices
ESP32-CAM can be widely used in various IoT applications. It is suitable for home smart
devices, industrial wireless control, wireless monitoring, QR wireless identification,
wireless positioning system signals and other IoT applications. It is an ideal solution for IoT
applications.

Schematic Diagram

Dimension Diagram
Notes: 1.Please be sure that the power supply for the module should be at least 5V 2A, otherwise
maybe there would be water ripple appearing on the image.

2.ESP32 GPIO32 pin is used to control the power of the camera, so when the camera is in
working, pull GPIO32 pin low.

3.Since IO pin is connected to camera XCLK, it should be left floating in using, and do not
connect it to high/low level.

4.The product has been equipped with default firmware before leaving the factory, and we do
not provide additional ones for you to download. So, please be cautious when you choose to
burn other firmwares.

FEATURES

 Up to 160MHz clock speed,Summary computing power up to 600 DMIPS

 Built-in 520 KB SRAM, external 4MPSRAM

 Supports UART/SPI/I2C/PWM/ADC/DAC

 Support OV2640 and OV7670 cameras, Built-in Flash lamp.

 Support image WiFI upload

 Support TF card

 Supports multiple sleep modes.

 Embedded Lwip and FreeRTOS

 Supports STA/AP/STA+AP operation mode

 Support Smart Config/AirKiss technology

 Support for serial port local and remote firmware upgrades (FOTA)

SPECIFICATION
 SPI Flash: default 32Mbit

 RAM: built-in 520 KB+external 4MPSRAM

 Dimension: 27*40.5*4.5(±0.2)mm/1.06*1.59*0.18”

 Bluetooth: Bluetooth 4.2 BR/EDR and BLE standards

 Wi-Fi: 802.11b/g/n/e/i

 Support Interface: UART, SPI, I2C, PWM

 Support TF card: maximum support 4G

 IO port: 9

 Serial Port Baud-rate: Default 115200 bps

 Image Output Format: JPEG( OV2640 support only ), BMP, GRAYSCALE

 Spectrum Range: 2412 ~2484MHz

 Antenna: onboard PCB antenna, gain 2dBi

 Transmit Power: 802.11b: 17±2 dBm (@11Mbps);

802.11g: 14±2 dBm (@54Mbps);

802.11n: 13±2 dBm (@MCS7)

 Receiving Sensitivity: CCK, 1 Mbps : -90dBm;


CCK, 11 Mbps: -85dBm;

6 Mbps (1/2 BPSK): -88dBm;

54 Mbps (3/4 64-QAM): -70dBm;


MCS7 (65 Mbps, 72.2 Mbps): -67dBm

 Power consumption: Turn off the flash: 180mA@5V

Turn on the flash and adjust the brightness to the maximum:

310mA@5V

Deep-sleep: the lowest power consumption can reach 6mA@5V

Moderm-sleep: up to 20mA@5V

Light-sleep: up to 6.7mA@5V

 Security: WPA/WPA2/WPA2-Enterprise/WPS

 Power supply range: 5V

 Operating temperature: -20 °C ~ 85 °C

 Sorage environment: -40 °C ~ 90 °C, < 90%RH

 Weight: 10g

SHIPPING LIST

 ESP32-CAM Development Board x1


47
3.6 Introduction to Servomotors

Hobby servomotors are a very elegant solution to the problem of adding a motor to your robot. They are mainly
used in hobby RC airplanes, so they are very compact, powerful, light and power conservative. Since they have been in
production for a long time they are also very cheap. You can buy a standard hobby servomotor for under $13. In a very
small package you get a DC motor, gearbox, and feedback control system.

The Futaba S-148 standard servo.

Available from towerhobbies.com or any RC hobby store (Colpar)

Servomotors are designed to operate control surfaces on hobby RC planes. So they do not rotate continuously.
Rather they are designed to rotate through 180 degrees with precise position control. If you want to use them as the
main drive motor for a mobile robot you need to modify them so that they will rotate continuously. This is not a difficult
thing to do. I will not cover it here but if you want to do it there are many sites on the web that cover this. An excellent
one is

48
They do not simply run on a DC voltage like a standard DC motor. They have 3 wires. Red is power (generally 3V
– 12V max), black is ground and then there is another wire, usually white or yellow that is the “input signal wire”.

A servomotor is controlled by sending a pulse signal that is HIGH for a brief time, generally 1 – 2 ms. If you just
connect a battery to power and ground, nothing will happen. You must have a timer circuit that generates this pulsed
signal and by varying the pulse ON time (or the pulse width) the motor will move to a certain position over its range of
motion and then stop as long as the input pulse width is the same. Depending on the pulse width, you’ll get a different
position.

49
This diagram shows some control signal pulses for a typical servo and the position to which it will rotate
in response to the pulse width.

There is another element to the signal that also requires timing accuracy. The frequency of the signal or its rate
of refresh. Not only do you have to send the pulse, you have to keep sending them as long as you want the motor to be
in that position (or to keep rotating for modified servos). Generally a frequency of 50 Hz is good. This means that you
send the Hi pulse 50 times every second.

50
I mentioned earlier that a servo will only rotate through 180 degrees unless you modify it for continuous
rotation (you can also buy them already modified through Acroname and other companies). One interesting thing that
comes out this modification is that you get a speed control function out of it, though somewhat coarse.

When you make the modification you replace the circuitry in the motor that tells the motor what position it is in.
The mods you make tell the motor that it is always in the center position. So if you feed a 1.75 ms pulse, it rotates to the
180 degree position, checks the feedback which tells it that “hey, you haven’t moved yet. You’re still in the center
position, keep going” so it does, checks and sees that it hasn’t moved yet and keeps doing it. Since it thinks that it is in
center position and it has to move to its right most position it will move at its fastest rate.

Now suppose you send it a signal that says to rotate to 95 degrees, 5 degrees right of center. The internal
control system knows that it is now to move a very short distance. It also knows that if it rotates at its fastest speed that
it may overshoot this and have to come back, and overshoot again in the other direction and try again, and so forth.
This is called oscillation and is not a good thing. The advantage that you get out of this is that the motor will move
slower when you feed a signal that is close to the center position. So you feed it a “go to 95 degree” signal and it will
rotate CW at a slow rate. Give it “go to 180 degrees” and it will rotate CW at its fastest rate. And the same for CCW.

51
3.8 Dc motor:

A dc motor uses electrical energy to produce mechanical energy, very typically through the interaction
of magnetic fields and current-carrying conductors. The reverse process, producing electrical energy from
mechanical energy, is accomplished by an alternator, generator or dynamo. Many types of electric motors can
be run as generators, and vice versa. The input of a DC motor is current/voltage and its output is torque (speed).

Fig 3.19: DC Motor

The DC motor has two basic parts: the rotating part that is called the armature and the stationary part that
includes coils of wire called the field coils. The stationary part is also called the stator. Figure shows a picture of
a typical DC motor, Figure shows a picture of a DC armature, and Fig shows a picture of a typical stator. From
the picture you can see the armature is made of coils of wire wrapped around the core, and the core has an
extended shaft that rotates on bearings. You should also notice that the ends of each coil of wire on the armature
are terminated at one end of the armature. The termination points are called the commutator, and this is where
the brushes make electrical contact to bring electrical current from the stationary part to the rotating part of the
machine.

Operation:
The DC motor you will find in modem industrial applications operates very similarly to the simple DC
motor described earlier in this chapter. Figure 12-9 shows an electrical diagram of a simple DC motor. Notice

52
that the DC voltage is applied directly to the field winding and the brushes. The armature and the field are both
shown as a coil of wire. In later diagrams, a field resistor will be added in series with the field to control the
motor speed.

When voltage is applied to the motor, current begins to flow through the field coil from the negative terminal to
the positive terminal. This sets up a strong magnetic field in the field winding. Current also begins to flow
through the brushes into a commutator segment and then through an armature coil. The current continues to
flow through the coil back to the brush that is attached to other end of the coil and returns to the DC power
source. The current flowing in the armature coil sets up a strong magnetic field in the armature.

Fig 3.20: Simple electrical diagram of DC motor

Fig 3.21: Operation of a DC Motor

The magnetic field in the armature and field coil causes the armature to begin to rotate. This occurs
by the unlike magnetic poles attracting each other and the like magnetic poles repelling each other. As the
armature begins to rotate, the commutator segments will also begin to move under the brushes. As an individual
commutator segment moves under the brush connected to positive voltage, it will become positive, and when it

53
moves under a brush connected to negative voltage it will become negative. In this way, the commutator
segments continually change polarity from positive to negative. Since the commutator segments are connected
to the ends of the wires that make up the field winding in the armature, it causes the magnetic field in the
armature to change polarity continually from north pole to south pole. The commutator segments and brushes
are aligned in such a way that the switch in polarity of the armature coincides with the location of the armature's
magnetic field and the field winding's magnetic field. The switching action is timed so that the armature will not
lock up magnetically with the field. Instead the magnetic fields tend to build on each other and provide
additional torque to keep the motor shaft rotating.
When the voltage is de-energized to the motor, the magnetic fields in the armature and the field
winding will quickly diminish and the armature shaft's speed will begin to drop to zero. If voltage is applied to
the motor again, the magnetic fields will strengthen and the armature will begin to rotate again.

Types of DC motors:

1. DC Shunt Motor,

2. DC Series Motor,

3. DC Long Shunt Motor (Compound)

4. DC Short Shunt Motor (Compound)

The rotational energy that you get from any motor is usually the battle between two magnetic fields chasing
each other. The DC motor has magnetic poles and an armature, to which DC electricity is fed, The Magnetic
Poles are electromagnets, and when they are energized, they produce a strong magnetic field around them, and
the armature which is given power with a commutator, constantly repels the poles, and therefore rotates.

1. The DC Shunt Motor:

54
In a 2 pole DC Motor, the armature will have two separate sets of windings, connected to a commutator at the
end of the shaft that are in constant touch with carbon brushes. The brushes are static, and the commutator
rotate and as the portions of the commutator touching the respective positive or negative polarity brush will
energize the respective part of the armature with the respective polarity. It is usually arranged in such a way that
the armature and the poles are always repelling.

The general idea of a DC Motor is, the stronger the Field Current, the stronger the magnetic field, and faster the
rotation of the armature. When the armature revolves between the poles, the magnetic field of the poles induce
power in the armature conductors, and some electricity is generated in the armature, which is called back emf,
and it acts as a resistance for the armature. Generally an armature has resistance of less than 1 Ohm, and
powering it with heavy voltages of Direct Current could result in immediate short circuits. This back emf helps
us there.

When an armature is loaded on a DC Shunt Motor, the speed naturally reduces, and therefore the back emf
reduces, which allows more armatures current to flow. This results in more armature field, and therefore it
results in torque.

Fig: Diagram of DC shunt motor

When a DC Shunt Motor is overloaded, if the armature becomes too slow, the reduction of the back emf could
cause the motor to burn due to heavy current flow thru the armature.

The poles and armature are excited separately, and parallel, therefore it is called a Shunt Motor.

2. The DC Series Motor:

55
Fig: Diagram of DC series motor

A DC Series Motor has its field coil in series with the armature. Therefore any amount of power drawn by the
armature will be passed thru the field. As a result you cannot start a Series DC Motor without any load attached
to it. It will either run uncontrollably in full speed, or it will stop.

Fig: Diagram of DC series motor graph representation

When the load is increased then its efficiency increases with respect to the load applied. So these are on Electric
Trains and elevators.

3. DC Compound Motor:

A compound of Series and Shunt excitation for the fields is done in a Compound DC Motor. This gives the best
of both series and shunt motors. Better torque as in a series motor, while the possibility to start the motor with
no load.

56
Fig: Diagram of DC compound motor

Above is the diagram of a long shunt motor, while in a short shunt, the shunt coil will be connected after the
serial coil.

A Compound motor can be run as a shunt motor without connecting the serial coil at all but not vice versa.

3.9 LASER

A laser is a device that emits light (electromagnetic radiation) through a process of optical amplification
based on the stimulated emission of photons. The term "laser" originated as an acronym for Light Amplification
by Stimulated Emission of Radiation.[1][2] The emitted laser light is notable for its high degree of spatial and
temporal coherence, unattainable using other technologies.

Spatial coherence typically is expressed through the output being a narrow beam which is diffraction-
limited, often a so-called "pencil beam." Laser beams can be focused to very tiny spots, achieving a very high
irradiance. Or they can be launched into a beam of very low divergence in order to concentrate their power at a
large distance.

57
Temporal (or longitudinal) coherence implies a polarized wave at a single frequency whose phase is
correlated over a relatively large distance (the coherence length) along the beam.[3] A beam produced by a
thermal or other incoherent light source has an instantaneous amplitude and phase which vary randomly with
respect to time and position, and thus a very short coherence length.

Most so-called "single wavelength" lasers actually produce radiation in several modes having slightly
different frequencies (wavelengths), often not in a single polarization. And although temporal coherence implies
monochromatic, there are even lasers that emit a broad spectrum of light, or emit different wavelengths of light
simultaneously. There are some lasers which are not single spatial mode and consequently their light beams
diverge more than required by the diffraction limit. However all such devices are classified as "lasers" based on
their method of producing that light: stimulated emission Lasers are employed in applications where light of the
required spatial or temporal coherence could not be produced using simpler technologies.

58
Fig: Diagram of laser module

Specifications:

1. Wavelength: 650 nm 5.0 nm output. Color red


2. Battery Type: SR754W (393) Silver Oxide Watch type batteries.
3. Battery Life: 2 to 4 hours constant on, 10 to 50 hours on/off use. Replace every year.
4. Operating Temperature: 15 - 125 degrees Fahrenheit.
5. Laser Dot: The dot size is approximately 0.375" at 20 ', 0.875" at 75'.
6. Water Resistant: The laser unit and components are potted (sealed) for superior water resistance.
7. Laser Life: The laser unit is rubber isolated by 4 neoprene O-rings to reduce shock to the unit. This shock
reduction increases the overall life of components. Laser unit life is approximately 2,000 hours.
8. Windage Screws: Auto-Laser uses a double opposing screw system. The use of this style of adjustment
assures that the laser alignment will remain intact for thousands of rounds.
9. Laser Size: The standard laser unit is 1.13" wide, .965" tall, & 1.99" long, to maintain a small profile.

59
10. Accuracy: Once mounted and adjusted the AUTO-LASER will maintain incredible pinpoint accuracy.
11. Manual Operation: A rocker style switch that is placed at the tip of your index finger is for turning the
unit on and off manually. The automatic function only works while it is in the holster.
12. Automatic Function: The automatic on/off function is controlled by a special magnetic switch. .

Fig: Circuit Diagram of laser

Applications:

There are many scientific, military, medical and commercial laser applications which have been developed
since the invention of the laser in the 1958. The coherency, high monochromatic, and ability to reach extremely
high powers are all properties which allow for these specialized applications.

Military uses of lasers include applications such as target designation and ranging, defensive countermeasures,
communications and directed energy weapons.

In science, lasers are used in many ways, including:


60
 A wide variety of inter ferometric techniques
 Raman spectroscopy

 Laser induced breakdown spectroscopy

 Atmospheric remote sensing

 Investigating nonlinear optics phenomena

 Holographic techniques employing lasers also contribute to a number of measurement techniques.

 Laser based Light Detection and Ranging (LIDAR) technology has application in geology, seismology,
remote sensing and atmospheric physics.

 Lasers have been used aboard spacecraft such as in the Cassini-Huygens mission.

 In astronomy, lasers have been used to create artificial laser guide stars, used as reference objects for
adaptive optics telescopes.

ULTRA SONIC sensor

Ultrasonic principle:

Ultrasonic sensors emit short, high-frequency sound pulses at regular intervals. These propagate in the air at
the velocity of sound. If they strike an object, then they are re
flected back as echo signals to the sensor, which itself computes the distance to the target based on the time-
span between emitting the signal and receiving the echo.

As the distance to an object is determined by measuring the time of flight and not by the intensity of the
sound, ultrasonic sensors are excellent at suppressing background interference.

Virtually all materials which reflect sound can be detected, regardless of their color. Even transparent
materials or thin foils represent no problem for an ultrasonic sensor.

61
Micro sonic ultrasonic sensors are suitable for target distances from 30 mm to 10 m and as they measure the
time of flight they can ascertain a measurement with pinpoint accuracy. Some of our sensors can even
resolve the signal to an accuracy of less than 0.18 mm.

Ultrasonic sensors can see through dust-laden air and ink mists. Even thin deposits on the sensor membrane
do not impair its function.

Sensors with a blind zone of just 30 mm and an extremely narrow beam spread are finding totally new
applications these days: measuring levels in yoghurt pots and test tubes as well as scanning small bottles in
the packaging sector - no trouble for our sensors. Even thin wires are reliably detected.

Fig.3.7.1Ultrasonic sensor module

Specification:

The ultrasonic range sensor detects objects in it’s path and can be used to calculate the range to the object. It
is sensitive enough to detect a 3cm diameter broom handle at a distance of over 2m.
Voltage - 5v
Current - 30mA Typ. 50mA Max.
Frequency - 40 KHz
Max Range - 3 m
Min Range - 3 cm
62
Sensitivity - Detect 3cm diameter broom handle at > 2 m
Input Trigger - 10uS Min. TTL level pulse
Echo Pulse - Positive TTL level signal, width proportional to range.
Small Size - 43mm x 20mm x 17mm height

Fig.3.7.2 Ultrasonic sensor timing diagram

Electrical connection:

The SRF004 ultrasonic range finder has 5 connections pins. The power supply is connected to the 5V and
0V ground connections on the SRF004. (Note that BOTH the ‘Mode’ (hole 4) and ‘0V Ground’ (hole 5)
connections MUST be connected to 0V for correct operation with the PICAXE system).
Take care not to overheat, and therefore damage, the solder connection pads whilst making connections.
The SRF004 Trigger Input is connected to a PICAXE output pin.
The SRF004 Echo Output is connected to a PICAXE input pin.

63
Ultrasonic sensors have set new standards in automation

Fig.3.7.4.Pin configuration of ultrasonic sensor module

Connection:
The SRF004 must be mounted above the buggy (e.g. by using a small home-made aluminum bracket (not
supplied)). The SRF004 has five solder connections which must be connected via wires to the solder joints
on the bottom of the buggy PCB.
1. Hole 1 – 5v Supply – to PIC chip leg 14 (V+ Supply)
2. Hole 2 – Echo Output – to PIC chip leg 15 (input 6)
3. Hole 3 – Trigger Input – to PIC chip leg 9 (output 3)
4. Hole 4 *8//////8
– Mode – to PIC chip leg 5 (0V Ground)
5. Hole 5 – 0V Ground – to PIC chip leg 5 (0V Ground)
Note that both holes 4 and 5 must both be connected to 0V. It is recommended that the wire links across the
bottom of the
Buggy are secured in place using a glue-gun or similar.

64
CHAPTER 4: SOFTWARE DESCRIPTION

This project is implemented using following software’s:


 Express PCB – for designing circuit
 PIC C compiler - for compilation part
 Proteus 7 (Embedded C) – for simulation part

4.1 Express PCB:

Breadboards are great for prototyping equipment as it allows great flexibility to modify a design
when needed; however the final product of a project, ideally should have a neat PCB, few cables, and survive a
shake test. Not only is a proper PCB neater but it is also more durable as there are no cables which can yank
loose.

65
Express PCB is a software tool to design PCBs specifically for manufacture by the company
Express PCB (no other PCB maker accepts Express PCB files). It is very easy to use, but it does have several
limitations.

It can be likened to more of a toy then a professional CAD program.

It has a poor part library (which we can work around)

It cannot import or export files in different formats

It cannot be used to make prepare boards for DIY production

Express PCB has been used to design many PCBs (some layered and with surface-mount parts.
Print out PCB patterns and use the toner transfer method with an Etch Resistant Pen to make boards. However,
Express PCB does not have a nice print layout. Here is the procedure to design in Express PCB and clean up the
patterns so they print nicely.

4.1.1 Preparing Express PCB for First Use:

Express PCB comes with a less then exciting list of parts. So before any project is started head
over to Audio logic and grab the additional parts by morsel, ppl, and tangent, and extract them into your
Express PCB directory. At this point start the program and get ready to setup the workspace to suit your style.

Click View -> Options. In this menu, setup the units for “mm” or “in” depending on how you think,
and click “see through the top copper layer” at the bottom. The standard color scheme of red and green is
generally used but it is not as pleasing as red and blue.

4.1.2 The Interface:

When a project is first started you will be greeted with a yellow outline. This yellow outline is the
dimension of the PCB. Typically after positioning of parts and traces, move them to their final position and then
crop the PCB to the correct size. However, in designing a board with a certain size constraint, crop the PCB to
the correct size before starting.

Fig: 4.1 show the toolbar in which the each button has the following functions:

66
Fig 4.1: Tool bar necessary for the interface

 The select tool: It is fairly obvious what this does. It allows you to move and manipulate parts. When
this tool is selected the top toolbar will show buttons to move traces to the top / bottom copper layer, and
rotate buttons.
 The zoom to selection tool: does just that.

 The place pad: button allows you to place small soldier pads which are useful for board connections or if
a part is not in the part library but the part dimensions are available. When this tool is selected the top
toolbar will give you a large selection of round holes, square holes and surface mount pads.

 The place component: tool allows you to select a component from the top toolbar and then by clicking in
the workspace places that component in the orientation chosen using the buttons next to the component
list. The components can always be rotated afterwards with the select tool if the orientation is wrong.

 The place trace: tool allows you to place a solid trace on the board of varying thicknesses. The top
toolbar allows you to select the top or bottom layer to place the trace on.

 The Insert Corner in trace: button does exactly what it says. When this tool is selected, clicking on a
trace will insert a corner which can be moved to route around components and other traces.

 The remove a trace button is not very important since the delete key will achieve the same result.

4.1.3 Design Considerations:

Before starting a project there are several ways to design a PCB and one must be chosen to suit
the project’s needs.

Single sided, or double sided:

When making a PCB you have the option of making a single sided board, or a double sided
board. Single sided boards are cheaper to produce and easier to etch, but much harder to design for large
projects. If a lot of parts are being used in a small space it may be difficult to make a single sided board
without jumper over traces with a cable. While there’s technically nothing wrong with this, it should be
avoided if the signal travelling over the traces is sensitive (e.g. audio signals).

67
A double sided board is more expensive to produce professionally, more difficult to etch on a
DIY board, but makes the layout of components a lot smaller and easier. It should be noted that if a trace is
running on the top layer, check with the components to make sure you can get to its pins with a soldering iron.
Large capacitors, relays, and similar parts which don’t have axial leads can NOT have traces on top unless
boards are plated professionally.

Ground-plane or other special purposes for one side:

When using a double sided board you must consider which traces should be on what side of the
board. Generally, put power traces on the top of the board, jumping only to the bottom if a part cannot be
soldiered onto the top plane (like a relay), and vice- versa.

Some projects like power supplies or amps can benefit from having a solid plane to use for
ground. In power supplies this can reduce noise, and in amps it minimizes the distance between parts and their
ground connections, and keeps the ground signal as simple as possible. However, care must be taken with
stubborn chips such as the TPA6120 amplifier from TI. The TPA6120 datasheet specifies not to run a ground
plane under the pins or signal traces of this chip as the capacitance generated could effect performance
negatively.

4.2 PIC Compiler:


PIC compiler is software used where the machine language code is written and compiled. After
compilation, the machine source code is converted into hex code which is to be dumped into the microcontroller
for further processing. PIC compiler also supports C language code.
It’s important that you know C language for microcontroller which is commonly known as
Embedded C. As we are going to use PIC Compiler, hence we also call it PIC C. The PCB, PCM, and PCH are
separate compilers. PCB is for 12-bit opcodes, PCM is for 14-bitopcodes, and PCH is for 16-bit opcode PIC
microcontrollers. Due to many similarities, all three compilers are covered in this reference manual. Features
and limitations that apply to only specific microcontrollers are indicated within. These compilers are
specifically designed to meet the unique needs of the PIC microcontroller. This allows developers to quickly
design applications software in a more readable, high-level language. When compared to a more traditional C
compiler, PCB, PCM, and PCH have some limitations. As an example of the limitations, function recursion is
not allowed.
This is due to the fact that the PIC has no stack to push variables onto, and also because of the
way the compilers optimize the code. The compilers can efficiently implement normal C constructs,

68
input/output operations, and bit twiddling operations. All normal C data types are supported along with pointers
to constant arrays, fixed point decimal, and arrays of bits.

PIC C is not much different from a normal C program. If you know assembly, writing a C
program is not a crisis. In PIC, we will have a main function, in which all your application specific work will be
defined. In case of embedded C, you do not have any operating system running in there. So you have to make
sure that your program or main file should never exit. This can be done with the help of simple while (1) or for
(;;) loop as they are going to run infinitely.

We have to add header file for controller you are using, otherwise you will not be able to access
registers related to peripherals.

#include <16F72.h> // header file for PIC 16F72//

4.3 Proteus:

Proteus is software which accepts only hex files. Once the machine code is converted into hex
code, that hex code has to be dumped into the microcontroller and this is done by the Proteus. Proteus is a
programmer which itself contains a microcontroller in it other than the one which is to be programmed. This
microcontroller has a program in it written in such a way that it accepts the hex file from the pic compiler and
dumps this hex file into the microcontroller which is to be programmed. As the Proteus programmer requires
power supply to be operated, this power supply is given from the power supply circuit designed and connected
to the microcontroller in proteus. The program which is to be dumped in to the microcontroller is edited in
proteus and is compiled and executed to check any errors and hence after the successful compilation of the
program the program is dumped in to the microcontroller using a dumper.

4.4 Procedural steps for compilation, simulation and dumping:

4.4.1 Compilation and simulation steps:

Introduction

Ah yes, it is finally time to make your Arduino do something! We're going to start with the classic hell world of
electronics, a blinking light.

69
This lesson will basically get you up and running using the Arduino software and uploading a sketch to the
Arduino board. Once you've completed this step we can continue to the really exciting stuff, which is when we
start writing our own sketches!

These instructions mostly show Windows software. Except when indicated, the software (should be) identical
on all platforms. Linux will be added once I figure out how to get it working (yay)

Do you have everything you need?

Not much is needed for this lesson, just a USB cable and an Arduino. If you have an older Arduino you may
also need an LED. Any LED is fine as long as it looks sorta like the photo, with a plastic bulb and two legs

Make sure you've gone through Lesson 0 first!

Assembled Arduino board, preferrably a


Diecimila (or whatever the latest version $35
Adafruit
is)

Adafruit
Or any
USB Cable. Standard A-B cable is required. computer
$5
Any length is OK. supply store

LED - Optional Any $1


Nearly any LED is OK, as long as it has two electronics
wire legs. This part is only required for NG supply store
rev c Arduinos (and maybe other older
ones). Diecimila Arduino's have this part

70
'built-in'

Download the Software

The first thing to do is download the Arduino software.

Go to the Arduino Software Download page and grab the right file for your OS. As of Sept 2007 the version
is 009 but you should use whatever is most recent.
The packages are quite large, 30-50 MB so it may take a while to finish

Unpack and Install

Extract the package onto the Desktop

Windows

71
Mac OS X

Windows

72
Mac OS X
Startup!

Double click the Arduino software icon

Windows

Mac OS X
To open up the workspace

73
I think I get the red error text shown because I already have Arduino installed. Either way, it isn't a problem if
you do or don't see it.

Select chip

The first step is to configure the Arduino software for the correct chip. Almost all Arduinos use the
ATmega168, but there's a chance you have an ATmega8. Look for the chip on the Arduino that looks like this:

74
If the text says ATMEGA8-16P then you have an atmega8 chip. If the text says ATMEGA168-20P then you
have anatmega168 chip. If it says "ATMEGA328P-20P" you have an atmega328p chip

Make sure the correct chip is selected (this picture is really old, will be fixed soon). This preference is saved so
you only have to set it once, the program will remember next time it's run.

Select port

Next, its time to configure the Serial Port (also known as the COM Port). Go back to lesson 0 to remind
yourself of which port it is. On a PC it will probably be something like COM3 or COM4. On a Mac it will be
something liketty.usbserial-xxxxx

75
Windows port selection

Mac port selection


This preference is saved so you only have to set it once, the program will remember next time it's run.

However, if you have multiple Arduino's, they may be assigned difference COM ports. So every time you plug
in a new Arduino, double check that the correct port is selected.

Open blink sketch

Sketches are little scripts that you can send to the Arduino to tell it how to act. Let's open up an Example
Sketch. Go to the File menu -> Sketchbook -> Examples -> Digital -> Blink

76
The window should now look like this, with a bunch of text in the formerly empty white space and the
tab Blink above it

77
Verify / Compile

The first step to getting a Sketch ready for transfer over to the arduino is to Verify/Compile it. That means
check it over for mistakes (sort of like editing) and then translate it into an application that is compatible with
the Arduino hardware.

78
After a few seconds, you should see the message Done compiling. in the Status Bar and Binary Sketch
Size: in theNotification area. This means the sketch was well-written and is ready for uploading to the Arduino
board!

79
Reset (NG only)

To tell the Arduino that it should prepare itself for a new Sketch upload, you must reset the board. Diecimila
Arduino's have built-in auto-reset capability, so you don't need to do anything. Older Arduinos, such as NG,
must be manually reset before uploading a sketch. To do that simply press the black button on the right hand
side of the board, shown here.

80
Upload

Now it's time to upload. Make sure the Arduino is plugged in, the green light is on and the correct Serial Port is
selected.

If you have an NG Arduino, press the Reset Button now, just before you select the Upload menu item.
Select Upload to I/O Board from the File menu

After a few seconds you should get this screen, with the message Done uploading. in the status bar.

81
If you get the following error message "avrdude: stk500_getsync(): not in sync: resp=0x00" that means that
the Arduino is not responding

Then check the following:

 If you have a NG Arduino, did you press reset just before selecting Upload menu item?
 Is the correct Serial Port selected?
 Is the correct driver installed?
82
 Is the chip inserted into the Arduino properly? (If you built your own arduino or have burned the bootloader on
yourself)
 Does the chip have the correct bootloader on it? (If you built your own arduino or have burned the bootloader
on yourself)
If you get the following error message:

It means you dont have a serial port selected, go back and verify that the correct driver is installed (lesson 0)

and that you have the correct serial port selected in the menu.

If you get the following error Expected signature for ATMEGA

Then you have either the incorrect chip selected in the Tools menu or the wrong bootloader burned onto the
chip
If you get the following error: can't open device "COM10": The system cannot find the file specified (under
Windows, COM port value may vary)

83
It means that you have too many COM ports (maybe you've got 9 Arduinos?) You should make sure that the
port is numbered as low as possible. You can use a program like FTClean to clear out old COM ports you aren't
using anymore. Once you've cleaned out the ports, you'll have to reinstall the driver again (see lesson 0).
Alternately, if you're sure that the ports are not used for something else but are left over from other USB
devices, you can simply change the COM port using the Device Manager. Select the USB device in the Device
Manager, right click and select Properties

Then click Advanced... and in the next window change the COM port to something like COM4 or COM5.
Don't forget to select the new port name in the Arduino software. The lower port names may say (in use) but as
long as the other USB devices aren't plugged in, it shouldn't be a problem. This is a little riskier than just using
FTClean...
Video of all steps

84
Here is a video showing the timing of the steps described so far.

Insert LED (NG Arduinos)

Some older Arduinos don't have a built in LED, its easy to tell if yours does or not

If you have a Diecimila or other Arduino with a built in LED you will see a translucent part as shown

If you have an NG rev C or other Arduino without an LED, the translucent part will not be there, and instead
you will see two silver dots

85
If you don't have an LED, you'll need to add your own. Any LED will do, as long as it has two legs and kinda
looks like the one shown here. LEDs are directional components. That means if you put it in backwards it will
not work! To help you put the LED in right, the LED factory cuts the legs at different lengths. The longer leg
goes in the hole marked 13and the shorter one goes in the hole marked GND

Watch!

If you have a Diecimila Arduino, the upload process is quite fast, just start the Upload from the software. The
board will automatically reset itself, transfer the sketch and start the sketch. The little translucent LED will start
blinking

Click To Play

If you have an NG arduino, make sure the LED is inserted as indicated before. Here is a video of the entire
uploading process. Right after I press the Reset Button I start the sketch upload. There is a short wait while the
software prepares to transfer the sketch. Then the two small orange lights blink, indicating the sketch is being
transfered. When its done, there is a 7 second delay until the sketch starts.

Click To Play

If you don't get a blinking LED, make sure you put the part in the right way, in the correct holes, and perhaps try a
different LED as it may be bad

86
CHAPTER 6: ADVANTAGES AND DISADVANTAGES

Advantages:

1. Remote Monitoring and Control: The Telnet server allows remote access and command input.
2. Real-Time Sensor Data: Temperature, humidity, and gas status are continuously monitored and
updated.

3. Obstacle Detection: Dual ultrasonic sensors provide distance data for navigation safety.

4. Integrated Control: One microcontroller handles all sensors and actuators efficiently.

5. Low Cost: Uses widely available and affordable components.

Disadvantages:

 Basic Security: Telnet lacks encryption, which can be a vulnerability in real-world deployments.

 Limited Range: The Wi-Fi-based system is constrained by network coverage.

 Servo Limitation: The servo scan mechanism lacks precision and could miss fast-moving threats.

 No Real-Time Tracking: Does not implement actual missile tracking, only detection and simulated
response.

Applications:

 Defense Surveillance Systems

 Military Training Simulations

87
 Autonomous Robotics Navigation

 IoT-based Industrial Monitoring

 Smart Border Monitoring Systems

CHAPTER 7: RESULTS

7.1 Result:

 The servo scans the area between 0° to 180° and back, simulating radar.
 Temperature, humidity, and gas status are displayed and updated every second via Telnet.
 The system responds to commands like FORWARD, BACKWARD, LEFT, RIGHT, and STOP.
 If an object is detected within 100 cm, a laser (represented by LED) is activated.
 Obstacle alert halts movement if an obstacle is detected within 30 cm using the second ultrasonic sensor.

7.2 Conclusion:

The implemented system successfully demonstrates a basic missile or threat detection and
directional response system using IoT. It efficiently integrates environmental sensing and directional control
under one platform using ESP32. Though rudimentary, it provides a solid foundation for future development in
smart defense systems.

7.3 Future Scope:

  Upgrade to Secure Protocols: Replace Telnet with MQTT or HTTPS for secure communication.

 Camera Integration: Add a camera module for live video streaming and object recognition.

 GPS & GSM Modules: Enable geolocation and alerts via SMS in remote regions.

 AI-based Threat Detection: Integrate machine learning models for intelligent decision-making.

 Cloud Connectivity: Store and analyze long-term sensor data using platforms like Firebase or ThingsBoard.

88
REFERENCES

 ESP32 Documentation – Espressif

 Arduino Servo Library

 DHT11 Sensor Basics – Adafruit

 Ultrasonic Sensor HC-SR04 – Datasheet

 LiquidCrystal_I2C Library GitHub

APPENDIX

Program Code:

The program code which is dumped in the microcontroller of our project is shown below.

89

You might also like