0% found this document useful (0 votes)
25 views41 pages

PJ New 1

The document discusses the importance of water management and the issues related to water scarcity, emphasizing the need for efficient systems to prevent water wastage. It introduces an automatic water level monitoring system that utilizes sensors and Arduino technology to control water levels in overhead tanks, reducing human intervention. The literature review highlights various existing solutions and technologies aimed at improving water management and conservation.

Uploaded by

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

PJ New 1

The document discusses the importance of water management and the issues related to water scarcity, emphasizing the need for efficient systems to prevent water wastage. It introduces an automatic water level monitoring system that utilizes sensors and Arduino technology to control water levels in overhead tanks, reducing human intervention. The literature review highlights various existing solutions and technologies aimed at improving water management and conservation.

Uploaded by

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

CHAPTER 1

INTRODUCTION
1.1 BACKGROUND
Water is one of the most important substances on earth. All plants and animals must have water to survive.
Water scarcity involves water crises, water shortage, water deficit or water stress. Water scarcity can be due
to physical water scarcity and economic water scarcity. Physical water scarcity refers to a situation where
natural water resources are unable to meet region’s demand while economic water crisis is a result of poor
water management resources. If there was no water there would be no life on earth. Apart from drinking it
to survive, people have many other uses for water. Overhead water tanks are used for Domestic water
storage and commercial water storage purposes. They are generally placed over the rooftop of any house,
building or apartment. These tanks circulate the water through its distributary channels or pipes to the taps.
Generally most of the houses depend upon the overhead tanks as the main source of water. One of the
commonly seen situations in every house is that the overflow from the tank made people to switch off the
pump. Otherwise they should keep monitoring the tank when the pump is ON and switch OFF the pump as
soon as the tank is full. What happens when the client or user is not aware of water overflow or he is not at
the home while water is overflowing, As a result water resource is being wasted only because of improper
management standards that we follow. Efficient usage techniques should be employed to gain better control
on resource consumption water wastage is a serious issue that must be considered. Every drop of water
counts when it comes to human survival on this planet as we only have a little amount of water available for
us. as per the records only 3 percent of the water is available for the inhabitation the remaining 97 percent
of the water is situated in the oceans.
 Currently there are many products which can solve this problem but the implementation and
maintenance are much difficult. This model does works by communicating wirelessly so the client
will no longer worry about the connection wires.
 Automatic water level monitoring system uses network of things i.e. this model uses its own local
area network to maintain communication between the nodes Arduino calculate and make decisions
based on the program given by the developer.
 Electronics deals with electrical circuits that involve active electrical components such as pump,
relay, LCD, transmitter and receiver circuit, LED, and sensors.
 Electronics is considered to be a branch of physics and electrical engineering. An electronic
