Anda di halaman 1dari 76

Chapter 1

INTRODUCTION

1.1 Aim of the Thesis


The main objective of Weather monitoring is to provide the information regarding
the weather conditions such that necessary precautions can be taken with reference to
the parameters obtained. Weather monitoring model continuously monitors and
records atmospheric conditions via sensors. Weather is determined by the basic
factors, namely temperature, visibility, humidity and wind. The whole weather
monitoring system is mounted on rover such that parameters at different locations can
be measured.

1.2 Literature survey

Weather conditions are the most important parameters in Agriculture, Solar power
generation, and many other fields of generation. Sun is the major contributor to the
continuously changing climatic conditions. In our Solar System, energy from the sun
creates so many imbalances in the temperature of flowing winds, which move from
place to place creating wet, stormy or even sunny weather. The sea plays a major role
in the regulating effect on the climate, due to which there is an enormous difference in
the temperature and even pressure between the regions of the country and the also
coastal regions. Weather is also affected by the natural dimensions of the earth and its
rotator motion. The renewable energy (Wind and Solar) allows decentralized
distribution of energy, particularly for meeting rural energy needs and empowering
people at the grass root level. In India, where alternative forms of energy are of the
need of the hour, due to ever increasing pollution, industries and population,
identifying places or locations which can generate renewable energy is very much
important. The present existing model used by the Indian Meteorological Department
involves a floating weather monitoring device in a hydrogen balloon at every four
hour intervals. This model is expensive and requires frequent manual efforts and is not
practical for many places in India. Design is remotely operated model with sensors

1
which gathers the weather parameters and transmits the measured values to the control
station.

However weather analysis in local regions has to be done in places within these
states, at which power generation capacity can be LOW or HIGH. We designed and
implemented a low cost and reliable instrumentation system for remote wireless
measurement of weather parameters with the help of various sensors. Based on the
parameter various necessary actions can implemented such that the damage caused
will be low and the productivity increases.

Generally, Weather stations provide the weather conditions information. This


information is based on average conditions of the vast area i.e. districts, cities, states,
and countries. It also gives the estimate of amount of rainfall, storms, cyclones etc.
Some well established organizations have their own mini weather stations within the
limits of their own area and location. Some scale organizations and regular farmers
cannot affords lack about this information and sometimes face the damage which
could be avoided if they have the information.

Our project is solution to above two problems. Our project consist weather
monitoring system on a rover. This is a low cost weather monitoring system handy for
types of organizations.

1.3 NEED FOR WEATHER MONITORING:

India has several geographical advantages for implementation of power plants


based on renewable energy, such as solar and wind energy. The Tropic of Cancer
passes through Indian subcontinent, so the temperature factors very much suitable to
fit the needs of the generation of solar energy. Indian subcontinent is also close to the
Equator which gives it a tropical climate and Monsoons. This type of climate is
featured by strong and regular winds throughout the year across the country. In fact,
temperature conditions are very good at certain states, like Gujarat, Madhya Pradesh,
2
and Chhattisgarh. However, weather analysis in local regions are to be done for places
within these states, to identify naturally cloudy or shadow regions, in which case the
generated power output will be very low.

1.4 DESIGN AND DEVELOPMENT:

We propose a system, which can predict whether a particular place is suitable for
establishing the solar power plant and/or wind power plant, various types of crops. We
designed and implemented a low cost and reliable instrumentation system for remote
wireless measurements of weather, with the help of various sensors. The device is
made as a standalone data acquisition unit, from which data is sent via GSM based
communication to the ground station. A number of power saving mechanisms are
implemented to give maximum battery life for the sensor module.

Whenever the weather conditions are to be detected, a command is sent to the


weather station in the form of an SMS, after which measured values are sent back to
the mobile via SMS. Another advantage of our system is that no command is sent
through the client side, as our system autonomously send a data to ground station
when the weather parameters increases more than the predefined value.

1.5 Technical Approach:

This project is divided into following steps

The objective of this project is to design a wireless weather monitoring rover in which
a microcontroller is interfaced with sensors and GSM module to transmit sensed data
wirelessly.
Analog data from BMP180 is to be fetched and fed to Micro Controller.
Send the measured temperature to user with the help of GSM module (SIM 900) Via
Shot Message Service.

1.6 Project Scope:


3
Weather Monitoring at geographical places where humans can't reach.
Suitability for installation of Solar and Wind Power generation plants can be known
easily.
GSM module sends the values of parameters to the control room.
Warning messages are sent by module when the parameters cross the safe limits.

Chapter 2
HARDWARE and SOFTWARE

HARDWARE

2.1 Arduino:

A microcontroller (MCU) is a small computer on a single integrated


circuit containing a processor core, memory, and programmable input or
output peripherals. Program memory in the form of NOR flash or OTP ROM is also
often included on chip, as well as a typically small amount of RAM. Microcontrollers
are designed for embedded applications, in contrast to the microprocessors used
in personal computers or other general purpose applications.
4
Figure 2.1.1 Arduino

Microcontrollers are used in automatically controlled products and devices,


such as automobile engine control systems, implantable medical devices, remote
controls, office machines, appliances, power tools, toys and other embedded systems.
By reducing the size and cost compared to a design that uses a separate
microprocessor, memory, and input/output devices, microcontrollers make it
economical to digitally control even more devices and processes. Mixed signal
microcontrollers are common, integrating analog components needed to control non-
digital electronic systems.

Some microcontrollers may use four-bit words and operate at clock


rate frequencies as low as 4 kHz, for low power consumption (single-digit milli watts
or microwatts). They will generally have the ability to retain functionality while
waiting for an event such as a button press or other interrupt; power consumption
while sleeping (CPU clock and most peripherals off) may be just nanowatts, making
many of them well suited for long lasting battery applications. Other microcontrollers
may serve performance-critical roles, where they may need to act more like a digital
signal processor (DSP), with higher clock speeds and power consumption.

5
A microcontroller can be considered a self-contained system with a processor,
memory and peripherals and can be used as an embedded system. The majority of
microcontrollers in use today are embedded in other machinery, such as automobiles,
telephones, appliances, and peripherals for computer systems.

Microcontrollers usually contain from several to dozens of general purpose


input/output pins (GPIO). GPIO pins are software configurable to either an input or an
output state. When GPIO pins are configured to an input state, they are often used to
read sensors or external signals. Configured to the output state, GPIO pins can drive
external devices such as LEDs or motors.

2.1.2 Comparison of Microcontroller and Microprocessor:

2.1.2.1 Microcontroller:
1. Microcontroller having inbuilt RAM or ROM and inbuilt timer.
2. Input and output ports are available.
3. Inbuilt serial port.
4. Separate memory to store program and data.
5. Many functions pins on the IC.
6. Boolean operation directly possible.
7. It take few instructions to read and write data from external memory.

2.1.2.2 Microprocessor:
1. Do not have inbuilt RAM or ROM and timer.
2. Input and output ports are not available, requires extra device like 8155
3. Do not have inbuilt serial port, requires 8250 device.
4. Program and data are stored in same memory.
5. Less multifunction pins on IC.
6. Boolean operation is not possible directly.
7. It take many instruction to read and write data from external memory.

Why Arduino?

6
Inexpensive - Arduino boards are relatively inexpensive compared to other
microcontroller platforms. The least expensive version of the Arduino module can be
assembled by hand, and even the pre-assembled Arduino modules cost less than 1000

Cross-platform - The Arduino Software (IDE) runs on Windows, Macintosh OSX,


and Linux operating systems. Most microcontroller systems are limited to Windows

Simple, clear programming environment - The Arduino Software (IDE) is easy-


to- use for beginners, yet flexible enough for advanced users to take advantage of as
well. For teachers, it's conveniently based on the Processing programming
environment, so students learning to program in that environment will be familiar with
how the Arduino IDE works.

Open source and extensible software - The Arduino software is published as open
source tools, available for extension by experienced programmers. The language can
be expanded through C++ libraries, and people wanting to understand the technical
details can make the leap from Arduino to the AVR C programming language on
which it's based. Similarly, you can add AVR-C code directly into your Arduino
programs if you want to.

Open source and extensible hardware - The plans of the Arduino boards are
published under a Creative Commons license, so experienced circuit designers can
make their own version of the module, extending it and improving it. Even relatively
inexperienced users can build the breadboard version of the module in order to
understand how it works and save money.

2.1.3 Power

The Uno board can be powered via the USB connection or with an external power
supply. The power source is selected automatically.

External (non-USB) power can come either from an AC-to-DC adapter (wall-wart)
or battery. The adapter can be connected by plugging a 2.1mm center-positive plug
into the board's power jack. Leads from a battery can be inserted in the GND and Vin
pin headers of the POWER connector.

7
The board can operate on an external supply from 6 to 20 volts. If supplied with
less than 7V, however, the 5V pin may supply less than five volts and the board may
become unstable. If using more than 12V, the voltage regulator may overheat and
damage the board. The recommended range is 7 to 12 volts.

The power pins are as follows:

Vin-The input voltage to the Uno board when it's using an external power source (as
opposed to 5 volts from the USB connection or other regulated power source). You
can supply voltage through this pin, or, if supplying voltage via the power jack, access
it through this pin.

5V-This pin outputs a regulated 5V from the regulator on the board. The board can be
supplied with power either from the DC power jack (7 - 12V), the USB connector
(5V), or the VIN pin of the board (7-12V). Supplying voltage via the 5V or 3.3V pins
bypasses the regulator, and can damage your board. We don't advise it.

3V3- A 3.3 volt supply generated by the on-board regulator. Maximum current draw is
50 mA.

GND- Ground pins.


IOREF- This pin on the Uno board provides the voltage reference with which the
microcontroller operates. A properly configured shield can read the IOREF pin voltage
and select the appropriate power source or enable voltage translators on the outputs to
work with the 5V or 3.3V.

