KEMBAR78
Main Iot Based Project | PDF | Rectifier | Arduino
0% found this document useful (0 votes)
19 views66 pages

Main Iot Based Project

The document is a mini project report on 'IoT-Based Highway Lights Control Based on Density' submitted to Jawaharlal Nehru Technological University as part of a Bachelor's degree in Electronics and Communication Engineering. It details the use of Arduino to control LED street lighting based on traffic density, aiming to reduce energy consumption compared to traditional High Intensity Discharge lamps. The project includes acknowledgments, a declaration of originality, and sections on hardware components, circuit operations, software development, and analysis of the system's advantages and applications.

Uploaded by

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

Main Iot Based Project

The document is a mini project report on 'IoT-Based Highway Lights Control Based on Density' submitted to Jawaharlal Nehru Technological University as part of a Bachelor's degree in Electronics and Communication Engineering. It details the use of Arduino to control LED street lighting based on traffic density, aiming to reduce energy consumption compared to traditional High Intensity Discharge lamps. The project includes acknowledgments, a declaration of originality, and sections on hardware components, circuit operations, software development, and analysis of the system's advantages and applications.

Uploaded by

Saiteja Golla
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 66

A

MINI PROJECT REPORT


ON

IoT-Based Highway Lights Control


Based on Density
Submitted to Jawaharlal Nehru Technological University, Hyderabad

in partial fulfillment of requirement for the degree of

BACHELOR OF TECHNOLOGY
in
ELECTRONICS AND COMMUNICATION ENGINEERING
Submitted by

G.Sravan Kumar - 229P1A0436

D.Kushalove - 229P1A0440

S.Ashok - 229P1A0405

B.Raghavendra - 239P5A0404

Under the guidance of


Dr.M V RAGHAVENDRA
(ASSIST PROFESSOR & PHD)

DEPARTMENT OF ELECTRONICS & COMMUNICATION ENGINEERING

SREE DATTHA GROUP OF INSTITUTIONS


Sagar Road,Sheriguda(village),Ibrahimpatnam(mandal)

Ranga Reddy Dt., Telangana-501510


SREE DATTHA GROUP OF INSTITUTIONS
DEPARTMENT OF
ELECTRONICS AND COMMUNICATION ENGINEERING

CERTIFICATE

This is to certify that the project report entitled. IoT-Based Highway Lights Control
Based on Density that is being submitted by
G.Sravan Kumar - 229P1A0436

D.Kushalove - 229P1A0440

S.Ashok - 229P1A0405

B.Raghavendra - 239P5A0404

in partial fulfillment for the award of Bachelor of Technology in Electronics


&Communication Engineering to the Jawaharlal Nehru Technological University,
Hyderabad is a record of bonafide work carried out by them under my guidance and
supervision. The results embodied in this project report have not been submitted to any other
University or Institute for the award of any degree or diploma.

(Dr. M V RAGARENDRA) (Dr. P Rama Koteswara Rao)


Assistant professor Professor & Head

External Examiner
ACKNOWLEDGEMENT
We would like to thank Chairman sir G. Panduranga Reddy Garu and Vice chairmen sir
G. N. Vibhav Reddy Garu for providing all the facilities to complete our project with in
time.

We would like to express our deep sense of gratitude to our principal Dr. M Senthil
Kumar Garu, Sree Dattha Group of Institutions, for his continuous effort in creating a
competitive environment in our college and encouraging through this course .

Working and writing our thesis in exchange at Sree Dattha Group of Institutions, was a great
opportunity and we would like to thank from the bottom of our heart Dr. P Rama
Koteswara Rao, HOD, Department of Electronics and Communication
Engineering for providing it to us. There was never such a resourceful and enriching time in
our life.

We are thankful to Dr. M V Raghavendra, Asst.Professor in the Department of


Electronics and Communication Engineering, for giving us this opportunity to work under
him and lending every support at every stage of this project work. We truly appreciate and
value his esteemed guidance and encouragement from the beginning to the end of this
thesis. We are indebted to his for having helped us to shape the problem and providing
insights towards the solution. His trust and support inspired us in the most important
moments of making right decisions and we are glad to work with him.

G.Sravan Kumar 229P1A0436

D.Kushalove 229P1A0440
S.Ashok 229P1A0405

B.Raghavendra 239P5A0404
SREE DATTHA GROUP OF INSTITUTIONS
DEPARTMENT OF
ELECTRONICS AND COMMUNICATION ENGINEERING

DECLARATION

This is to certify that the work reported in the present project . IoT-Based Highway
Lights Control Based on Density is a record work done by us in the Department of
Electronics and Communication Engineering, Sree Dattha Group of Institutions.

No part of thesis is copied from books/journals/internet and where ever portion is


taken, the same has been duly referred in the text the report is based on major project done
entirely by us, not copied from any other source.

G.Sravan Kumar 229P1A0436

D.Kushalove 229P1A0440

S.Ashok 229P1A0405
239P5A0404
B.Raghavendra

Internal guide Head of the department


Dr. M V Raghavendra Dr. P Rama Koteswara Rao
TABLE OF CONTENTS
TITLE Page no.

ABSTRACT i
LIST OF TABLES ii
LIST OF FIGURES iii
LIST OF ABBREVIATIONS iv

1.INTRODUCTION
1.1 Introduction 1

1.2 Block Diagram 10

2. DESCRIPTION OF HARDWARE COMPONENTS


2.1 ARDUINO
2.1.1 Introduction to ARDUINO 11

2.1.2 Features 12
2.1.3 Architectural overview 14

2.1.4 Pin description for ARDUINO 15

2.1.5 Memories 20

2.2 POWER SUPPLY


2.2.1 Introduction 21

2.2.2 Transformer Power Supply Circuit 21

2.2.3 Rectifier 22

2.2.4 Filter Capacitor 24

2.2.5 Regulator 25

2.2.6 Power Supply Circuit Diagram 25

2.3 IOT MODULE 27


2.4 L293D 29

3. CIRCUITS AND THEIR OPERATION


3.1 CIRCUIT DIAGRAM 37

4. SOURCE CODE

4.1 SOURCE CODE 38

5. SOFTWARE DEVELOPMENT

5.1 INTRODUCTION 51

6. ANALYSIS

6.1 ADVANTAGES, DISADVANTAGES AND APPLICATIONS 51

6.2 RESULT AND CONCLUSIONS 52

BIBILOGRAPHY 53

REFERENCES 54
ABSTRACT

White Light Emitting Diodes (LED) replaces HID lamps in street lighting system to include
dimming feature. An Arduino board is used to control the intensity by developing pulse
width modulated signals that drives a MOSFET to switch the LEDs according to achieve
desired operation. In the present system, mostly the lightning up of highways is done
through High Intensity Discharge lamps (HID), whose energy consumption is high.

Its intensity cannot be controlled according to the requirement so there is a need to switch
on to an alternative method of lightning system i.e., by using LEDs. This system is build to
overcome the present day drawbacks of HID lamps. This system demonstrates the usage of
the LED’s (light emitting diodes) as the light source and its variable intensity control,
according to the requirement.

LED’s consume less power and its life time is more, as compared to the conventional HID
lamps. The more important and interesting feature is its intensity can be controlled
according to the requirement during non peak hours which is not feasible in HID lamps. A
cluster of LEDs are used to form a street light. The Arduino board contains programmable
instructions which controls the intensity of lights based on the PWM (Pulse width
modulation) signals generated.

The intensity of lights are kept high during the peak hours, as the traffic on the roads tend
to decrease slowly in the late nights, the intensity also decreases progressively till morning.
Final it completely shuts down at morning 6, and again resumes at 6pm in the evening. The
process is repeated. This concept in future can be enhanced by integrating it with the solar
panel, which converts the solar intensity into corresponding voltage, and this energy is used
to feed up the highway lights. This project deals with “Development of an embedded system
for automatic street light controlling while vehicle passing” using micro controller
AT89S52 and IR transmitter and receiver are used for informing vehicle passing on road
and corresponding front lights are glowing ,while vehicle passed away back street lights are
off.LDR is used for light intensity if light intensity is low when the vehicles passing on the
road corresponding light will be ON. If light intensity is high all lights are off.