component is any physical entity in an electronic system used to affect the electrons or their
associated fields in a manner consistent with the intended function of the electronic system.
Components are generally intended to be connected together, usually by being soldered to a printed
circuit board (PCB), to create an electronic circuit with a particular function (for example an
amplifier, radio receiver, or oscillator Some common electronic components are capacitors,
inductors, resistors, diodes, transistors, etc. Components are often categorized as active or passive.

1.2 Problem Statement


Most of the times People generally switch on the motor when their taps go dry and switch off the motor
when the tank starts overflowing. This results in unnecessary wastage of water and sometimes non-
availability of water in emergency.
Sometimes people forget to switch OFF the pump by involving in their day-to-day activities. This
results in wastage of both water and power resources. This is the serious problem that must be
considered because the global scale of power and water resource wastage will be high.

1.3 Objectives

 The main intention of this project is to control the water management activity automatic by
using some sensors which can detect the water level and controllers which can turn ON or OFF
the pump based on the water level.

 The system which decreases human intervention in maintaining the overhead tanks which is
capable of effective water usage.

 To test the water temperature using LM35 sensor, if the temperature is above threshold valve,
then water flows through special valve provided or else it flows to sump for reuse without
wastage.

 To design water billing monitoring system using flow liquid meter sensor and SMS gateway.

1.4 Scope of the Project:


This model can turn OFF the pump as soon as the sensor detects the maximum water level in the tank.
The pump will be turned ON as soon as the water level in the tank goes low. This circuit not only
indicates the amount of water present in the overhead tank but also gives alarm when the tank is full.
This worthy device starts ringing as soon as the water tank becomes full. It is suitable for every tank.
CHAPTER 2
LITERATURE REVIEW

 Ria Sood, Manjit Kaur, Hemant Lenka( IJCSE vol3,june2013) have emphasised on the need of
water level controller in irrigation in agriculture. It says that every crop requires different amount of
water and this can be done by using automatic water level controller which will also help in
reducing wastage of water. Here they use a technique to measure flow of rate of water in irrigation
pipelines. It uses a Hall Effect Sensor to measure the rate flow. G1/2 Hall Effect water flow sensor
is used as a sensing unit with a turbine rotor inside it, whose speed of rotation changes with the
different rate of flow of water.

 SanamPudasaini, Anuj Pathak, SukirtiDhakal, Milan Paudel (International journal of Scientific


and Research publication, September 2014) have presented a system of an automatic water level
controller with SMS notification. SMS notification was added to automatic controller system so that
water can be managed by user during load shedding. Two systems work synergistically. automatic
level controller system and SMS system. The program was developed in Arduino program
developing environment and uploaded to the Microcontroller. Water level in the system is controlled
automatically. The controller operates on a battery power. Whenever the system encounters empty
level and the status of load shedding, the SMS notification is sent to the user. The system will
automate the process by placing a single sensor unit in the tank that will periodically take
measurements of the water level and will control the motor automatically. This system eliminates
the efforts of people for daily filling of the tank and checks for overflow.

 Asaad Ahmed Mohammed Ahamad Eltaieb , Zhang Jian Min (IJSR 2016) Thet involved in
designing and development of automatic water level control system had exposed to the better way of
software and hardware architecture that blends together for the interfacing purposes. The system
employs the use of advance sensing technology to detect the water level. It uses Arduino and uses
relay to control motor. Different wires are attached at different Junctions of the Beaker. When we
pour water in the beaker. The water comes in contact with the wire and tells the level of water in the
tank. Accordingly, they have displayed the level of water on LCD display. And uses relay to turn
ON and OFF the motor.
 Ms.Pooja K, Ms. Kusumavathi , Ms. Pavithra, Ms. Nishmitha, Prof. Aishwarya D Shetty
involved in water level indicator and controller system is used to sort out the issues associated with
water tank. It is also possible to check the level of the water using sensor so that whenever the water
goes below, pump gets turned ON automatically also when there is overflow of water in water tank
it uses sensor to detect the water level so that if the water level goes above, the pump gets turned off
automatically. This system prevents wastage of water.

 P. Nancy Rachel, D. Sophia, G. Sandhya Rani, J. JahnaviaRishika, P. Sai Annapurna


presented the drinking water crisis in India is reaching alarming proportions. It might very soon
attain the nature of global crisis. Hence it is of extreme importance to preserve water. In homebased
water tank, the one problem is very common to us that the control of water level of overhead tank,
as a result the wastage of water is increasing day by day. But we all know water is very precious to
us. This problem can be controlled by a simple electronic circuit consists with some cheap electronic
components that circuit is called 'water level indicator'. As the water level rises or falls, different
circuits in the controller send different signals. The relay operates the water pump so, when the
water level is maximum, the relay turns the pump OFF and when the water level is minimum, the
relay turns ON the pump.
This reduces the water wastage due to overflow from tanks and also ensures that water in the tank is
always available to use. Also reduces human involvement in turning ON and OFF the pump, as this
process is made entirely automatic.

 Vaishnavi Raikar, Archana Ranjan, Pramodh Poddar, K. J. Chaitanya involved water level
Indicator which help us to know when the water in our tanks is either full or empty and
automatically switch ON and OFF the pump as and when necessary. By using the basic principle of
ultrasonic sensors, i.e. the ECHO method. The 20 kHz ultrasonic distance sensor remotely senses
level of water by measuring length of emptiness or fullness of the tank from recorded time of arrival
of echo from water surface. This length is interpreted and displayed by program-based
microprocessor in percentage of the capacity on Liquid Crystal Display (LCD) unit.

 ANIRUDH KODAVATIGANTI (International Journal of Research in Engineering and Applied Sciences


(IJREAS)Vol. 8 Issue 9, September -2018.) involved in the designing of a water level sensor device
using Arduino UNO, that can detect the level of water in a water storage system. An ultrasonic
sensor is used to generate ultrasonic waves, a water sensor to detect the water level, LEDs to signify
the importance of different water levels, PC to observe the levels of water. We indicated a green
LED for safe water level, one red LED for about to reach max level and two red LEDs for maximum
water level. This circuit is efficient and can be used for any application involving the levels of any
liquid.
 Mr. MuthamilSelvan.S, Aratrika Roy, Kurnal Pratap Singh, Ashutosh Kumar (Automatic
water level indicator using ultrasonic sensor and GSM module .Vol.4 Issue 5,2018.)Water is being
measured by using ultrasonic sensors. Initially, the tank is considered to be empty. When the sound
waves are transmitted in the environment, they are reflected back as ECHO. This same concept is
applied this project. Waves generated by ultrasonic sensors is sent to the water tank and their time
of travelling and coming back is noted and after few calculations we can estimate the level of water
in the tank. The motor pump is automatically turned ON when the water level becomes low and
turned OFF when the tank is full. These alerts are sent as notifications in our phones through the
GSM Module.

 Prayash, Kurnalsingh( International Journal of Science and Research (IJSR),2019)involved in


development of water level controlling and monitoring system for preserving water using Arduino
and easy-to-use mobile application. Actually, there is a lot of drinking water crisis in India and also
in other countries. Today we need to preserve water at any cost. In India, we can see many houses as
overhead tanks and they keep on overflowing water. It wastes a lot of water as well as electricity. If
we do not do anything on this matter than we can face huge scarcity of water.

 Vardaan Mittal (IJSR 2018) involved in measuring of water level with the help of ultrasonic
sensors. This system uses automated turning motor ON/OFF with the help of relay which helps in
controlling the excess water flow from overhead tanks. Accordingly, they have displayed the level
of water on LCD Display.

 Mallikarjun Hudedmani, Nagaraj, Shrikanth.B.J , Ali Adil Sha


,Pramod.G(Flexible Automatic Water level controller January 2018) presented that water is very
precious for the living beings and scarcity of the same is gradually increasing. Most of the cities in
the county and that of the world are facing this problem. This is one of the motivations for the
current work and to deploy techniques in order to save water and help the environment which in turn
ensures water for the future. Hence, it is of utmost importance to preserve and save water. In many
houses there exists unnecessary wastage of water due to overflow from overhead tanks etc.
Automatic Water Level Controller can provide a solution to this problem. Present work does not use
any microcontrollers etc. The operation of water level controller is based on the fact that water
conducts electricity. As the water level rises or fall the sensing probes and circuits of the controller
detect the same. These signals are used to switch ON or switch OFF the pump motor as per
requirements. This system is used to automate the process of water pumping to over-head tank
storage and has the facility to select the level of water to pump. The logical situations using
electronic circuit manage the system. The required amount or volume of water can be pumped to the
overhead tank by choosing level selector unlike waiting for the complete filling in the conventional
circuits.
 Gaurav Gosavi, Gajanan Gawde, Goutam Gosavi (GOA COLLEGE OF ENGINEERING, GOA
INDIA Smart water flow monitoring and forecasting system (Publisher IEEE 2017)) developed
accurate metering and determining proper tariff, as well as billing system, are vital in water
management system. The paper proposes a method to watch and forecast the consumption of the
water in the domestic pipeline through a web server. There are many systems to do the same, but
this is about monitoring consumption of water using the Internet with the help of Raspberry pi and
Arduino. The flow rate of the water is measured by Hall Effect sensor based flow meter. Raspberry
Pi a micro-computer receives the data from Arduino micro-controller which is connected to the flow
meter. The Raspberry pi uploads the data onto cloud infrastructure where database is setup. The web
base solution also depicts the day to day consumption of the water to its users and water distributors.
The paper also aims at predicting the consumption of the water in future for its users using advance
data analytics. This paper also includes demand management, asset management, and leakage
management aspects of water management system.

 F Fahmi1,A Hizriadi2 , , F Khairani2 , U Andayani2 , B Siregar. (IOP PUBLISHING December


2019) ExplainedPublic clean water company as public organization which is designed to meet the
needs of the community. Currently, the number of PDAM subscribers is very big and will continue
to grow, but the service and facilities to customers are still done conventionally by visiting the
customer's home to record the last position of the meter. One of the problems of PDAM is the lack
of disclosure of PDAM customers' invoice because it is only done monthly. This, of course, makes
PDAM customers difficult to remember the date of payment of water account. Therefore, it is
difficult to maintain the efficiency. The purpose of this research is to facilitate customers of PDAM
water users to know the details of water usage and the time of payment of water bills easily. It also
facilitates customers in knowing information related to the form of water discharge data used,
payment rates, and time grace payments using SMS Gateway. In this study, Flow Liquid Meter
Sensor was used for data retrieval of water flowing in the piping system. Sensors used to require the
help of Hall Effect sensor that serves to measure the speed of water discharge and placed on the pipe
that has the same diameter size with the sensor diameter. The sensor will take the data from the rate
of water discharge it passes; this data is the number of turns of the mill on the sensor. The results of
the tests show that the built system works well in helping customers know in detail the amount of
water usage in a month and the bill to be paid.
Chapter 3
Methodology

INTRODUCTIONTOTHEARDUINO BOARD

looking at the board from the top down, this is an outline of what you will see(parts of the
board you might interact with in the course of normal use arehighlighted):

STARTINGCLOCKWISEFROMTHETOPCENTER: -

 Analog reference pin(orange)


 digital ground(light green)
 digitalpins2-13(green)
 digital pins 0-1/serial in/out - tx/rx (dark green) - these pins cannot be used for digital
i/o(digital read and digital write)if you are also using serial communication(e.g.
serial. begin).
 resetbutton-s1(dark blue)
 in-circuit serial programmer (blue-green)

 analoginpins0-5(light blue)
 power and ground pins(power: orange, grounds: light orange)
 external power supply in(9-12vdc) -x1(pink)
 togglesexternalpowerandusbpower(placejumperontwopinsclosesttodesiredsupply)
-sv1(purple)
 usb (used for uploading sketches to the board and for serial communication
between the board and the computer ; can be used to power the board)(yellow)

Digital Pins: -

In addition to the specific functions listed below, the digital pins on an arduino board can be
used for general purpose input and output via the pin mode(), digital read(),and digital
write() commands. Each pin has an internal pull-up resistor which can be turned on and off
using digital write() (w/ a value of high or low, respectively) when the pin is configured as an
input . the maximum current per pin is 40 ma.

.serial: 0 (rx) and 1 (tx). used to receive (rx) and transmit (tx) ttl serial data. on the arduino
decimal , these pins are connected to the corresponding pins of the ftdiusb-to-ttl serial chip.on
the arduino bt, they are connected to the corresponding pins of the wt11 bluetooth module.on
the arduino mini and lily pad arduino, they are intended for use with an external ttl serial
module(e.g. the mini-usb adapter).

 external interrupts: 2 and 3. these pins canbe configured to trigger an interrupt on a lowvalue, a
rising or falling edge, or a change in value. see the attachinterrupt() function fordetails.
 pwm: 3, 5, 6, 9, 10, and 11. provide 8-bit pwm output with the analogwrite() function.
onboardswith an atmega8,pwmoutputisavailable onlyonpins 9, 10, and11.
 btreset:7.(arduinobt-only)connectedtotheresetlineofthebluetoothmodule.
 spi: 10 (ss), 11 (mosi), 12 (miso), 13 (sck). these pins support spi communication,
which,althoughprovidedby theunderlyinghardware,is notcurrently includedin
thearduinolanguage.
 led: 13. on the diecimila and lilypad, there is a built-in led connected to digital pin 13.
whenthepinishighvalue, theledison, whenthe pinislow,it'soff.

ANALOGPINS:-

in addition to the specific functions listed below, the analog input pins support 10-bit analog-
to-digital conversion (adc) using the analogread() function. most of the analog inputs can
alsobeusedasdigital pins:analoginput 0asdigital pin14throughanaloginput5as digitalpin
19. analoginputs6and7(presentontheminiandbt)cannotbeusedasdigitalpins.

 i2c: 4 (sda) and 5 (scl).support i2c (twi) communication using the


wirelibrary(documentation on the wiringwebsite).

POWERPINS:-

 vin (sometimes labelled "9v"). the input voltage to the arduino board when it's using
anexternal power source(as opposed to 5 volts from the usb connection or other
regulatedpower source). you can supply voltage through this pin, or, if supplying voltage via
the powerjack, access it through this pin. note that different boards accept different input
voltagesranges, please see the documentation for your board. also note that the lilypad has no
vin pinandaccepts onlyaregulatedinput.
 5v. the regulated power supply used to power the microcontroller and other components onthe
board. this can come either from vin via an on-board regulator, or be supplied by usb
oranotherregulated 5vsupply.
 3v3.(diecimila-only)a3.3 voltsupplygeneratedbytheon-board ftdichip.
 gnd.groundpins.

OTHERPINS:-

 aref. referencevoltagefor theanaloginputs. not currentlysupported bythearduinosoftware.


 reset. (diecimila-only) bring this line low to reset the microcontroller. typically used to add
aresetbutton toshieldswhich blockthe oneon theboard.

 the text of the arduino getting started guide is licensed under a creative commons attribution-
sharealike3.0 license. codesamplesin theguidearereleased into thepublicdomain.

arduinoisanopen-sourcehardwareandsoftwarecompany,projectandusercommunitythatdesigns
and manufactures single-board microcontrollers and microcontroller kits for buildingdigital
devices. its products are licensed under the gnu lesser general public license (lgpl)
orthegnugeneralpubliclicense(gpl),permittingthemanufactureofarduinoboardsandsoftware
distribution by anyone. arduino boards are available commercially in preassembledformor as
do-it-yourself(diy) kits.

arduinoboarddesignsuseavarietyofmicroprocessorsandcontrollers.theboardsareequipped with
sets of digital and analog input/output (i/o) pins that may be interfaced tovarious expansion
boards ('shields') or breadboards (for prototyping) and other circuits. theboards feature serial
communications interfaces, including universal serial bus (usb) on
somemodels,whicharealsousedforloadingprogramsfrompersonalcomputers.themicrocontroller
s can be programmed using c and c++programming languages. in addition tousing traditional
compiler toolchains, the arduino project provides an integrated developmentenvironment(ide)
basedon the processinglanguageproject.

the arduino project started in 2005 as a program for students at the interaction design
instituteivreain ivrea, italy, aiming to provide a low-cost and easy way for novices and
professionalsto create devices that interact with their environment using sensors and
actuators. commonexamples of such devices intended for beginner hobbyists
includesimplerobots, thermostatsand motiondetectors.

the name arduino comes from a bar in ivrea, italy, where some of the founders of the
projectused to meet. the bar was named after arduin of ivrea, who was the margrave of the
march ofivreaandkingof italyfrom 1002 to 1014

APPLICATIONS:-

 arduboy,ahandheldgameconsole basedonarduino
 arduinome,amidicontrollerdevicethatmimicsthemonome
 ardupilot,dronesoftwareandhardware
 ardusat,a cubesatbasedonarduino.

 c-stem studio, a platform for hands-on integrated learning of computing,


science,technology,engineering,andmathematics (c-stem) withrobotics.
 dataloggersforscientificresearch.
 obduino,atripcomputerthatusestheon-
boarddiagnosticsinterfacefoundinmostmoderncars
 openevseanopen-source electricvehiclecharger
 xod,avisual programminglanguageforarduino
SOFTWARE:-

AN INTRODUCTION TO KEIL MICROVISION

Embedded system means some combination of computer hardware and programmable software
which is specially designed for a particular task like displaying message on LCD. If you are still
wondering about an embedded system, just take a look at these circuit applications using AT89c51
microcontroller. You can call these applications embedded systems as it involves hardware (AT89c51
microcontroller) and software (the code written in assembly language).

Some real life examples of embedded systems may involve ticketing machines, vending
machines, temperature controlling unit in air conditioners etc. Microcontrollers are nothing without a
Program in it.

One of the important part in making an embedded system is loading the software/program we
develop into the microcontroller. Usually it is called “burning software” into the controller. Before
“burning a program” into a controller, we must do certain prerequisite operations with the program. This
includes writing the program in assembly language or C language in a text editor like notepad, compiling
the program in a compiler and finally generating the hex code from the compiled program. Earlier people
used different software/applications for all these 3 tasks. Writing was done in a text editor like
notepad/WordPad, compiling was done using a separate software (probably a dedicated compiler for a
particular controller like AT89c51), converting the assembly code to hex code was done using another
software etc. It takes lot of time and work to do all these separately, especially when the task involves
lots of error debugging and reworking on the source code.

Keil Micro Vision is a free software which solves many of the pain points for an embedded
program developer. This software is an integrated development environment (IDE), which integrated a
text editor to write programs, a compiler and it will convert your source code to hex files too.

Here is simple guide to start working with Keil Vision which can be used for

 Writing programs in C/C++ or Assembly language


 Compiling and Assembling Programs
 Debugging program
 Creating Hex and Axf file
 Testing your program without Available real Hardware (Simulator Mode)
This is simple guide on Keil u Vision 4 though also applicable on previous versions also.

These are the simple steps to get off the mark your inning!

Step 1: After opening Keil uV4, Go to Project tab and Create new u Vision project. Now Select new
folder and give name to Project. As shown in figure 1.

Figure: 1

Step 2: After Creating project now Select your device model. Example.NXP-LPC2148 as shown in
figure 2.
Figure: 2

Step 3: so now your project is created and Message window will appear to add startup file of your Device
click on Yes so it will be added to
your project folder. As shown in
figure 3.
Figure: 3

Step 4: Now go to File and create new file and save it with .C extension if you will write program in C
language or save with .asm for assembly language. As shown in figure 4.

Figure : 4

Step 5: Now write your program and save it again. You can try example given at end of this tutorial.
Right click on target and click on options for target. Here you can change your device also. As shown
in figure 5.
Figure: 5

Step 6: After that on left you see project window [if it’s not there….go to View tab and click on project
window]. Now come on Project window. Click output tab here & check create Hex file if you want to
generate hex file. Now click on ok so it will save changes. As shown in figure 6.

Figure: 6
Step 7: Now Expand target and you will see source group. Right click on group and click on Add files
to source group. As shown in figure 7.

Figure: 7

Now add your program file which you have written in C/assembly. You can see program file added
under source group.

Step 8: Now Click on Build target. You can find it under Project tab or in toolbar .It can also be done
by pressing F7 key.
Figure: 7

Step 9: you can see Status of your program in Build output window

Now you are done with your program. Next time we will look at Debugging and Simulation of
Program. Hope you find it helpful
IDE:-

The arduino integrated development environment (ide) is a cross-platform


application(forwindows,macos,andlinux)thatiswrittenintheprogramminglanguagejava.itorigin
ated from the ide for the languages processing and wiring. it includes a code editor
withfeaturessuchastextcuttingandpasting,searchingandreplacingtext,automaticindenting, brace
matching,and syntax highlighting,and provides simple one-click mechanisms to compile
and upload programs to an arduino board. it also contains amessage area, a text console, a
toolbar with buttons for common functions and a hierarchy ofoperation menus. the source
code for the ide is released under the gnu general public license,version2.

the arduino ide supports the languages c and c++using special rules of code structuring.
thearduinoidesuppliesasoftwarelibraryfromthewiringproject,whichprovidesmanycommon
input and output procedures. user-written code only requires two basic functions, forstarting
the sketch and the main program loop, that are compiled and linked with a programstub
main() into an executable cyclic executive program with the gnu toolchain, also
includedwiththeidedistribution.thearduinoideemploystheprogramavrdudetoconverttheexecuta
ble code into a text file in hexadecimal encoding that is loaded into the arduino
boardbyaloader programinthe board's firmware.

proide:-

on october 18th, 2019, arduino pro ide (alpha preview) was released. the system still
usesarduinocli(commandlineinterface),butimprovementsincludeamoreprofessionaldevelopme
ntenvironment,autocompletionsupport,andgitintegration.the application frontend is based on
the eclipse open source ide. the main features available in the alpha release are:

 modern,fullyfeatureddevelopmentenvironment
 dual mode, classic mode (identical to the classic arduino ide) and pro mode (file
systemview)
 newboardmanager
 newlibrarymanager
 boardlist
 basicauto-completion(armtargetsonly)
 gitintegration
 serialmonitor
 darkmode

SKETCH[EDIT]:-

a sketch is a program written with the arduino ide sketches are saved on the development
computer as text files with the file extension.ino.arduino software(ide) pre-
1.0savedsketcheswith the extension .pde.

aminimal arduino c/c++ program consists of only two functions

 setup(): this function is called once when a sketch starts after power-up or reset. it is
usedto initialize variables, input and outputpin modes, and other libraries needed in
thesketch.itisanalogous tothe functionmain()
 loop(): after setup() function exits (ends), the loop() function is executed repeatedly in
themain program.it controlsthe boarduntil the boardis poweredofforis reset.it
isanalogousto the functionwhile(1)
blink example

Power led(red) and user led(green)attached top in 13onanarduinocompatibleboard

most arduino boards contain a light-emitting diode (led) and a current limiting
resistorconnectedbetweenpin13andground,whichisaconvenientfeatureformanytestsandprogramfunctions.atypicalprogr
amusedbybeginners,akintohello,world!,is"blink",whichrepeatedlyblinkstheon-
boardledintegratedintothearduinoboard.thisprogramusesthefunctionspinmode(),digitalwrite(),anddelay(),whicharepro
videdbytheinternallibrariesincludedintheideenvironment.thisprogramisusuallyloadedintoanewarduinoboard bythe
manufacturer

Power(USB/BarrelJack)

every arduino board needs a way to be connected to a power source. the arduino uno can be
powered from a usb cable coming from your computer or a wall power supply (like this)
thatis terminated in a barrel jack. in the picture above the usb connection is labeled (1) and
thebarreljack is labeled (2).
the usb connection is also how you will load code onto your arduino board. more on how
toprogramwith arduino canbefound inourinstallingand programmingarduinotutorial.

note: do not use a power supply greater than 20 volts as you will overpower (and
therebydestroy) your arduino. the recommended voltage for most arduino models isbetween 6
and12 volts.

Pins(5V,3.3V,GND,Analog,Digital,PWM,AREF)

the pins onyour arduino are the places whereyouconnect wirestoconstruct a


circuit(probablyinconjuctionwithabreadboardandsomewire.theyusuallyhaveblackplastic
„headers‟ that allow you to just plug a wire right into the board. the arduino has
severaldifferentkindsofpins,eachofwhichislabeled ontheboardandusedfordifferentfunctions.

 gnd (3): short for „ground‟. there are several gnd pins on the arduino, any of
whichcanbeusedtogroundyourcircuit.
 5v (4) & 3.3v (5): as you might guess, the 5v pin supplies 5 volts of power, and
the3.3v pin supplies 3.3 volts of power. most of the simple components used with
thearduino run happilyoffof 5 or3.3volts.
 analog (6): the area of pins under the „analog in‟ label (a0 through a5 on the uno)
areanalogin pins.these pinscanreadthe signalfromananalog
sensor(likeatemperaturesensor)and convertitinto adigitalvaluethat we canread.
 digital (7): across from the analog pins are the digital pins (0 through 13 on the
uno).these pins can be used for both digital input (like telling if a button is pushed)
anddigitaloutput(likepoweringanled).
 pwm(8):youmayhavenoticedthetilde(~)nexttosomeofthedigitalpins(3,5,6,9, 10, and 11
on the uno). these pins act as normal digital pins, but canalso be usedfor something
called pulse-width modulation (pwm). we have a tutorial on pwm, butfor now, think
of these pins as being able to simulate analog output (like fading an ledinandout).

 aref(9):standsforanalogreference.mostofthetimeyoucanleavethispinalone.itis
sometimes used to set an external reference voltage (between 0 and 5 volts) as
theupperlimitforthe analog inputpins.

RESETBUTTON

just like the original nintendo, the arduino has a reset button (10). pushing it will
temporarilyconnect the reset pin to ground and restart any code that is loaded on the arduino.
this can bevery useful if your code doesn‟t repeat, but you want to test it multiple times.
unlike theoriginalnintendo however, blowingon thearduinodoesn't usuallyfixanyproblems.

POWERLEDINDICATOR

just beneath and to the right of the word “uno” on your circuit board, there‟s a tiny led next
tothe word „on‟ (11). this led should light up whenever you plug your arduino into a
powersource. if this light doesn‟tturn on, there‟s a good chance something is wrong. time to
re-checkyourcircuit!

TXRX LEDS

tx is short for transmit, rx is short for receive. these markings appear quite a bit in
electronicsto indicate the pins responsible for serial communication. in our case, there are two
places onthe arduino uno where tx and rx appear -- once by digital pins 0 and 1, and a second
time nextto the tx and rx indicator leds (12). these leds will give us some nice visual
indicationswhenever our arduino is receiving or transmitting data (like when we‟re loading a
newprogramonto the board).

MAINIC

the black thing with all the metal legs is an ic, or integrated circuit (13). think of it as
thebrains of our arduino. the main ic on the arduino is slightly different from board type to
boardtype,butis usually fromtheatmegaline ofic‟sfromtheatmelcompany.thiscanbeimportant,
as you may need to know the ic type (along with your board type) before loadingup a new
program from the arduino software. this information can usually be found in writingon the
top side of the ic. if you want to know more about the difference between various
ic's,readingthe datasheetsisoften a goodidea.

VOLTAGEREGULATOR

the voltage regulator (14) is not actually something you can (or should) interact with on
thearduino. but it is potentially useful to know that it is there and what it‟s for. the
voltageregulator does exactly what it says -- it controls the amount of voltage that is let into
thearduino board. think of it as a kind of gatekeeper; it will turn away an extra voltage that
mightharm the circuit. of course, it has its limits, so don‟thook up your arduino to anything
greaterthan 20 volts.
THEARDUINOFAMILY
arduino makes several different boards, each with different capabilities. in addition, part
ofbeing open source hardware means that others can modify and produce derivatives of
arduinoboards that provide even more form factors and functionality. if you‟re not sure
which one isright for your project, check this guide for some helpful hints. here are a few
options that arewell-suitedto someonenew to the world ofarduino:

ARDUINOUNO(R3)

the uno is a great choice for your first arduino. it's got everything you need to get started,
andnothing you don't. it has 14 digital input/output pins (of which 6 can be used as
pwmoutputs), 6 analog inputs, a usb connection, a power jack, a reset button and more. it
containseverything needed to support the microcontroller; simply connect it to a computer
with a usbcableorpoweritwith aac-to-dcadapteror batterytogetstarted.

LILYPADARDUINO

this is lilypadarduino mainboard!lilypad isawearablee-textiletechnology


developedbyleahbuechleyandcooperativelydesignedbyleahandsparkfun.eachlilypadwascreativ
ely designed with large connecting pads and a flat back to allow them to be sewn intoclothing
with conductive thread. the lilypad also has its own family of input, output,
power,andsensorboardsthatarealsobuiltspecificallyfore-textiles.they'reevenwashable!
REDBOARD

at sparkfun we use many arduinos and we're always looking for the simplest, most stable
one.each board is a bit different and no one board has everything we want -- so we decided
tomakeour own version that combines all our favoritefeatures.

the redboard can be programmed over a usb mini-b cable using the arduino ide. it'll work
onwindows 8 without having tochangeyour security settings (we used signed drivers,
unliketheuno).it'smorestableduetotheusb/ftdichipweused,plusit'scompletelyflatontheback,
making it easier to embed in your projects. just plug in the board, select "arduino
uno"fromtheboardmenuandyou'rereadytouploadcode.youcanpowertheredboardoverusbor
through thebarrel jack.the on-board power regulator can handleanythingfrom7 to15vdc.
ARDUINOMEGA(R3)

the arduino mega is like the uno's big brother. it has lots (54!) of digital input/output pins (14can be used as pwm
outputs), 16 analog inputs, a usb connection, a power jack, and a resetbutton. it contains everything needed to support
the microcontroller; simply connect it to acomputer with a usb cable or power it with a ac-to-dc adapter or battery to
get started. thelarge number of pins make this board very handy for projects that require a bunch of digitalinputs or
outputs

