Major Report Batch-9
Major Report Batch-9
by
G. SRAVANI 18L51A0407
K.V.S. SRAVANI 18L51A0414
K. MAMATHA 18L51A0417
P. RISHITHA 18L51A0428
Under the guidance of
Assistant Professor
2021 - 2022
i
CERTIFICATE
This is to certify that the Industry Oriented Major Project report titled, “Smart Phone
Operated Multipurpose Agricultural Robotic vehicle” is being submitted by “G. SRAVANI Hall
Ticket No 18L51A0407, K.V.S.SRAVANI Hall Ticket No 18L51A0414, K.MAMATHA Hall
Ticket No 18L51A0417 and P. RISHITHA Hall Ticket No 18L51A0428” in partial fulfillment of
the requirements for the award of the degree of Bachelor of Technology in Electronics and
Communication Engineering to Jawaharlal Nehru Technological University Hyderabad, is a
record of Bonafide work carried out by them.
The contents presented in this project report have been verified and are found to be satisfactory.
Submitted for JNTUH Industry Oriented Major Project work Viva-Voce Examination held on
-
Principal
ii
ACKNOWLEDGEMENT
The success and final outcome of this project required a lot of guidance and assistance
from many people and we are extremely privileged to have got this all along the completion
of our project. All that we have done is only due to such supervision and assistance and we
would not forget to thank them.
We respect and thank Mr. Mohammed Shah Alam Rasool Khan, Chairman, Dr.
Zehra Khan, Joint Secretary and Mr. Rahman Sharif, Director of Shadan Educational
Society for providing us an opportunity to do the project work and giving us all support to
complete the project duly.
We are extremely thankful to Dr. K. Palani, B.E, M.E, Ph. D, Principal and
Dr. P. Hima Bindu, Vice Principal for providing us nice support and encouragement
throughout the completion of this project work.
We would not forget to remember our Head of the Department Dr. M.A. Khader Khan
for his encouragement and more over for his timely support and guidance till the completion of
our project work.
We heartily thank our internal project guide, Ms. K. Bhagya Lakshmi, Assistant
Professor, Electronics and Communication Engineering Department for her guidance and
suggestions during this project work.
We are thankful to and fortunate enough to get constant encouragement, support and
guidance from all Teaching staffs of Electronics and Communication Engineering Department
which helped us in successfully completing our project work
We would like to express our gratitude towards our parents for their kind co-operation
and encouragement which help us in completion of this project.
G. SRAVANI 18L51A0407
K.V.S. SRAVANI 18L51A0414
K. MAMATHA 18L51A0417
P. RISHITHA 18L51A0428
iii
DECLARATION
We hereby declare that the Industry Oriented Major Project report titled, “Smart
Phone Operated Multipurpose Agricultural Robotic Vehicle”, is a record of work done by
us and submitted to the Department of Electronics and Communication Engineering, Shadan
Women’s College of Engineering and Technology, Hyderabad in partial fulfillment of
academic requirements for the award of Degree of Bachelor of Technology degree in
Electronics and Communication Engineering, under Jawaharlal Nehru Technological
University Hyderabad, Hyderabad.
No part of the thesis is copied from books, journals or Internet and wherever the portion
is taken; the same has been duly referred in the text. The reported results are based on the
project work entirely done by us and not copied from any other source.
Also, we declare that the matter embedded in this thesis has not been submitted by any
students in full or partial thereof for the award of any degree/diploma of any other institution
or University previously.
G. SRAVANI 18L51A0407
K.V.S. SRAVANI 18L51A0414
K. MAMATHA 18L51A0417
P. RISHITHA 18L51A0428
iv
v
INDEX
Chapter TOPIC Page No.
No.
Abstract ix
List of Figures x
List of Tables xii
1 INTRODUCTION 1
1.1 General 1
1.2 Existing System 2
1.3 Disadvantages Of Existing System 2
1.4 Proposed System 3
1.5 Advantages Of Proposed System 3
2 LITERATURE SURVEY 4
3 PROJECT DESCRIPTION 6
3.1 General Introduction to Embedded System 6
3.2 Block Diagram 14
3.3 Modules 15
3.3.1 ARDUINO 15
3.3.2 Digital 17
3.3.3 Analog 18
3.3.4 Output signal 20
3.3.5 Input signal 21
3.3.6 Software Tips 26
3.6 BLUETOOTH 32
3.6.1 Pin Description 33
3.6.2 Specifications 38
vi
3.6.3 Applications 38
3.7 RELAY 39
3.7.1 Working of Relay 40
3.8 DC MOTOR 43
3.8.1 Working of Motor 43
3.8.2 Types of Motors 45
3.8.3 Applications 46
3.9 L293D 46
3.9.1 Concept 47
3.9.2 Working of L293D 48
3.10 DHT-11 50
3.10.1 Working of DHT-11 51
3.10.2 Specifications 52
3.10.3 Applications 53
3.11 MQ-7 53
3.11.1 Working of Motor 53
5 IMPLEMENTATION
5.1 WORKING OPERATION 70
5.2 STEPS
6 CONCLUSION
6.1 Future Scope 73
vii
REFERENCECES 75
APPENDIX 76
Code of a Smart Phone Operated Multipurpose Agricultural
Robotic Vehicle
viii
ABSTRACT
ix
List of Figures
S. No Figure Name of the Figure Page
No. No
1 3.1 Overview of Embedded System Architecture 11
2 3.2 Block Diagram of Embedded System 12
3 3.3 Block Diagram of AGRIBOT 14
4 3.4 Arduino UNO 15
5 3.5 Mini and Lilypad Arduino 16
6 3.6 Pin Configuration of Arduino 22
7 3.7 Structure and Symbol of LDR 27
8 3.8 LDR 28
9 3.9 Circuit diagram of LDR 30
10 3.10 Moisture Sensor 31
11 3.11 Bluetooth Module 33
12 3.12 Serial Interface of Bluetooth 34
13 3.13 Pin Configuration of Bluetooth 37
14 3.14 Relay 39
15 3.15 Structure of Relay 40
16 3.16 Circuit diagram of Relay 40
17 3.17 Pin diagram of Relay 41
18 3.18 DC Motor 43
19 3.19 Circuit diagram of Motor 45
20 3.20 Pin diagram of L293D 47
21 3.21 Circuit diagram of L293D 48
22 3.22 Diagram of geared DC Motor 49
23 3.23 DHT-11 Sensor 50
24 3.24 Pin diagram of DHT-11 52
25 3.25 Gas Sensor 53
26 3.26 Servo Motor 55
27 3.27 Parts of Servo Motor 57
28 3.28 Pulse diagram of Motor 58
x
29 3.29 LED 60
30 3.30 Water Pump 61
31 3.31 Robo Setup 62
32 4.1 Arduino IDE: Default Window 64
33 4.2 Arduino IDE: Board setup Procedure 65
34 4.3 Arduino IDE: Com Port Setup 66
35 4.4 Arduino IDE: Loading Blink Sketch 67
36 4.5 Arduino IDE: Output Window 67
37 5.1 Smart phone controlled Agricultural Robot for 71
automatic irrigation system
xi
List of Tables
xii
CHAPTER 1
INTRODUCTION
1.1 GENERAL
1
1.2 EXISTING SYSTEM
2
1.4 PROPOSED SYSTEM
3
CHAPTER 2
LITERATURE SURVEY
[2] Akhila Gollakota and M. B. Srinivas has termed the indigenous agriculture
robot as “Agribot”. India is a major agriculture boosted economic country and
so such machines are necessary for the farmers to work faster in the fields. The
model consists of a PSoC controller to operate the components of the motor and
it performs the functions like ploughing the soil, seedling and covering the soil
over. The paper shows how PSoC controller can display over many parameters
and is an alternative to the Arduino microcontroller. The advantage of this model
is that it will improve the accuracy and efficiency of operations in the farms.
[3] Saurabh Umarkar and Anil Karwankar underline the effect of unavailability
of skilled workers in the farming occupation and use of machinery is very vast.
So, it presents a design and development of a robot which will perform the
functions of ploughing, seed sowing and also to detect obstacles in the way. The
result of this model shows how the seeds are placed in the field at different
4
intervals. The advantage of such model is that it increases productivity in the
farm and also operates on a renewable energy source of solar power.
[5] Swati D. Sambare, S.S. Belsare has described over the whole process of seed
sowing technology. The dispensing mechanism uses ARM module and is
connected to PC using Zig Bee module. The paper explains how various seeds
can be dispensed and sowed through the robot accordingly. This can help the
farmers in seed sowing purpose in the fields.
5
CHAPTER 3
PROJECT DESCRIPTION
6
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, s 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.
Application Areas
Nearly 99 per cent of the processors manufactured end up in embedded
systems. The embedded system market is one of the highest growth areas as these
systems are used in very market segment- consumer electronics, office
automation, industrial automation, biomedical engineering, wireless
communication, data communication, telecommunications, transportation,
military and so on.
Consumer appliances
At home we use a number of embedded systems which include digital
camera, digital diary, DVD player, electronic toys, microwave oven, remote
controls for TV and 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 powerful
embedded systems using which we can carry out many general-purpose tasks such
as playing games and word processing.
7
Office Automation
The office automation products using embedded systems are copying
machine, fax machine, key telephone, modem, printer, scanner etc.
Industrial Automation
Today a lot of industries use embedded systems for process control. These
include pharmaceutical, cement, sugar, oil exploration, nuclear energy, electricity
generation and transmission. The embedded systems for industrial use are
designed to carry out specific tasks such as monitoring the temperature, pressure,
humidity, voltage, current etc., and then take appropriate action based on the
monitored levels to control other devices or to send information to a centralized
monitoring station. In hazardous industrial environment, where human presence
has to be avoided, robots are used, which are programmed to do specific jobs. The
robots are now becoming very powerful and carry out many interesting and
complicated tasks such as hardware assembly.
Medical Electronics
Almost every medical equipment in the hospital is an embedded system.
This equipment includes diagnostic aids such as ECG, EEG, blood pressure
measuring devices, X-ray scanners; equipment used in blood analysis, radiation,
colonoscopy, endoscopy etc. Developments in medical electronics have paved
way for more accurate diagnosis of diseases.
Computer Networking
Computer networking products such as bridges, routers, Integrated
Services Digital Networks (ISDN), Asynchronous Transfer Mode (ATM), X.25
and frame relay switches are embedded systems which implement the necessary
data communication protocols. For example, a router interconnects two networks.
The two networks may be running different protocol stacks. The router’s function
is to obtain the data packets from incoming pores, analyze the packets and send
them towards the destination after doing necessary protocol conversion. Most
networking equipment’s, other than the end systems (desktop computers) we use
to access the networks, are embedded systems.
8
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 20th century. It is a very powerful embedded system that
provides voice communication while we are on the move. The Personal Digital
Assistants and the palmtops can now be used to access multimedia service over
the Internet. Mobile communication infrastructure such as base station controllers,
mobile switching centers are also powerful embedded systems.
Instrumentation
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 powerful
processors. Thank to miniaturization, the test and measuring equipment are now
becoming portable facilitating easy testing and measurement in the field by field-
personnel.
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
9
store. Developing embedded systems for security applications is one of the most
lucrative businesses nowadays. Security devices at homes, offices, airports etc. for
authentication and verification are embedded systems. Encryption devices are
nearly 99 per cent of the processors that are manufactured end up in~ embedded
systems. Embedded systems find applications in every industrial segment-
consumer electronics, transportation, avionics, biomedical engineering,
manufacturing, process control and industrial automation, data communication,
telecommunication, defense, security etc. Used to encrypt the data/voice being
transmitted on communication links such as telephone lines. Biometric systems
using fingerprint and face recognition are now being extensively used for user
authentication in banking applications as well as for access control in high security
buildings.
Finance
Financial dealing through cash and cheques are now slowly paving way for
transactions using smart cards and ATM (Automatic Teller Machine, also
expanded as Any Time Money) machines. Smart card, of the size of a credit card,
has a small micro-controller and memory; and it interacts with the smart card
reader! ATM machine and acts as an electronic wallet. Smart card technology has
the capability of ushering in a cashless society. Well, the list goes on. It is no
exaggeration to say that eyes wherever you go, you can see, or at least feel, the
work of an embedded system.
10
Figure 3.1 Overview of Embedded System Architecture
Now, let us see the details of the various building blocks of the hardware
of an embedded system. As shown in Fig 3.2 the building blocks are;
· Central Processing Unit (CPU)
· Memory (Read-only Memory and Random-Access Memory)
· Input Devices
· Output devices
· Communication interfaces
· Application-specific circuitry
11
Figure 3.2 Block Diagram of Embedded System
Memory
The memory is categorized as Random-Access Memory (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
12
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.
Communication Interfaces
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 interfaces such
as RS232, RS422, RS485, Universal Serial Bus (USB), and IEEE 1394, Ethernet
etc.
Application-Specific Circuitry
13
3.2 BLOCK DIAGRAM
14
3.3 MODULES
3.3.1 ARDUINO
The Arduino Uno is an open-source microcontroller board based on the
Microchip ATmega328P microcontroller and developed by Arduino.cc.
The board is equipped with sets of digital and analog input/output pins that
may be interfaced to various expansion boards and other circuits.
These boards as shown in the Fig 3.4 below use the same micro-
controller, just in a different package. The Lilypad is designed for use with
conductive thread instead of wire and the Arduino Mini is simply a smaller
package without the USB, Barrel Jack and Power Outs.
15
Figure 3.5 Arduino Lilypad and Arduino Mini
It depends on what you want to do with it really. There are two different
purposes outlined above for the voltage divider as shown in the Fig 3.5, we will
go over both. If you wish to use the voltage divider as a sensor reading device
first you need to know the maximum voltage allowed by the analog inputs you
are using to read the signal. On an Arduino this is 5V. So, already we know the
maximum value we need for Vout. The Vin is simply the amount of voltage
already present on the circuit before it reaches the first resistor. You should be
able to find the maximum voltage your sensor outputs by looking on the
Datasheet, this is the maximum amount of voltage your sensor will let through
given the voltage in of your circuit. Now we have exactly one variable left, the
value of the second resistor. Solve for R2 and you will have all the components
of your voltage divider figured out! We solve for R1's highest value because a
smaller resistor will simply give us a smaller signal which will be readable by
our analog inputs.
Powering an analog Reference is exactly the same as reading a sensor except
you have to calculate for the Voltage Out value you want to use as the analog
Reference.
All of the electrical signals that the Arduino works with are either Analog
or Digital. It is extremely important to understand the difference between these
two types of signals and how to manipulate the information these signals
represent.
16
3.3.2 DIGITAL SIGNALS
Humans perceive the world in analog, but robots, computers and circuits
use Digital. A digital signal is a signal that has only two states. These states can
vary depending on the signal, but simply defined the states are ON or OFF, never
in between.
In the world of Arduino, Digital signals are used for everything with the
exception of Analog Input. Depending on the voltage of the Arduino the ON or
HIGH of the Digital signal will be equal to the system voltage, while the OFF
or LOW signal will always equal 0V. This is a fancy way of saying that on a 5V
Arduino the HIGH signals will be a little under 5V and on a 3.3V Arduino the
HIGH signals will be a little under 3.3V.
The Arduino also has the capability to output a Digital signal that acts
as an Analog signal, this signal is called Pulse Width Modulation (PWM).
17
Digital Pins # 3, # 5, # 6, # 9, # 10 and #11 have PWM capabilities. To output a
PWM signal use the command: analog Write (pin Number, value); where pin
Number is a Digital Pin with PWM capabilities and value is a number between
0 (0%) and 255 (100%). For more information on PWM see the PWM
worksheets or S.I.K. circuit 12.
All of the electrical signals that the Arduino works with are either
Analog or Digital. It is extremely important to understand the difference
between these two types of signals and how to manipulate the information these
signals represent.
18
off. The Arduino does this by sampling the voltage signal sent to these pins and
comparing it to a voltage reference signal (5V). Depending on the voltage of
the Analog signal when compared to the Analog Reference signal the Arduino
then assigns a numerical value to the signal somewhere between 0 (0%) and
1023 (100%). The digital system of the Arduino can then use this number in
calculations and sketches.
The Arduino also has the capability to output a digital signal that acts
as an Analog signal, this signal is called Pulse Width Modulation (PWM).
Digital Pins # 3, # 5, # 6, # 9, # 10 and #11 have PWM capabilities. To output
a PWM signal use the command: Write (pin Number, value); where pin
Number is a Digital Pin with PWM capabilities and value is a number between
0 (0%) and 255 (100%). On the Arduino UNO PWM pins are signified by a ~
sign. For more information on PWM see the PWM worksheets or S.I.K. circuit
12.
▪ Analog Input uses the Analog In pins, Analog Output uses the PWM
pins
▪ To receive an Analog signal use: analog Read (pin Number);
▪ To send a PWM signal use: analog Write (pin Number, value);
▪ Analog Input values range from 0 to 1023 (1024 values because it uses
10 bits, 210)
▪ PWM Output values range from 0 to 255 (256 values because it uses 8
bits, 28)
19
▪ All of the electrical signals that the Arduino works with are either input
or output. It is extremely important to understand the difference between
these two types of signals and how to manipulate the information these
signals represent.
20
• Regular Digital Output is always either HIGH or LOW.
• PWM Output varies from 0 to 255.
All of the electrical signals that the Arduino works with are either input
or output. It is extremely important to understand the difference between these
two types of signals and how to manipulate the information these signals
represent.
where pin Number is the Analog Input pin number. This function will
return an Analog Input reading between 0 and 1023. A reading of zero
corresponds to 0 Volts and a reading of 1023 corresponds to 5 Volts. These
voltage values are emitted by the analog sensors and interfaces. If you have an
Analog Input that could exceed Vcc + .5V you may change the voltage that 1023
corresponds to by using the Aref pin. This pin sets the maximum voltage
parameter your Analog Input pins can read. The Aref pin's preset value is 5V.
Digital Input can enter your Arduino through any of the Digital Pins # 0 - # 13.
Digital Input signals are either HIGH (On, 5V) or LOW (Off, 0V).
Because the Digital pins can be used either as input or output you will
need to prepare the Arduino to use these pins as inputs in your setup () function.
To do this type the command: pin Mode (pin Number, INPUT); Inside the curly
brackets of the setup () function where pin Number is the Digital pin number
you wish to declare as an input. You can change the pin Mode in the loop ()
21
function if you need to switch a pin back and forth between input and output,
but it is usually set in the setup () function and left untouched in the loop ()
function. To read the Digital pins set as inputs use the command: digital Read
(pin Number); where pin Number is the Digital Input pin number. Input can
come from many different devices, but each device's signal will be either Analog
or Digital, it is up to the user to figure out which kind of input is needed, hook
up the hardware and then type the correct code to properly use these signals.
X1:
DE-9 serial connector, used to connect computer (or other devices)
using RS-232 standard. Needs a serial cable, with at least 4 pins connected: 2,
3, 4 and 5. Works only when JP0 is set to 2-3 position.
DC1:
2.1 mm. power jack, used to connect external power source. Centre
positive. Voltage Regulator Works with regulated +7 to +20 volts DC (9v. to
12v. is recommended). It is possible to alternatively connect external power
using 9v. pin or 5v. pin. (See POWER PINOUT).
22
ICSP:
2x3 pin header Used to program Atmega with bootloader. The number
1 on both sides of the board indicates cable pin1 position. Used to upload
sketches on Atmega ICs without bootloader (available only in Arduino IDE
versions 0011 and 0012).
JP0
3 pins jumper When in position 2-3, this jumper enables serial
connection (through X1 connector) to/from computer/devices. Use this as
default position. When in position 1-2, it disables serial communication, and
enables external pull-down resistors on pin0 (RX) and pin1 (TX). Use this only
to prevent noise on RX (that seems incoming data to Atmega), that sometimes
makes sketch not starting. When removing this jumper, serial communication is
disabled, and pin0 and pin1 work as a normal (floating) digital pin. Useful when
more digital pins are needed, but only when serial communication is not
necessary. External pull-down/pull-up resistor is required.
JP4
2 pins jumper When in position 1-2, this jumper enables auto reset
feature, useful when uploading a sketch to Arduino, resetting Atmega
automatically. It makes unnecessary to press reset button (S1) when uploading
sketches. Be sure that computer COM Port speed is set to 19200bps otherwise
auto reset will not work properly. If removed, disables auto reset feature. Very
useful to prevent undesired Atmega reset when using sketches that needs serial
communication. Auto reset works with DTR pulse on serial pin4. Sometimes
Arduino senses a DTR pulse when connecting X1 (serial connector) and some
software’s sends a DTR pulse when it starts or when it closes, that makes
Atmega reset when not desired.
S1
Tactile button This button resets Atmega, to restart uploaded sketch or
to prepare Arduino to receive a sketch through serial connector (when auto reset
is not active).
23
LEDS
Indicative leds POWER led Turns on when Arduino is powered through
DC1, +9v. pin or +5v. pin. RX led Blinks when receiving data from
computer/device through serial connection. TX led Blinks when sending data to
computer/device through serial connection. L led This led is connected to digital
pin13 with a current limiter resistor (that doesn’t affect pin13). Useful to test
sketches. It is normal to blink when boot loading too.
POWER PINOUT
6 pin headers
RST pin
Makes Atmega reset when connected to GND. Useful for Shield Boards,
or to connect external reset.
NC pin
This pin is not connected in Arduino S3v3. Arduino Diecimila has a 3.3
volts pin in the same position.
+9v. pin
When Arduino DC1 is powered (with battery or DC adaptor), this pin is
used as Vout, with the same voltage supplied on DC1 (see DC1), minus 0,7
volts. The total supplied current depends on external power source capacity
When Arduino DC1 is not powered, +9v. pin can be used as Vin, connecting it
to a external regulated power source (+7 to +20 volts) and connecting 0v. pin to
external power source GND.
+5v. pin
This can be used as Vout, supplying +5 volts. +5v. pin When Arduino
DC1 is powered (with battery or DC adaptor), +5v. pin supplies +5 volts as a
Vout pin. The total supplied current depends on Voltage Regulator (7805
supplies up to 1A). This applies only to +5v. pin: Atmega in/out pins only
supplies max. 40mA on each pin. When Arduino DC1 is not powered, this pin
can be used as Vin, connecting it to a regulated +5v. and connecting 0v. pin to
24
power source GND. In this case, +9v. pin is inactive. 0v. pin (GND) Two 0v.
pins between +5v. and +9v. / One.
0v. pin
Beside AREF pin. When Arduino DC1 is powered, 0v. pin supplies 0
volts reference (GND) for +5v. pin and +9v. pin. When DC1 is not powered,
and Arduino is powered through +5v. pin or +9v. pin, 0v. pin must be used as
GND reference, connecting it to the external power source GND.
GND pin
See 0v. pin (GND).
AREF pin
The AREF can be set to AVcc (default), internal 2.56 volts (Atmega8),
internal 1.1 volts (Atmega168), or external AREF. In case of AVcc or internal
AREF, AREF pin can be used to attach na external capacitor to decouple the
signal, for better noise performance. In case of external AREF, AREF pin is
used to attach the external reference voltage. Remember that it is necessary to
change de fuses (wiring’s file), and re-upload sketch, before connecting
external voltage to AREF.
25
3.3.6 SOFTWARE TIPS
When boot loading an Atmega8 chip with Arduino 0010, there is a
command (-i800) that makes bootloader delay 10 minutes. So, if you need to use
bootloader, use command line instead of IDE, removing “–i800” command and
adding “–F” command, or use Arduino 0007 IDE. To upload sketches Arduino
0010 works fine.
26
3.4 LIGHT DEPENDENT RESISTOR (LDR)
27
3.4.2 CHARACTERISTICS OF LDR
LDR CHARACTERISTICS
Also, LDR’s are less sensitive than photo diodes and phototransistor. (A
photo diode and a photocell (LDR) are not the same, a photo-diode is a pn
28
junction semiconductor device that converts light to electricity, whereas a
photocell is a passive device, there is no pn junction in this nor it “converts”
light to electricity).
29
Figure 3.9 Circuit diagram of LDR
30
3.5 MOISTURE SENSOR
3.5.1 SPECIFICATIONS
• Working Voltage:5V
• Working Current:<20mA
• Interface type: Analog
• Working Temperature:10°C~30°C
31
dielectric permittivity, and therefore the water content of the soil. The sensor
averages the water content over the entire length of the sensor. There is a 2 cm
zone of influence with respect to the flat surface of the sensor, but it has little or
no sensitivity at the extreme edges. The Soil Moisture Sensor is used to measure
the loss of moisture over time due to evaporation and plant uptake, evaluate
optimum soil moisture contents for various species of plants, monitor soil
moisture content to control irrigation in greenhouses and enhance bottle biology
experiments.
ADVANTAGES:
• Very accurate with calibration.
• Larger measurement zone of influence than capacitance probes.
• Not affected by salinity unless it is greater than 9dS/m.
DISADVANTAGES:
• Only covers a small sensing area.
• Requires good contact between the soil and the sensor.
• Installation requires care to ensure there are no air gaps.
• Larger sensitivity to temperature, clay content and air gaps than other
sensor types.
32
Figure 3.11 Bluetooth Module
Pin
Pin No Description
Name
Enable / This pin is used to toggle between Data Mode (set low) and
1
Key AT command mode (set high). By default, it is in Data mode
RX – Receive Serial Data. Every serial data given to this pin will be
5
Receiver broadcasted via Bluetooth
33
HC-05 module information
• HC-05 has red LED which indicates connection status, whether the
Bluetooth is connected or not. Before connecting to HC-05 module this
red LED blinks continuously in a periodic manner. When it gets
connected to any other Bluetooth device, its blinking slows down to two
seconds.
• This module works on 3.3 V. We can connect 5V supply voltage as well
since the module has on board 5 to 3.3 V regulator.
• As HC-05 Bluetooth module has 3.3 V level for RX/TX and
microcontroller can detect 3.3 V level, so, no need to shift transmit level
of HC-05 module. But we need to shift the transmit voltage level from
microcontroller to RX of HC-05 module.
34
So, when we want to communicate through smartphone with HC-05
Bluetooth module, connect this HC-05 module to the PC via serial to USB
converter. Before establishing communication between two Bluetooth devices,
1st we need to pair HC-05 module to smartphone for communication.
1. Search for new Bluetooth device from your phone. You will find
Bluetooth device with “HC-05” name.
2. Click on connect/pair device option; default pin for HC-05 is 1234 or
0000.
Command mode
35
• To do this, HC-05 has AT commands.
• To use HC-05 Bluetooth module in AT command mode, connect “Key”
pin to High (VCC).
• Default Baud rate of HC-05 in command mode is 38400bps.
• To send these commands, we have to connect HC-05 Bluetooth module
to the PC via serial to USB converter and transmit this command
through serial terminal of PC.
Set Password
AT+PSWD=XXXX OK
e.g. AT+PSWD=4567
+Version: XX
OK
Respond version no. of
AT+VERSION?
Bluetooth module
e.g. +Version: 2.0
20130107 OK
Parameters:
device type,
Send detail of setting
AT+ORGL module mode,
done by manufacturer
serial parameter,
passkey, etc.
The HC-05 is a very cool module which can add two-way (full-duplex)
wireless functionality to your projects. You can use this module to communicate
36
between two microcontrollers like Arduino or communicate with any device
with Bluetooth functionality like a Phone or Laptop. There are many android
applications that are already available which makes this process a lot easier. The
module communicates with the help of USART at 9600 baud rate hence it is
easy to interface with any microcontroller that supports USART. We can also
configure the default values of the module by using the command mode. So if
you looking for a Wireless module that could transfer data from your computer
or mobile phone to microcontroller or vice versa then this module might be the
right choice for you. However, do not expect this module to transfer multimedia
like photos or songs; you might have to look into the CSR8645 module for that.
During power up the key pin can be grounded to enter into Command
mode, if left free it will by default enter into the data mode. As soon as the
module is powered you should be able to discover the Bluetooth device as “HC-
05” then connect with it using the default password 1234 and start
37
communicating with it. The name password and other default parameters can be
changed by entering into the inputs.
3.6.2 SPECIFICATIONS
3.6.3 APPLICATIONS
4. Consumer applications
5. Wireless Robots
6. Home Automation
38
3.7 RELAY
What is a relay?
They were also used in long distance telegraphy. They were used to
switch the signal coming from one source to another destination. After the
invention of computers, they were also used to perform Boolean and other
logical operations. The high-end applications of relays require high power to be
driven by electric motors and so on. Such relays are called contactors
39
Figure 3.15 Structure of Relay
3.7.1 WORKING
This magnetic field moves the relay armature for opening or closing the
connections. The small power relay has only one contact, and the high-power
relay has two contacts for opening the switch.
40
The inner section of the relay is shown in the Fig 3.17 below. It has an
iron core which is wound by a control coil. The power supply is given to the coil
through the contacts of the load and the control switch. The current flow through
the coil produces the magnetic field around it.
Due to this magnetic field, the upper arm of the magnet attracts the lower arm.
Hence close the circuit, which makes the current flow through the load. If the
contact is already closed, then it moves oppositely and hence opens the contacts.
Relay Basics
The basics for all the relays are the same. Take a look at a 4 – pin relay
shown in the below Fig 3.17. There are two colors shown. The green color
represents the control circuit and the red color represents the load circuit. A small
control coil is connected onto the control circuit. A switch is connected to the
load. This switch is controlled by the coil in the control circuit. Now let us take
the different step that occurs in a relay.
As shown in the circuit, the current flowing through the coils represented
by pins 1 and 3 causes a magnetic field to be aroused. This magnetic field causes
the closing of the pins 2 and 4. As soon as the current flow stops through pins 1
and 3, the relay switch opens and thus the open circuit prevents the current flow
through pins 2 and 4. Thus the relay becomes de-energized and thus in off
position.
41
Pole and Throw
Relays have the exact working of a switch. So, the same concept is also
applied. A relay is said to switch one or more poles. Each pole has contacts that
can be thrown in mainly three ways. They are
Relays can be used to control several circuits by just one signal. A relay
switches one or more poles, each of whose contacts can be thrown by energizing the
coil. Relays are also named with designations like
• Single Pole Single Throw (SPST) – The SPST relay has a total of four
terminals. Out of these two terminals can be connected or disconnected. The
other two terminals are needed for the coil to be connected.
• Single Pole Double Throw (SPDT) – The SPDT relay has a total of five
terminals. Out of these two are the coil terminals. A common terminal is also
included which connects to either of two others.
42
• Double Pole Single Throw (DPST) – The DPST relay has a total of six
terminals. These terminals are further divided into two pairs. Thus, they can act
as two SPST’s which are actuated by a single coil. Out of the six terminals two
of them are coil terminals.
• Double Pole Double Throw (DPDT) – The DPDT relay is the biggest of all. It
has mainly eight relay terminals. Out of these two rows are designed to be
change over terminals. They are designed to act as two SPDT relays which are
actuated by a single coil.
43
magnetic flux density, I = current and L = length of the conductor within the
magnetic field.
If we stretch the first finger, second finger and thumb of our left hand to
be perpendicular to each other, and the direction of magnetic field is represented
by the first finger, direction of the current is represented by the second finger,
then the thumb represents direction of the force experienced by the current
carrying conductor.
Back EMF
The circuit diagram below illustrates the direction of the back emf and
44
armature current. Magnitude of the Back emf can be given by emf equation of
a DC generator.
On the other hand, if a dc motor is suddenly loaded, the load will cause
decrease in the speed. Due to decrease in speed, back emf will also decrease
allowing more armature current. Increased armature current will increase the
torque to satisfy the load requirement. Hence, presence of the back emf makes a
dc motor ‘self-regulating’.
45
• Self-excited -
• Cranes
• Conveyors
• Pumps
• Fans
• Machine tools
• Air compressors
• Toys
• Motor starters in cars
3.9 L293D
The l293d can drive small and quiet big motors as well, check the
Voltage Specification at the end.
46
3.9.1 CONCEPT OF L293D
In a single L293D chip there are two h-Bridge circuit inside the IC which
can rotate two dc motor independently. Due its size it is very much used in
robotic application for controlling DC motors. Given Fig 3.20 below is the pin
diagram of a L293D motor controller.
47
3.9.2 WORKING OF L293D IC
• L293D motor driver IC contains two H-bridge circuit inside it, which may
also use Darlington transistor some times for current amplification.
• Let we understand this H-bridge circuit, in case 1, when logic ‘1’ apply to
transistor T1 and T4, motor starts rotating in clockwise direction due to
circuit complete and current flows through it as shown by blue indication.
• In case 2, we apply logic ‘1’ to transistor T2 and T3, so motor starts rotating
in anti-clockwise direction due to circuit complete and direction of current
flows through it is shown by green indication.
• As I mentioned that logic ‘1’ apply to T1 & T4 or T2 & T3 is just for
simplicity cause this transistor is hard wired inside IC so you just need to
take care of pin-out and apply logic to IC’s pin directly and carried out your
work.
48
How simple or geared DC motor work with microcontroller?
• As you can see on above Fig 3.22, understanding of motor is simple as seen.
• Motor rotates in the direction of higher potential to lower potential.
• Here we make this diagram as simple as we can, cause easy understanding
(not use L293D IC).
The motor driver IC deals with heavy currents. Due to so much current
flow the IC gets heated. So, we need a heat sink to reduce the heating. Therefore,
there are 4 ground pins. When we solder the pins on PCB, we get a huge metallic
area between the grounds where the heat can be released.
Voltage Specification
VCC is the voltage that it needs for its own internal operation 5v; L293D
will not use this voltage for driving the motor. For driving the motors, it has a
separate provision to provide motor supply VSS (V supply). L293d will use this
to drive the motor. It means if you want to operate a motor at 9V then you need
to provide a Supply of 9V across VSS Motor supply. The maximum voltage for
VSS motor supply is 36V.
49
It can supply a max current of 600mA per channel. Since it can drive
motors Up to 36v hence you can drive pretty big motors with this l293d.
VCC pin 16 is the voltage for its own internal Operation. The maximum
voltage ranges from 5v and up to 36v.
3.10 DHT-11
50
3.10.1 WORKING
DHT11 sensor has four pins- VCC, GND, Data Pin and a not connected
pin. A pull-up resistor of 5k to 10k ohms is provided for communication between
sensor and micro-controller.
HUMIDITY (DHT11):
• DHT11 uses only one wire for communication. The voltage levels with
certain time value defines the logic one or logic zero on this pin.
• The communication process is divided in three steps, first is to send
request to DHT11 sensor then sensor will send response pulse and then
it starts sending data of total 40 bits to the microcontroller.
51
• After sending 40-bit data, DHT11 sensor sends 54us low level and then
goes high. After this DHT11 goes in sleep mode.
DHT11 vs DHT22
Two versions of the DHT sensor, they look a bit similar and have the
same pinout, but have different characteristics and specifications:
• Ultra-low cost
• 3 to 5V power and I/O
• 2.5mA max current use during conversion (while requesting data)
• Good for 20-80% humidity readings with 5% accuracy
• Good for 0-50°C temperature readings ±2°C accuracy
• No more than 1 Hz sampling rate (once every second)
• Body size 15.5mm x 12mm x 5.5mm
• 4 pins with 0.1" spacin
52
3.10.3 APPLICATIONS
Ideal sensor is shown in the Fig 3.25 below use to detect the presence of
a dangerous LPG leak in your car or in a service station, storage tank
environment. This unit can be easily incorporated into an alarm unit, to sound
an alarm or give a visual indication of the LPG concentration. The sensor has
excellent sensitivity combined with a quick response time. The sensor can also
sense iso-butane, propane, LNG and cigarette smoke.
53
output current will be zero. The below gif shown the oxygen molecules (blue
colour) attracting the free electrons (black color) inside the SnO2 and preventing
it from having free electrons to conduct current.
FEATURES
• High Sensitivity
• Detection Range: 100 - 10,000 ppm iso-butane propane
• Fast Response Time: <10s
• Heater Voltage: 5.0V
• Dimensions: 18mm Diameter, 17mm High excluding pins, Pins - 6mm
High
APPLICATIONS
54
3.12 SERVO MOTOR
3.12.1 WORKING
Mechanism of servomotor:
55
expected output, an error signal generates. This then causes the motor to rotate
in either direction, as per need to bring the output shaft to the appropriate
position. As the position approaches, the error signal reduces to zero. Finally,
the motor stops.
Working of servomotors
56
between the current position and required position. The amount of power require
by the motor is proportional to the distance it needs to travel.
All motors have three wires coming out of them. Out of which two will
be used for Supply (positive and negative) and one will be used for the signal
that is to be sent from the MCU.
57
controlled by a variable resistor (potentiometer) and some gears. High speed
force of DC motor is converted into torque by Gears. We know that WORK=
FORCE X DISTANCE, in DC motor Force is less and distance (speed) is high
and in Servo, force is High and distance is less. Potentiometer is connected to
the output shaft of the Servo, to calculate the angle and stop the DC motor on
required angle.
Servo motor can be rotated from 0 to 180 degree, but it can go up to 210
degrees, depending on the manufacturing. This degree of rotation can be
controlled by applying the Electrical Pulse of proper width, to its Control pin.
Servo checks the pulse in every 20 milliseconds. Pulse of 1 ms (1 millisecond)
width can rotate servo to 0 degree, 1.5ms can rotate to 90 degree (neutral
position) and 2 ms pulse can rotate it to 180 degree.
All servo motors work directly with your +5V supply rails but we have
to be careful on the amount of current the motor would consume, if you are
planning to use more than two servo motors a proper servo shield should be
designed.
58
3.12.2 APPLICATIONS:
1. Robotics: At every joint of the robot, we connect a servomotor. Thus, giving
the robot arms its precise angle.
2. Conveyor belts: servo motors move, stop, and start conveyor belts carrying
product along to various stages, for example, in product packaging/ bottling, and
labeling.
3. Camera auto focus: A highly precise servo motor build into the camera
corrects a camera lens to sharpen out of focus images.
4. Solar tracking system: Servo motors adjust the angle of solar panels
throughout the day and hence each panel continues to face the sun which results
in harnessing maximum energy from sunup to sundown.
Advantages:
• If a heavy load is placed on the motor, the driver will increase the current to
the motor coil as it attempts to rotate the motor. Basically, there is no out-of-
step condition.
• High-speed operation is possible.
Disadvantages:
• Since the servomotor tries to rotate according to the command pulses, but
lags behind, it is not suitable for precision control of rotation.
• Higher cost.
• When stopped, the motor’s rotor continues to move back and forth one pulse,
so that it is not suitable if you need to prevent vibration
59
3.13 LED
Advantages:
• The LED are smaller in sizes, and they can be stacked together to form
numeric and alphanumeric display in the high-density matrix.
• The intensity of the light output of the LED depends on the current flows
through it. The intensity of their light can be controlled smoothly.
• The LED are available which emits light in the different colours like red,
yellow, green and amber.
60
3.14 WATER PUMP
This DC 3-6 V Mini Micro Submersible Water Pump is a low cost, small
size Submersible Pump Motor which can be operated from a 2.5 ~ 6V power
supply. It can take up to 120 liters per hour with a very low current consumption
of 220mA. Just connect tube pipe to the motor outlet, submerge it in water and
power it.
Make sure that the water level is always higher than the motor. The dry
run may damage the motor due to heating and it will also produce noise.
3.14.1 SPECIFICATION:
• DC 3v to 6v submersible pump
61
3.15 ROBO SETUP
The Robot Car Kit 01 is a kit that can act as a basic framework for a
car/robot. Simply add extra components, such as a power source (rechargeable
battery, batteries) and a controller, such as an Arduino with a motor controller.
Technical data:
• Current when idle: 160 - 200 mA
• Speed when idle: 90 - 300 rpm (10% tolerance)
• Torque: 800 - 1200 gf/cm and min
62
CHAPTER 4
SOFTWARE SPECIFICATION
63
4.3 SOFTWARE OVERVIEW
Board Setup
You have to tell the Arduino IDE what board you are uploading to. Select the
Tools pull down menu and go to Board. This list is populated by default with
the currently available Arduino Boards that are developed by Arduino. If you
are using an Uno or an Uno-Compatible Clone (ex. Funduino, Sain Smart, IEIK,
etc.), select Arduino Uno as shown in below Fig 4.2.
64
Figure 4.2 Arduino IDE: Board Setup Procedure
65
Figure 4.3 Arduino IDE: COM Port Setup
At this point shown in above Fig 4.3, your board should be set up for
programming, and you can begin writing and uploading code.
Uploading Blink
One common procedure to test whether the board you are using is
properly set up is to upload the “Blink” sketch. This sketch is included with all
Arduino IDE releases and can be accessed by the File pull-down menu and going
to Examples, 01. Basics, and then select Blink. Standard Arduino Boards include
a surface-mounted LED labeled “L” or “LED” next to the “RX” and “TX”
LEDs, that is connected to digital pin 13. This sketch will blink the LED at a
regular interval, and is an easy way to confirm if your board is set up properly
and you were successful in uploading code. Open the “Blink” sketch and press
the “Upload” button in the upper-left corner to upload “Blink” to the board as
shown in the below Fig 4.5.
66
Figure 4.4 Arduino IDE: Loading Blink Sketch
67
4.4 STEPS TO WRITE AN ASSEMBLY LANGUAGE
PROGRAM IN ARDUINO IDE AND HOW TO COMPILE IT
68
▪ Double-check that you have the correct board selected in the Tools
menu.
▪ Depending on the size of your program, it may take a few seconds to
upload. If you feel like it is taking too long, it may be encountering an
error and you can try unplugging and plugging in the Arduino board.
69
CHAPTER 5
IMPLEMENTATION
This agriculture robot has two modes one is auto mode another is a
manual mode in manual this set with help of switch button in manual it works
with Bluetooth (HC -05) signals, in auto mode it works with Help of IR sensor
in front of the robot for making a grid pattern seed sowing, In this agriculture
robot project we are using Arduino UNO as motherboard which will control the
robot driving motors and seed dispenser servo. entire project runs on 12V lead-
acid battery
70
to water the field. The sensor data can also be manually updated by the in-app
Refresh button.
Fig. 5.1 Smart phone controlled Agricultural Robot for automatic irrigation system
71
5.2 THE STEPS OF THE IMPLEMENTATION
1. Enter the length
2. Enter the width
3. Select the mode
4. Microcontroller inputs
5. Algorithm executed
Rest once the execution is completed the farmers give the dimensions
of area or field as an input the total travelling area of robot is fixed. Once we
enter the dimensions, robot start working in the field once the robot reaches at
the end then it turns to 1800 degree and start working by using Arduino,
dimensions are taken or entered directly, after entering the dimension, then it
asks the modes and work accordingly.
BENEFITS
Some benefits helpful to farmers: The cost is cheap and it is affordable
to all farmers. It helps to all classes of people specially to helps poor people as
well as middle class people. It is fully autonomous. Farmers are not need to
present in farm land. It runs through battery so it not harms the farm land. It
works faster than the human’s efforts and save time. It is fully an automatic
robot which works on open architecture, does a lot of work in farms it reduces
human labor. The systems observe the different environmental conditions and
takes accordingly which human can’t do accurately.
• Nursery planting
• Crop seeding
• Crop monitoring and analysis
• Fertilizing and irrigation
• Crop weeding and spraying
• Autonomous tractors
• Thinning and pruning
• Picking and harvesting hole on the shaft to digging dirt.
72
CHAPTER 6
CONCLUSION
We concluded from our analysis of reference articles that the farm robot
is capable of performing numerous agricultural chores in the field, but that it
will require some adaptation. So, in this study, a multipurpose farm robot is
presented to perform various agricultural tasks such as plugging, seed sowing,
mud levelling, and water spraying. The projected outcome demonstrates that this
robot is implemented to perform as intended and also provides farmers with a
cost-effective solution. This robot is expected to assist farmers in increasing the
efficiency and accuracy of agricultural operations.
73
designed by European Union named CROPS, USA-ISAAC2 & Michigan-
Hortibot, Australia-AgBot, Finland-Demeter, India-Agribot and many other
countries.
The agricultural robots are designed using different localization
techniques which are vision, GPS, laser and sensor-based navigation control
system. In this paper, comparative study including an overview of Robotics
approach for precision Agriculture in India and worldwide development is
explored.
74
REFERENCES
75
APPENDIX
#include<SoftwareSerial.h>
SoftwareSerial BT (0,1);
String readvoice;
char c;
int motor1 =4;
int motor2 =5;
int motor3 =6;
int motor4 =7;
int r=8;
int ldr=A2;
int gas=A1;
int m=9;
int so=A0;
#include <dht.h>
#define dht_apin A3
// Analog Pin sensor is connected to
dht DHT;
void setup ()
{
Serial.begin(9600);
pinMode (motor1, OUTPUT); pinMode (motor3, OUTPUT);
pinMode (motor2, OUTPUT); pinMode (motor4, OUTPUT);
Serial.println("Welcome user");
Serial.println("waiting for your command");
pinMode (r, OUTPUT);
pinMode (ldr, INPUT);
pinMode (gas, INPUT);
pinMode (m, OUTPUT);
pinMode (so, INPUT);
}
void loop ()
{
while (Serial.available())
{
c = Serial.read();
//Serial.println(c);
if (c =='a')
{
76
if (c =='e')
{
Serial.println("motor is running in m2 high and m1
medium condition");
analogWrite(motor1,0); analogWrite(motor2,0);
analogWrite(motor3,255); analogWrite(motor4,0);
}
if (c =='f')
{
Serial.println("motor is running in m1 high and m2 stop
condition");
analogWrite(motor1,255); analogWrite(motor2,0);
analogWrite(motor3,0); analogWrite(motor4,0);
}
}
if (c =='s')
{
Serial.println("motor is running in m1 high and m2 stop
condition");
analogWrite(motor1,0); analogWrite(motor2,0);
analogWrite(motor3,0); analogWrite(motor4,0);
}
if (c =='k')
{
digital Write (r, HIGH);
}
if (c =='P')
{
analogWrite(m,255); analogWrite(m,0);
}
if (c =='Q')
{
analogWrite(m,150);
}
if (c =='L')
{
analogWrite(m,100);
}
DHT.read11(dht_apin);
Serial. Print ("Current humidity = ");
Serial.println(DHT.humidity);
Serial.print("% “);
delay (1000);
Serial.print("temperature = ");
Serial.print(DHT.temperature);
Serial.println("C “);
delay (1000);
if (DHT.temperature>=40)
{
digital Write (r, HIGH);
}
int I=analogRead(so);
Serial.print("soil value");
Serial.println(I);
delay (1000);
77
if(I>=500)
{
digital Write (r, HIGH);
}
int x=analogRead(gas);
Serial.print("gas value");
Serial.println(x);
delay (1000);
if(x=500)
{
digital Write (r, HIGH);
}
int y=analogRead(ldr);
Serial.print("ldr value");
Serial.println(y);
delay (1000);
if(y>=500)
{
digital Write (r, HIGH);
}
}
78