i
List of Tables

Table no. Table Name Page no.

2.1.2 Features 12

ii
List of Figures
Figure no. Figure Name Page no.

1.2 Block diagram 8

2.1 Arduino UNO 9

2.1.1 Internal block diagram 10

2.1.3 Pin diagram of ATMEGA 328P 15

2.2.1 Power Supply block diagram 21

2.2.2 Transformer 23

2.2.3 Rectifier

1.Half wave rectifier 23

2.Full wave rectifier 23

3.Bridge rectifier 23

2.2.4 Waveforms 23

2.2.5 Voltage regulator 24

2.2.6 Circuit diagram of power supply 25

2.3.1 ESP 8266 32

2.3.1 ESP-01 Module 36

3.1 Circuit diagram 37

5.1 Arduino UNO 42

5.1.2 USB Cable 43

5.1.3 Output Result 52


Bibilography 53
Reference 54

iii
List of Abbreviations
 ICSP In-circuit Serial programming

 DIP Dual In-line Package

 TTL Transistor - Transistor Logic

 UART Universal Asynchronous Receiver / Transmitter

 SPI Serial Peripheral Interface

 USB Universal Serial Bus

 LED Light Emitting Diode

 LDR Light Dependent Resistor

 MCU Microcontroller Unit

 GSM Gobal System for Mobile communication

 GPS Global Positioning System

 RTC Real-Time Clock

 PIR Passive Infrared Sensor

 IR Infrared (Sensor or LED)

 PCB Printed Circuit Board

iv
CHAPTER 1

Introduction of Embedded System

An Embedded System is a combination of computer hardware and software, and


perhaps additional mechanical or other parts, designed to perform a specific function. A good
example is the microwave oven. Almost every household has one, and tens of millions of
them are used everyday, but very few people realize that a processor and software are involved
in the preparation of their lunch or dinner.

This is in direct contrast to the personal computer in the family room. It too is
comprised of computer hardware and software and mechanical components (disk drives, for
example). However, a personal computer is not designed to perform a specific function rather;
it is able to do many different things. Many people use the term general-purpose computer to
make this distinction clear. As shipped, a general-purpose computer is a blank slate; the
manufacturer does not know what the customer will do wish it. One customer may use it for
a network file server another may use it exclusively for playing games, and a third may use it
to write the next great American novel.

Frequently, an embedded system is a component within some larger system. For


example, modern cars and trucks contain many embedded systems. One embedded system
controls the anti-lock brakes, other monitors and controls the vehicle's emissions, and a third
displays information on the dashboard. In some cases, these embedded systems are connected
by some sort of a communication network, but that is certainly not a requirement.

At the possible risk of confusing you, it is important to point out that a


general-purpose computer is itself made up of numerous embedded systems. For example,
my computer consists of a keyboard, mouse, video card, modem, hard drive, floppy drive,
and sound card-each of which is an embedded system. Each of these devices contains a
processor and software and is designed to perform a specific function. For example, the
modem is designed to send and receive digital data over analog telephone line. That's it and
all of the other devices can be summarized in a single sentence as well.

1
If an embedded system is designed well, the existence of the processor and software
could be completely unnoticed by the user of the device. Such is the case for a microwave
oven, VCR, or alarm clock. In some cases, it would even be possible to build an equivalent
device that does not contain the processor and software. This could be done by replacing the
combination with a custom integrated circuit that performs the same functions in hardware.
However, a lot of flexibility is lost when a design is hard-cooled in this way. It is mush easier,
and cheaper, to change a few lines of software than to redesign a piece of custom hardware.

Real Time Systems:

One subclass of embedded is worthy of an introduction at this point. As commonly


defined, a real-time system is a computer system that has timing constraints. In other words,
a real-time system is partly specified in terms of its ability to make certain calculations or
decisions in a timely manner. These important calculations are said to have deadlines for
completion. And, for all practical purposes, a missed deadline is just as bad as a wrong answer.

The issue of what if a deadline is missed is a crucial one. For example, if the
real-time system is part of an airplane's flight control system, it is possible for the lives of the
passengers and crew to be endangered by a single missed deadline. However, if instead the
system is involved in satellite communication, the damage could be limited to a single corrupt
data packet. The more severe the consequences, the more likely it will be said that the deadline
is "hard" and thus, the system is a hard real-time system. Real-time systems at the other end
of this discussion are said to have "soft" deadlines.

All of the topics and examples presented in this book are applicable to the
designers of real-time system who is more delight in his work. He must guarantee reliable
operation of the software and hardware under all the possible conditions and to the degree
that human lives depend upon three system's proper execution, engineering calculations and
descriptive paperwork.

2
Application Areas:

Nearly 99 per cent of the processors manufactured end up in embedded


systems. The embedded system market is one of the highest growth areas as these systems
are used in very market segment- consumer electronics, office automation, industrial
automation, biomedical engineering, wireless communication, data communication,
telecommunications, transportation, military and so on.

Consumer appliances:

At home we use a number of embedded systems which include digital camera,


digital diary, DVD player, electronic toys, microwave oven, remote controls for TV and
airconditioner, VCO player, video game consoles, video recorders etc. Today’s high-tech car
has about 20 embedded systems for transmission control, engine spark control, air-
conditioning, navigation etc. Even wristwatches are now becoming embedded systems. The
palmtops are powerful embedded systems using which we can carry out many general-
purpose tasks such as playing games and word processing.

Office automation:

The office automation products using em embedded systems are copying machine,
fax machine, key telephone, modem, printer, scanner etc.

Industrial automation:

Today a lot of industries use embedded systems for process control. These include
pharmaceutical, cement, sugar, oil exploration, nuclear energy, electricity generation and
transmission. The embedded systems for industrial use are designed to carry out specific tasks
such as monitoring the temperature, pressure, humidity, voltage, current etc., and then take
appropriate action based on the monitored levels to control other devices or to send
information to a centralized monitoring station. In hazardous industrial environment, where
human presence has to be avoided, robots are used, which are programmed to do specific jobs.
The robots are now becoming very powerful and carry out many interesting and complicated
tasks such as hardware assembly.

3
Medical electronics:

Almost every medical equipment in the hospital is an embedded system. These


equipments include diagnostic aids such as ECG, EEG, blood pressure measuring devices,
Xray scanners; equipment used in blood analysis, radiation, colonscopy, endoscopy etc.
Developments in medical electronics have paved way for more accurate diagnosis of diseases.

Computer networking:

Computer networking products such as bridges, routers, Integrated Services


Digital Networks (ISDN), Asynchronous Transfer Mode (ATM), X.25 and frame relay
switches are embedded systems which implement the necessary data communication
protocols. For example, a router interconnects two networks. The two networks may be
running different protocol stacks. The router’s function is to obtain the data packets from
incoming pores, analyze the packets and send them towards the destination after doing
necessary protocol conversion. Most networking equipments, other than the end systems
(desktop computers) we use to access the networks, are embedded systems

Telecommunications:

In the field of telecommunications, the embedded systems can be categorized


as subscriber terminals and network equipment. The subscriber terminals such as key
telephones, ISDN phones, terminal adapters, web cameras are embedded systems. The
network equipment includes multiplexers, multiple access systems, Packet Assemblers
Dissemblers (PADs), sate11ite modems etc. IP phone, IP gateway, IP gatekeeper etc. are the
latest embedded systems that provide very low-cost voice communication over the Internet.

Wireless technologies:

Advances in mobile communications are paving way for many interesting


applications using embedded systems. The mobile phone is one of the marvels of the last
decade of the 20’h century. It is a very powerful embedded system that provides voice
communication while we are on the move. The Personal Digital Assistants and the palmtops
can now be used to access multimedia services over the Internet. Mobile communication
4
infrastructure such as base station controllers, mobile switching centers are also powerful
embedded systems.