sensors
with some simple code, the arduino can control and interact with awidevarietyof sensors thingsthatcanmeasure light,
temperature, degreeofflex, pressure, proxi mity, acceleration, carbon monoxide, radioactivity, humidity, barometric
pressure, you name it, you can sense it!
justafew ofthe sensors that are easilycompatiblewith arduinoshields

additionally, there are these things called shields -- basically they are pre-built circuit
boardsthatfitontopofyourarduinoandprovideadditional capabilities --
controllingmotors,connectingto the internet,providing cellularorother
wirelesscommunication,controllingan lcd screen,and muchmore.
apartialselectionofavailableshields toextendthepowerofyour arduino

C-SR04UltrasonicSensor
ULTRASONIC SENSORHCSR04PINDIAGRAM

ULTRASONICSENSORPINCONFIGURATION

PINNUM PINN DESCRIPTION


BER AME

1 VCC THEVCCPINPOWERSTHESENSOR,TYPICALLYWITH
+5V

2 TRIGGER TRIGGER PIN IS AN INPUT PIN. THIS PIN HAS TOBEKEPT


HIGH FOR 10US TO INITIALIZE MEASUREMENT
BYSENDINGUSWAVE.

3 ECHO ECHOPINISANOUTPUTPIN.THISPINGOESHIGHFORAPERI
ODOFTIMEWHICHWILLBEEQUALTOTHETIME TAKEN
FOR THE US WAVE TO RETURN BACK TOTHESENSOR.