2.1.4 Memory

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

2.1.5 Input and Output

8
Each of the 14 digital pins on the Uno can be used as an input or output,
using pinMode(),digitalWrite(), and digitalRead() functions. They operate at 5 volts.
Each pin can provide or receive 20mA as recommended operating condition and has
an internal pull-up resistor (disconnected by default) of 20-50k ohm. A maximum of
40mA is the value that must not be exceeded on any I/O pin to avoid permanent
damage to the microcontroller.

In addition, some pins have specialized functions:

Serial: 0 (RX) and 1 (TX). Used to receive (RX) and transmit (TX) TTL serial data.
These pins are connected to the corresponding pins of the ATmega8U2 USB-to-TTL
Serial chip.
External Interrupts: 2 and 3. These pins can be configured to trigger an interrupt on a
low value, a rising or falling edge, or a change in value. See the attachInterrupt()
function for details.

PWM: 3, 5, 6, 9, 10, and 11. Provide 8-bit PWM output with the analogWrite()
function.

SPI: 10 (SS), 11 (MOSI), 12 (MISO), 13 (SCK). These pins support SPI


communication using the SPI library.

LED: 13. There is a built-in LED driven by digital pin 13. When the pin is HIGH
value, the LED is on, when the pin is LOW, it's off.

TWI: A4 or SDA pin and A5 or SCL pin. Support TWI communication using the
Wire library.

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

AREF. Reference voltage for the analog inputs. Used with analogReference().

9
Reset. Bring this line LOW to reset the microcontroller. Typically used to add a reset
button to shields which block the one on the board.

2.1.6 Communication

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

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

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

2.2 GSM MODULE

2.2.1 DEFINITION OF GSM:

GSM (Global System for Mobile communications) is an open, digital cellular


technology used for transmitting mobile voice and data services. GSM (Global System
for Mobile communication) is a digital mobile telephone system that is widely used in
Europe and other parts of the world. GSM uses a variation of Time Division Multiple
Access (TDMA) and is the most widely used of the three digital wireless telephone

10
technologies (TDMA, GSM, and CDMA). GSM digitizes and compresses data, then
sends it down a channel with two other streams of user data, each in its own time slot.
It operates at either the 900 MHz or 1,800 MHz frequency band. It supports voice calls
and data transfer speeds of up to 9.6 kbit/s, together with the transmission of SMS
(Short Message Service).

2.2.2 GSM FREQUENCIES:

GSM networks operate in a number of different frequency ranges (separated into


GSM frequency ranges for 2G and UMTS frequency bands for 3G). Most 2G GSM
networks operate in the 900 MHz or 1800 MHz bands. Some countries in the
Americas (including Canada and the United States) use the 850 MHz and 1900 MHz
bands because the 900 and 1800 MHz frequency bands were already allocated. Most
3G GSM networks in Europe operate in the 2100 MHz frequency band. The rarer 400
and 450 MHz frequency bands are assigned in some countries where these frequencies
were previously used for first-generation systems.

GSM-900 uses 890915 MHz to send information from the mobile station to the
base station (uplink) and 935960 MHz for the other direction (downlink), providing
124 RF channels (channel numbers 1 to 124) spaced at 200 kHz. Duplex spacing of 45
MHz is used. In some countries the GSM-900 band has been extended to cover a
larger frequency range. This 'extended GSM', E-GSM, uses 880915 MHz (uplink)
and 925960 MHz (downlink), adding 50 channels (channel numbers 975 to 1023 and
0) to the original GSM-900 band.

Time division multiplexing is used to allow eight full-rate or sixteen half-rate


speech channels per radio frequency channel. There are eight radio timeslots (giving
eight burst periods) grouped into what is called a TDMA frame. Half rate channels use
alternate frames in the same timeslot. The channel data rate for all 8 channels is
170.833 Kbit/s, and the frame duration is 4.615 ms.

The transmission power in the handset is limited to a maximum of 2 watts in


GSM850/900 and 1 watt in GSM1800/1900. GSM operates in the 900MHz and
1.8GHz bands in Europe and the 1.9GHz and 850MHz bands in the US. The 850MHz

11
band is also used for GSM and 3G in Australia, Canada and many South American
countries. By having harmonized spectrum across most of the globe, GSMs
international roaming capability allows users to access the same services when
travelling abroad as at home. This gives consumers seamless and same number
connectivity in more than 118 countries.

Terrestrial GSM networks now cover more than 80% of the worlds population.
GSM satellite roaming has also extended service access to where terrestrial coverage
is not available.

2.2.3 MOBILE TELEPHONY STANDARDS:

Table 2.2.1 Telephony standards

2.2.4 ARCHITECTURE OF THE GSM NETWORK:

In a GSM network, the user terminal is called a mobile station. A mobile station is
made up of a SIM (Subscriber Identity Module) card allowing the user to be uniquely
identified and a mobile terminal. The terminals (devices) are identified by a unique
15-digit identification number called IMEI (International Mobile Equipment Identity).
Each SIM card also has a unique (and secret) identification number called
IMSI (International Mobile Subscriber Identity). This code can be protected using a 4-
digit key called a PIN code.

The SIM card therefore allows each user to be identified independently of the
terminal used during communication with a base station. Communications occur
through a radio link (air interface) between a mobile station and a base station.

12
Figure 2.2.1 GSM architecture

All the base stations of a cellular network are connected to a base station
controller (BSC) which is responsible for managing distribution of the resources. The
system consisting of the base station controller and its connected base stations is called
the Base Station Subsystem (BSS).

Finally, the base station controllers are themselves physically connected to


the Mobile Switching Centre (MSC), managed by the telephone network operator,
which connects them to the public telephone network and the Internet. The MSC
belongs to a Network Station Subsystem (NSS), which is responsible for managing
user identities, their location and establishment of communications with other
subscribers.

The MSC is generally connected to databases that provide additional functions:

13
The Home Location Register (HLR) is a database containing information
(geographic position, administrative information etc.) of the subscribers registered in
the area of the switch (MSC).
The Visitor Location Register (VLR) is a database containing information of users
other than the local subscribers.
The VLR retrieves the data of a new user from the HLR of the user's subscriber zone.
The data is maintained as long as the user is in the zone and is deleted when the user
leaves or after a long period of inactivity (terminal off).
The Equipment Identify Register (EIR) is a database listing the mobile terminals.
The Authentication Centre (AUC) is responsible for verifying user identities.
The cellular network formed in this way is designed to support mobility via
management of handovers (movements from one cell to another).

Finally, GSM networks support the concept of roaming i.e., movement from one
operator network to another.

2.2.5 GSM MODEM:

A GSM modem is a wireless modem that works with a GSM wireless network. A
wireless modem behaves like a dial-up modem. The main difference between them is
that a dial-up modem sends and receives data through a fixed telephone line while a
wireless modem sends and receives data through radio waves.

14
Figure 2.2.2 GSM Modem

A GSM modem can be an external device or a PC Card / PCMCIA Card. Typically,


an external GSM modem is connected to a computer through a serial cable or a USB
cable. A GSM modem in the form of a PC Card / PCMCIA Card is designed for use
with a laptop computer. It should be inserted into one of the PC Card / PCMCIA Card
slots of a laptop computer. Like a GSM mobile phone, a GSM modem requires a SIM
card from a wireless carrier in order to operate.

A SIM card contains the following information:

Subscriber telephone number (MSISDN)

International subscriber number (IMSI, International Mobile Subscriber Identity)

State of the SIM card

Service code (operator)

Authentication key

PIN (Personal Identification Code)

PUK (Personal Unlock Code)

15
Computers use AT commands to control modems. Both GSM modems and dial-up
modems support a common set of standard AT commands. In addition to the standard
AT commands, GSM modems support an extended set of AT commands. These
extended AT commands are defined in the GSM standards. With the extended AT
commands, the following operations can be performed:

Reading, writing and deleting SMS messages.

Sending SMS messages.

Monitoring the signal strength.

Monitoring the charging status and charge level of the battery.

Reading, writing and searching phone book entries.

The number of SMS messages that can be processed by a GSM modem per minute
is very low i.e., about 6 to 10 SMS messages per minute.

2.2.6 INTRODUCTION TO AT COMMANDS

AT commands are instructions used to control a modem. AT is the abbreviation of


ATtention. Every command line starts with "AT" or "at". That's the reason, modem
commands are called AT commands. Many of the commands that are used to control
wired dial-up modems, such as ATD (Dial), ATA (Answer), ATH (Hook control) and
ATO (Return to online data state) are also supported by GSM modems and mobile
phones.

Besides this common AT command set, GSM modems and mobile phones support
an AT command set that is specific to the GSM technology, which includes SMS-
related commands like AT+CMGS (Send SMS message), AT+CMSS (Send SMS
message from storage), AT+CMGL (List SMS messages) and AT+CMGR (Read SMS
messages).

16
It should be noted that the starting "AT" is the prefix that informs the modem about
the start of a command line. It is not part of the AT command name. For example, D is
the actual AT command name in ATD and +CMGS is the actual AT command name in
AT+CMGS.

Some of the tasks that can be done using AT commands with a GSM modem or
mobile phone are listed below:

Get basic information about the mobile phone or GSM modem. For example, name of
manufacturer (AT+CGMI), model number (AT+CGMM), IMEI number (International
Mobile Equipment Identity) (AT+CGSN) and software version (AT+CGMR).

Get basic information about the subscriber. For example, MSISDN (AT+CNUM) and
IMSI number (International Mobile Subscriber Identity) (AT+CIMI).

Get the current status of the mobile phone or GSM/GPRS modem. For example,
mobile phone activity status (AT+CPAS), mobile network registration status
(AT+CREG), radio signal strength (AT+CSQ), battery charge level and battery
charging status (AT+CBC).