Security:

Security of persons and information has always been a major issue. We need
to protect our homes and offices; and also the information we transmit and store.
Developing embedded systems for security applications is one of the most lucrative
businesses nowadays. Security devices at homes, offices, airports etc. for authentication and
verification are embedded systems. Encryption devices are nearly 99 per cent of the
processors that are manufactured end up in~ embedded systems. Embedded systems find
applications in . every industrial segment- consumer electronics, transportation, avionics,
biomedical engineering, manufacturing, process control and industrial
automation, data communication, telecommunication, defense, security etc. Used
to encrypt the data/voice being transmitted on communication links such as telephone lines.
Biometric systems using fingerprint and face recognition are now being extensively used for
user authentication in banking applications as well as for access control in high security
buildings.

Finance:

Financial dealing through cash and cheques are now slowly paving way for
transactions using smart cards and ATM (Automatic Teller Machine, also expanded as Any
Time Money) machines. Smart card, of the size of a credit card, has a small micro-controller
and memory; and it interacts with the smart card reader! ATM machine and acts as an
electronic wallet. Smart card technology has the capability of ushering in a cashless society.
Well, the list goes on. It is no exaggeration to say that eyes wherever you go, you can see, or
at least feel, the work of an embedded system!

What are microcontrollers and what are they used for?

Like all good things, this powerful component is basically very simple. It is made by mixing
tested and high- quality "ingredients" (components) as per following receipt:
5
1. The simplest computer processor is used as the "brain" of the future system.
2. Depending on the taste of the manufacturer, a bit of memory, a few A/D converters,
timers, input/output lines etc. are added
3. All that is placed in some of the standard packages.
4. A simple software able to control it all and which everyone can easily learn about has
been developed.

On the basis of these rules, numerous types of microcontrollers were designed and they
quickly became man's invisible companion. Their incredible simplicity and flexibility
conquered us a long time ago and if you try to invent something about them, you should know
that you are probably late, someone before you has either done it or at least has tried to do it.

The following things have had a crucial influence on development and success of the
microcontrollers:

• Powerful and carefully chosen electronics embedded in the microcontrollers can


independetly or via input/output devices (switches, push buttons, sensors, LCD
displays, relays etc.), control various processes and devices such as industrial
automation, electric current, temperature, engine performance etc.
• Very low prices enable them to be embedded in such devices in which, until recent
time it was not worthwhile to embed anything. Thanks to that, the world is
overwhelmed today with cheap automatic devices and various “smart” appliences.
• Prior knowledge is hardly needed for programming. It is sufficient to have a PC
(software in use is not demanding at all and is easy to learn) and a simple device (called
the programmer) used for “loading” raedy-to-use programs into the microcontroller.

So, if you are infected with a virus called electronics, there is nothing left for you to do but to
learn how to use and control its power.

How does the microcontroller operate?

Even though there is a large number of different types of microcontrollers and even more
programs created for their use only, all of them have many things in common. Thus, if you
learn to handle one of them you will be able to handle them all. A typical scenario on the basis
of which it all functions is as follows:

6
1. Power supply is turned off and everything is still…the program is loaded into the
microcontroller, nothing indicates what is about to come…
2. Power supply is turned on and everything starts to happen at high speed! The control
logic unit keeps everything under control. It disables all other circuits except quartz
crystal to operate. While the preparations are in progress, the first milliseconds go by.
3. Power supply voltage reaches its maximum and oscillator frequency becomes stable.
SFRs are being filled with bits reflecting the state of all circuits within the
microcontroller. All pins are configured as inputs. The overall electronis starts
operation in rhythm with pulse sequence. From now on the time is measured in micro
and nanoseconds.
4. Program Counter is set to zero. Instruction from that address is sent to instruction
decoder which recognizes it, after which it is executed with immediate effect.
5. The value of the Program Counter is incremented by 1 and the whole process is
repeated...several million times per second.

What is what in the microcontroller?

7
As you can see, all the operations within the microcontroller are performed at high speed and
quite simply, but the microcontroller itself would not be so useful if there are not special
circuits which make it complete. In continuation, we are going to call your attention to them.

Read Only Memory (ROM)

Read Only Memory (ROM) is a type of memory used to permanently save the program being
executed. The size of the program that can be written depends on the size of this memory.
ROM can be built in the microcontroller or added as an external chip, which depends on the
type of the microcontroller. Both options have some disadvantages. If ROM is added as an
external chip, the microcontroller is cheaper and the program can be considerably longer. At
the same time, a number of available pins is reduced as the microcontroller uses its own
input/output ports for connection to the chip. The internal ROM is usually smaller and more
expensive, but leaves more pins available for connecting to peripheral environment. The size
of ROM ranges from 512B to 64KB.

Random Access Memory (RAM)

Random Access Memory (RAM) is a type of memory used for temporary storing
data and intermediate results created and used during the operation of the microcontrollers.
The content of this memory is cleared once the power supply is off. For example, if the
program performes an addition, it is necessary to have a register standing for what in everyday
life is called the “sum” . For that purpose, one of the registers in RAM is called the "sum" and
used for storing results of addition. The size of RAM goes up to a few KBs.

Electrically Erasable Programmable ROM (EEPROM)

The EEPROM is a special type of memory not contained in all microcontrollers. Its contents
may be changed during program execution (similar to RAM ), but remains permanently saved
even after the loss of power (similar to ROM). It is often used to store values, created and
used during operation (such as calibration values, codes, values to count up to etc.), which
must be saved after turning the power supply off. A disadvantage of this memory is that the
process of programming is relatively slow. It is measured in miliseconds.

8
Special Function Registers (SFR)

Special function registers are part of RAM memory. Their purpose is predefined by the
manufacturer and cannot be changed therefore. Since their bits are physically connected to
particular circuits within the microcontroller, such as A/D converter, serial communication
module etc., any change of their state directly affects the operation of the microcontroller or
some of the circuits. For example, writing zero or one to the SFR controlling an input/output
port causes the appropriate port pin to be configured as input or output. In other words, each
bit of this register controls the function of one single pin.

Program Counter

Program Counter is an engine running the program and points to the memory
address containing the next instruction to execute. After each instruction execution, the value
of the counter is incremented by 1. For this reason, the program executes only one instruction
at a time just as it is written. However…the value of the program counter can be changed at
any moment, which causes a “jump” to a new memory location. This is how subroutines and
branch instructions are executed. After jumping, the counter resumes even and monotonous
automatic counting +1, +1, +1…

BLOCK DIAGRAM

9
Hardware Requirements

• ARDUINO UNO

• POWER SUPPLAY

• LEDS

• LDR

• IR TAX AND RX

• IOT MODULE

10
CHAPTER 2
DESCRIPTION OF HARDWARE COMPONENTS
2.1 ATmega328p:

2.1.1.INTRODUCTION:

Arduino/Genuino Uno is a microcontroller board based on the ATmega328P


(datasheet). It has 14 digital input/output pins (of which 6 can be used as PWM outputs), 6
analog inputs, a 16 MHz quartz crystal, a USB connection, a power jack, an ICSP header and
a reset button. It contains everything needed to support the microcontroller; simply connect it
to a computer with a USB cable or power it with a AC-to-DC adapter or battery to get started..
You can tinker with your UNO without worring too much about doing something wrong,
worst case scenario you can replace the chip for a few dollars and start over again.

"Uno" means one in Italian and was chosen to mark the release of Arduino Software
(IDE) 1.0. The Uno board and version 1.0 of Arduino Software (IDE) were the reference
versions of Arduino, now evolved to newer releases. The Uno board is the first in a series of
USB Arduino boards, and the reference model for the Arduino platform; for an extensive list
of current, past or outdated boards see the Arduino index of boards.

You can find here your board warranty informations.