4 GROUND THISPINISCONNECTEDTOTHEGROUNDOFTHESYS
TEM.

HC-SR04SENSORFEATURES

 operatingvoltage:+5v
 theoreticalmeasuringdistance:2cmto450cm
 practicalmeasuringdistance:2cmto80cm
 accuracy:3mm
 measuringangle covered:<15°
 operatingcurrent:<15ma
 operatingfrequency:40hz

hc-sr04ultrasonicsensor-working

as shown above the hc-sr04 ultrasonic (us) sensor is a 4 pin module, whose pin names
arevcc, trigger, echo and ground respectively. this sensor is a very popular sensor used in
manyapplications where measuring distance or sensing objects are required. the module has
twoeyes like projects in the front which forms the ultrasonic transmitter and receiver. the
sensorworkswith the simple high school formulathat

distance=speed×time

the ultrasonic transmitter transmits an ultrasonic wave, this wave travels in air and when
itgets objected by any material it gets reflected back toward the sensor this reflected wave
isobservedbythe ultrasonicreceivermoduleas showninthepicturebelow

now, to calculate the distance using the above formulae, we should know the speed and time.since we are
using the ultrasonic wave we know the universal speed of us wave at roomconditions which is 330m/s. the
circuitry inbuilt on the module will calculate the time takenfor the us wave to come back and turns on the
echo pin high for that same particular amountof time, this way we can also know the time taken. now simply
calculate the distance using amicrocontrollerormicroprocessor
how to usethe hc-sr04ultrasonicsensor