Establish a data connection or voice connection to a remote modem (ATD, ATA, etc).

Send and receive fax (ATD, ATA, AT+F*).

Send (AT+CMGS, AT+CMSS), read (AT+CMGR, AT+CMGL), write (AT+CMGW)


or delete (AT+CMGD) SMS messages and obtain notifications of newly received
SMS messages (AT+CNMI).

Read (AT+CPBR), write (AT+CPBW) or search (AT+CPBF) phonebook entries.

Perform security-related tasks, such as opening or closing facility locks (AT+CLCK),


checking whether a facility is locked (AT+CLCK) and changing passwords
(AT+CPWD). (Facility lock examples: SIM lock [a password must be given to the
SIM card every time the mobile phone is switched on] and PH-SIM lock [a certain

17
SIM card is associated with the mobile phone. To use other SIM cards with the mobile
phone, a password must be entered.])

Control the presentation of result codes / error messages of AT commands. For


example, the user can control whether to enable certain error messages (AT+CMEE)
and whether error messages should be displayed in numeric format or verbose format
(AT+CMEE=1 or AT+CMEE=2).

Get or change the configurations of the mobile phone or GSM/GPRS modem. For
example, change the GSM network (AT+COPS), bearer service type (AT+CBST),
radio link protocol parameters (AT+CRLP), SMS center address (AT+CSCA) and
storage of SMS messages (AT+CPMS).

Save and restore configurations of the mobile phone or GSM/GPRS modem. For
example, save (AT+CSAS) and restore (AT+CRES) settings related to SMS messaging
such as the SMS center address.

It should be noted that the mobile phone manufacturers usually do not implement
all AT commands, command parameters and parameter values in their mobile phones.
Also, the behavior of the implemented AT commands may be different from that
defined in the standard. In general, GSM modems, designed for wireless applications,
have better support of AT commands than ordinary mobile phones.

2.3 GPS Module

2.3.1 Definition of GPS

The Global Positioning System (GPS) is a space-based navigation system that


provides location and time information in all weather conditions, anywhere on or near
the Earth where there is an unobstructed line of sight to four or more GPS satellites.[1]
The system provides critical capabilities to military, civil, and commercial users around
the world. The United States government created the system, maintains it, and makes it
freely accessible to anyone with a GPS receiver.

18
The US began the GPS project in 1973 to overcome the limitations of previous
navigation systems,[2] integrating ideas from several predecessors, including a number
of classified engineering design studies from the 1960s. The U.S. Department of
Defense (DoD) developed the system, which originally used 24 satellites. It became
fully operational in 1995. Roger L. Easton, Ivan A. Getting and Bradford Parkinson are
credited with inventing it.

Advances in technology and new demands on the existing system have now led to
efforts to modernize the GPS and implement the next generation of GPS Block IIIA
satellites and Next Generation Operational Control System (OCX).[3] Announcements
from Vice President Al Gore and the White House in 1998 initiated these changes. In
2000, the U.S. Congress authorized the modernization effort, GPS III. India's NAVIC
Indian Regional Navigation Satellite System was completed in 2016. In addition to
GPS, other systems are in use or under development. The Russian Global Navigation
Satellite System (GLONASS) was developed contemporaneously with GPS, but
suffered from incomplete coverage of the globe until the mid-2000s.[4] There are also
the planned European Union Galileo positioning system, China's BeiDou Navigation
Satellite System and the Japanese Quasi-Zenith Satellite System.

2.3.2 SOME GPS APPLICATIONS

AGRICULTURE

MILITARY

MARITIME

AUTOMOTIVE

SURVEYING

AVIATION

FORESTRY

ENVIRONMENTAL
19
PUBLIC SAFETY

Mapping Software

HIKING

HUNTING

NATURE STUDY

FISHING

GEOCACHING etc.

2.3.3 NEO-6M -0-001 GPS Module

Figure 2.3.1 GPS Module

Overview

The NEO-6 module series is a family of stand-alone GPS receivers featuring the
high performance u-blox 6 positioning engine. These flexible and cost effective
receivers offer numerous connectivity options in a miniature 16 x 12.2 x 2.4 mm

20
package. Their compact architecture and power and memory options make NEO-6
modules ideal for battery operated mobile devices with very strict cost and space
constraints. The 50-channel u-blox 6 positioning engine boasts a Time-To-First-Fix
(TTFF) of under 1 second. The dedicated acquisition engine, with 2 million correlators,
is capable of massive parallel time/frequency space searches, enabling it to find
satellites instantly. Innovative design and technology suppresses jamming sources and
mitigates multipath effects, giving NEO-6 GPS receivers excellent navigation
performance even in the most challenging environments.

2.3.4 Pin Description

GPS pin MBED pin Bambino 210E pin

VCC Vout 3.3V

RX P13 UART0_TX

TX P14 UART0_RX

GND GND GND

Table 2.3.1 GPS Pin description

2.4 BH1750- Ambient Light Sensor

21
2.4.1 Description

BH1750FVI is an digital Ambient Light Sensor IC for I2C bus interface. This IC is
the most suitable to obtain the ambient light data for adjusting LCD and Keypad
backlight power of Mobile phone. It is possible to detect wide range at High
resolution.( 1 - 65535 lx ).

Figure 2.4.1 BH1750

2.4.2 Features

I2C bus Interface ( f / s Mode Support )


Spectral responsibility is approximately human eye response
Illuminance to Digital Converter
Wide range and High resolution. ( 1 - 65535 lx )
Low Current by power down function
50Hz / 60Hz Light noise reject-function
1.8V Logic input interface
No need any external parts
Light source dependency is little. ( ex. Incandescent Lamp. Fluorescent Lamp,
Halogen Lamp, White LED, Sun Light )
It is possible to select 2 type of I2C slave-address.
Adjustable measurement result for influence of optical window.
Small measurement variation (+/- 20%)
The influence of infrared is very small.

22
2.4.3 Absolute Maximum ratings

Table 2.4.1 Bh1750 Maximum ratings

2.4.4 Operating Conditions

Table 2.4.2 BH1750 Operating conditions

2.4.5 Block Diagram

23
Figure 2.4.2 BH1750 Block diagram

2.4.5 Block Diagram Descriptions

PD- Photo diode with approximately human eye response.

AMP Integration- OPAMP for converting from PD current to Voltage.

ADC- AD converter for obtainment Digital 16bit data.

Logic - I2C Interface

Ambient Light Calculation and I2C BUS Interface. It is including below register.

Data Register This is for registration of Ambient Light Data. Initial Value is
"0000_0000_0000_0000".

Measurement Time Register This is for registration of measurement time. Initial


Value is "0100_0101".

OSC- Internal Oscillator ( typ. 320kHz ). It is CLK for internal logic.

2.4.6 Measurement Procedure

24
Figure 2.4.3 BH750 measurement procedure

2.5 BMP180 - Digital Barometric Pressure Senor

2.5.1 Description:

The BMP180 is the new digital barometric pressure sensor of Bosch Sensortec,
with a very high performance, which enables applications in advanced mobile devices,
such as smart phones, tablet PCs and sports devices. It follows the BMP085 and brings
many improvements, like the smaller size and the expansion of digital interfaces.

Figure 2.5.1 BMP180


25
The BMP180 is based on piezo-resistive technology for EMC robustness, high
accuracy and linearity as well as long term stability. The ultra-low power consumption
down to 3 A makes the BMP180 the leader in power saving for your mobile devices.
BMP180 is also distinguished by its very stable behaviour (performance) with regard
to the independency of the supply voltage.

2.5.2 Key features

Pressure range: 300 ... 1100hPa

Supply voltage: 1.8 ... 3.6V (VDD)


1.62V ... 3.6V (VDDIO)

Package: LGA package with metal lid

Small footprint: 3.6mm x 3.8mm

Super-flat: 0.93mm height

Low power: 5A at 1 sample / sec. in


standard mode

Low noise: 0.06hPa (0.5m) in ultra low power


mode0.02hPa (0.17m) advanced
resolution mode

Table 2.5.1 BMP180 Key features

Temperature measurement included


I2C interface
Fully calibrated
Pb-free, halogen-free and RoHS compliant,
MSL 1

2.5.3 Operation

2.5.4 General description

The BMP180 is designed to be connected directly to a microcontroller of a mobile


device via the I2C bus. The pressure and temperature data has to be compensated by
the calibration data of the E2PROM of the BMP180.

26
2.5.5 General function and application schematics

The BMP180 consists of a piezo-resistive sensor, an analog to digital converter and


a control unit with E2PROM and a serial I2C interface. The BMP180 delivers the
uncompensated value of pressure and temperature. The E2PROM has stored 176 bit of
individual calibration data. This is used to compensate offset, temperature dependence
and other parameters of the sensor.

UP = pressure data (16 to 19 bit)

UT = temperature data (16 bit)

2.5.6 Measurement of pressure and temperature

For all calculations presented here an ANSI C code is available from Bosch
Sensortec (BMP180 _API). The microcontroller sends a start sequence to start a
pressure or temperature measurement. After converting time, the result value (UP or
UT, respectively) can be read via the I2C interface. For calculating temperature in C
and pressure in hPa, the calibration data has to be used. These constants can be read
out from the BMP180 E2PROM via the I2C interface at software initialization. The
sampling rate can be increased up to 128 samples per second (standard mode) for
dynamic measurement. In this case, it is sufficient to measure the temperature only
once per second and to use this value for all pressure measurements during the same
period.

27
Figure 2.5.2 Measurement flow BMP180

2.5.7 Typical applications

Enhancement of GPS navigation (dead-reckoning, slope detection, etc.)


In- and out-door navigation
Leisure and sports
Weather forecas

2.6 DHT 11 Humidity Sensor