11
You can find in the Getting Started section all the information you need to configure your
board, use the Arduino So ftware (IDE), and start tinker with coding and electronics.

2.1.2 Features:
Microcontroller ATmega328P

Operating Voltage 5V

Input Voltage (recommended) 7-12V

Input Voltage (limit) 6-20V

Digital I/O Pins 14 (of which 6 provide PWM output)

PWM Digital I/O Pins 6

Analog Input Pins 6

DC Current per I/O Pin 20 mA

DC Current for 3.3V Pin 50 mA

32 KB (ATmega328P)
Flash Memory
of which 0.5 KB used by bootloader

SRAM 2 KB (ATmega328P)

EEPROM 1 KB (ATmega328P)

Clock Speed 16 MHz

68.6
53.4
25 g

OSH: Schematics, Reference Design, Board size


Arduino / Genuino Uno is open-source hardware! You can build your own board using the
follwing files:

12
Programming
The Arduino/Genuino Uno can be programmed with the (Arduino Software (IDE)). Select
"Arduino/Genuino Uno from the Tools > Board menu (according to the microcontroller on
your board). For details, see the reference and tutorials.

The ATmega328 on the Arduino/Genuino Uno comes preprogrammed with a bootloader that
allows you to upload new code to it without the use of an external hardware programmer. It
communicates using the original STK500 protocol (reference, C header files).

You can also bypass the bootloader and program the microcontroller through the ICSP
(InCircuit Serial Programming) header using Arduino ISP or similar; see these instructions
for details.

The ATmega16U2 (or 8U2 in the rev1 and rev2 boards) firmware source code is available in
the Arduino repository. The ATmega16U2/8U2 is loaded with a DFU bootloader, which can
be activated by:

• On Rev1 boards: connecting the solder jumper on the back of the board (near the map
of Italy) and then rese ing the 8U2.
• On Rev2 or later boards: there is a resistor that pulling the 8U2/16U2 HWB line to
ground, making it easier to put into DFU mode.

You can then use Atmel's FLIP software (Windows) or the DFU programmer (Mac OS X and
Linux) to load a new firmware. Or you can use the ISP header with an external programmer
(overwriting the DFU bootloader). See this user-contributed tutorial for more information.

Differences with other boards


The Uno differs from all preceding boards in that it does not use the FTDI USB-
toserial driver chip. Instead, it features the Atmega16U2 (Atmega8U2 up to version R2)
programmed as a USB-to-serial converter.

13
2.1.3 Internal block diagram:

14
2.1.4 PIN DIAGRAM OF ATMEGA328P:

2.1.4.1 Power and Ground


The power supply voltage (5 volts) must be connected to the VCC input on pin 7. The ground
connectionsare on pins 8 and 22.

2.1.4.2 Clock
Some sort of clock signal must be provided in order for the microcontroller to operate. On the
ATmega328P the clock can come from one of three di_erent sources. The selection of the
clock source is done by program ming fuse bits in the chip. A TTL-compatible clock signal
can be generated externally by other logic and connected to the XTAL1 input (pin 9.) This

15
probably the easiest way to generate the clock for the EE 459 projects. The lab has a supply
of DIP oscillators in some of the more common frequencies. These output a TTL level square
wave that can be fed directly into the microcontroller and to other chips. Alternatively, the
processor can generate a clock if a crystal is connected to the XTAL1 and XTAL2 inputs.
This method uses a plain crystal, not the DIP crystal oscillators as described above. The third
method uses an internal oscillator that runs at approximately 8MHz. This is probably the least
accurate way to generate a clock. Do not use this method if your project requires a clock
running close to a specified frequency. The advantage of using the internal clock is that you
do not need to provide any external signal and other functions are now available on pin 9. For
example it can now be used as Port B bit 6 (PB6) thus giving the microcontroller 22 I/O pins.
In applications where the UART0 serial communications interface is being used, the choice
of clock frequency determines the baud rates that can be used for transmitting and receiving
serial data. The accuracy of the frequency of the baud rate depends on the clock frequency
used for the microcontroller. If a high degree of accuracy is required, an external oscillator of
the correct frequency will be needed..

2.1.4.3 Reset
The reset input (RESET, pin 1) must be in the high state for the processor to operate
normally. This pin has an internal pull-up and does not have to be externally pulled-up to
VCC in order for the processor to operate normally.

2.1.4.4 SPI Programming


The Flash memory on the ATmega328P is programed using connections to the reset input and
three other pins: PB3, PB4 and PB5. These three I/O pins can be used for other purposes as
long as the design allows the programming hardware to have sole access to these pins during
the programming process. Make sure that none of these pins is used as in input from some
source that will continue to drive a signal at the 328P while the reset line is in the low state.

2.1.4.5 I/O Ports


See the mapping between Arduino pins and ATmega328P ports. The mapping for the
Atmega8, 168, and 328 is identical Each of the 14 digital pins on the Uno can be used as an
input or output, using pinMode(),digitalWrite(), and digitalRead() functions. They operate at
5 volts. Each pin can provide or receive 20 mA as recommended operating condition and has

16
an internal pull-up resistor (disconnected by default) of 20-50k ohm. A maximum of 40mA
is the value that must not be exceeded on any I/O pin to avoid permanent damage to the
microcontroller.

Port B (PB)

Port B on the ATmega328P has seven usable pins (PB0 through PB5 and PB7). A eighth bit,
PB6, shares a pin with the XTAL1 input. If the chip is configured for an external clock, this
pin is not available for I/O. Three of the pins (PB3, PB4 and PB5) are use for the SPI interface
for programming the Flash memory. These pins should not be used as inputs connected to
sources that will continue to drive signals at the 328P while in the reset state. 2.2.2 Port C
(PC)

Port C on the 328P has six pins (PC0 through PC5). A seventh bit, PC6, shares a pin with the
RESET input. By changing the configuration fuse settings this bit can be use for I/O. Most of
the pins in PC are shared with the analog-to-digital converter so if the ADC function is used
one or more pins will not be available for general purpose I/O. In addition, PC4 and PC5 are
use for the I2C interface and will not be available for general I/O if I2C is used

Port D (PD)
Port D on the 328P has eight pins (PD0 through PD7). Two of the pins, PD0 and PD1, are
shared with the serial communications interface and can not be used as I/O if the USART0
functions are used.

2.1.4.6 Timer/Counters

The ATmega328P contains three timers:


Timer/Counter0 - an 8-bit counter.
Timer/Counter1 - a 16-bit counter.
Timer/Counter2 - an 8-bit counter similar to Timer/Counter0 but with asynchronous clocking
capability. The internal timers can be used to count events and generate an interrupt when a
specified number of events has occurred. A common use of a timer is to implement a delay
function by counting the number of internal clock cycles that occur. The example on the class
web site in program at328-2.c and discussed below uses the 16-bit timer but the the procedure
17
is similar for the 8-bit timers. To implements a delay _rst set the timer for \Clear Timer on
Compare Match" (CTC) mode using Output Compare Register A (OCR1A). The mode is set
using four bits: WGM12 and WGM13 in TCCR1B, and WGM10 and WGM11 in TCCR1A.
In most situations enabling the CTC interrupt is also required. This is done by setting the
OCIE1A bit in the TIMSK1 register. In this mode the counter counts up to the value in
OCR1A, generates an interrupt, clears the count and starts counting up again. Use the rate of
the internal clock to calculate what count value the counter will need to count to. If the
maximum value exceeds the range of the timer's 16-bit register (greater then 65,535),
determine what value to use in the prescaler to divide the internal clock by (8, 64, 256 or
1024) before it reaches the timer. The maximum count value, after any prescaling, is loaded
into the Output Capture Register (OCR1A). The prescaler is controlled by bits CS10, CS11
and CS12 in TCCR1B. The action of setting the prescaler bits to something other than all
zeros starts the timer counting. To turn the timer o_, set the prescaler bits to all zero. When
the counter reaches the maximum count value, it generates an interrupt, resets the count value
to zero and continues to count. The user program should service the interrupt and take
whatever action is necessary. Keep in mind that the counter does not stop and wait for the
interrupt to be serviced. It continues to count regardless of when or if the user program
services the interrupt.