hc-sr04 distance sensor is commonly used with both microcontroller and


microprocessorplatforms like arduino, arm, pic, raspberry pie etc. the following guide is
universally since ithasto be followed irrespectiveof thetypeof computationaldeviceused.

power the sensor using a regulated +5v through the vcc ad ground pins of the sensor.
thecurrentconsumed by the sensor is less than 15ma and hence can be directly powered by
theon board 5v pins (if available). the trigger and the echo pins are both i/o pins and hence
theycan be connected to i/o pins of the microcontroller. to start the measurement, the trigger
pinhas to be made high for 10us and then turned off. this action will trigger an ultrasonic
wave atfrequency of 40hz from the transmitter and the receiver will wait for the wave to
return. oncethe wave is returned after it getting reflected by any object the echo pin goes high
for aparticular amount of time which will be equal to the time taken for the wave to return
back tothesensor.

the amount of time during which the echo pin stays high is measured by the mcu/mpu as
itgives the information about the time taken for the wavetoreturn back to the sensor.
usingthisinformation thedistance ismeasuredas explained intheaboveheading.

APPLICATIONS

 usedtoavoidanddetectobstacleswithrobotslikebipedrobot,obstacleavoiderrobot,pathfindingr
obotetc.
 usedto measurethe distancewithin awiderange of2cmto400cm
 canbeusedtomaptheobjectssurroundingthesensorbyrotatingit
 depthofcertainplaceslikewells,pitsetccanbemeasuredsincethewavescanpenetratethrough