2.6.1 Introduction

28
This DHT11 Temperature & Humidity Sensor features a temperature & humidity
sensor complex with a calibrated digital signal output. By using the exclusive digital-
signal-acquisition technique and temperature & humidity sensing technology, it
ensures high reliability and excellent long-term stability. This sensor includes a
resistive-type humidity measurement component and an NTC temperature
measurement component, and connects to a high performance 8-bit microcontroller,
offering excellent quality, fast response, anti-interference ability and cost-
effectiveness.

Figure 2.6.1 DHT11

Each DHT11 element is strictly calibrated in the laboratory that is extremely accurate
on humidity calibration. The calibration coefficients are stored as programmes in the
OTP memory, which are used by the sensors internal signal detecting process. The
single-wire serial interface makes system integration quick and easy. Its small size,
low power consumption and up-to-20 meter signal transmission making it the best
choice for various applications, including those most demanding ones. The component
is 4-pin single row pin package. It is convenient to connect and special packages can
be provided according to users request.

2.6.2 Overview:

29
Table 2.6.1 Overview

2.6.3 Interfacing

Figure 2.6.2 DHT11 Interfacing

2.6.4 Technical Specifications:

30
Table 2.6.2 DHT Technical specifications

When the connecting cable is shorter than 20 metres, a 5K pull-up resistor is


recommended; when the connecting cable is longer than 20 metres, choose a appropriate
pull-up resistor as needed.

2.6.5 Power and Pin

DHT11s power supply is 3-5.5V DC. When power is supplied to the sensor, do not
send any instruction to the sensor in within one second in order to pass the unstable
status. One capacitor valued 100nF can be added between VDD and GND for power
filtering.

31
2.6.6 Communication Process: Serial Interface (Single-Wire Two-Way)

Single-bus data format is used for communication and synchronization between


MCU and DHT11 sensor. One communication process is about ms.

Data consists of decimal and integral parts. A complete data transmission is 40bit,
and the sensor sends higher data bit first.

Data format: 8bit integral RH data + 8bit decimal RH data + 8bit integral T data +
8bit decimal T data + 8bit check sum. If the data transmission is right, the check-sum
should be the last 8bit of "8bit integral RH data + 8bit decimal RH data + 8bit integral
T data + 8bit decimal T data".

2.6.7 Overall Communication Process

When MCU sends a start signal, DHT11 changes from the low-power-consumption
mode to the running-mode, waiting for MCU completing the start signal. Once it is
completed, DHT11 sends a response signal of 40-bit data that include the relative
humidity and temperature information to MCU. Users can choose to collect (read)
some data. Without the start signal from MCU, DHT11 will not give the response
signal to MCU. Once data is collected, DHT11 will change to the lowpower-
consumption mode until it receives a start signal from MCU again.

2.6.8 MCU Sends out Start Signal to DHT

Data Single-bus free status is at high voltage level. When the communication
between MCU and DHT11 begins, the programme of MCU will set Data Single-bus
voltage level from high to low and this process must take at least 18ms to ensure
DHTs detection of MCU's signal, then MCU will pull up voltage and wait 20-40us
for DHTs response.

32
2.6.9 DHT Responses to MCU

Once DHT detects the start signal, it will send out a low-voltage-level response
signal, which lasts 80us. Then the programme of DHT sets Data Single-bus voltage
level from low to high and keeps it for 80us for DHTs preparation for sending data.

When DATA Single-Bus is at the low voltage level, this means that DHT is sending
the response signal. Once DHT sent out the response signal, it pulls up voltage and
keeps it for 80us and prepares for data transmission.

When DHT is sending data to MCU, every bit of data begins with the 50us low-
voltage-level and the length of the following high-voltage-level signal determines
whether data bit is "0" or "1"

If the response signal from DHT is always at high-voltage-level, it suggests that


DHT is not responding properly and please check the connection. When the last bit
data is transmitted, DHT11 pulls down the voltage level and keeps it for 50us. Then
the Single-Bus voltage will be pulled up by the resistor to set it back to the free status.

2.6.10 Electrical Characteristics

VDD=5V, T = 25 (unless otherwise stated)

Table 2.6.3 Electrical characteristics of DHT11

Note: Sampling period at intervals should be no less than 1 second.

Operating conditions

33
Applying the DHT11 sensor beyond its working range stated in this datasheet can
result in 3%RH signal shift/discrepancy. The DHT11 sensor can recover to the
calibrated status gradually when it gets back to the normal operating condition and
works within its range. Please refer to (3) of this section to accelerate its recovery.
Please be aware that operating the DHT11 sensor in the non-normal working
conditions will accelerate sensors aging process.
Attention to chemical materials
Vapour from chemical materials may interfere with DHTs sensitive-elements and
debase its sensitivity. A high degree of chemical contamination can permanently
damage the sensor.
Temperature Affect
Relative humidity largely depends on temperature. Although temperature
compensation technology is used to ensure accurate measurement of RH, it is still
strongly advised to keep the humidity and temperature sensors working under the
same temperature. DHT11 should be mounted at the place as far as possible from parts
that may generate heat. Long time exposure to strong sunlight and ultraviolet may
debase DHTs performance.

2.7 MOISTURE SENSOR:

Figure 2.7.1 Moisture sensor


34
2.8 ULTRASONIC SENSOR:

2.8.1 Description

The term ultrasonic applied to sound refers to anything above the frequencies of
audible sound, and nominally includes anything over 20,000 Hz.

Figure 2.8.1 Ultrasonic sensor

2.8.2Working:

Ultrasonic sensors are based on the measurement of the properties of acoustic waves
with frequencies above the human audible range, often at roughly 40 kHz 1). They
typically operate by generating a high-frequency pulse of sound, and then receiving
and evaluating the properties of the echo pulse.

Three different properties of the received echo pulse may be evaluated, for different
sensing purposes. They are:

Time of flight (for sensing distance)

Doppler shift (for sensing velocity)

Amplitude attenuation (for sensing distance, directionality, or attenuation coefficient)

35
2.8.2 Modes of Operation:

2.8.2.1 Reflection Mode

In reflection mode (also known as echo ranging), an ultrasonic transmitter emits a


short burst of sound in a particular direction. The pulse bounces off a target and
returns to the receiver after a time interval t. The receiver records the length of this
time interval, and calculates the distance travelled r based on the speed of sound c:

r = c * t2)

Very often, separate transmitting and receiving transducers are placed immediately
next to each other, housed as a single unit. (The PING))) Range Finder, Omega
flowmeter and Migatron high-accuracy sensor below are all designed this way.) In
these cases,the distance calculated will be twice the distance from the sensor to the
target.

Using proper coordination, a single transducer can be used for both emitting the pulse
and receiving the echo. Note that it takes time for the transducer to change modes,
presenting a challenge to short-distance measurement.

2.8.2.2 Direct Measurement Mode

In this mode of operation the transmitter and receiver are two separate units that move
relative to each other. For example, the receiver can be fixed to a target that moves
relative to a stationary transmitter, or vice-versa. Multiple transmitters can be used to
increase the directionality of the transmitted pulse.placed multiple ultrasonic
transmitters on a performer, whose signals were received by multiple receivers in the
performance space, enabling a computer program to triangulate the performer
position.

2.8.2.3 Doppler Shift

When a wave reflects off of a moving object, its frequency is shifted by an amount
proportional to the velocity of the object. This fact can be exploited in ultrasonic
sensing by having the receiver measure not the time of flight but the frequency of the
36
returning echo pulse. Knowing fe and fr, the frequency of the emitted and received
pulse, respectively, the velocity v of the target may be calculated:

fe - fr = 2 fe (v / c) cos(A)

where A is the angle between the target's and the pulse's lines of motion.

Figure 2.8.2 Ultrasonic measuring mode

2.8.2.4 Amplitude Attenuation

Ultrasonic sound attenuates much faster than audible sound when propagating through
air. By measuring the intensity of the returning pulse, an estimate of the distance
travelled can be made using the following equation:

I = I0e-ax

where I and I0 are the received and the original intensities, respectively, and where
a is the attenuation coefficient (a property of the medium) and x is the distance
travelled by the wave. Attenuation may also be caused by an increased angle between
the target and receiver, which may even deflect the echo somewhere else and not be
heard at all.

In our project we used time of flight reflection type of ultrasonic sensors. When the
triggered signal is given to the ultrasonic transmitter, it transmits a burst of sound
waves of 40KHz frequency and waits for the signal to come back after hitting an

37
obstacle. It estimates the time taken for the signal to come back and from that the
distance of the obstacle from the sensor can be estimated.

2.8.3 Specifications

Working Voltage DC 5 V

Working Frequency 40Hz

Max Range 4m

Min Range 2cm

MeasuringAngle 15 degree

Trigger Input Signal 10uS TTL pulse

Table 2.8.1 Ultrasonic sensor specifications

2.8.4 Interfacing the sensor to the Arduino:

An ultrasonic sensor has 4 pins

Vcc, Gnd, Triggger, Echo

Connect +5v to Vcc and ground the Gnd terminal.

Connect the trigger and the echo pins to any two digital pins of the arduino uno board.

38
Figure 2.8.3 Ultrasonic interfacing

2.9 Servo motor

2.9.1 Description

A servo motor is an electrical device which can push or rotate an object with great
precision. If you want to rotate and object at some specific angles or distance, then you use
servo motor. It is just made up of simple motor which run through servo mechanism. If
motor is used is DC powered then it is called DC servo motor, and if it is AC powered motor
then it is called AC servo motor. We can get a very high torque servo motor in a small and
light weight packages. Doe to these features they are being used in many applications like
toy car, RC helicopters and planes, Robotics, Machine etc

Figure 2.9.1 Servo

2.9.2 Features
39
Holds any position between 0 and 180 degrees