In addition ,some pins have specialized functiones:


• Serial: 0 (RX) and 1 (TX). Used to receive (RX) and transmit (TX) TTL serial data.
These pins are connected to the corresponding pins of the ATmega8U2 USB-to-TTL
Serial chip.
• External Interrupts: 2 and 3. These pins can be configured to trigger an interrupt on a
low value, a rising or falling edge, or a change in value. See the attachInterrupt()
function for details.
• PWM: 3, 5, 6, 9, 10, and 11. Provide 8-bit PWM output with the analogWrite()
function.
• SPI: 10 (SS), 11 (MOSI), 12 (MISO), 13 (SCK). These pins support SPI
communication using the SPI library.
• LED: 13. There is a built-in LED driven by digital pin 13. When the pin is HIGH
value, the LED is on, when the pin is LOW, it's off.
18
• TWI: A4 or SDA pin and A5 or SCL pin. Support TWI communication using the Wire
library.

The Uno has 6 analog inputs, labeled A0 through A5, each of which provide 10 bits of
resolution (i.e. 1024 different values). By default they measure from ground to 5 volts, though
is it possible to change the upper end of their range using the AREF pin and the anal og
Reference() function. There are a couple of other pins on the board:

• AREF. Reference voltage for the analog inputs. Used with analog Reference().
• Reset. Bring this line LOW to reset the microcontroller. Typically used to add a reset
button to shields which block the one on the board.

Communication
Arduino/Genuino Uno has a number of facilities for communicating with a computer, another
Arduino/Genuino board, or other microcontrollers. The ATmega328 provides UART TTL
(5V) serial communication, which is available on digital pins 0 (RX) and 1 (TX). An
ATmega16U2 on the board channels this serial communication over USB and appears as a
virtual com port to software on the computer. The 16U2 firmware uses the standard USB
COM drivers, and no external driver is needed. However, on Windows, a .inf file is required.
The Arduino Software (IDE) includes a serial monitor which allows simple textual data to be
sent to and from the board. The RX and TX LEDs on the board will flash when data is being
transmitted via the USB-to-serial chip and USB connection to the computer (but not for serial
communication on pins 0 and 1).

A Software Serial library allows serial communication on any of the Uno's digital pins.

The ATmega328 also supports I2C (TWI) and SPI communication. The Arduino Software
(IDE) includes a Wire library to simplify use of the I2C bus; see the documentation for details.
For SPI communication, use the SPI library.

Automatic (Software) Reset


Rather than requiring a physical press of the reset button before an upload, the
Arduino/Genuino Uno board is designed in a way that allows it to be reset by software running
on a connected computer. One of the hardware flow control lines (DTR) of the
ATmega8U2/16U2 is connected to the reset line of the ATmega328 via a 100 nanofarad
capacitor. When this line is asserted (taken low), the reset line drops long enough to reset the
19
chip. The Arduino Software (IDE) uses this capability to allow you to upload code by simply
pressing the upload button in the interface toolbar. This means that the bootloader can have a
shorter timeout, as the lowering of DTR can be well-coordinated with the start of the upload.

This setup has other implications. When the Uno is connected to either a computer running
Mac OS X or Linux, it resets each time a connection is made to it from software (via USB).
For the following half-second or so, the bootloader is running on the Uno. While it is
programmed to ignore malformed data (i.e. anything besides an upload of new code), it will
intercept the first few bytes of data sent to the board after a connection is opened. If a sketch
running on the board receives one-time configuration or other data when it first starts, make
sure that the software with which it communicates waits a second after opening the connection
and before sending this data.

The Uno board contains a trace that can be cut to disable the auto-reset. The pads on either
side of the trace can be soldered together to re-enable it. It's labeled "RESET-EN". You may
also be able to disable the auto-reset by connecting a 110 ohm resistor from 5V to the reset
line; for details.

Revisions
Revision 3 of the board has the following new features:
• 1.0 pinout: added SDA and SCL pins that are near to the AREF pin and two other new
pins placed near to the RESET pin, the IOREF that allow the shields to adapt to the voltage
provided from the board. In future, shields will be compatible with both the board that
uses the AVR, which operates with 5V and with the Arduino Due that operates with 3.3V.
The second one is a not connected pin, that is reserved for future purposes.
• Stronger RESET circuit.
• Atmega 16U2 replace the 8U2.

2.1.5 Memory

The ATmega328 has 32 KB (with 0.5 KB occupied by the bootloader). It also has 2 KB of
SRAM and 1 KB of EEPROM (which can be read and written with the EEPROM library).

20
2.2 Power Supply
2.2.1 INTRODUCTION

There are many types of power supply. Most are designed to convert high voltage
AC mains electricity to a suitable low voltage supply for electronics circuits and other
devices. A power supply can by broken down into a series of blocks, each of which
performs a particular function. For example a 5V regulated supply can be shown as below

Fig 3.1: Block Diagram of a Regulated Power Supply System

Similarly, 12v regulated supply can also be produced by suitable selection of


the individual elements. Each of the blocks is described in detail below and the power
supplies made from these blocks are described below with a circuit diagram and a
graph of their output:

2.2.2 Transformer:

A transformer steps down high voltage AC mains to low voltage AC. Here we
are using a center-tap transformer whose output will be sinusoidal with 36volts peak
to peak value.

21
Fig: 2.3.1 Output Waveform of transformer

The low voltage AC output is suitable for lamps, heaters and special AC
motors. It is not suitable for electronic circuits unless they include a rectifier and a
smoothing capacitor. The transformer output is given to the rectifier circuit.

2.2.3 Rectifier:

A rectifier converts AC to DC, but the DC output is varying. There are several
types of rectifiers; here we use a bridge rectifier.

The Bridge rectifier is a circuit, 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
unidirectional.

22
Figure 3.3 Rectifier circuit

Now the output of the rectifier shown in Figure 3.3 is shown below in Figure 3.4

Figure 2.3.4 Output of the Rectifier

The varying DC output is suitable for lamps, heaters and standard motors. It
is not suitable for lamps, heaters and standard motors. It is not suitable for electronic
circuits unless they include a smoothing capacitor.

Smoothing:

The smoothing block smoothes the DC from varying greatly to a small ripple
and the ripple voltage is defined as the deviation of the load voltage from its DC value.
Smoothing is also named as filtering.

Filtering is frequently effected by shunting the load with a capacitor. The


action of this system depends on the fact that the capacitor stores energy during the
conduction period and delivers this energy to the loads during the no conducting
period. In this way, the time during which the current passes through the load is

23
prolonging Ted, and the ripple is considerably decreased. The action of the capacitor
is shown with the help of waveform.

1) Figure 2.3.5 Smoothing action of capacitor

Figure2. 3.6 Waveform of the rectified output smoothing

2.2.4 Regulator:

Regulator eliminates ripple by setting DC output to a fixed voltage. Voltage


regulator ICs are available with fixed (typically 5V, 12V and 15V) or variable output
voltages. Negative voltage regulators are also available

24
Many of the fixed voltage regulator ICs has 3 leads (input, output and high
impedance). They include a hole for attaching a heat sink if necessary. Zener diode is
an example of fixed regulator which is shown here.

Figure 3.7 Regulator

Circuit diagram:

Fig:Power supply circuit diagrom

25
LDR
Working

A photo resistor or Light Dependent Resistor or CdS Cell is a resistor whose resistance
decreases with increasing incident light intensity. It can also be referred to as a
photoconductor. A photo resistor is made of a high resistance semiconductor. If light falling
on the device is of high enough frequency, photons absorbed by the semiconductor give bound
electrons enough energy to jump into the conduction band. The resulting free electron (and
its hole partner) conduct electricity, thereby lowering resistance.