water

RELAY
A relay is an electrically operated switch in which contacts can be made to operate in the pre –
arranged fashion.
In short, a relay is a switch worked by an electromagnet.

CLASSIFICATION OF RELAYS.
1. Electromagnet relays.
2. Solid state relays.
3. Hybrid relays.
ELECTROMAGNETIC RELAYS
by currents and employed to control large power or to Relays are switching devices operated perform
switching operations.

OPERATION:
Fig shows the construction features of a simple electromagnetic relay. It consists of a coil.
A dc current passing through which produces a magnetic field. This magnetic field attracts an armature
which in turn operates the contact, normally open contacts close and normally closed contacts open. As
long as current flows, the two contacts remains closed. When the current is switched off, the attractive force
on armature is no longer present and the contact is opened.

RELAY INTERFACE
The circuit diagram shows the connection of Relay Driver Circuit. When the logic signal from
the Buffer O/P is applied to base of the transistor through resistor 1KOhm the starts conducting, it energizes the
relay. The transistor act as a small signal amplifier resistor of 1KOhm is used to provide proper emitter base
voltage to turn the transistor to ON state from OFF state.
Relay is an electromechanical switch & it works on the principled energizing an electromagnet. It
consists of primary coil, 2 contacts one is normally open contact “NO” & the other is normally closed contact
“NC”& pole normally identified a common. When relay is in off state the pole is connected to normally closed
(NC contact).The load is connected to the relay as shown in above circuit diagram. The load may be a fan or dc
motor or heater coil, when transistor starts conducting current starts flowing through the coil. Which develops
its own magnetic flux when the strength of current is suitable, a sufficient flux when produced attracts the pole
to make contact with normally open position ‘NO’. Hence the load connected to it performs its operation until
the contact is broken. A diode connected in parallel across the primary coil is to eliminate the effect of back
EMF on the transistor. Relays have great application in industry. Using the principle of energizing an
Electromagnet we can handle large voltages & current application. Without the risk of shocks.
NodeMCU ESP8266