38 oz-in torque at 6 VDC

Accepts four mounting screws

Easy to interface with any Parallax microcontroller

PWM-capable device

Simple to control with the PULSOUT command

PBASIC High-precision gear made of POM (polyacetal) resin

makes for smooth operation with no backlash Weighs only 1.55 oz (44g)

2.9.3 Key Specifications

Power requirements: 4 to 6 VDC

Maximum current draw is 140 +/- 50 mA at 6 VDC when operating in no load conditions,
15 mA when in static state Communication:

Pulse-width modulation, 0.752.25 ms high pulse, 20 ms intervals

Dimensions approx 2.2 x 0.8 x 1.6 in (5.58 x 1.9 x 40.6 cm) excluding servo horn

Figure 2.9.2 Servo interfacing

40
2.9.5 Operating temperature range: 14 to 122 F (-10 to +50 C)

*Power Requirement Notes The manufacturer specifies 4-6 VDC for this servo.

However, we find that this servo is tolerant of a 9 V battery for very brief periods of time
when there is no load, as used in some activities in the Stamps in Class series of tutorials.
(Slight jittering may be observed when batteries are fresh; this does not cause damage). Do
not use this servo with an unregulated wall-mount supply, or a regulated wall mount supply
exceeding 6 VDC. Servo current draw can spike while under load. Be sure that your
application's power supply and voltage regulator is prepared to supply adequate current for
all servos used. Do not try to power this servo directly from a BASIC Stamp module's or
any microcontrollers Vdd or Vin pins; do not connect the servo's Vss line directly to the
BASIC Stamp module's or any microcontrollers Vss pin.

2.9.6 Specifications

Pin Name Description Minimum Typical Maximum Units

1 Signal Input TTL or CMOS 3.3 5.0 Vservo V

2 Vservo Power Supply 4.0 5.0 6.0 V

3 Vss Ground 0 V

Table-2.9.1 Servo Specifications

Power Precautions

41
Do not use this servo with an unregulated wall-mount supply. Such power supplies may
deliver variable voltage far above the stated voltage. Do not power this servo through the
BASIC Stamp Module's Vdd pin. Servo current draw can spike while under peak load; be
sure your application's regulator is prepared to supply adequate current for all servos used
in combination. Some Stamps in Class tutorials, such as What's a Microcontroller? instruct
the user to briefly power these servos with a 9 V battery when using a HomeWork Board
and no load; this does not cause damage.

Communication Protocol The Parallax Standard Servo is controlled through pulse width
modulation, where the position of the servo shaft is dependent on the duration of the pulse.
In order to hold its position, the servo needs to receive a pulse every 20 ms. Below is a
sample timing diagram for the center position of the Parallax Standard Servo.

2.10 DC Motor:

A DC motor is any of a class of electrical machines that converts direct current electrical
power into mechanical power. The most common types rely on the forces produced by
magnetic fields. Nearly all types of DC motors have some internal mechanism, either
electromechanical or electronic, to periodically change the direction of current flow in part
of the motor. Most types produce rotary motion; a linear motor directly produces force and
motion in a straight line.

DC motors were the first type widely used, since they could be powered from existing
direct-current lighting power distribution systems. A DC motor's speed can be controlled
over a wide range, using either a variable supply voltage or by changing the strength of
current in its field windings. Small DC motors are used in tools, toys, and appliances.
The universal motor can operate on direct current but is a lightweight motor used for
portable power tools and appliances. Larger DC motors are used in propulsion of electric
vehicles, elevator and hoists, or in drives for steel rolling mills. The advent of power
electronics has made replacement of DC motors with AC motors possible in many
applications.

42
Figure 2.10.1 DC motor

2.11 SPDT RELAYS:

2.11.1 Description

A relay is an electrically operated switch. Many relays use an electromagnet to


mechanically operate a switch. A simple electromagnetic relay consists of a coil of
wire wrapped around a soft iron core, an iron yoke which provides a low reluctance
path for magnetic flux, a movable iron armature, and one or more sets of contacts
(there are two in the relay pictured). The armature is hinged to the yoke and
mechanically linked to one or more sets of moving contacts. It is held in place by a
spring so that when the relay is de-energized there is an air gap in the magnetic circuit.
In this condition, one of the two sets of contacts in the relay pictured is closed, and the
other set is open. Other relays may have more or fewer sets of contacts depending on
their function. The relay in the picture also has a wire connecting the armature to the
yoke. This ensures continuity of the circuit between the moving contacts on the
armature, and the circuit track on the printed circuit board (PCB) via the yoke, which
is soldered to the PCB.

43
Figure 2.11.1 Relay

When an electric current is passed through the coil it generates a magnetic field that
activates the armature and the consequent movement of the movable contact either
makes or breaks (depending upon construction) a connection with a fixed contact. If
the set of contacts was closed when the relay was de-energized, then the movement
opens the contacts and breaks the connection, and vice versa if the contacts were open.
When the current to the coil is switched off, the armature is returned by a force,
approximately half as strong as the magnetic force, to its relaxed position. Usually this
force is provided by a spring.

Figure 2.11.2 Relay internal diagram

44
2.12 ULN2003:

2.12.1 Description:

ULN2003 is a high voltage and high current Darlington array IC. It contains seven
open collector darlington pairs with common emitters. A darlington pair is an
arrangement of two bipolar transistors.

The schematic for each driver is given below:

Figure 2.12.1 Internal circuit of ULN2003

Figure 2.12.2 Pin diagram of ULN2003


45
2.12.2 Working:

Each channel or darling ton pair in ULN2003 is rated at 500mA and can
withstand peak current of 600mA. The inputs and outputs are provided opposite to
each other in the pin layout. Each driver also contains a suppression diode to dissipate
voltage spikes while driving inductive loads.

2.12.3 Advantages:

ULN2003 belongs to the family of ULN200X series of ICs. Different versions


of this family interface to different logic families. ULN2003 is for 5V TTL, CMOS
logic devices. These ICs are used when driving a wide range of loads and are used as
relay drivers, display drivers, line drivers etc. ULN2003 is also commonly used while
driving Stepper Motors. Refer Stepper Motor interfacing using ULN2003.

2.13 IC 7805

2.13.1 Description

7805 is a voltage regulator integrated circuit. It is a member of 78xx series of fixed


linear voltage regulator ICs. The voltage source in a circuit may have fluctuations and
would not give the fixed voltage output. The voltage regulator IC maintains the output
voltage at a constant value. The xx in 78xx indicates the fixed output voltage it is
designed to provide. 7805 provides +5V regulated power supply. Capacitors of
suitable values can be connected at input and output pins depending upon the
respective voltage level.

Figure 2.13.1 7805


46
2.14 BATTERY (Twelve Volts):

2.14.1 Description

As dual regulated power supply is not portable, we generally use D.C. batteries. In
our project we used twelve volts battery. The most common form of twelve-volt
battery is commonly called the transistor battery which was introduced for the early
transistor radios. Lead Acid batteries have changed little since the 1880's although
improvements in materials and manufacturing methods continue to bring
improvements in energy density, life and reliability. All lead acid batteries consist of
flat lead plates immersed in a pool of electrolyte. Regular water addition is required
for most types of lead acid batteries although low-maintenance types come with
excess electrolyte calculated to compensate for water loss during a normal lifetime.

Figure 2.14.1 12V Battery

2.15 PCB Manufacturing process

PCB - The Evolution of the Production Process

Eventually processes were developed that would plate copper onto the walls of the drilled
holes. That allowed circuits on both sides of the board to be connected electrically. Copper
had replaced brass as the metal of choice because of its ability to carry electrical current,
relatively low cost and ease of manufacturing. In 1956 the US Patent Office issued a patent
for the "Process of Assembling Electrical Circuits" that was sought by a small group of

47
scientists represented by the US Army. The patented process involved using a base material
like melamine to which a layer of copper foil had been securely laminated. A drawing was
made of the wiring pattern and then photographed onto a zinc plate. The plate was used to
create a printing plate for an offset printing press. An acid resistant ink was printed onto the
copper foil side of the board that was etched to remove the exposed copper leaving the
"printed wire" behind. Other methods like using stencils, screening, hand printing and rubber
stamping were also proposed to deposit the ink pattern. Holes were then punched in patterns
using dies to match the position of the component wire leads or terminals. The leads were
inserted through the non-plated holes in the laminate material and then the card was dipped
or floated on a bath of molten solder. The solder would coat the traces as well as connecting
the leads of the components to the traces.

They also used tinned eyelets, rivets and washers to attach various types of components to
the board. Their patent even has a drawing showing two single sided boards stacked on top
of each other with a standoff holding them apart. There are components on the top side of
each board and one component shown with its leads extending through the top board into
holes on the bottom board, connecting them together, a rough attempt at making the first
multi-layer.

Much has changed since then. With the advent of plating processes that allowed hole
walls to be plated came the first double sided boards. Surface mount pad technology,
something we associate with the 1980's was actually being explored twenty years earlier in
the 60's. Solder masks were being applied as early as 1950 to help reduce the corrosion that
was occurring to traces and components. Epoxy compounds were spread over the surface of
the assembled boards similar to what we know now as conformal coating. Eventually the
inks were being screen printed onto the panels before assembling the boards. Areas that were
meant to be soldered were blocked out on the screens. It helped keep the boards clean,
reduce corrosion and oxidation but the tin/lead coating used to coat the traces would melt
during the soldering process causing the mask to flake off. Because of the wide spacing of
the traces it was seen more as a cosmetic problem than a functional issue. By the 1970's
circuitry and spacing was becoming smaller and smaller and the tin/lead coating that was
still being used to coat the traces on the boards began fusing traces together during the
soldering process.