A photoelectric device can be either intrinsic or extrinsic. An intrinsic semiconductor


has its own charge carriers and is not an efficient semiconductor, e.g. silicon. In intrinsic
devices the only available electrons are in the valence band, and hence the photon must have
enough energy to excite the electron across the entire band gap. Extrinsic devices have
impurities, also called dopants, added whose ground state energy is closer to the conduction
band; since the electrons don't have as far to jump, lower energy photons (i.e., longer
wavelengths and lower frequencies) are sufficient to trigger the device. If a sample of silicon
has some of its atoms replaced by phosphorus atoms (impurities), there will be extra electrons
available for conduction. This is an example of an extrinsic semiconductor.

A Light Dependent Resistor (LDR, photoconductor, or photocell) is a device which has a


resistance which varies according to the amount of light falling on its surface. They will be having a
resistance of 1 MOhm in total darkness, and a resistance of a 1 to 10 of kOhm in bright light. A
photoelectric device can be either intrinsic or extrinsic.

26
Applications:

An LDR can even be used in a simple remote control circuit using the backlight of a mobile
phone to turn on a device - call the mobile from anywhere in the world, it lights up the LDR, and
lighting can be turned on remotely!

There are two basic circuits using light dependent resistors - the first is activated by darkness,
the second is activated by light.

In the circuit diagram on the left, the led lights up whenever the LDR is in darkness. The 10K
variable resistor is used to fine-tune the level of darkness required before the LED lights up. The 10K
standard resistor can be changed as required to achieve the desired effect, although any replacement
must be at least 1K to protect the transistor from being damaged by excessive current.

By swapping the LDR over with the 10K and 10K variable resistors , the circuit will be
activated instead by light. Whenever sufficient light falls on the LDR (manually fine-tuned using the
10K variable resistor), the LED will light up.

27
The circuits shown above are not practically useful. In a real world circuit, the LED
(and resistor) between the positive voltage input (Vin) and the collector (C) of the transistor
would be replaced with the device to be powered.

Typically a relay is used - particularly when the low voltage light detecting circuit is used to switch
on (or off) a 240V mains powered device. A diagram of that part of the circuit is shown above. When
darkness falls (if the LDR circuit is configured that way around), the relay is triggered and the 240V
device - for example a security light - switches on.

Measure Light Intensity using Light Dependent Resistor (LDR):

The relationship between the resistance RL and light intensity Lux for a typical LDR
is

RL = 500 / Lux Kohm

With the LDR connected to 5V through a 3.3K resistor, the output voltage of the LDR is
Vo = 5*RL / (RL+3.3)
28
Reworking the equation, we obtain the light intensity

Lux = (2500/Vo - 500)/3

IR LEDs
An electroluminescent IR LED is a product which requires care in use. IR LEDs are
fabricated from narrow band heterostructures with energy gap from 0.25 to 0.4 eV. That's why
the bias used to initiate current flow is low compared to the well known visible or NIR LEDs.
Typical forward bias is V~0.1- 1 V only for mid-IR LEDs!

29
Be sure not to exceed I*max which is given in each LED specification and do not use test
instrument that contain sources/batteries with voltage greater that Vcw max given in
specification. For LED current restriction and further LED current measurement we
recommend to use resistor (1-5 Ohms) connected in serial to LED. This is important to note
that un-grounded devices (e.g. computers) can give V=1-5 V that is enough to destroy the
LED!
It is highly desirable that the user has I-V meter for small currents (10-100 x10 -6 A). We
guarantee the existence of the LED output as long as V-I characteristic shows saturation in
the reverse bias (10-100 x10-6 A).
We recommend activating pulse generator prior connecting LED to generator. On switching
off the procedure is reversed: disconnect LED, switch off pulse generator. Long wires
connecting LED with pulse generator may be the reason for LED failure because of
unexpected voltage surges when switching on and off the LED supply.
Please test all elements and circuits before applying voltage to LED. Remember that ground
(T0-18 or another holder) should be biased positively (if not specially designed). Usually the
negative electrode is made shorter than the positive one.
The expected signal is not very big and it is important to test and eliminate noise in the detector
circuits.
In some cases it is possible to increase pulse duration. Imax in such cases can be estimated
using the following equation: Imax=I* max /20*SQRT(f*t), where f-is the frequency (Hz),
tis the pulse duration (s), I* max-is the maximum current (A) for t=5 us and f=500 Hz. The
equation gives an order of magnitude and may be used for t< 0.1 ms only. Pulses with t > 0.15
ms should be considered as adequate to CW operation and Imax and Vmax should be taken
close to CW operation parameters. Please, note that long pulses can increase heat dissipation
and the chip temperature. This effect decreases LED emission power and can be traced due
to the LED resistance decrease during each pulse. CW power often decreases with time due
to heatsink temperature increase.
Micro immersion LEDs are made with chalcogenide glass that have low melting temperature
(50-70oC). That’s why, please, avoid any heater source close to the LED. Even sunlight
concentrated onto the lens can melt glass the lens. That’s why we recommend vertical position
for the LEDs at the initial stage of the research work. We are working now to increase the
glass melting temperature or/and to strengthen its position and shape.
Be patient in adjusting the optical system. It is only experience that allows fast work.

30
Lifetime Tests

Room temperature lifetime tests


were performed with InGaAs
homojunction diodes, un-
encapsulated and encapsulated at
current pulses of 2A, duration 50 µs
and repetition rate of 30 Hz.
Lower figure presents data on the
long-term variation of the
properties of the uncoated InGaAs
homojunction LED s at high
temperatures. The
upper graph shows the times for which the LEDs under study operated at several
ambient temperatures. The samples operated at currents I = 0, 0.5, 1, 2 A for 150 h at
room temperature, 450 h at T = 130°C, and 800 h at T =180°C. The LEDs were cooled
to room temperature and heated again to T = 130°C eight times and to 180°C three
times.
The lower graph shows the output
power as a function of the working
time. As can be seen, the output
power decreased, on average, by
25% after 1400 h of operation. It is
noteworthy that the operating
current strength has no effect on the
degradation of the LEDs. With
increasing operating time, the
reverse currents at a bias U = 1 V
increased from 0.5–1 mA (0 h) to
3–4 mA (1400 h). On “cleaning” the sample surface by etching in CP-4, the reverse current
returned to its initial values, and the output power tended to regain its initial value: P(1400
h) = (0.85–0.9)P(0 h).
This confirms that LED encapsulation or by protection with window should increase LED
lifetime at elevated temperatures.
31
ESP 8266:

ESP8266 Features

• 802.11 b/g/n protocol


• Wi-Fi Direct (P2P), soft-AP
• Integrated TCP/IP protocol stack
• Integrated TR switch, balun, LNA, power amplifier and matching network
• Integrated PLL, regulators, and power management units
• +19.5dBm output power in 802.11b mode
• Integrated temperature sensor
• Supports antenna diversity
• Power down leakage current of < 10uA
• Integrated low power 32-bit CPU could be used as application processor
• SDIO 2.0, SPI, UART
• STBC, 1×1 MIMO, 2×1 MIMO
• A-MPDU & A-MSDU aggregation & 0.4µs guard interval
• Wake up and transmit packets in < 2ms
• Standby power consumption of < 1.0mW (DTIM3)

32
The ESP8266 is a low-cost Wi-Fi chip with full TCP/IP stack and MCU (Micro Controller
Unit) capability produced by Shanghai-based Chinese manufacturer,

The chip first came to the attention of western makers in August 2014 with the ESP-01
module, made by a third-party manufacturer, AI-Thinker. This small module allows
microcontrollers to connect to a Wi-Fi network and make simple TCP/IP connections using
Hayes-style commands. However, at the time there was almost no English-language
documentation on the chip and the commands it accepted. The very low price and the fact that
there were very few external components on the module which suggests that it could
eventually be very inexpensive in volume, attracted many hackers to explore the module,
chip, and the software on it, as well as to translate the Chinese documentation.