NodeMCU is an open-source Lua based firmware and development board specially targeted for IoT based
Applications. It includes firmware that runs on the ESP8266 Wi-Fi SoC from Espressif Systems, and
hardware which is based on the ESP-12 module.

NodeMCU ESP8266 Specifications & Features

 Microcontroller: Tensilica 32-bit RISC CPU Xtensa LX106


 Operating Voltage: 3.3V
 Input Voltage: 7-12V
 Digital I/O Pins (DIO): 16
 Analog Input Pins (ADC): 1
 UARTs: 1
 SPIs: 1
 I2Cs: 1
 Flash Memory: 4 MB
 SRAM: 64 KB
 Clock Speed: 80 MHz
 USB-TTL based on CP2102 is included onboard, Enabling Plug n Play
 PCB Antenna
 Small Sized module to fit smartly inside your IoT projects

Brief About NodeMCU ESP8266


The NodeMCU ESP8266 development board comes with the ESP-12E module containing ESP8266 chip
having TensilicaXtensa 32-bit LX106 RISC microprocessor. This microprocessor supports RTOS and
operates at 80MHz to 160 MHz adjustable clock frequency. NodeMCU has 128 KB RAM and 4MB of
Flash memory to store data and programs. Its high processing power with in-built Wi-Fi / Bluetooth and
Deep Sleep Operating features make it ideal for IoT projects.
NodeMCU can be powered using Micro USB jack and VIN pin (External Supply Pin). It supports UART,
SPI, and I2C interface.