48
Hot air soldering methods began in the late 70's allowing the tin/lead to be stripped after
etching eliminating the problem. Solder mask could then be applied over the bare copper
circuits and leave only the plated holes and pads free to be coated with solder. As holes
continued to get smaller and trace work became more densely packed solder mask bleed and
registration issues brought on dry film masks. They were primarily used in the US while the
first photo-imageable masks were being developed in Europe and Japan. In Europe the
solvent based "Probimer" ink was applied by curtain coating the entire panel. The Japanese
centered on screen processes using various aqueous developed LPIs. All of three of these
mask types used standard UV exposure units and photo tools to define the pattern on the
panel. By the mid 1990's the aqueous developed liquid photo-imageable masks were
dominating the industry with specialized equipment designed specifically for their
application.

The increased complexities and densities that were driving the evolution of solder mask
were also forcing the development of layers of copper traces laminated between layers of
dielectric materials. products. Aerospace equipment, flight instrumentation, computers and
telecommunication products as well as defense systems and weapons all began to take
advantage of the space saving that a multi-layer circuit board provided. Surface mount
devices were being designed that wers wilenth the size and weight of the comparable
through hole components. Followed by the invention of integrated circuits the circuit board
has continued to shrink in almost every way. Rigid boards and cable applications have given
way to flexible circuit boards or combinations of rigid and flexible PCBs. These and other
advancements will keep the manufacture of printed circuit boards a dynamic field for many
years.

How to make a PCB

Step 1: Prepare a layout of the circuit on any commonly used PCB designing software. A
layout is a design which interconnects the components according to the schematic diagram
(circuit diagram). Take a mirror image print of the layout on the OHP sheet using a laser
printer. Make sure that the design is correct with proper placement of the components.

49
Step 2: Cut the copper board according to the size of layout. A copper board is the base of a
PCB, it can be single layer, double layer or multi layer board.

Single layer copper board has copper on one side of the PCB, they are used to make single
layer PCBs, it is widely used by hobbyist or in the small circuits. A double layer copper
board consists of copper on both the sides of the PCB. These boards are generally used by
the industries. A multilayer board has multiple layers of copper; they are quite costly and
mainly used for complex circuitries like mother board of PC.

50
Step 3: Rub the copper side of PCB using steel wool. This removes the top oxide layer of
copper as well as the photo resists layer if any.

Step 4: Place the OHP sheet (wax paper) which has the printed layout on the PCB sheet.
Make sure that the printed/mirror side should be placed on the copper side of PCB.

51
Step 5: Put a white paper on the OHP sheet and start ironing. The heat applied by the electric
iron causes the ink of the traces on the OHP sheet to stick on the copper plate exactly in the
same way it is printed on the OHP sheet. This means that the copper sheet will now have the
layout of the PCB printed on it. Allow the PCB plate to cool down and slowly remove the
OHP sheet. Since it is manual process it may happen that the layout doesnt comes properly
on PCB or some of the tracks are broken in between. Use the permanent marker and
complete the tracks properly.

Step 6: Now the layout is printed on PCB. The area covered by ink is known as the masked
area and the unwanted copper, not covered by the ink is known as unmasked area. Now
make a solution of ferric chloride. Take a plastic box and fill it up with some water. Dissolve
2-3 tea spoon of ferric chloride power in the water. Dip the PCB into the Etching solution
(Ferric chloride solution, Fecl3) for approximately 30 mins. The Fecl 3 reacts with the
unmasked copper and removes the unwanted copper from the PCB. This process is called as
Etching. Use pliers to take out the PCB and check if the entire unmasked area has been
etched or not. In case it is not etched leave it for some more time in the solution.

52
Step 7: Take out the PCB wash it in cold water and remove the ink by rubbing it with steel
wool. The remaining area which has not been etched is the conductive copper tracks which
connect the components as per the circuit diagram.

53
Step 8: Now carefully drill the PCB using a drilling machine on the pads.

Step 9: Put the components in the correct holes and solder them.

This completes your PCB fabrication now put the components on mounting side and solder
them. Make sure that you properly dispose of the FeCl3 solution, clean your tools and wash
your hands after this exercise. You can also store the solution in a plastic box for future use
but not for too long.

54
SOFTWARE

2.16 Arduino IDE

2.16.1 Description

Arduino IDE is a software company, project, and user community that designs and
manufactures computer open-source hardware, open-source software,
and microcontroller-based kits for building digital devices and interactive objects that
can sense and control physical devices.

The project is based on microcontroller board designs, produced by several


vendors, using various microcontrollers. These systems provide sets of digital and
analog I/O pins that can interface to various expansion boards (termed shields) and
other circuits. The boards feature serial communication interfaces, including Universal
Serial Bus (USB) on some models, for loading programs from personal computers.
For programming the microcontrollers, the Arduino project provides an integrated
development environment (IDE) based on a programming language
named Processing, which also supports the languages C and C++.

The first Arduino was introduced in 2005, aiming to provide a low cost, easy way
for novices and professionals to create devices that interact with their environment
using sensors and actuators. Common examples of such devices intended for beginner
hobbyists include simple robots, thermostats, and motion detectors.

Arduino boards are available commercially in preassembled form, or as do-it-


yourself kits. The hardware design specifications are openly available, allowing the
Arduino boards to be produced by anyone

Automatic (Software) Reset

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

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

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

The ATmega328 on the Uno comes preprogrammed with a boot loader that allows
you to upload new code to it without the use of an external hardware programmer. It
communicates using the original STK500 protocol. We can also bypass the boot loader
and program the microcontroller through the ICSP (In-Circuit Serial Programming)
header using Arduino ISP or similar.

56
2.17 Eagle CADSOFT

2.17.1 Description

EAGLE stands for, Easily Applicable Graphical Layout Editorin English and
Einfach anzuwendender grafischer Layout-Editor in German. It is designed and
developed by CadSoft Computer GmbH and is a flexible, expandable and
scriptable, electronic design automation (EDA) application with schematic capture
editor, printed circuit board (PCB) layout editor, auto-router and computer-aided
manufacturing (CAM) and bill of materials (BOM) tools. Premier Farnell bought
EAGLE in 2008

EAGLE was developed in 1988 as a 16-bit application for Microsoft DOS, with support
for OS/2 and Windows added later on. Starting with version 4.0, EAGLE was converted
to 32-bit. EAGLE version 4.0 also dropped support for DOS and OS/2, but was among
the first professional electronic CAD tools available for Linux. A 32-bit DPM version of
EAGLE 4.0 running under DOS was available on special request in order to help
support existing customers, but was not released commercially.

Starting with version 4.13, EAGLE became available for Mac OS X, with versions
before 5.0.0 still requiring X11. Version 5.0.0 officially dropped support for Windows
9x and Windows NT 3.x/4.x. EAGLE 6.0.0 no longer supports Mac OS X

Chapter 3

57
THEORITICAL ANALYSIS

3.1 ALGORITHM

Start

Step1: Initialize all the serial ports.

Step 2: Check whether there is any obstacle in front of the rover.

Step3: If there is no obstacle proceed to the next halt point.

Step4: If there is any obstacle then avoid it and enter the predefined path

Step5: Calibrate different weather parameters at the halt point.

Step6: Send the calibrated data in the form of text message to the registered number.

Step7: Meanwhile if there is message from the registered number then calibrate the
parameters send data in the form of text message.

Step8: Also send a message to the registered number if in case any parameter exceeds the
threshold level

End

3.2 Flow chart

58
Initialize all serial
ports

Start traversing along


the predefined path

If any
NO YES
obstacle
is
detected
Reach halt point
calibrate the weather
parameters Avoid and re-enter
Pre-defined path
Send the calibrated data
as text message to the
registered number

NO If Yes
predefined
path is
completed

STOP

3.3 Block Diagram


59
MOBILE UNIT
ALTITUDE TEMPARATURE LOCATION

GSM
HUMIDITY MODEM
ARDUINO

MOISTURE
LIGHT
PRESSURE RADAR
INTENSITY

3.4 Schematic diagrams

3.4.1 Schematic diagram of PROJECT

60
Figure 3.4.1 Schematic diagram

3.4.2 Layout of Weather board

Figure 3.4.2 Layout of weather board

3.4.3 Layout of Motor driver

61
Figure 3.4.3 Layout of Motor Driver

Chapter 4

62
RESULTS

4.1 SMS from weather board

63
4.2 Rover

64
Chapter 5

CONCLUSION AND FUTURE SCOPE

5.1 CONCLUSION

The project deals with designing a simple and low cost weather monitoring system using
BH1750, BMP180, DHT11, MOISTURE SENSOR, GPS, SIM900, ULTRASONIC
SENSOR, SERVO and ATMEGA328 MICROCONTROLLER in ARDUINO IDE.

To monitor weather conditions of the desired location and transmit it to a mobile phone at
distant location through SMS.

The entire field will be traversed and the parameters at regular intervals will be sent to the
user either on request from the user or in case of any breach of the pre-defined threshold
levels.

The designed product module is at prelim stage and designed only for temperature, light
intensity, pressure, humidity, moisture and altitude.

5.2 FUTURE SCOPE

Different other sensors as wind sensor, rain sensor and gas sensor can also be included in
the weather board.

The rover can be made self balancing using accelerometers and gyroscopes.

For more accurate and stable readings of the parameters, we can use more no. of sensors and
take the average of them as the final reading.
Robust outer covering can be used to use the module in tough climatic conditions

Offline maps can be created for our field of inspection and can be interfaced to a mobile
application in order to make this more interactive with the users.

CHAPTER 6

REFERENCES

65
https://www.arduino.cc/

http://www.cadsoftusa.com/

http://www.propox.com/download/docs/SIM900.pdf

http://www.arcelect.com/GSM%20Developer%20Guide%20

%20GSM%20AT%20Commands%20-%20Rev%20%20A.pdf