The ESP8285 is an ESP8266 with 1 MB of built-in flash, allowing for single-chip devices
capable of connecting to Wi-Fi.

The successor to these module(s) is ESP32.

This is the series of ESP8266-based modules made by Espressif.

Active Form Dimensions


Name Pitch LEDs Antenna Shielded? Notes pins factor (mm)

ESP-
2×9 FCC ID 2AC7Z- No PCB
Yes
WROOM- 18 0.1" 18 × 20 trace
DIL ESPWROOM02
02

In the table above (and the two tables which follow), "Active pins" include the GPIO and
ADC pins with which you can attach external devices to the ESP8266 MCU. The "Pitch" is
the space between pins on the ESP8266 module, which is important to know if you are going
to breadboard the device. The "Form factor" also describes the module packaging as "2 x 9
DIL", meaning two rows of 9 pins arranged "Dual In Line", like the pins of DIP ICs. Many
ESP-xx modules include a small on-board LED which can be programmed to blink and
thereby indicate activity. There are several antenna options for ESP-xx boards including a
trace antenna, an on-board ceramic antenna, and an external connector which allows you to
attach an external Wi-Fi antenna. Since Wi-Fi communications generates a lot of RFI (Radio
33
Frequency Interference), governmental bodies like the FCC like shielded electronics to
minimize interference with other devices. Some of the ESP-xx modules come housed within
a metal box with an FCC seal of approval stamped on it. First and second world markets will
likely demand FCC approval and shielded Wi-Fi devices.

AI-Thinker modules

ESP-01 module

These are the first series of modules made with the ESP8266 by the third-party manufacturer
AI-Thinker and remain the most widely available. They are collectively referred to as "ESPxx
modules". To form a workable development system they require additional components,
especially a serial TTL-to-USB adapter (sometimes called a USB-to-UART bridge) and an
external 3.3 Volt power supply. Novice ESP-8266 developers are encouraged to consider
larger ESP8266 Wi-Fi development boards like the Node MCU which includes the USB-
toUART bridge and a Micro-USB connector coupled with a 3.3 Volt power regulator already
built into the board. When project development is complete, you may not need these
components and can consider using these cheaper ESP-xx modules as a lower power, smaller
footprint option for your production runs.

This is the series of ESP8266-based modules made by Espressif.

Active Form Dimensions


Name Pitch LEDs Antenna Shielded? Notes pins factor (mm)

ESP- 2×9 FCC ID PCB 2AC7Z18 0.1" 18 × 20


No trace Yes
WROOM- DIL ESPWROOM02 02

In the table above (and the two tables which follow), "Active pins" include the GPIO and
ADC pins with which you can attach external devices to the ESP8266 MCU. The "Pitch" is
34
the space between pins on the ESP8266 module, which is important to know if you are going
to breadboard the device. The "Form factor" also describes the module packaging as "2 x 9
DIL", meaning two rows of 9 pins arranged "Dual In Line", like the pins of DIP ICs. Many
ESP-xx modules include a small on-board LED which can be programmed to blink and
thereby indicate activity. There are several antenna options for ESP-xx boards including a
trace antenna, an on-board ceramic antenna, and an external connector which allows you to
attach an external Wi-Fi antenna. Since Wi-Fi communications generates a lot of RFI (Radio
Frequency Interference), governmental bodies like the FCC like shielded electronics to
minimize interference with other devices. Some of the ESP-xx modules come housed within
a metal box with an FCC seal of approval stamped on it. First and second world markets will
likely demand FCC approval and shielded Wi-Fi devices.

AI-Thinker modules

ESP-01 module

These are the first series of modules made with the ESP8266 by the third-party manufacturer
AI-Thinker and remain the most widely available. They are collectively referred to as "ESPxx
modules". To form a workable development system they require additional components,
especially a serial TTL-to-USB adapter (sometimes called a USB-to-UART bridge) and an
external 3.3 Volt power supply. Novice ESP-8266 developers are encouraged to consider
larger ESP8266 Wi-Fi development boards like the Node MCU which includes the USB-
toUART bridge and a Micro-USB connector coupled with a 3.3 Volt power regulator already
built into the board. When project development is complete, you may not need these
components and can consider using these cheaper ESP-xx modules as a lower power, smaller
footprint option for your production runs.

35
ESP8266 offers a complete and self-contained Wi-Fi networking solution, allowing it to either
host the application or to offload all Wi-Fi networking functions from another application
processor.

When ESP8266 hosts the application, and when it is the only application processor in the
device, it is able to boot up directly from an external flash. It has integrated cache to improve
the performance of the system in such applications, and to minimize the memory
requirements.
Alternately, serving as a Wi-Fi adapter, wireless internet access can be added to any
microcontroller-based design with simple connectivity through UART interface or the CPU
AHB bridge interface.

The popularity of many of these "other boards" over the earlier ESP-xx modules is the
inclusion of an on-board USB-to-UART bridge (like the Silicon Labs' CP2102 or the WCH
CH340G) and a Micro-USB connector coupled with a 3.3 Volt regulator to provide both
power to the board and connectivity to the host (software development) computer commonly
referred to as the console. With earlier ESP-xx modules, these two items (the USB-to-Serial
adaptor and a 3.3 Volt regulator) had to be purchased separately and be wired into the ESP-
xx circuit. Modern ESP8266 boards like the Node MCU boards are a lot less painful and offer
more GPIO pins to play with. Most of these "other boards" are based on the ESP-12E module,
but new modules are being introduced seemingly every few months.

36
CHAPTER 3
3.1 CIRCUIT DIAGRAM

Circuit
Diagram:

LDR

3.2 CIRCUIT OPERATION

CIRCUIT OPERATION
In our daily life we are observing street lights still on night even if vehicles are not presented,
In this type of conditions are more effected the electricity board by electricity.

This project deals the how to avoid this condition using embedded. The project presented here
to on/off the street lights automatically when the vehicle moving in nights automatically.

Here we are mainly using the sensor for detect the IR(Infra red rays).The Microcontroller was
used to control the whole system, it monitors the sensor out put and according to the sensor
condition the street lights operated. The whole program written in embedded c and burned
into the microcontroller ROM.

The ARDUNIO UNO is an 8-bit microcontroller with 8k bytes of flash ROM, 256 bytes of
RAM and is preferred in using this micro due to its quick programming and ease of use.

37
CHAPTER 4
3.3 SOURCE CODE
unsigned int Light;
float adcValue; char

light_flag,bulb_flag; int

BULB = 3;

