New Automatic Control of Street Lights
New Automatic Control of Street Lights
INTRODUCTION
1.1 Embedded Systems
The Street lights are the major requirements in today’s life for safety purposes and avoiding
accidents during night. Providing street lighting is one of the most important and expensive
responsibilities of a city. Lighting can account for 10-38% of the total energy bill in typical
cities worldwide. Street lighting is a particularly critical concern for public authorities in
developing countries because of its strategic importance for Now, we need arise to make the
system automated so that human intervention and manual work avoided and create the
transparency in system. In our project we propose the concept about to economic and social
stability. The fixtures of street lights indirectly have assisted the public and government in
reduction of crime rate and accidents in the area. It also encourages social inclusion by
providing an environment in which people feel they can walk in hours of darkness. Despite
that in today’s busy lifestyle no one bothers to switch it OFF/ON when not required.
Inefficient lighting wastes significant financial resources each year, and poor lighting creates
unsafe conditions. Energy efficient technologies and design can cut street lighting costs
dramatically. The main consideration in the present field technologies are Automation, Power
consumption and cost effectiveness.
Automation is intended to reduce man power with the help of intelligent systems. Power
saving is the main consideration forever as the sources of the power are getting diminished
due to various reasons. Designing a cost efficient system is very important as the requirement
is more. In order to overcome this problem, automatic street light control methods is
introduced. The main objective of our project is to provide a better solution to minimize the
electrical wastage in operating street lights, in this era of automation humans are restless and
are not in a position to regulate the manual operations in any field, a rapid advancement in
embedded systems has paved path for the design and development of microcontroller based
automatic control systems. Our project presents an automatic street light controller using light
dependent resistor (LDR). By using this system manual works are removed.
The street lights are automatically switched ON when the sunlight goes below the visible
region of our eyes. It automatically switches OFF the street lights under illumination by
sunlight. It is a simple and powerful concept, to switch ON/OFF the street light system
1
automatically. It automatically switches ON the streetlight when the sunlight goes below the
visible region of our eyes and switches OFF the streetlight when ample amount of sunlight is
available. The component used for light sensing is a Light Dependent Resistor. By using the
LDR we can operate the streetlight automatically, when ample amount of light is available
the streetlight will be in the OFF state and when it is dark the light will be in ON state, it
means LDR resistance is inversely proportional to light falling on it. When the light falls on
the LDR it sends the commands to the control circuit that it should be in the OFF state and
the streetlight turns OFF. An embedded system can be defined as a computing device that
does a specific focused job. Appliances such as the air-conditioner, VCD player, DVD player,
printer, fax machine, mobile phone etc. are examples of embedded systems. Each of these
appliances will have a processor and special hardware to meet the specific requirement of the
application along with the embedded software that is executed by the processor for meeting
that specific requirement. The embedded software is also called “firm ware”. The
desktop/laptop computer is a general purpose computer. You can use it for a variety of
applications such as playing games, word processing, accounting, software development and
so on. In contrast, the software in the embedded systems is always fixed listed below:
Embedded systems do a very specific task, they cannot be programmed to do different things.
. Embedded systems have very limited resources, particularly the memory. Generally, they do
not have secondary storage devices such as the CDROM or the floppy disk. Embedded
systems have to work against some deadlines. A specific job has to be completed within a
specific time. In some embedded systems, called real-time systems, the deadlines are
stringent. Missing a deadline may cause a catastrophe-loss of life or damage to property.
Embedded systems are constrained for power. As many embedded systems operate through a
battery, the power consumption has to be very low. Some embedded systems have to operate
in extreme environmental conditions such as very high temperatures and humidity.
2
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 air-conditioner, 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 poweIRul 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 poweIRul and carry out
many interesting and complicated tasks such as hardware assembly.
3
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 poweIRul 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 infrastructure such as base station controllers, mobile switching centers are
also poweIRul embedded systems.
Insemination: Testing and measurement are the fundamental requirements in all scientific
and engineering activities. The measuring equipment we use in laboratories to measure
parameters such as weight, temperature, pressure, humidity, voltage, current etc. are all
embedded systems. Test equipment such as oscilloscope, spectrum analyzer, logic analyzer,
protocol analyzer, radio communication test set etc. are embedded systems built around
poweIRul processors. Thank to miniaturization, the test and measuring equipment are now
becoming portable facilitating easy testing and measurement in the field by field-personnel.
1.4 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
4
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!
The operating system runs above the hardware, and the application software runs above the
operating system. The same architecture is applicable to any computer including a desktop
computer. However, there are significant differences. It is not compulsory to have an
operating system in every embedded system. For small appliances such as remote control
units, air conditioners, toys etc., there is no need for an operating system and you can write
only the software specific to that application. For applications involving complex processing,
it is advisable to have an operating system. In such a case, you need to integrate the
5
application software with the operating system and then transfer the entire software on to the
memory chip. Once the software is transferred to the memory chip, the software will continue
to run for a long time you don’t need to reload new software.
Now, let us see the details of the various building blocks of the hardware of an embedded
system. As shown in Fig. the building blocks are;
Central Processing Unit (CPU)
Memory (Read-only Memory and Random Access Memory)
Input Devices
Output devices
Communication inteIRaces
Application-specific circuitry
Memory:
6
The memory is categorized as Random Access 11emory (RAM) and Read Only Memory
(ROM). The contents of the RAM will be erased if power is switched off to the chip, whereas
ROM retains the contents even if the power is switched off. So, the firmware is stored in the
ROM. When power is switched on, the processor reads the ROM; the program is program is
executed.
Input devices:
Unlike the desktops, the input devices to an embedded system have very limited capability.
There will be no keyboard or a mouse, and hence interacting with the embedded system is no
easy task. Many embedded systems will have a small keypad-you press one key to give a
specific command. A keypad may be used to input only the digits. Many embedded systems
used in process control do not have any input device for user interaction; they take inputs
from sensors or transducers 1’fnd produce electrical signals that are in turn fed to other
systems.
Output devices:
The output devices of the embedded systems also have very limited capability. Some
embedded systems will have a few Light Emitting Diodes (LEDs) to indicate the health status
of the system modules, or for visual indication of alarms. A small Liquid Crystal Display
(LCD) may also be used to display some important parameters.
Communication inteIRaces:
The embedded systems may need to, interact with other embedded systems at they may have
to transmit data to a desktop. To facilitate this, the embedded systems are provided with one
or a few communication inteIRaces such as RS232, RS422, RS485, Universal Serial Bus
(USB), IEEE 1394, Ethernet etc.
Application-specific circuitry:
Sensors, transducers, special processing and control circuitry may be required fat an
embedded system, depending on its application. This circuitry interacts with the processor to
carry out the necessary work. The entire hardware has to be given power supply either
through the 230 volts main supply or through a battery. The hardware has to design in such a
way that the power consumption is minimized.
7
1.7 Project Idea
The main consideration in the present field technologies are Automation, Power consumption
and cost effectiveness. Automation is intended to reduce man power with the help of
intelligent systems. Power saving is the main consideration forever as the source of the
power(Thermal, Hydro etc.,)are getting diminished due to various reasons. The main aim of
the project is Automatic street power saving system with LDR, this is to save the power. We
want to save power automatically instead of doing manual. So its easy to make cost
effectiveness. This saved power can be used in some other cases. So in villages, towns etc we
can design intelligent systems for the usage of street lights. Needs no manual operation for
switching ON and OFF. When there is need of light. It detects itself weather there is need for
light or not. When darkness rises to a certain value then automatically street light is switched
The sensitiveness of the street light can also be adjusted. In our project we have used four
L.E.D for indication of bulb but for high power switching one can connect Relay
(electromagnetic switch) at the output of pin 3 of I.C 555. Then it will be possible to turn
ON/OFF any electrical appliances connected all the way through relay.
Most of the time we see street lights are ON even after sunrise thus wasting lot of energy.
Over here we are avoiding the problem by having an automatic system which turns ON OFF
the street lights at given time or when the ambient light falls below a specific. intensity. Each
controller has an LDR which is used to detect the ambient light. If the ambient light is below
a specific value the lights are turned ON[3]. A light dependent sensors is interfaced to the
pic18f452 microcontroller it is used to track the sun light and when the sensors goes dark the
led will be made on and when the sensor founds light the led will be made OFF. It clearly
demonstrates the working of transistor in saturation region and cut-off region. The working of
relay is also known Microcontroller and the code is written in c language in MikroC ide, the
resulted value can be seen with the help of UART or LCD display.
8
Automatic Street Light Control System is a simple yet powerful concept, which uses
transistor as a switch. By using this system manual works are 100 percent removed. It
automatically switches ON lights when the sunlight goes below the visible region of our eyes.
This is done by a sensor called Light Dependent Resistor (LDR) which senses the light
actually like our eyes. It automatically switches OFF lights whenever the sunlight comes,
visible to our eyes]. Aim of this project is to control the street light using LDR. When the
light falling occur means resistance value will be change. There is no light then the resistance
value is change. From this resistance change the voltage variation can be obtained this value
is given to ADC of PIC. PIC is stand for peripheral interface controller. The existing system
is commonly used in all streets of street light system. But in this method there is a loss of
heavy electricity in the whole night. And also the street light is not necessary when there are
no human movements in the street.
A real local time is received from the GPS data and a sunrise and sunset time associated with
the geographic location can then be determined. Street light is poorly designed and
inadequately maintained, there are large number of burned out lamps which leads to
insecurity. There is a complaint register in every zonal office street light section. It is being
maintained by the line inspector. The complaint received from public, councillors and
corporation officials either over phone is in person being recorded in the complaint
register.The complaint thus entered is being handed over to the fieldwork man so as to rectify
the complaints. The field staff will have the rounds in the respective areas twice in a week
and the complaints about non burning are also being attended then and there. But this is not
the immediate remedy on complaints and has many disadvantages like the repair work takes
days/even months instead of taking few hours which results in delay, telephone line may be
busy, sometimes no response. The switches of street lights are switched ON/OFF manually
by the workman in all the zones. This leads to the rise of man power and time. As it is human
operation it is prone to errors.
PROBLEM STATEMENT
Existing methods like registering the complaint, switching on/off the light manually is time
consuming & requires man power. The new method automatic ON/OFF and fault detection
without human intervention is easier when compared to the existing system. We proposed an
automatic light control system which eliminates the disadvantages of the existing systems by
taking date and time from the GPS, as it also gives information about the position of the
9
system. Based on the results the microcontroller calculates and automatically detects
geographical area and retrieve relevant data for sunrise and sunset in the area, respectively
ensures very precise ON/OFF mode of the lighting System. It increases bulb life in result of
the dimming effect.
10
CHAPTER 2
POWER SUPPLY
2.1 POWER SUPPLY:
The input to the circuit is applied from the regulated power supply. The a.c. input i.e., 230V
from the mains supply is step down by the transformer to 12V and is fed to a rectifier. The
output obtained from the rectifier is a pulsating d.c voltage. So in order to get a pure d.c
voltage, the output voltage from the rectifier is fed to a filter to remove any a.c components
present even after rectification. Now, this voltage is given to a voltage regulator to obtain a
pure constant dc voltage.
230V AC D.C
Output
50Hz
2.2Rectifier:
The output from the transformer is fed to the rectifier. It converts A.C. into pulsating D.C.
The rectifier may be a half wave or a full wave rectifier. In this project, a bridge rectifier is
used because of its merits like good stability and full wave rectification.
11
Fig 2.2: Rectifier
2.3 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 R L. 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 R L 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.
12
Filter:
Capacitive filter is used in this project. It removes the ripples from the output of rectifier and
smoothens the D.C. Output received from this filter is constant until the mains voltage and
load is maintained constant. However, if either of the two is varied, D.C. voltage received at
this point changes. Therefore a regulator is applied at the output stage.
13
CHAPTER - 3
ARDUINO UNO
3.1 Arduino/genuino
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 worrying 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.
14
3.2 TECHNICAL SPECIFICATIONS
3.3 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 pre-programmed 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 (in-circuit 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 reseting 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
15
firmware. Or you can use the isp header with an external programmer (overwriting the dfu
bootloader). See this user-contributed tutorial for more information.
WARNINGS
The arduino/genuino Uno has a resettable polyfuse that protects your computer's usb ports
from shorts and overcurrent. Although most computers provide their own internal
protection, the fuse provides an extra layer of protection. If more than 500 ma is applied to
the usb port, the fuse will automatically break the connection until the short or overload is
removed.
POWER
The arduino/genuino uno board can be powered via the usb connection or with an external
power supply. The power source is selected automatically. External (non-usb) power can
come either from an ac-to-dc adapter (wall-wart) or battery. The adapter can be connected
by plugging a 2.1mm center-positive plug into the board's power jack. Leads from a battery
can be inserted in the gnd and vin pin headers of the power connector. The board can
operate on an external supply from 6 to 20 volts. If supplied with less than 7v, however, the
5v pin may supply less than five volts and the board may become unstable. If using more
than 12v, the voltage regulator may overheat and damage the board. The recommended
range is 7 to 12 volts. The power pins are as follows:Vin. The input voltage to the
arduino/genuino board when it's using an external power source (as opposed to 5 volts from
the usb connection or other regulated power source). You can supply voltage through this
pin, or, if supplying voltage via the power jack, access it through this pin.5v.this pin outputs
a regulated 5v from the regulator on the board. The board can be supplied with power either
from the dc power jack (7 - 12v), the usb connector (5v), or the vin pin of the board (7-
12v). Supplying voltage via the 5v or 3.3v pins bypasses the regulator, and can damage
your board. We don't advise it.3v3. A 3.3 volt supply generated by the on-board regulator.
Maximum current draw is 50 ma.Gnd. Ground pins.Ioref. This pin on the arduino/genuino
board provides the voltage reference with which the microcontroller operates. A properly
16
configured shield can read the ioref pin voltage and select the appropriate power source or
enable voltage translators on the outputs to work with the 5v or 3.3v.
3.4 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).
Each of the 14 digital pins on the uno can be used as an input or output, using pin mode(),
digital write (), and digital read () functions. They operate at 5 volts. Each pin can provide
or receive 20 ma as recommended operating condition and has 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. In addition,
some pins have specialized functions:
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.
17
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 attach interrupt()
function for details.
Pwm: 3, 5, 6, 9, 10, and 11. Provide 8-bit pwm output with the analog write()
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. Twi: a4 or sda pin and a5 or scl pin.
Support two 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 are pin and the analog
reference() function.
3.6 COMMUNICATION
Arduino/genuine Uno has a number of facilities for communicating with a computer,
another arduino/genuino board, or other microcontrollers. The atmega328 provides uartttl
(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 txleds 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 softwareserial library allows serial communication on
any of the uno's digital pins.
18
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.
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; see this forum thread for details.
19
CHAPTER 4
SENSORS
4.1 IR SENSOR
IR the same principle in ALL Infra-Red proximity sensors. The basic idea is to send infra
red light through IR-LEDs, which is then reflected by any object in front of the sensor.
Then all you have to do is to pick-up the reflected IR light. For detecting the reflected IR
light, we are going to use a very original technique: we are going to use another IR-
LED, to detect the IR light that was emitted from another led of the exact same type. This is
an electrical property of Light Emitting Diodes (LEDs) which is the fact that a led produce
a voltage difference across its leads when it is subjected to light. As if it was a photo-cell,
but with much lower output current. In other words, the voltage generated by the leds can't
be - in any way - used to generate electrical power from light, It can barely be detected.
that's why as you will notice in the schematic, we are going to use a Op-Amp (operational
Amplifier) to accurately detect very small voltage changes.
20
Fig 4.2 : Sender & Receiver
4.2 The Sender
The sender is composed of an IR LED (D2) in series with a 470 Ohm resistor, yielding a
forward current of 7.5mA. The receiver part is more complicated, the 2 resistors R5 and
R6 form a voltage divider which provides 2.5V at the anode of the IR LED (here, this led
will be used as a sensor). When IR light falls on the LED (D1), the voltage drop increases,
the cathode's voltage of D1 may go as low as 1.4V or more, depending on the light
intensity. This voltage drop can be detected using an Op-Amp (operational Amplifier
LM358).
You will have to adjust the variable resistor (POT.) R8 so the the voltage at the positive
input of the Op-Amp (pin No. 5) would be somewhere near 1.6 Volt. if you understand the
functioning of Op-Amps, you will notice that the output will go High when the volt at the
cathode of D1 drops under 1.6. So the output will be High when IR light is detected, which
is the purpose of the receiver.
If the +ve input's voltage is higher than the -ve input's voltage, the output goes High
(5v, given the supply voltage in the schematic), otherwise, if the +ve input's voltage is
lower than the -ve input's voltage, then the output of the Op-Amp goes to Low (0V). It
doesn't matter how big is the difference between the +ve and -ve inputs, even a 0.0001 volts
difference will be detected, and the the output will swing to 0v or 5v according to which
input has a higher voltage.
21
4.3 LIGHT DEPENDENT RESISTOR
INTRODUCTION:
An LDR (Light dependent resistor), as its name suggests, offers resistance in response to
the ambient light. The resistance decreases as the intensity of incident light increases, and
vice versa. In the absence of light, LDR exhibits a resistance of the order of mega-ohms
which decreases to few hundred ohms in the presence of light. It can act as a sensor, since a
varying voltage drop can be obtained in accordance with the varying light. It is made up of
cadmium sulphide (CdS).
An LDR has a zigzag cadmium sulphide track. It is a bilateral device, i.e., conducts in both
directions in same fashion.
22
A typical light dependent resistor is pictured above together with (on the right hand side) its
circuit diagram symbol. Different LDR's have different specifications, however the LDR's
we sell in the REUK Shop are fairly standard and have a resistance in total darkness of 1
MOhm, and a resistance of a couple of kOhm in bright light (10-20kOhm @ 10 lux, 2-
4kOhm @ 100 lux).
In the circuit diagram above, 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.
23
By swapping the LDR over with the 10K and 10K variable resistors (as shown above), 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.
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 on4.6
Light-emitting diode (LED)
Light-emitting diodes are elements for light signalization in electronics. They are
manufactured in different shapes, colors and sizes. For their low price, low consumption
and simple use, they have almost completely pushed aside other light sources- bulbs at first
place. They peIRorm similar to common diodes with the difference that they emit light
when current flows through them.
24
Fig 4.6 LED
It is important to know that each diode will be immediately destroyed unless its current is
limited. This means that a conductor must be connected in parallel to a diode. In order to
correctly determine value of this conductor, it is necessary to know diode’s voltage drop in
forward direction, which depends on what material a diode is made of and what colour it is.
Values typical for the most frequently used diodes are shown in table below: As seen, there
are three main types of LEDs. Standard ones get ful brightness at current of 20mA. Low
Current diodes get ful brightness at ten times lower current while Super Bright diodes
produce more intensive light than Standard ones.
Since the 8052 microcontrollers can provide only low input current and since their pins are
configured as outputs when voltage level on them is equal to 0, direct connectining to LEDs
is carried out as it is shown on figure (Low current LED, cathode is connected to output
pin).
25
CHAPTER 5
LIQUID CRYSTAL DISPLAY
5.1 LCD screen:
LCD screen consists of two lines with 16 characters each. Each character consists of
5x7 dot matrix. Contrast on display depends on the power supply voltage and whether
messages are displayed in one or two lines. For that reason, variable voltage 0-Vdd is
applied on pin marked as Vee. Trimmer potentiometer is usually used for that purpose.
Some versions of displays have built in backlight (blue or green diodes). When used during
operating, a resistor for current limitation should be used (like with any LE diode).
26
LCDs are more energy efficient and offer safer disposal than CRTs. Its low electrical power
consumption enables it to be used in battery-powered electronic equipment. It is an
electronically-modulated optical device made up of any number of pixels filled with liquid
crystals and arrayed in front of a light source (backlight) or reflector to produce images in
color or monochrome. The earliest discovery leading to the development of LCD
technology, the discovery of liquid crystals, dates from 1888. By 2008, worldwide sales of
televisions with LCD screens had surpassed the sale of CRT units.
Each pixel of an LCD typically consists of a layer of molecules aligned between two
transparent electrodes, and two polarizing filters the axes of transmission of which are (in
most of the cases) perpendicular to each other. With no actual liquid crystal between the
polarizing filters, light passing through the first filter would be blocked by the second
(crossed) polarizer. In most of the cases the liquid crystal has double refraction
The most commonly used Character based LCDs are based on Hitachi's HD44780
controller or other which are compatible with HD44580. In this tutorial, we will discuss
about character based LCDs, their interfacing with various microcontrollers, various
interfaces (8-bit/4-bit), programming, special stuff and tricks you can do with these simple
looking LCDs which can give a new look to your application.
27
5.3 Pin Description
The most commonly used LCDs found in the market today are 1 Line, 2 Line or 4
Line LCDs which have only 1 controller and support at most of 80 characters, whereas
LCDs supporting more than 80 characters make use of 2 HD44780 controllers.
28
Pin no. 14 D7
Data bus line 7 (MSB)
29
Although looking at the table you can make your own commands and test them. Below is a
brief list of useful commands which are used frequently while working on the LCD.
No.
30
Instruction
Hex
Decimal
1.Function Set: 8-bit, 1 Line, 5x7 Dots
0x3048
2. Function Set: 8-bit, 2 Line, 5x7 Dots
0x3856
3. Function Set: 4-bit, 1 Line, 5x7 Dots
0x2032
4.Function Set: 4-bit, 2 Line, 5x7 Dot
0x2840
5.Entry Mode
0x066
6. Display off Cursor off
(clearing display without clearing DDRAM content)
0x088
7. Display on Cursor on
0x0E14
8 .Display on Cursor off
0x0C12
9. Display on Cursor blinking 0x0F15
10. Shift entire display left
0x1824
12. Shift entire display right
0x1C30
13 .Move cursor left by one character
0x10 16
14. Move cursor right by one character0x1420
15.Clear Display (also clear DDRAM content)0x011
16 .Set DDRAM address or courser position on display 0x80+add*128+add*
17. Set CGRAM address or set pointer to CGRAM location
0x40+add**64+add**
31
* DDRAM address given in LCD basics section see Figure 2,3,4
** CGRAM address from 0x00 to 0x3F, 0x00 to 0x07 for char1 and so on..
5.5 RELAY:
32
Fig 5.4: Automotive-style miniature relay, dust cover is taken off
A relay is an electrically operated switch. Many relays use an electromagnet to operate a
switching mechanism mechanically, but other operating principles are also used. Relays are
used where it is necessary to control a circuit by a low-power signal (with complete
electrical isolation between control and controlled circuits), or where several circuits must
be controlled by one signal. The first relays were used in long distance telegraph circuits,
repeating the signal coming in from one circuit and re-transmitting it to another. Relays
were used extensively in telephone exchanges and early computers to perform logical
operations.A type of relay that can handle the high power required to directly drive an
electric motor is called a contactor. Solid-state relays control power circuits with no moving
parts, instead using a semiconductor device to perform switching. Relays with calibrated
operating characteristics and sometimes multiple operating coils are used to protect
electrical circuits from overloadfaults; in modern electric power systems these functions are
performed by digital instruments still called "protective relays".
33
Fig 5.6: Small relay as used in electronics
A simple electromagnetic relay consists of a coil of wire surrounding a soft iron core, an
iron yoke which provides a low reluctance path for magnetic flux, a movable iron armature,
and one or more sets of contacts (there are two in the relay pictured). The armature is
hinged to the yoke and mechanically linked to one or more sets of moving contacts. It is
held in place by a spring so that when the relay is de-energized there is an air gap in the
magnetic circuit. In this condition, one of the two sets of contacts in the relay pictured is
closed, and the other set is open. Other relays may have more or fewer sets of contacts
depending on their function. The relay in the picture also has a wire connecting the
armature to the yoke. This ensures continuity of the circuit between the moving contacts on
the armature, and the circuit track on the printed circuit board (PCB) via the yoke, which is
soldered to the PCB. When an electric current is passed through the coil it generates a
magnetic field that attracts the armature and the consequent movement of the movable
contact either makes or breaks (depending upon construction) a connection with a fixed
contact. If the set of contacts was closed when the relay was de-energized, then the
movement opens the contacts and breaks the connection, and vice versa if the contacts were
open. When the current to the coil is switched off, the armature is returned by a force,
approximately half as strong as the magnetic force, to its relaxed position. Usually this
force is provided by a spring, but gravity is also used commonly in industrial motor starters.
Most relays are manufactured to operate quickly. In a low-voltage application this reduces
noise; in a high voltage or current application it reduces arcing. When the coil is energized
with direct current, a diode is often placed across the coil to dissipate the energy from the
34
collapsing magnetic field at deactivation, which would otherwise generate a voltage spike
dangerous to semiconductor circuit components. Some automotive relays include a diode
inside the relay case. Alternatively, a contact protection network consisting of a capacitor
and resistor in series (snubber circuit) may absorb the surge. If the coil is designed to be
energized with alternating current (AC), a small copper "shading ring" can be crimped to
the end of the solenoid, creating a small out-of-phase current which increases the minimum
pull on the armature during the AC cycle. A solid-state relay uses a thyristor or other solid-
state switching device, activated by the control signal, to switch the controlled load, instead
of a solenoid. An optocoupler (a light-emitting diode (LED) coupled with a photo
transistor) can be used to isolate control and controlled circuits.
TYPES:
a) LATCHING RELAY:
35
b) REED RELAY:
A reed relay is a reed switch enclosed in a solenoid. The switch has a set of contacts inside
an evacuated or inert gas-filled glass tube which protects the contacts against atmospheric
corrosion; the contacts are made of magnetic material that makes them move under the
influence of the field of the enclosing solenoid. Reed relays can switch faster than larger
relays, require only little power from the control circuit, but have low switching current and
voltage ratings.
d) POLARIZED RELAY:
A polarized relay placed the armature between the poles of a permanent magnet to increase
sensitivity. Polarized relays were used in middle 20th Century telephone exchanges to
detect faint pulses and correct telegraphic distortion. The poles were on screws, so a
technician could first adjust them for maximum sensitivity and then apply a bias spring to
set the critical current that would operate the relay.
36
e) MACHINE TOOL RELAY:
A machine tool relay is a type standardized for industrial control of machine tools, transfer
machines, and other sequential control. They are characterized by a large number of
contacts (sometimes extendable in the field) which are easily converted from normally-open
to normally-closed status, easily replaceable coils, and a form factor that allows compactly
installing many relays in a control panel. Although such relays once were the backbone of
automation in such industries as automobile assembly, the programmable logic controller
(PLC) mostly displaced the machine tool relay from sequential control applications.
f) CONTACTOR RELAY:
A contactor is a very heavy-duty relay used for switching electric motors and lighting loads,
although contactors are not generally called relays. Continuous current ratings for common
contactors range from 10 amps to several hundred amps. High-current contacts are made
with alloys containing silver. The unavoidable arcing causes the contacts to oxidize;
however, silver oxide is still a good conductor.[2] Such devices are often used for motor
starters. A motor starter is a contactor with overload protection devices attached. The
overload sensing devices are a form of heat operated relay where a coil heats a bi-metal
strip, or where a solder pot melts, releasing a spring to operate auxiliary contacts. These
auxiliary contacts are in series with the coil. If the overload senses excess current in the
load, the coil is de-energized. Contactor relays can be extremely loud to operate, making
them unfit for use where noise is a chief concern.
g) SOLID-STATE RELAY:
37
Fig 5.11: A solid state contactors
A solid state relay (SSR) is a solid state electronic component that provides a similar
function to an electromechanical relay but does not have any moving components,
increasing long-term reliability. With early SSR's, the tradeoff came from the fact that every
transistor has a small voltage drop across it. This voltage drop limited the amount of current
a given SSR could handle. As transistors improved, higher current SSR's, able to handle
100 to 1,200 Amperes, have become commercially available. Compared to electromagnetic
relays, they may be falsely triggered by transients.
i) BUCHHOLZ RELAY:
A Buchholz relay is a safety device sensing the accumulation of gas in large oil-filled
transformers, which will alarm on slow accumulation of gas or shut down the transformer if
gas is produced rapidly in the transformer oil.
38
j) FORCED-GUIDED CONTACTS RELAY:
A forced-guided contacts relay has relay contacts that are mechanically linked together, so
that when the relay coil is energized or de-energized, all of the linked contacts move
together. If one set of contacts in the relay becomes immobilized, no other contact of the
same relay will be able to move. The function of forced-guided contacts is to enable the
safety circuit to check the status of the relay. Forced-guided contacts are also known as
"positive-guided contacts", "captive contacts", "locked contacts", or "safety relays".
39
Circuit symbols of relays. (C denotes the common terminal in SPDT and DPDT types.)
Since relays are switches, the terminology applied to switches is also applied to relays. A
relay will switch one or more poles, each of whose contacts can be thrown by energizing
the coil in one of three ways:
Normally-open (NO) contacts connect the circuit when the relay is activated; the
circuit is disconnected when the relay is inactive. It is also called a Form A contact
or "make" contact. NO contacts can also be distinguished as "early-make" or
NOEM, which means that the contacts will close before the button or switch is fully
engaged.
Normally-closed (NC) contacts disconnect the circuit when the relay is activated;
the circuit is connected when the relay is inactive. It is also called a Form B contact
or "break" contact. NC contacts can also be distinguished as "late-break" or NCLB,
which means that the contacts will stay closed until the button or switch is fully
disengaged.
Change-over (CO), or double-throw (DT), contacts control two circuits: one
normally-open contact and one normally-closed contact with a common terminal. It
is also called a Form C contact or "transfer" contact ("break before make"). If this
type of contact utilizes a "make before break" functionality, then it is called a Form
D contact.
The following designations are commonly encountered:
SPST – Single Pole Single Throw. These have two terminals which can be
connected or disconnected. Including two for the coil, such a relay has four
terminals in total. It is ambiguous whether the pole is normally open or normally
closed. The terminology "SPNO" and "SPNC" is sometimes used to resolve the
ambiguity.
SPDT – Single Pole Double Throw. A common terminal connects to either of two
others. Including two for the coil, such a relay has five terminals in total.
DPST – Double Pole Single Throw. These have two pairs of terminals. Equivalent
to two SPST switches or relays actuated by a single coil. Including two for the coil,
such a relay has six terminals in total. The poles may be Form A or Form B (or one
of each).
DPDT – Double Pole Double Throw. These have two rows of change-over
terminals. Equivalent to two SPDT switches or relays actuated by a single coil. Such
a relay has eight terminals, including the coil.
40
The "S" or "D" may be replaced with a number, indicating multiple switches connected to a
single actuator. For example 4PDT indicates a four pole double throw relay (with 14
terminals).
EN 50005 are among applicable standards for relay terminal numbering; a typical EN
50005-compliant SPDT relay's terminals would be numbered 11, 12, 14, A1 and A2 for the
C, NC, NO, and coil connections, respectively.
5.6 APPLICATIONS:
Relays are used to and for:
Control a high-voltage circuit with a low-voltage signal, as in some types of
modems or audio amplifiers,
Control a high-current circuit with a low-current signal, as in the startersolenoid of
an automobile,
Detect and isolate faults on transmission and distribution lines by opening and
closing circuit breakers (protection relays),
42
Coil current
Package/enclosure – open, touch-safe, double-voltage for isolation between circuits,
explosion proof, outdoor, oil and splash resistant, washable for printed circuit board
assembly
Assembly – Some relays feature a sticker that keeps the enclosure sealed to allow
PCB post soldering cleaning, which is removed once assembly is complete.
Mounting – sockets, plug board, rail mount, panel mount, through-panel mount,
enclosure for mounting on walls or equipment
Switching time – where high speed is required
"Dry" contacts – when switching very low level signals, special contact materials
may be needed such as gold-plated contacts
Contact protection – suppress arcing in very inductive circuits
Coil protection – suppress the surge voltage produced when switching the coil
current
Isolation between coil circuit and contacts
Aerospace or radiation-resistant testing, special quality assurance
Expected mechanical loads due to acceleration – some relays used in aerospace
applications are designed to function in shock loads of 50 g or more
Accessories such as timers, auxiliary contacts, pilot lamps, test buttons
43
CHAPTER 6
SOFTWARE SPECIFICATION
6.1 Arduino software
The Arduino Uno can be programmed with the Arduino software. Select "Arduino 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 Uno comes preburned with
a boot loader 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).We can also bypass the boot loader and programs the microcontroller through
the ICSP (In-Circuit Serial Programming) header; see these instructions for details. The
ATmega16U2 (or 8U2 in the rev1 and rev2 boards) firmware source code is available. The
ATmega16U2/8U2 is loaded with a DFU boot loader, 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 resetting 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.
The Arduino Uno has a number of facilities for communicating with a computer, another
Arduino, 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, an .information file is required. The
Arduino software includes a serial monitor which allows simple textual data to be sent to
and from the Arduino 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 for serial
communication on any of the Uno's digital pins. The ATmega328 also supports I2C (TWI)
and SPI communication. The Arduino software includes aWire library to simplify use of the
I2C bus.
44
The Arduino Integrated Development Environment
Arduino Software (IDE) - contains a text editor for writing code, a message area, a text
console, a toolbar with buttons for common functions and a series of menus. It connects to
the Arduino and Genuino hardware to upload programs and communicate with them.
WRITING SKETCHES
Programs written using Arduino Software (IDE) are called sketches. These sketches are
written in the text editor and are saved with the file extension .ino. The editor has features
for cutting/pasting and for searching/replacing text. The message area gives feedback while
saving and exporting and also displays errors. The console displays text output by the
Arduino Software (IDE), including complete error messages and other information. The
bottom righthand corner of the window displays the configured board and serial port. The
toolbar buttons allow you to verify and upload programs, create, open, and save sketches,
and open the serial monitor.
NB: Versions of the Arduino Software (IDE) prior to 1.0 saved sketches with the
extension .pde. It is possible to open these files with version 1.0, you will be prompted to
save the sketch with the .ino extension on save.
Verify
Upload
Compiles your code and uploads it to the configured board. See uploading below for
details.
Note: If you are using an external programmer with your board, you can hold down the
"shift" key on your computer when using this icon. The text will change to "Upload using
Programmer"
New
45
Fig 6.1: Create a new sketch
Open
Presents a menu of all the sketches in your sketchbook. Clicking one will open
it within the current window overwriting its content. Note: due to a bug in Java,
this menu doesn't scroll; if you need to open a sketch late in the list, use the File
| Sketch book menu instead.
Save
Saves your sketch.
Serial Monitor
Opens the serial monitor.
46
FILE
New
Creates a new instance of the editor, with the bare minimum structure of a sketch already in
place.
Open
Allows to load a sketch file browsing through the computer drives and folders.
Open Recent
Provides a short list of the most recent sketches, ready to be opened.
Sketchbook
Shows the current sketches within the sketchbook folder structure; clicking on any name
opens the corresponding sketch in a new editor instance.
Examples
Any example provided by the Arduino Software (IDE) or library shows up in this menu item.
All the examples are structured in a tree that allows easy access by topic or library.
Close
Closes the instance of the Arduino Software from which it is clicked.
Save
Saves the sketch with the current name. If the file hasn't been named before, a name will be
provided in a "Save as.." window.
Save as...
Allows to save the current sketch with a different name.
Page Setup
It shows the Page Setup window for printing.
Print
47
Sends the current sketch to the printer according to the settings defined in Page Setup.
Preferences
Opens the Preferences window where some settings of the IDE may be customized, as the
language of the IDE interface.
Quit
Closes all IDE windows. The same sketches open when Quit was chosen will be
automatically reopened the next time you start the IDE.
EDIT
Undo/Redo
Goes back of one or more steps you did while editing; when you go back, you may go
forward with Redo.
Cut
Removes the selected text from the editor and places it into the clipboard.
Copy
Duplicates the selected text in the editor and places it into the clipboard.
Paste
Puts the contents of the clipboard at the cursor position, in the editor.
Select All
Selects and highlights the whole content of the editor.
48
Comment/Uncomment
Puts or removes the // comment marker at the beginning of each selected line.
Increase/Decrease Indent
Adds or subtracts a space at the beginning of each selected line, moving the text one space
on the right or eliminating a space at the beginning.
Find
Opens the Find and Replace window where you can specify text to search inside the
current sketch according to several options.
Find Next
Highlights the next occurrence - if any - of the string specified as the search item in the
Find window, relative to the cursor position.
Find Previous
Highlights the previous occurrence - if any - of the string specified as the search item in
the Find window relative to the cursor position.
SKETCH
• Verify/Compile
Checks your sketch for errors compiling it; it will report memory usage for code and
variables in the console area.
49
• Upload
Compiles and loads the binary file onto the configured board through the configured Port.
This will overwrite the bootloader on the board; you will need to use Tools >
Burn Bootloader to restore it and be able to Upload to USB serial port again.
However, it allows you to use the full capacity of the Flash memory for your
sketch. Please note that this command will NOT burn the fuses. To do so a
Tools -> Burn Bootloader command must be executed.
Include Library
50
Adds a library to your sketch by inserting #include statements at the start of your code.
For more details, see libraries below. Additionally, from this menu item you can access
the Library Manager and import new libraries from .zip files.
Add File...
Adds a source file to the sketch (it will be copied from its current location). The new file
appears in a new tab in the sketch window. Files can be removed from the sketch using the
tab menu accessible clicking on the small triangle icon below the serial monitor one on the
right side o the toolbar.
6.2 TOOLS
Auto Format
This formats your code nicely: i.e. indents it so that opening and closing curly braces line up,
and that the statements inside curly braces are indented more.
Archive Sketch
Archives a copy of the current sketch in .zip format. The archive is placed in the
same directory as the sketch.
Fix Encoding & Reload
Fixes possible discrepancies between the editor char map encoding and other
operating systems char maps.
Serial Monitor
Opens the serial monitor window and initiates the exchange of data with any connected
board on the currently selected Port. This usually resets the board, if the board supports
Reset over serial port opening.
Board
Select the board that you're using. See below for descriptions of the various boards.
Port
This menu contains all the serial devices (real or virtual) on your machine. It
should automatically refresh every time you open the top-level tools menu.
51
Programmer
For selecting a harware programmer when programming a board or chip and not using
the onboard USB-serial connection. Normally you won't need this, but if you're burning a
bootloader to a new microcontroller, you will use this.
Burn Bootloader
The items in this menu allow you to burn a bootloader onto the microcontroller on an
Arduino board. This is not required for normal use of an Arduino or Genuino board but is
useful if you purchase a new ATmega microcontroller (which normally come without a
bootloader). Ensure that you've selected the correct board from the Boards menu before
burning the bootloader on the target board. This command also set the right fuses.
Help
Here you find easy access to a number of documents that come with the Arduino Software
(IDE). You have access to Getting Started, Reference, this guide to the IDE and other
documents locally, without an internet connection. The documents are a local copy of the
online ones and may link back to our online website.
Find in Reference
This is the only interactive function of the Help menu: it directly selects the relevant page
in the local copy of the Reference for the function or command under the cursor.
52
Allows you to manage sketches with more than one file (each of which appears in its own
tab). These can be normal Arduino code files (no visible extension), C files (.c extension),
C++ files (.cpp), or header files (.h).
6.4 LIBRARY
Libraries provide extra functionality for use in sketches, e.g. working with hardware or
manipulating data. To use a library in a sketch, select it from the Sketch > Import Library
menu. This will insert one or more #include statements at the top of the sketch and compile
the library with your sketch. Because libraries are uploaded to the board with your sketch,
they increase the amount of space it takes up. If a sketch no longer needs a library, simply
delete its #includestatements from the top of your code.
There is a list of libraries in the reference. Some libraries are included with the Arduino
software. Others can be downloaded from a variety of sources or through the Library
Manager. Starting with version 1.0.5 of the IDE, you do can import a library from a zip file
and use it in an open sketch. See these instructions for installing a third-party library.
To write your own library, see this tutorial.
Third-Party Hardware Support for third-party hardware can be added to the hardware
directory of your sketchbook directory. Platforms installed there may include board
definitions (which appear in the board menu), core libraries, bootloaders, and programmer
definitions. To install, create the hardware directory, then unzip the third-party platform into
its own sub-directory. (Don't use "arduino" as the sub-directory name or you'll override the
built-in Arduino platform.) To uninstall, simply delete its directory.
For details on creating packages for third-party hardware, see the Arduino IDE 1.5 3rd party
Hardware specification.
SERIAL MONITOR
Displays serial data being sent from the Arduino or Genuino board (USB or serial board). To
send data to the board, enter text and click on the "send" button or press enter. Choose the
baud rate from the drop-down that matches the rate passed to Serial.begin in your sketch.
Note that on Windows, Mac or Linux, the Arduino or Genuino board will reset (rerun your
sketch execution to the beginning) when you connect with the serial monitor.
You can also talk to the board from Processing, Flash, MaxMSP, etc (see the interfacing
page for details).
53
PREFERENCES
Some preferences can be set in the preferences dialog (found under the Arduino menu on the
Mac, or File on Windows and Linux). The rest can be found in the preferences file, whose
location is shown in the preference dialog.
Since version 1.0.1 , the Arduino Software (IDE) has been translated into 30+ different
languages. By default, the IDE loads in the language selected by your operating system.
(Note: on Windows and possibly Linux, this is determined by the locale setting which
controls currency and date formats, not by the language the operating system is displayed in.)
If you would like to change the language manually, start the Arduino Software (IDE) and
open the Preferences window. Next to the Editor Language there is a dropdown menu of
currently supported languages. Select your preferred language from the menu, and restart the
software to use the selected language. If your operating system language is not supported, the
Arduino Software (IDE) will default to English.
You can return the software to its default setting of selecting its language based on your
operating system by selecting System Default from the Editor Language drop-down. This
setting will take effect when you restart the Arduino Software (IDE). Similarly, after
54
changing your operating system's settings, you must restart the Arduino Software (IDE) to
update it to the new default language.
BOARDS
The board selection has two effects: it sets the parameters (e.g. CPU speed and baud rate)
used when compiling and uploading sketches; and sets and the file and fuse settings used by
the burn bootloader command. Some of the board definitions differ only in the latter, so even
if you've been uploading successfully with a particular selection you'll want to check it before
burning the bootloader. You can find a comparison table between the various boards here.
Arduino Software (IDE) includes the built in support for the boards in the following list, all
based on the AVR Core. The Boards Manager included in the standard installation allows to
add support for the growing number of new boards based on different cores like Arduino
Due, Arduino Zero, Edison, Galileo and so on.
55
CHAPTER – 7
FUTURE SCOPE
56
CHAPTER-8
CONCLUSION
8.1 The project “Smart Energy Management System“been successfully designed and
tested. It has been developed by integrating features of all the hardware components used.
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.
8.2 Advantages:
Remote monitoring and control the street light.
Automatic ON/OFF control.
Flexible,
Easy maintains,
Low power consumption,
Accurate
8.3 Applications:
Street light control system
Industrial applications
Any automatic control management system
57
BIBLOGRAPGHY
58
Code:
#include <LiquidCrystal.h>
LiquidCrystal lcd(2, 3, 4, 5, 6, 7);
int IR = 9;
int LDR = 8;
int Light = 11;
void setup() {
pinMode(IR,INPUT);
pinMode(LDR,INPUT);
pinMode(Light,OUTPUT);
digitalWrite(Light,LOW);
lcd.begin(16, 2);
lcd.print("Smart Energy");
lcd.setCursor(0,1);
lcd.print("Managment System");
delay(5000);
}
void loop() {
// put your main code here, to run repeatedly:
if(!digitalRead(IR)&&!digitalRead(LDR))
{
digitalWrite(Light,HIGH);
lcd.clear();
lcd.print("Lights On");
lcd.setCursor(0,1);
lcd.print("Vehicle Detected");
59
delay(1000);
}
else if(digitalRead(IR)&&!digitalRead(LDR))
{
digitalWrite(Light,LOW);
lcd.clear();
lcd.print("MONITORING ");
lcd.setCursor(0,1);
lcd.print("VEHICLE");
delay(1000);
}
else if(!digitalRead(IR)&&digitalRead(LDR))
{
digitalWrite(Light,LOW);
lcd.clear();
lcd.print("VEHICLE ");
lcd.setCursor(0,1);
lcd.print("PASSING");
delay(1000);
}
}
60