http://rohmfs.rohm.com/en/products/databook/datasheet/ic/sensor/light/bh1750fv
i-e.pdf

http://skylab.com.cn/uploadfile/Download/201507071152007386.pdf

https://cdn-shop.adafruit.com/datasheets/BST-BMP180-DS000-09.pdf

https://processing.org/

http://www.micro4you.com/files/sensor/DHT11.pdf

http://www.jameco.com/Jameco/workshop/howitworks/how-servo-motors-
work.html

http://www.futurlec.com/TR40-16OA00.shtml

APPENDICES

Appendix A:
66
Arduino Code: unsigned int
sensorValue,percentValue;
#include<SoftwareSerial.h> float h;
#include<Wire.h> int hum,h_threshold=30;
#include <math.h> int mois,m_threshold=50;
#include <DHT.h> int temp,t_threshold=50;
#include <Servo.h> int distance,dist[100];
#include <TimerOne.h> long duration;
#define DHTPIN 2 int Icnt,icnt;
#define BMP180_ADDRESS 0x77
#define BH1750_ADDRESS 0x23 void dht11(int a)
#define DHTTYPE DHT11 {
Servo myServo; dht.begin();
h = dht.readHumidity();
DHT dht(DHTPIN, DHTTYPE); float t = dht.readTemperature();
float f = dht.readTemperature(true);
SoftwareSerial mygsm(9,10); if (isnan(h) || isnan(t) || isnan(f))
SoftwareSerial mygps(5,6); {
Serial.println("Failed to read
char c,data[150]; from DHT sensor!");
int return;
i,j,k,l,m,n,o,ac1,ac2,ac3,b1,b2,mb,m }
c,md; float hif = dht.computeHeatIndex(f,
String gps_data; h);
float s1,s2; float hic = dht.computeHeatIndex(t,
int d1,m1,d2,m2,cnt; h, false);
unsigned int ac4; if(a==1)
unsigned int ac5; {
unsigned int ac6; if(h>h_threshold&&hum==1)
long b5; {
//define variables for pressure and hum=0;
temperature calculation mygsm.println("AT+CMGF=1");
long x1,x2; delay(1000);
//define variables for pressure // Delay of 1000 milli seconds or 1
calculation second
long x3,b3,b6,p; mygsm.println("AT+CMGS=\"+919
unsigned long b4,b7; 966961383\"\r");; // Replace x with
//define variables for temperature mobile number
and pressure reading delay(1000);
mygsm.print("ALERT:HUMIDITY
short temperature; OVER THRESHOLD");
long pressure; mygsm.println((char)26);
// instr count }
const unsigned char OSS = 0; // }
Oversampling Setting else if(h<h_threshold)
byte buff[2]; hum=1;
uint16_t val; Serial.print("Humidity: ");
Serial.println(h);
67
} }

void moisture(int a) delay(150);


{ }
sensorValue = analogRead(A0);
percentValue = map(sensorValue, int BH1750_Read(int address) //
1023, 0, 0, 100); {
constrain(percentValue,0,100); int i=0;
Serial.println(percentValue); Wire.beginTransmission(address);
if(a==1) Wire.requestFrom(address, 2);
{ while(Wire.available()) //
if(percentValue<m_threshold&&mo {
is==1) buff[i] = Wire.read(); // receive
{ one byte
mois=0; i++;
mygsm.println("AT+CMGF=1"); }
delay(1000); Wire.endTransmission();
// Delay of 1000 milli seconds or 1 return i;
second }
mygsm.println("AT+CMGS=\"+919
966961383\"\r");; // Replace x with void BH1750_Init(int address)
mobile number {
delay(1000); Wire.beginTransmission(address);
mygsm.print("ALERT:MOISTURE Wire.write(0x10);//1lx reolution
BELOW THRESHOLD"); 120ms
mygsm.println((char)26); Wire.endTransmission();
} }
}
else if(percentValue>m_threshold) int bmp180ReadInt(unsigned char
mois=1; address)
} {
unsigned char msb, lsb;
void bh1750()
{ Wire.beginTransmission(BMP180_
int i; ADDRESS);
Wire.write(address);
BH1750_Init(BH1750_ADDRESS) Wire.endTransmission();
;
delay(200); Wire.requestFrom(BMP180_ADDR
ESS, 2);
while(Wire.available()<2);
if(2==BH1750_Read(BH1750_AD msb = Wire.read();
DRESS)) lsb = Wire.read();
{ return (int) msb<<8 | lsb;
val=((buff[0]<<8)|buff[1])/1.2; }
Serial.print(val,DEC);
Serial.println("[lx]");
//val=(val,DEC);
68
double Wire.endTransmission();
bmp180CorrectTemperature(unsign
ed int ut) // Wait for conversion, delay time
{ dependent on OSS
x1 = (((long)ut - delay(5 + (5*OSS));
(long)ac6)*(long)ac5) >> 15;
x2 = ((long)mc << 11)/(x1 + md); // Read register 0xF6 (MSB), 0xF7
b5 = x1 + x2; (LSB), and 0xF8 (XLSB)
return (((b5 + 8)>>4));
} Wire.beginTransmission(BMP180_
ADDRESS);
unsigned int bmp180ReadUT() Wire.write(0xF6);
{ Wire.endTransmission();
unsigned int ut;
Wire.requestFrom(BMP180_ADDR
// Write 0x2E into Register 0xF4 ESS, 3);
and wait at least 4.5mS
// This requests a temperature // Wait for data to become
reading available
// with results in 0xF6 and 0xF7 while(Wire.available() < 3)
;
Wire.beginTransmission(BMP180_ msb = Wire.read();
ADDRESS); lsb = Wire.read();
Wire.write(0xF4); xlsb = Wire.read();
Wire.write(0x2E);
Wire.endTransmission();
up = (((unsigned long) msb << 16)
// Wait at least 4.5ms | ((unsigned long) lsb << 8) |
delay(500); (unsigned long) xlsb) >> (8-OSS);

ut = bmp180ReadInt(0xF6); return up;


return ut; }
}
double
unsigned long bmp180ReadUP() bmp180CorrectPressure(unsigned
{ long up)
unsigned char msb, lsb, xlsb; {
unsigned long up = 0; b6 = b5 - 4000;
// Calculate B3
// Write 0x34+(OSS<<6) into x1 = (b2 * (b6 * b6)>>12)>>11;
register 0xF4 x2 = (ac2 * b6)>>11;
// Request a pressure reading w/ x3 = x1 + x2;
oversampling setting b3 = (((((long)ac1)*4 +
x3)<<OSS) + 2)>>2;
Wire.beginTransmission(BMP180_
ADDRESS); // Calculate B4
Wire.write(0xF4); x1 = (ac3 * b6)>>13;
Wire.write(0x34 + (OSS<<6)); x2 = (b1 * ((b6 * b6)>>12))>>16;
69
x3 = ((x1 + x2) + 2)>>2; {
b4 = (ac4 * (unsigned long)(x3 + if(temperature>t_threshold&&temp
32768))>>15; ==1)
{
b7 = ((unsigned long)(up - b3) * temp=0;
(50000>>OSS)); mygsm.println("AT+CMGF=1");
if (b7 < 0x80000000) delay(1000);
p = (b7<<1)/b4; // Delay of 1000 milli seconds or 1
else second
p = (b7/b4)<<1; mygsm.println("AT+CMGS=\"+919
x1 = (p>>8) * (p>>8); 966961383\"\r");; // Replace x with
x1 = (x1 * 3038)>>16; mobile number
x2 = (-7357 * p)>>16; delay(1000);
p += (x1 + x2 + 3791)>>4; mygsm.print("ALERT:TEMPERAT
URE OVER THRESHOLD");
return p; mygsm.println((char)26);
} }
}
void bmp180(int a) else if(temperature<t_threshold)
{ temp=1;
ac1 = bmp180ReadInt(0xAA); }
ac2 = bmp180ReadInt(0xAC);
ac3 = bmp180ReadInt(0xAE); int check_data()
ac4 = bmp180ReadInt(0xB0); {
ac5 = bmp180ReadInt(0xB2); int a=0;
ac6 = bmp180ReadInt(0xB4); String data1;
b1 = bmp180ReadInt(0xB6); int c;
b2 = bmp180ReadInt(0xB8); if(mygps.available()>0)
mb = bmp180ReadInt(0xBA); {
mc = bmp180ReadInt(0xBC); do
md = bmp180ReadInt(0xBE); {
c=mygps.read();
temperature = data1+=char(c);
bmp180CorrectTemperature(bmp18 }while(c>0 && c!=42);
0ReadUT());
pressure = if(data1.substring(0,6)=="$GPGGA
bmp180CorrectPressure(bmp180Re ")
adUP()); {
Serial.print(temperature*0.1); gps_data=data1;
Serial.print(char(176)); a=1;
Serial.print("c "); }
Serial.print(pressure*0.01); else
Serial.println("hpa"); {
Serial.println(); a=0;
delay(500); }
temperature=temperature*0.1; return a;
pressure = pressure*0.01; }
if(a==1) }
70
void convert() Serial.print(gps_data.substring(33,4
{ 6));
float la1,lo1; Serial.println();
int la2,lo2; convert();
la1=gps_data.substring(23,29).toInt }
();
lo1=gps_data.substring(38,44).toInt void gps()
(); {
s1=(la1*60)/1000000; mygps.begin(9600);
s2=(lo1*60)/1000000; int b;
la2=gps_data.substring(18,24).toInt Serial.println("started");
(); b=check_data();
lo2=gps_data.substring(33,38).toInt while(b!=1)
(); {
d1=la2/100; b=check_data();
m1=la2%100; Serial.print(b);
d2=lo2/100; delay(1000);
m2=lo2%100; }
Serial.print("lat:"); disp();
Serial.print(d1); }
Serial.print(char(176));
Serial.print(m1); void SendMessage()
Serial.print(char(39)); {
Serial.print(s1);
Serial.print(char(34)); mygsm.println("AT+CMGF=1");
Serial.println(); delay(1000);
Serial.print("lon:"); // Delay of 1000 milli seconds or 1
Serial.print(d2); second
Serial.print(char(176)); mygsm.println("AT+CMGS=\"+919
Serial.print(m2); 966961383\"\r"); // Replace x with
Serial.print(char(39)); mobile number
Serial.print(s2); delay(1000);
Serial.print(char(34)); mygsm.print("lat: ");
Serial.println(); mygsm.println(gps_data.substring(1
} 8,31));
mygsm.print("lon: ");
void disp() mygsm.println(gps_data.substring(3
{ 3,46));
mygsm.print("alt(m): ");
Serial.println(gps_data); mygsm.println(gps_data.substring(5
Serial.print("lattitude:"); 6,62));
mygsm.print("temp: ");
Serial.print(gps_data.substring(18,3 mygsm.print(temperature);
1)); mygsm.println("C");
Serial.print(" "); mygsm.print("press: ");
Serial.print("longitude:"); mygsm.print(pressure);
mygsm.println("hpa");
71
mygsm.print("light inten: "); duration = pulseIn(11, HIGH); //
mygsm.println(val,DEC); Reads the echoPin, returns the
mygsm.println("lx"); sound wave travel time in
mygsm.println("moisture content in microseconds
percent: "); distance= duration*0.034/2;
mygsm.print(percentValue); return distance;
mygsm.print("Humidity in percent: }
");
mygsm.println(h); void forward()
mygsm.println((char)26);// ASCII {
code of CTRL+Z digitalWrite(4,HIGH);
delay(1000); digitalWrite(7,LOW);
} digitalWrite(8,HIGH);
digitalWrite(13,LOW);
void rover() Timer1.initialize(1000000);
{ Timer1.attachInterrupt(callback);

for(int i=0;i<=50;i++) }
{
myServo.write(i); void left()
delay(10); {
digitalWrite(7,HIGH);
Serial.println("."); digitalWrite(4,LOW);
digitalWrite(8,HIGH);//left
} digitalWrite(13,LOW);
}
for(int i=50;i>=0;i--) void right()
{ {
myServo.write(i); digitalWrite(4,HIGH);
delay(10); digitalWrite(7,LOW);//right
} digitalWrite(13,HIGH);
digitalWrite(8,LOW);
for(int i=0;i<51;i++) }
{
if(dist[i]>=50) void halt()
cnt++; {
} digitalWrite(4,LOW);
} digitalWrite(7,LOW);//right
digitalWrite(13,LOW);
int calculateDistance(){ digitalWrite(8,LOW);
digitalWrite(12, LOW); }
delayMicroseconds(2);
// Sets the trigPin on HIGH state void cleardata()
for 10 micro seconds {
digitalWrite(12, HIGH); for(i=0;i<100;i++)
delayMicroseconds(10); data[i]='\0';
digitalWrite(12, LOW); i=0;
}
72
void callback() }
{ if(mygsm.available()>0)
icnt=1; {
Timer1.detachInterrupt(); Serial.println("b");
halt(); while(mygsm.available()>0)
} {
data[i]=char(mygsm.read());
void setup() Serial.print(data[i]);
{ i++;
Wire.begin(); }
mygsm.begin(9600); if(strstr(data,"9966961383"))
Serial.begin(9600); {
delay(100); if(strstr(data,"How is it out there?"))
Serial.println("started"); {
k=0; //gps();
Icnt=0; Serial.println("hello");
icnt=0;
rover(); bh1750();
}
bmp180(0);
void loop() moisture(0);
{
cleardata(); dht11(0);
while(mygsm.available()<0 &&
icnt!=1) SendMessage();
{ }
Serial.println("a");
if(cnt==50) }
forward();
else }
{
if(icnt==1)
left();
delay(100); {
do
{ Serial.println("c");
forward();
rover(); //gps();
Icnt++; bh1750();
}while(cnt==50 && Icnt<2);
right(); bmp180(1);
delay(100);
Icnt=0; moisture(1);
}
rover(); dht11(1);

APPENDIX B
73
Processing code:

import processing.serial.*; // fill(98,245,31); // green color


imports library for serial // calls the functions for drawing
communication the radar
import java.awt.event.KeyEvent; // drawRadar();
imports library for reading the data drawLine();
from the serial port drawObject();
import java.io.IOException; drawText();
Serial myPort; // defines Object }
Serial void serialEvent (Serial myPort) { //
// defubes variables starts reading data from the Serial
String angle=""; Port
String distance=""; // reads the data from the Serial
String data=""; Port up to the character '.' and puts it
String noObject; into the String variable "data".
float pixsDistance; data = myPort.readStringUntil('.');
int iAngle, iDistance; data =
int index1=0; data.substring(0,data.length()-1);
int index2=0;
PFont orcFont; index1 = data.indexOf(","); // find
void setup() { the character ',' and puts it into the
variable "index1"
size (1366, 768); // ***CHANGE angle= data.substring(0, index1); //
THIS TO YOUR SCREEN read the data from position "0" to
RESOLUTION*** position of the variable index1 or
smooth(); thats the value of the angle the
myPort = new Serial(this,"COM3", Arduino Board sent into the Serial
9600); // starts the serial Port
communication distance= data.substring(index1+1,
myPort.bufferUntil('.'); // reads the data.length()); // read the data from
data from the serial port up to the position "index1" to the end of the
character '.'. So actually it reads data pr thats the value of the
this: angle,distance. distance

} // converts the String variables into


void draw() { Integer
iAngle = int(angle);
fill(98,245,31); iDistance = int(distance);
}
noStroke(); void drawRadar() {
fill(0,4); pushMatrix();
rect(0, 0, width, height- translate(width/2,height-
height*0.065); height*0.074); // moves the starting
coordinats to new location

74
noFill(); width*0.505)*sin(radians(iAngle)));
strokeWeight(2); }
stroke(98,245,31); popMatrix();}
// draws the arc lines void drawLine() {
arc(0,0,(width-width*0.0625), pushMatrix();
(width-width*0.0625),PI,TWO_PI); strokeWeight(9);
arc(0,0,(width-width*0.27),(width- stroke(30,250,60);
width*0.27),PI,TWO_PI); translate(width/2,height-
arc(0,0,(width-width*0.479), height*0.074); // moves the starting
(width-width*0.479),PI,TWO_PI); coordinats to new location
arc(0,0,(width-width*0.687), line(0,0,(height-
(width-width*0.687),PI,TWO_PI); height*0.12)*cos(radians(iAngle)),-
// draws the angle lines (height-
line(-width/2,0,width/2,0); height*0.12)*sin(radians(iAngle)));
line(0,0,(- // draws the line according to the
width/2)*cos(radians(30)),(- angle
width/2)*sin(radians(30))); popMatrix();
line(0,0,(- }
width/2)*cos(radians(60)),(- void drawText() { // draws the texts
line(0,0,(- on the screen
width/2)*cos(radians(150)),(- pushMatrix();
width/2)*sin(radians(150))); if(iDistance>40) {
line((- noObject = "Out of Range";}
width/2)*cos(radians(30)),0,width/2 else {
,0); noObject = "In Range"}
popMatrix(); fill(0,0,0);
} noStroke();
void drawObject() { rect(0, height-height*0.0648,
pushMatrix(); width, height);
translate(width/2,height- fill(98,245,31);
height*0.074); // moves the starting textSize(25);
coordinats to new location
strokeWeight(9); text("10cm",width-
stroke(255,10,10); // red color width*0.3854,height-
pixsDistance = iDistance*((height- height*0.0833);
height*0.1666)*0.025); // covers the text("20cm",width-
distance from the sensor from cm to width*0.281,height-height*0.0833);
pixels text("30cm",width-
// limiting the range to 40 cms width*0.177,height-height*0.0833);
if(iDistance<40){ text("40cm",width-
// draws the object according to width*0.0729,height-
the angle and the distance height*0.0833);
line(pixsDistance*cos(radians(iAng textSize(40);
le)),- text("Object: " + noObject, width-
pixsDistance*sin(radians(iAngle)), width*0.875, height-
(width- height*0.0277);
width*0.505)*cos(radians(iAngle)),
-(width-
75
text("Angle: " + iAngle +" ",
width-width*0.48, height-
height*0.0277);
text("Distance: ", width-
width*0.26, height-height*0.0277);
if(iDistance<40) {
text(" " + iDistance +" cm",
width-width*0.225, height-
height*0.0277);
}
textSize(25);
fill(98,245,60);
translate((width-
width*0.4994)+width/2*cos(radians
(30)),(height-height*0.0907)-
width/2*sin(radians(30)));
rotate(-radians(-60));
text("30",0,0);
resetMatrix();
translate((width-
width*0.503)+width/2*cos(radians(
60)),(height-height*0.0888)-
width/2*sin(radians(60)));
rotate(-radians(-30));
text("60",0,0);
resetMatrix();
translate((width-
width*0.507)+width/2*cos(radians(
90)),(height-height*0.0833)-
width/2*sin(radians(90)));
rotate(radians(0));
text("90",0,0);
resetMatrix();
translate(width-
width*0.513+width/2*cos(radians(1
20)),(height-height*0.07129)-
width/2*sin(radians(120)));
rotate(radians(-30));
text("120",0,0);
resetMatrix();
translate((width-
width*0.5104)+width/2*cos(radians
(150)),(height-height*0.0574)-
width/2*sin(radians(150)));
rotate(radians(-60));
text("150",0,0);
popMatrix();
}
76

Anda mungkin juga menyukai