void setup() {

// put your setup code here, to run once:

pinMode(BULB,OUTPUT);

digitalWrite(BULB,LOW);

void loop() {

// put your main code here, to run repeatedly:

adcValue =

((analogRead(A0))*0.0049); Light =

(((2500/adcValue)-500)/2.2); if(Light

< 40) { analogWrite(BULB,250);

else if((Light > 60) && (Light < 100)) {

analogWrite(BULB,150);

else if((Light > 125) && (Light < 175)) {

analogWrite(BULB,50);

else if(Light > 200){

analogWrite(BULB,0);

}}

38
SAMPLE PROGRAMS

Example 1:

#define F_CPU
#define F_CPU 16000000UL // 16 MHz clock speed
#endif

#include <avr/io.h>
#include <util/delay.h>

int main(void)
{
DDRC = 0xFF; //Nakes PORTC as Output
while(1) //infinite loop
{
PORTC = 0xFF; //Turns ON All LEDs
_delay_ms(1000); //1 second delay
PORTC= 0x00; //Turns OFF All LEDs
_delay_ms(1000); //1 second delay
}
}

39
Example 2:

#include <avr/io.h>

#include <util/delay.h>

int main(void)

DDRC |= (1<<PC0); //Nakes first pin of PORTC as Output

// OR DDRC = 0x01;

DDRD &= ~(1<<PD0);//Makes firs pin of PORTD as Input

// OR DDRD = 0x00; //Makes all pins of PORTD input

while(1) //infinite loop

if(PIND & (1<<PD0) == 1) //If switch is pressed

PORTC |= (1<<PC0); //Turns ON LED

_delay_ms(3000); //3 second delay

PORTC &= ~(1<<PC0); //Turns OFF LED

Example3:

40
#include <LiquidCrystal.h>

// initialize the library with the numbers of the interface pins

LiquidCrystal lcd(0, 1, 8, 9, 10, 11); /// REGISTER SELECT PIN,ENABLE PIN,D4 PIN,D5
PIN, D6 PIN, D7 PIN

void setup()

// set up the LCD's number of columns and rows: lcd.begin(16, 2);

void loop()

// set the cursor to column 0, line 1 lcd.print(" CIRCUIT DIGEST");//print name

lcd.setCursor(0, 1); // set the cursor to column 0, line 2

lcd.print("www.circuitdigest.com");//print name delay(750);//delay of 0.75sec

lcd.scrollDisplayLeft();//shifting data on LCD lcd.setCursor(0, 0);// set the cursor to column

0, line1

41
CHAPTER 5
SOFTWARE DEVELOPMENT
5.1 Introduction:

In this chapter the software used and the language in which the program code is
defined is mentioned and the program code dumping tools are explained. The chapter also
documents the development of the program for the application. This program has been termed
as “Source code”. Before we look at the source code we define the two header files that we
have used in the code.

Required Equipment:

• A computer (Windows, Mac, or Linux)


• An Arduino-compatible microcontroller (anything from this guide should work)
• A USB A-to-B cable, or another appropriate way to connect your Arduino-compatible
microcontroller to your computer (check out this USB buying guide if you’re not sure
which cable to get).

An Arduino Uno

42
An A-to-B USB Cable

(b) Suggested Reading

If you’re new to Arduino in general, you want to check out this tutorial to familiarize yourself
with everyone’s favorite microcontroller platform.

• What is an Arduino?

If you’re ready to get started, click on the link in the column on the left that matches up with
your operating system, or you can jump to your operating system here.

• Windows
• Mac
• Linux

Section 1.02 Windows

This page will show you how to install and test the Arduino software with a Windows
operating system (Windows 8, Windows 7, Vista, and XP).

(a) Windows 8, 7, Vista, and XP

43
• Go to the Arduino download page and download the latest version of the Arduino
software for Windows.
• When the download is finished, un-zip it and open up the Arduino folder to confirm
that yes, there are indeed some files and sub-folders inside. The file structure is
important so don’t be moving any files around unless you really know what you’re
doing.
• Power up your Arduino by connecting your Arduino board to your computer with a
USB cable (or FTDI connector if you’re using an Arduino pro). You should see the
an LED labed ‘ON’ light up. (this diagram shows the placement of the power LED on
the UNO).
• If you’re running Windows 8, you’ll need to disable driver signing, so go see the
Windows 8 section. If you’re running Windows 7, Vista, or XP, you’ll need to install
some drivers, so head to the Windows 7, Vista, and XP section down below.

(b) Windows 8

Windows 8 comes with a nice little security ‘feature’ that ‘protects’ you from unsigned driver
installation. Some older versions of Arduino Uno come with unsigned drivers, so in order to
use your Uno, you’ll have to tell Windows to disable driver signing. This issue has been
addressed in newer releases of the Arduino IDE, but if you run into issues, you can try this
fix first.

For a nice, step-by-step tutorial with pictures click here, otherwise the steps are outlined
below.

To temporarily disable driver signing:

• From the Metro Start Screen, open Settings (move your mouse to the bottom-
rightcorner of the screen and wait for the pop-out bar to appear, then click the Gear
icon)
• Click ‘More PC Settings’
• Click ‘General’
• Scroll down, and click ‘Restart now’ under ‘Advanced startup’.
• Wait a bit.
• Click ‘Troubleshoot’.
• Click ‘Advanced Options’
44
• Click ‘Windows Startup Settings’
• Click Restart.
• When your computer restarts, select ‘Disable driver signature enforcement‘ from the
list.

To permanently disable driver signing (recommended, but has some minor security
implications):

• Go to the metro start screen


• Type in “cmd”
• Right click “Command Prompt” and select “Run as Administrator” from the buttons
on the bottom of your screen
• Type/paste in the following commands: bcdedit -
set loadoptions
DISABLE_INTEGRITY_CHECKS bcdedit -set TESTSIGNING ON
 Reboot!

(c) Windows 7, Vista, and XP

Installing the Drivers for the Arduino Uno (from Arduino.cc)

• Plug in your board and wait for Windows to begin it’s driver installation process
• After a few moments, the process will fail, despite its best efforts
• Click on the Start Menu, and open up the Control Panel
• While in the Control Panel, navigate to System and Security. Next, click on System
• Once the System window is up, open the Device Manager
• Look under Ports (COM & LPT). You should see an open port named “Arduino UNO
(COMxx)”. If there is no COM & LPT section, look under ‘Other Devices’ for
‘Unknown Device’

45
• Right click on the “Arduino UNO (COMxx)” or “Unknown Device” port and choose
the “Update Driver Software” option
• Next, choose the “Browse my computer for Driver software” option

46
• Finally, navigate to and select the Uno’s driver file, named “ArduinoUNO.inf”,
located in the “Drivers” folder of the Arduino Software download (not the “FTDI USB
Drivers” sub-directory). If you cannot see the .inf file, it is probably just hidden. You
can select the ‘drivers’ folder with the ‘search sub-folders’ option selected instead.
• Windows will finish up the driver installation from there

For earlier versions of the Arduino boards (e.g.Arduino Duemilanove, Nano, or Diecimila)
check out this page for specific directions.

(d) Launch and Blink!

After following the appropriate steps for your software install, we are now ready to test your
first program with your Arduino board!

• Launch the Arduino application


• If you disconnected your board, plug it back in
• Open the Blink example sketch by going to: File > Examples > 1.Basics > Blink

47
• Select the type of Arduino board you’re using: Tools > Board > your board type

• Select the serial/COM port that your Arduino is attached to: Tools > Port > COMxx
48
• If you’re not sure which serial device is your Arduino, take a look at the available
ports, then unplug your Arduino and look again. The one that disappeared is your
Arduino.
• With your Arduino board connected, and the Blink sketch open, press the ‘Upload’
button

49
• After a second, you should see some LEDs flashing on your Arduino, followed by the
message ‘Done Uploading’ in the status bar of the Blink sketch.
• If everything worked, the onboard LED on your Arduino should now be blinking! You
just programmed your first Arduino!

(e) Troubleshooting

This guide from Arduino has some more details and troubleshooting tips if you get stuck.

50
CHAPTER 6
ADVANTAGES DISADVANTAGES & APPLICATIONS

ADVANTAGES

1. Low cost,less complexity.

2. As we can reduce manpower increasing the economy to some extent

DISADVANTAGES

1.This technology can be used only very shorter distance.

APPLICATIONS

1.This method can be used in shopingmalls and transportation applications

2.This method can be used in hospitals,theaters etc…

51
Results and Conclusion
The project “INTELLIGENT HIGH WAY STREET LIGHT CONTROLLER WHILE
VEHICLE PASSING ” has been successfully designed and tested. Integrating features of all
the hardware components used have developed it. Presence of every module has been
reasoned out and placed carefully thus contributing to the best working of the unit. Secondly,
using highly advanced IC’s and with the help of growing technology the project has been
successfully implemented.

52
BIBILOGRAPHY
1. WWW.MITEL.DATABOOK.COM
2. WWW.ATMEL.DATABOOK.COM
3. WWW.FRANKLIN.COM

53
REFERENCES
1. "Power Electronics” by M D Singh and K B Khanchandan

2. "Linear Integrated Circuits” by D Roy Choudary & Shail Jain

3. "Electrical Machines” by S K Bhattacharya

4. "Electrical Machines II” by B L Thereja

54
68

You might also like