ESP8266 Chip Pinout and Descriptions


The LM35 datasheet specifies that this ICs are precision integrated-circuit temperature sensors, whose
output voltage is linearly proportional to the Celsius (Centigrade) temperature.

The LM35 thus has an advantage over linear temperature sensors calibrated in ˚ Kelvin, as the user is not
required to subtract a large constant voltage from its output to obtain convenient Centi-grade scaling. The
LM35 does not require any external calibration or trimming to provide typical accuracies of ±1⁄4˚C at room
temperature and ±3⁄4˚C over a full −55 to +150˚C temperature range.

433MHz Transmitter with Encoder circuit


The ASK (Amplitude Shift Keying) type Transmitter tuned at 433MHz frequency gets the data out
pin of HT 12E encoder IC. There 8 number of address lines & number of data lines are present in HT 12E.
The data on D0-D3 pin transmitted serially & available at data O/P pin. A RF transmitter of 433MHz have a
pin of data in now the serial data from HT 12E is given to this pin. The respective Vcc(5V) & ground pins
are connected . An antenna terminal is connected to a Telescopic antenna. If the I/P data for HT 12E is 0001
(Binary) the D0-D3 bits transmitted serially & 433MHz transmitter transmit these bits in the form of RF
waves trough an transmitting antenna.

The Receiver CKT is arranged as shown above. The 433MHz RF receiver (ASK type) gets the data from
antenna & the serial data is available at its data O/P pin. The corresponding +Vcc & GND pins are
connected to +5V source.

HT 12D Decoder decodes the serial data to parallel & it is available at D1- D4 data bits the
oscillating resistor of 51K is connected to its oscillating pins (pin 15 pin16) Pin 17 is considered as going
high when Transmitter starts generating & sending RF wave the pin 17 is connected to a transistor & an
LED which glows & indicates the link between Transmitter & Receiver. If a data bit of 1010 is applied to
the D0-D3 of HT 12E is Transmit serially. Transmit 433MHz & now through Transmitter& Receiver
receives the data bits & HT 12D decodes the serial data bits to parallel & the same data i.e. 1010 is
available at D1-D4 pins of HT 12D.

LED’S

A light-emitting diode (LED) is a semiconductor light source. LEDs are used as indicator lamps in
many devices and are increasingly used for other lighting.
The LED consists of a chip of semiconducting material doped with impurities to create a p-n
junction. As in other diodes, current flows easily from the p-side, or anode, to the n-side, or cathode, but not
in the reverse direction. Charge-carriers—electrons and holes—flow into the junction from electrodes with
different voltages. When an electron meets a hole, it falls into a lower energy level, and releases energy in
the form of a photon.
The wavelength of the light emitted, and thus its color depends on the band gap energy of the materials
forming the p-n junction. In silicon or germanium diodes, the electrons and holes recombine by a non-
radiative transition, which produces no optical emission, because these are indirect band gap materials. The
materials used for the LED have a direct band gap with energies corresponding to near-infrared, visible, or
near-ultraviolet light.
LED development began with infrared and red devices made with gallium arsenide. Advances
in materials science have enabled making devices with ever-shorter wavelengths, emitting light in a variety
of colors.
LEDs are usually built on an n-type substrate, with an electrode attached to the p-type layer deposited
on its surface. P-type substrates, while less common, occur as well. Many commercial LEDs, especially
GaN/InGaN, also use sapphire substrate.
Most materials used for LED production have very high refractive indices. This means that much light will
be reflected back into the material at the material/air surface interface. Thus, light extraction in LEDs is an
important aspect of LED production, subject to much research and development.

Parts of an LED.

Although not directly labeled, the flat bottom surfaces of the anvil and post embedded inside the epoxy act
as anchors, to prevent the conductors from being forcefully pulled out from mechanical strain or vibration

LIQUID CRYSTAL DISPLAY (LCD)

The LCD panel used in this block interfaced with micro-controller through output port. This is a 16
character × 2Line LCD module, capable of display numbers, characters, and graphics. The display contains
two internal byte-wide registers, one for commands (RS=0) and the second for character to be displayed
(RS=1). It also contains a user programmed Ram area (the character RAM) character that can be formed
using dot matrix that can be programmed to generate any desired. Two distinguished between these areas,
the hex command byte will be signify that the display RAM address 00h is chosen.

LCD can add a lot to our application in terms of providing a useful interface for the user, debugging
an application or just giving it a “professional” look. The most common type of LCD controller is the
Hitachi 44780 which provides a relatively simple interface between a processor and an LCD. Using this
inter is often not attempted by inexperienced designers and programmers because it is difficult to find good
documentation on the interface, initializing the interface can be problem and the displays themselves are
expensive.

Connection to a PC parallel port is mostly simple. These displays can handle eight bit input directly.
They also need two extra lines to control which kind of data has just arrived and when the data is meant to
be stable. Those signals are also called RS (Register Select, instruction or data register) and EN (enable).

So it has to control ten data lines (8 bits + RS + EN) and one common ground (GND) line, which
make eleven lines to the parallel port. Data read back is not supported by the driver and so it does not
require extra line for this. The following table shows the needed connection.

BLOCK DIAGRAM:

Parallel port 16×2


Microcontroller Alphanumeric
LCD

Fig 4.3: 16×2 LCD connection to microcontroller

The pin outs are as follows:

Fig 4.4: LCD Pin out.

You might also like