Академический Документы
Профессиональный Документы
Культура Документы
CHAPTER 1
EMBEDDED SYSTEMS
1.1 Introduction:
An embedded system is a system which is going to do a predefined specified
task is the embedded system and is even defined as combination of both software and
hardware. A general-purpose definition of embedded systems is that they are devices
used to control, monitor or assist the operation of equipment, machinery or plant.
"Embedded" reflects the fact that they are an integral part of the system. At the other
extreme a general-purpose computer may be used to control the operation of a large
complex processing plant, and its presence will be obvious.
All embedded systems are including computers or microprocessors. Some of
these computers are however very simple systems as compared with a personal
computer.
The very simplest embedded systems are capable of performing only a single
function or set of functions to meet a single predetermined purpose. In more complex
systems an application program that enables the embedded system to be used for a
particular purpose in a specific application determines the functioning of the
embedded system. The ability to have programs means that the same embedded
system can be used for a variety of different purposes. In some cases a microprocessor
may be designed in such a way that application software for a particular purpose can
be added to the basic software in a second process, after which it is not possible to
make further changes. The applications software on such processors is sometimes
referred to as firmware.
The simplest devices consist of a single microprocessor (often called a
"chip”), which may itself be packaged with other chips in a hybrid system or
Application Specific Integrated Circuit (ASIC). Its input comes from a detector or
sensor and its output goes to a switch or activator which (for example) may start or
stop the operation of a machine or, by operating a valve, may control the flow of fuel
to an engine..As the embedded system is the combination of both software and
hardware.
Embedded
System
Software Hardware
o ALP o Processor
o C o Peripherals
o VB o memory
Etc.,
ALU
CU
Memory
architectures designed specifically for the types of operations required in digital signal
processing. Like a general purpose microprocessor, a DSP is a programmable device,
with its own native instruction code. DSP chips are capable of carrying out millions of
floating point operations per second, and like their better-known general-purpose
cousins, faster and more powerful versions are continually being introduced. DSPs
can also be embedded within complex "system-on-chip" devices, often containing
both analog and digital circuitry.
1.3.4 Application Specific Integrated Circuit (ASIC):
ASIC is a combination of digital and analog circuits packed into an IC to
achieve the desired control/computation function.
1.3.4(a) ASIC typically contains:
CPU cores for computation and control
Peripherals to control timing critical functions
Memories to store data and program
Analog circuits to provide clocks and interface to the real world
Which is analog in nature
1.4 Computer Instruction Set:
There are two different types of computer instruction set there are:
1. RISC (Reduced Instruction Set Computer) and
2. CISC (Complex Instruction Set computer)
1.4.1 Reduced Instruction Set Computer (RISC):
A RISC (reduced instruction set computer) is a microprocessor that is
designed to perform a smaller number of types of computer instruction so that it can
operate at a higher speed (perform more million instructions per second, or millions of
instructions per second). Since each instruction type that a computer must perform
requires additional transistors and circuitry, a larger list or set of computer
instructions tends to make the microprocessor more complicated and slower in
operation.
Besides performance improvement, some advantages of RISC and related
design improvements are:
instructions and data. The CPU fetches program instructions on the program memory
bus.
The Harvard architecture is a computer architecture with physically separate
storage and signal pathways for instructions and data. The term originated from the
Harvard Mark I relay-based computer, which stored instructions on punched tape (24
bits wide) and data in electro-mechanical counters. These early machines had limited
data storage, entirely contained within the central processing unit, and provided no
access to the instruction storage as data. Programs needed to be loaded by an operator,
the processor could not boot itself.
PU and memory are, however, considerably more complex than the original
von Ne Texas Instruments TMS320 C55x processors, as one example, have
multiple parallel data busses (two write, three read) and one instruction bus.
Microcontrollers are characterized by having small amounts of program (flash
memory) and data (SRAM) memory, with no cache, and take advantage of the
Harvard architecture to speed processing by concurrent instruction and data
access. The separate storage means the program and data memories can have
different bit depths, for example using 16-bit wide instructions and 8-bit wide
data. They also mean that instruction pre-fetch can be performed in parallel
with other activities. Examples include, the AVR by Atmel Corp, the PIC by
Microchip Technology, Inc. and the ARM Cortex-M3 processor (not all ARM
chips have Harvard architecture).
1.5.2 Von-Neumann Architecture:
A computer has a single, common memory space in which both program
instructions and data are stored. There is a single internal data bus that fetches both
instructions and data. They cannot be performed at the same time
The von Neumann architecture is a design model for a stored-program digital
computer that uses a central processing unit (CPU) and a single separate storage
structure ("memory") to hold both instructions and data. It is named after the
mathematician and early computer scientist John von Neumann. Such computers
implement a universal Turing machine and have a sequential architecture.
A stored-program digital computer is one that keeps its programmed
instructions, as well as its data, in read-write, random-access memory (RAM). Stored-
program computers were advancement over the program-controlled computers of the
1940s, such as the Colossus and the ENIAC, which were programmed by setting
switches and inserting patch leads to route data and to control signals between various
functional units. In the vast majority of modern computers, the same memory is used
for both data and program instructions. The mechaniGSM for transferring the data
and instructions between the C von-neumann architecture.
BLOCK DIAGRAM
Light
LDR
Water soil
Humidity sensor
sensor
CHAPTER 2
STM 32 MCU
2.1. INTRODUCTION TO THE STM32 :-
Furthermore, the code can be slow – often multiple procedure calls are used by
the library where none would be required by custom code. Nevertheless, the library
offers a much faster path to correct prototype code. For prototype work, it’s probably
better to throw extra hardware (memory, clock rate) at a problem than sweat the
details. For serious product development it may be wise to refine a design to reduce
dependence on these libraries.
To get a sense of the cost of using the library consider the code in figure which
configures pc8 and pc9 as outputs (to drive led) and pa0 as an input (to read the push
button). 3. Similar library based code is presented. Compare the space requirements of
two versions of this program with and without the use of the standard peripheral
library. The first column (text) provides the size of “text segment” (code and data
initializes), the data allocated in ram at start up is the sum of data (initialized data) and
bss (zeroed data). The total memory requirements are provided in column text. The
.elf files are the complete binaries. Excluding 256 bytes of reallocated runtime stack
(bss), the library version is nearly 3 times as large. Unlike the original which did
minimum system initialization, i included two common start up files for both
versions. Also, the standard peripheral library has extensive parameter checking
which I disabled for this comparison.
Finally, data transfers between peripherals and memory can be automated
using dam. In chapter 4 we discuss basic peripheral configuration, in chapter we
show how interrupts can be used to build effective software, and in chapter we show
how to use dam to improve performance and allow processing to proceed in parallel
with data transfer. Throughout this book we utilize the st standard peripheral library
for the stm32 f10xx processors. It is helpful to understand the layout of this software
library.
included modules for general purpose I/O (GPIO), I2C, SPI, and serial IO (USART).
Throughout this book I will introduce the modules as necessary. There are additional
directories distributed with the firmware libraries that provide sample code which are
not illustrated. The supplied figure provides the paths to all of the key component
required to build the tutorials in this book.
The STM32 F1 has a sophisticated clock system. There are two primary
external sources of timing – HSE and LSE. The HSE signal is derived from an 8MHz
crystal or other resonator, and the LSE signal is derived from a 32.768 kHz crystal.
Internally, the HSE is multiplied in frequency through the use of a PLL; the output of
this, SYSCLK is used to derive (by division) various on chip time sources include
clocks for the ABP1 and APB2 peripherals as well as for the various programmable
timers. The LSE is used to manage a low-power Real-time clock. The STM32F100
micro-controllers can support a maximum SYSCLK frequency of 24MHz while the
other STM32 F1xx micro-controllers support a SYSCLK frequency of 72MHz.
Fortunately, most of the code required to manage these clocks is provided in the
standard peripheral library module (system_stm32f10x.[Ch]) which provides an
initialization function System In it(void) to be called at start up. This module also
exports a variable.
System Core Clock which contains the SYSCLK frequency; this simplifies
ADC Analog to digital converter
DAC Digital to analog converter
GPIO General Purpose I/O
I2C I2C bus
SPI SPI bus
TIM Timers (various)
USART Universal synchronous asynchronous receiver transmitter
The following peripherals are not considered in this book.
CAN Controller area network. Not supported by STM32F100
CEC Consumer electronics control.
CRC Cyclic redundancy check calculation unit.
ETH Ethernet interface. Not supported by the STM32F100
B.TECH [E.C.E.], PITS, CHINTALAPUDI Page 16
GSM BASED WEATHER MONITORING SYSTEM
modifying the port configuration. This final feature can help minimize the possibility
that software bugs lead to hardware failures; e.g., accidentally causing a short circuit.
In addition to providing the addresses of the peripherals, stm32f10x.h also provides C
language level structures that can be used to access each Peripherals. For example, the
GPIO ports are defined by the following register structure.
{
Volatile uint32_t CRL;
Volatile uint32_t CRH;
Volatile uint32_t IDR;
Volatile uint32_t ODR;
Volatile uint32_t BSRR;
Volatile uint32_t BRR;
Volatile uint32_t LCKR;
}
GPIO
STM32 F1:-
The register addresses of the various ports are defined in the library as
(The following defines are from stm32f10x.h)
#define PERIPH_BASE ((uint32_t) 0x40000000)
#define APB2PERIPH_BASE (PERIPH_BASE + 0x10000)
#define GPIOA_BASE (APB2PERIPH_BASE + 0x0800)
#define GPIOA ((GPIO_TypeDef *) GPIOA_BASE)
The preceding example is somewhat misleading in its simplicity. Consider that to
configure a GPIO pin requires writing two 2-bit fields at the correct location in correct
configuration register. In general, the detail required can be excruciating. Fortunately,
the standard peripheral library provides modules for each Peripheral that can greatly
simplify this task. For example, the following is a Subset of the procedures available
for managing GPIO ports: voidGPIO_Init (GPIO_TypeDef* GPIOx,
GPIO_InitTypeDef* GPIO_InitStruct);
GPIO_ReadInputDataBit (GPIO_TypeDef* GPIOx,
GPIO_Pin);
B.TECH [E.C.E.], PITS, CHINTALAPUDI Page 18
GSM BASED WEATHER MONITORING SYSTEM
2.2STM32 VL
The Key Component Used In The Tutorials Is The Stm32 Vl Discovery Board
Produced By STMicroelectronics (St) And Available From Many Electronics
Distributors F1. 4 This Board, Illustrated In Figure 1.2 Includes A User Configurable
Stm32 F100 Micro-Controller With 128 Kb Flash And 8 Kb Ram As Well As An
Integrated Hardware Debugger Interface Based Upon A Dedicated USB Connected
Stm32 F103. With Appropriate Software 3at The Time Of Writing Sale Offers A
Discount To Students And Professors.
2.3. REQUIRED HARDWARE
Component Supplier cost
2.3.1. Processor:
STM32 VL discovery Mouser, Digital key, Future Electronics
Pin diagram:-
Interface is accessible through pin headers and can be used to debug any
member of the STM32 family – effectively, ST are giving away a hardware debugger
interface with a basic prototyping board. The STM32 VL Discovery board is
distributed with complete documentation including schematics. In the photograph,
there is a vertical white line slightly to the left of the midpoint. To the right of the line
are the STM32 F100, crystal oscillators, two user accessible LEDs, a user accessible
push-button and a reset push button. To the left is the hardware debugger interface
including an STM32 F103, voltage regulator, and other components. The regulator
converts the 5V supplied by the USB connection to 3.3V for the processors and also
available at the board edge connectors. This regulator is capable of sourcing sufficient
current to support the additional hardware used for the tutorials. All of the pins of the
STM32 F100 are brought out to well labelled headers as we shall see the pin labels
directly correspond to the logical names used throughout the STM32 documentation
rather than the physical pins associated with the particular part/package used. This use
of logical names is consistent across the family and greatly simplifies the task of
designing portable software. The STM32 F100 is a member of the value line STM32
processors and executes are a relatively slow 24 MHz, yet provides far more
computation and I/O horsepower than is required for the tutorials described in this
book. Furthermore, all of the peripherals provided by the STM32 F100 are common
to the other members of the STM32 family and, the code developed on this
component is completely portable across the microController family.
2.6.Stm32 f1:
The stm32 is a family of micro-controllers. The stm32 f1xx microcontrollers
are based upon the cortex-m3 and include the stm32f100 value line micro-controller
used on the discovery board considered in this book. The stm32 l1 series is derived
from the stm32 f1 series but with reduced power consumption. The stm32 f2 series is
also based upon the cortex-m3 but has an enhanced set of peripherals and a faster
processor core. Many of the peripherals of the stm32 f1 series are forward compatible,
but not all. The stm32 f4 series of processors use the cortex-m4 core which is a
significant enhancement of the cortex-m3. Finally, there is a new stm32 family – the
stm32 f0 based upon the cortex-m0. Each of these families – stm32f0, stm32 f1,
stm32 l1. Stm32 f2, and stm32 f4 are supported by different firmware libraries. While
there is significant overlap between the families and their peripherals, there are also
important differences. In this book we focus on the stm32 f1 family. The stm32 f1
micro-controllers are based upon the cortex-m3 core with a set of peripherals
distributed across three buses– ahb and its two sub-buses apb1 and apb2. These
peripherals are 38 2.2. Stm32 f1 controlled by the core with load and store
instructions that access memory mapped registers.
2.7STM32 Configuration
The STM32 processors are complex systems with many peripherals. Before
any of
These peripherals can be used they must be configured. Some of this configuration is
generic – for example clock distribution and pin configuration–while the rest is
clock distribution network which ensures that only Those peripherals that are actually
needed are powered. This system, called Reset and clock control (rcc) is supported by
the firmware module
Stm32f10x_rcc [ch]. While this module can be used to control the main System
clocks and plls, any required configuration of those is handled by the Start up code
provided with the examples in this book. Our concern here is Simply with enabling
the peripheral clocks.
2.10 I/O PINS:-
Most of the pins of the stm32 can be configured as input or output and may be
connected to either the gpio ports or “alternative functions” (other peripherals). As a
standard naming convention, the pins are called by their gpio function – for example
pa0 or pb9. Indeed, the labelling of the discovery board follows this convention.
Subject to specific hardware constraints, each pin can be configured in the Modes
illustrated Function library constant Alternate function open-drain gpio mode
Alternate function push-pull gpio mode Analog gpio_mode_ain Input floating
gpio_mode_in_floating Input pull-down gpio_mode_ipd Input pull-up
gpio_mode_ipu Output open-drain gpio_mode_out_od Output push-pull
gpio_mode_out_pp By default, most pins are reset to “input floating”– this ensures
that No hardware conflicts will occur when the system is powering up. The firmware
Library provides an initialization routine in stm32f10x_gpio.[ch] which may Be used
to reconfigure the pins. For example, for the blinking lights we configured Pc9 as a
(slow) output as illustrated in listing 4.1. When configuring an output as shown above,
we have three choices of Output “speed”– 50 MHz, 10 MHz, and 2 MHz In general,
for reasons of Power consumption and noise, it is desirable to use the lowest speed
consistent.
2.11. Blinking Lights with Pushbutton:-
Modify the blinking lights program to additionally track the state of The user
pushbutton (PA0) on the blue LED (PC8). See if you can figure out How to configure
both leds with a single call to GPIO Init.
while (1)
{
if (read (button))
led = on;
else
led = off;
}
CHAPTER 3
POWER SUPPLY
To construct and test the +5 volt power supply the following parts are needed:
The transformer does not add power, so it follows that the power (V × I) on
either side must be constant. That is the reason why the winding with more turns has
higher voltage but lower current, while the winding with less turns has lower voltage
but higher current. The step down transformer converts the AC input with the higher
level to some lower level. A bridge rectifier converts the AC voltage into DC voltage.
A four-transistor converter (Bridge Rectifier) can generate the highest output power
than other types of rectifiers. The filter circuit resists the unwanted AC signals. The
regulator down-convert a DC voltage to a lower DC voltage of the same polarity.
returns to the transformer via the other parallel diode. When the polarity changes the
other two diodes conduct. The output waveform is the same as the full-wave rectifier.
Supply voltage-240V
Secondary voltage-12V
Where Vac is the rms transformer secondary voltage and 0.7 is the voltage drop across
rectifier as there are two diodes conducting for each half cycle.
Vdc=Vp - I/4 CF, where Vp - peak voltage value, C- capacitance, F-supply frequency,
and I-load current
Vdc=15.52 - 900mA/4x1000πx50
=11.02V
This circuit can give +5V output at about 150 mA current, but it can be increased to
1A when good cooling is added to 7805 regulator chip. The circuit has over overload
and terminal protection
CHAPTER 4
GLOBAL SYSTEM MOBILE
4.1 Architecture of the GSM network:
The Base Transceiver Station houses the radio tranceivers that define a cell and
handles the radio-link protocols with the Mobile Station. In a large urban area, there
will potentially be a large number of BTSs deployed, thus the requirements for a BTS
are ruggedness, reliability, portability, and minimum cost.
The Base Station Controller manages the radio resources for one or more BTSs.
It handles radio-channel setup, frequency hopping, and handovers, as described
below. The BSC is the connection between the mobile station and the Mobile service
Switching Center (MSC).
The Home Location Register (HLR) and Visitor Location Register (VLR),
together with the MSC, provide the call-routing and roaming capabilities of GSM.
The HLR contains all the administrative information of each subscriber registered in
the corresponding GSM network, along with the current location of the mobile. The
location of the mobile is typically in the form of the signalling address of the VLR
associated with the mobile station. The actual routing procedure will be described
later. There is logically one HLR per GSM network, although it may be implemented
as a distributed database.
Channels are defined by the number and position of their corresponding burst
periods. All these definitions are cyclic, and the entire pattern repeats approximately
every 3 hours. Channels can be divided into dedicated channels, which are allocated
to a mobile station, and common channels, which are used by mobile stations in idle
mode.
Figure4.6: Organization of bursts, TDMA frames, and multi frames for speech
and data
Used to synchronise the mobile to the time slot structure of a cell by defining
the boundaries of burst periods, and the time slot numbering. Every cell in a
GSM network broadcasts exactly one FCCH and one SCH, which are by
definition on time slot number 0 (within a TDMA frame).
Slotted Aloha channel used by the mobile to request access to the network.
Recall that the speech codec produces a 260 bit block for every 20 ms speech
sample. From subjective testing, it was found that some bits of this block were more
important for perceived speech quality than others. The bits are thus divided into three
classes:
Class Ia bits have a 3 bit Cyclic Redundancy Code added for error detection. If
an error is detected, the frame is judged too damaged to be comprehensible and it is
discarded. It is replaced by a slightly attenuated version of the previous correctly
received frame. These 53 bits, together with the 132 Class Ib bits and a 4 bit tail
sequence (a total of 189 bits), are input into a 1/2 rate convolutional encoder of
constraint length 4. Each input bit is encoded as two output bits, based on a
combination of the previous 4 input bits. The convolutional encoder thus outputs 378
bits, to which are added the 78 remaining Class II bits, which are unprotected. Thus
every 20 ms speech sample is encoded as 456 bits, giving a bit rate of 22.8 kbps.
Recall that each time-slot burst is transmitted at a gross bit rate of 270.833
kbps. This digital signal is modulated onto the analog carrier frequency using
Gaussian-filtered Minimum Shift Keying (GMSK). GMSK was selected over other
modulation schemes as a compromise between spectral efficiency, complexity of the
transmitter, and limited spurious emissions. The complexity of the transmitter is
related to power consumption, which should be minimized for the mobile station. The
spurious radio emissions, outside of the allotted bandwidth, must be strictly controlled
so as to limit adjacent channel interference, and allow for the co-existence of GSM
and the older analog systems (at least for the time being).
every time-slot burst. The actual implementation of the equalizer is not specified in
the GSM specifications.
The mobile station measures the signal strength or signal quality (based on the
Bit Error Ratio), and passes the information to the Base Station Controller, which
ultimately decides if and when the power level should be changed. Power control
should be handled carefully, since there is the possibility of instability. This arises
from having mobiles in co-channel cells alternatingly increase their power in response
to increased co-channel interference caused by the other mobile increasing its power.
This in unlikely to occur in practice but it is (or was as of 1991) under study.
Ensuring the transmission of voice or data of a given quality over the radio link is
only part of the function of a cellular mobile network. A GSM mobile can seamlessly
roam nationally and internationally. In addition, the fact that the geographical area
covered by the network is divided into cells necessitates the implementation of a
handover mechanism. These functions are performed by the Network Subsystem,
mainly using the Mobile Application Part (MAP) built on top of
Mobility Management:
Manages the location updating and registration procedures, as well as security
and authentication.
Location updating:
A powered-on mobile is informed of an incoming call by a paging message sent
over the PAGCH channel of a cell. One extreme would be to page every cell in the
network for each call, which is obviously a waste of radio bandwidth. The other
extreme would be for the mobile to notify the system, via location updating messages,
of its current location at the individual cell level. This would require paging messages
to be sent to exactly one cell, but would be very wasteful due to the large number of
location updating messages. A compromise solution used in GSM is to group cells
into location areas. Updating messages are required when moving between location
areas, and mobile stations are paged in the cells of their current location area.
The location updating procedures, and subsequent call routing, use the MSC and
two location registers: the Home Location Register (HLR) and the Visitor Location
Register (VLR). When a mobile station is switched on in a new location area, or it
moves to a new location area or different operator's PLMN, it must register with the
network to indicate its current location. In the normal case, a location update message
is sent to the new MSC/VLR, which records the location area information, and then
sends the location information to the subscriber's HLR. The information sent to the
HLR is normally the SS7 address of the new VLR, although it may be a routing
number. The reason a routing number is not normally assigned, even though it would
reduce signalling, is that there is only a limited number of routing numbers available
in the new MSC/VLR and they are allocated on demand for incoming calls. If the
subscriber is entitled to service, the HLR sends a subset of the subscriber information,
needed for call control, to the new MSC/VLR, and sends a message to the old
MSC/VLR to cancel the old registration.
The same initial random number and subscriber key are also used to compute
the ciphering key using an algorithm called A8. This ciphering key, together with the
TDMA frame number, use the A5 algorithm to create a 114 bit sequence that is XO
Red with the 114 bits of a burst (the two 57 bit blocks). Enciphering is an option for
the fairly paranoid, since the signal is already coded, interleaved, and transmitted in a
TDMA manner, thus providing protection from all but the most persistent and
dedicated eavesdroppers.
The most general routing procedure begins with the GMSC querying the
called subscriber's HLR for an MSRN. The HLR typically stores only the SS7 address
of the subscriber's current VLR, and does not have the MSRN (see the location
updating section). The HLR must therefore query the subscriber's current VLR, which
will temporarily allocate an MSRN from its pool for the call. This MSRN is returned
to the HLR and back to the GMSC, which can then route the call to the new MSC. At
the new MSC, the IMSI corresponding to the MSRN is looked up, and the mobile is
paged in its current location area.
microprocessor technology, many functions of the mobile station can be built on one
chipset, resulting in lighter, more compact and more energy efficient terminals.
The GSM system, and its sibling systems operating at 1.8 GHz (called
DCS1800) and 1.9 GHz (called GSM1900 or PCS1900, and operating in North
America), are a first approach at a true personal communication system. The SIM
card is a novel approach that implements personal mobility in addition to terminal
mobility. Together with international roaming, and support for a variety of services
such as telephony, data transfer, fax, Short Message Service, and supplementary
services, GSM comes close to fulfilling the requirements for a personal
communication system.
CHAPTER 5
A liquid crystal display or LCD draws its definition from its name itself. It is
combination of two states of matter, the solid and the liquid. LCD uses a liquid crystal
to produce a visible image. Liquid crystal displays are super-thin technology display
screen that are generally used in laptop computer screen, TVs, cell phones and
portable video games. LCD’s technologies allow displays to be much thinner when
compared to cathode ray tube (CRT) technology.
Liquid crystal display is composed of several layers which include two polarized
panel filters and electrodes. LCD technology is used for displaying the image in
notebook or some other electronic devices like mini computers. Light is projected
from a lens on a layer of liquid crystal. This combination of colored light with the
gray scale image of the crystal (formed as electric current flows through the crystal)
forms the colored image. This image is then displayed on the screen. An LCD is
either made up of an active matrix display grid or a passive display grid. Most of the
Smartphone’s with LCD display technology uses active matrix display, but some of
the older displays still make use of the passive display grid designs. Most of the
electronic devices mainly depend on liquid crystal display technology for their
display. The liquid has a unique advantage of having low power consumption than the
LED or cathode ray tube.
Liquid crystal display screen works on the principle of blocking light rather
than emitting light. LCD’s requires backlight as they do not emits light by them. We
always use devices which are made up of LCD’s displays which are replacing the use
of cathode ray tube. Cathode ray tube draws more power compared to LCD’s and are
also heavier and bigger.
Thus the light travels through each layer and guided on the next with the help of
molecule. The molecule tends to change its plane of vibration of the light in order to
match their angle. When the light reaches to the far end of the liquid crystal
substance, it vibrates at the same angle as that of the final layer of the molecule
vibrates. The light is allowed to enter into the device only if the second layer of the
polarized glass matches with the final layer of the molecule.
The principle behind the LCD’s is that when an electrical current is applied to
the liquid crystal molecule, the molecule tends to untwist. This causes the angle of
light which is passing through the molecule of the polarized glass and also cause a
change in the angle of the top polarizing filter. As a result a little light is allowed to
pass the polarized glass through a particular area of the LCD. Thus that particular area
will become dark compared to other. The LCD works on the principle of blocking
light. While constructing the LCD’s, a reflected mirror is arranged at the back. An
electrode plane is made of indium-tin oxide which is kept on top and a polarized glass
with a polarizing film is also added on the bottom of the device. The complete region
of the LCD has to be enclosed by a common electrode and above it should be the
liquid crystal matter.
Next comes to the second piece of glass with an electrode in the form of the
rectangle on the bottom and, on top, another polarizing film. It must be considered
that both the pieces are kept at right angles. When there is no current, the light passes
through the front of the LCD it will be reflected by the mirror and bounced back. As
the electrode is connected to a battery the current from it will cause the liquid crystals
between the common-plane electrode and the electrode shaped like a rectangle to
untwist. Thus the light is blocked from passing through. That particular rectangular
area appears blank
CHAPTER 6
SOIL SENSOR & WATER SENSOR
6.1Hardware
The hardware is consists of an Arduino microcontroller (here an Arduino Uno R3)
and a pre-wired soil moisture sensor module. The soil moisture sensor module , built
around the LM393 comparator, gives an active-low (L) level output when the soil is
dry (determined by a pre-setted threshold value). This digital output (wet soil → L /
dry soil → H) is routed to one I/O terminal (D2) of the Arduino microcontroller.
Based on this input (at D2) arduino gives an active-high (H) output through D13 when
soil is dry, and an active-low (L) output when soil is wet.
6.3Hook Up Note
The +5V supply line (VCC) of the module is linked to the 5V line of the Arduino.
GND of the module is the common (0V) connection. The digital signal output to be
detected (usually marked as DO in the module) is applied to D2 input of the Arduino.
Analog output (marked as AO) from the module is not used here. Sensor-head of the
module contains two probes in a small metal pcb. When the sensor-head is inserted in
wet soil, mositure bridges the probes through a low-resistance path (when soil is dry,
resistance between the probes is also high). A potentiometer is included in the module
for adjusting the soil wet/dry detection sensitivity according to actual requirements.
B.TECH [E.C.E.], PITS, CHINTALAPUDI Page 49
GSM BASED WEATHER MONITORING SYSTEM
6.4Analog Link
It is also possible to read the amount of moisture present in the soil (for
judging whether the soil is wet or dry) by linking the analog output (AO) of the
module, to one analog input (A0) of the Arduino. Here is the test code that indicates
the soil wet/dry conditions using just two LEDs (green & red).
CHAPTER 7
Light Dependent Resistor
7.1 INTRODUCTION OF LDR
The dominant of street lights, outside lights, a number of indoor home
appliances, and so on are typically operated and maintained manually on many
occasions. This is not only risky, however additionally leads to wastage of power with
the negligence of personnel or uncommon circumstances in controlling these
electrical appliances ON and OFF. Hence, we can utilize the light sensor circuit for
automatic switch OFF the loads based on daylight’s intensity by employing a light
sensor. This article discusses in brief about what is a light dependent resistor, how to
make a light dependent resistor circuit and its applications.
CHAPTER 8
HUMIDITY AND TEMPERATURE SENSOR
8.1Humidity:-
A humidity sensor (or hygrometer) senses, measures and reports the relative
humidity in the air. It thereforemeasures both moisture and air temperature. Relative
humidity is the ratio of actual moisture in the air to the highest amount of moisture
that can be held at that air temperature. The warmer the air temperature is, themore
moisture it can hold. Humidity / dew sensors use capacitive measurement, which
relies on electrical capacitance. Electrical capacity is the ability of two nearby
electrical conductors to create an electrical field between them. The sensor is
composed of two metal plates and contains a non-conductive polymer film between
them. This film collects moisture from the air, which causes the voltage between the
two plates tochange. These voltage changes are converted into digital readings
showing the level of moisture in the air.
circuit), humidity sensor switch, digital home humidity sensor, wireless humidity
sensor, digitalhumidity meter, soil moisture sensor, dew point sensor, remote
humidity sensor or for any other application that needs humidity measurement.
Simply choose from the humidity sensor technical attributes below and your search
results will quickly be narrowed to match your specific humidity sensor application
needs.If you have a preferred brand, we deal with Digi International, GE
Measurement & Control, Measurement Specialties or Vishay as manufacturers. You
can easily refine your humidity sensor product search results by clicking your
preferred humidity sensor brand below from our list of manufacturers.
8.4APPLICATIONS FOR HUMIDITY SENSORS:
Humidity sensors can be used as a monitoring and preventive measure in homes for
people with illnesses that are affected by humidity. They are also found as part of
home heating, ventilating, and air conditioning systems (HVAC systems). They can
also be found in offices, cars, humidors, museums, industrial spaces and greenhouses
and can be used in meteorology stations to report and predict weather. Dew sensors
are used in the coating industry because the application of paint and other coatings
may be extremely sensitive to dew point.
8.5 TEMPERATURE SENSOR
This sensor is used for reading the temperature and also to calculate dew point
and heat index. LM35 – Temperature Sensor It is a 3-pin temperature sensor IC that
measures temperature in degree Centigrade and gives output response of 10 mV/°C.
Itsresponse is linear and highly suitable for interfacing with the analogue-to-digital
converter (ADC) of any micro-controller. For example, if temperature is 25°C, then
its output is 250 mV. The sensor operates off 5V DC supply. The output of the
temperature sensor is connected to analogue input A5 of the Arduino board The LM
35 temperature sensor is an easy to use, cost-effective sensor with decent accuracy.
CHAPTER 9
SOFTWARE DESCRIPTION
9.1AURDINO PROGRAM
In this chapter I discuss the process of creating, compiling, loading, executing,
and debugging a program with the STM32 VL Discovery board and Sorcery tools.
For desktop machines, the standard first example is the “hello world”.
9.2. Program:
#include <stdio.h>
main () {
printf("hello world\n");
}
which can be compiled and executed in a single step
gcc -o hello hello.c ;. / hello
hello world
This simple program hides an enormous amount of complexity ranging from
the automatic inclusion of the standard libraries, to linking in start up code, to
interacting with the world through the shell. In the embedded world, much of that
complexity is visible to the programmer and hence it is necessary to understand quite
a bit more about the execution environment for even the simplest program (and “hello
world” is not a simple program).
In the embedded world, the simplest C program is one which does not require any
standard libraries and does not interact with the world:
Main
{
}
However, this is a little too pared down for our purposes. Instead, we structure
this chapter around a program that has some data and which runs Forever.
Int off = 5;
Voidinc(void){
I += off;
}
Int main(void){
While (1) {
Inc();
}
}
While we cannot directly observe this program when it executes, we can
attach a debugger and control its execution through breakpoints and watch points.
Notice that this program has two global variables (I and off) one of which is
initialized to zero and the other has a non-zero initializer. Furthermore the program
has a single procedure other than main and repeatedly calls this procedure. Before we
can execute the program there are a number of hurdles we must overcome. First, we
must compile the program into a binary format Suitable for loading onto the discovery
board. Second, we must load this Binary into the flash memory. Finally, in order to
observe the program, we must interact with the discovery board through a debugger
(GDB). While we use GDB as a loader as well as a debugger, in general the last two
steps may involve separate tools.
9.3.Demo Program:-
change directories to the Demo directory and Execute “make”. This should create a
file called Demo. Elf which contains the Compiled binary.
To download and execute this binary we will need two programs –gdb (arm-
none-eabi-gdb), which is part of the Sorcery distribution, and st-util, which provides a
gdb server that communicates with the stlink debugging Stub on the discovery board
through a USB connection. We described how to Installst-util in Section 1.2. I will
assume you have installed and tested the Connection. You should open two terminal
windows.
Note: earlier versions of st-util need a different start up sequence
St-util 4242 /dev/stlink
Which starts a gdb server listening at port 4242. You should see an output
resides in flash and the mutable state (variables and the run-time stack) resides in
static ram (SRAM). In addition, the first portion of flash memory, starting at
0x08000000, contains a vector table consisting of pointers to the various
Exception handlers. The most important of these are the address of the reset handler
(stored at 0x08000004) which is executed whenever the processor is reset, and the
initial stack pointer value (stored at 0x08000000).
This memory structure is reflected in the linker script fragment illustrated in
Figure 3. The script begins by defining the code entry point (Reset Handler) and the
two memory regions – flash and ram. It then places the named sections from the
object files being linked into appropriate locations in these two memory regions.
From the perspective of an executable, there are three relevant sections –“.text” which
is always placed in flash, “.data” and“.bss” which are always allocated space in
the ram region. The constants Required to initialize .data at runtime are placed in flash
as well for the start up.code to copy
CHAPTER 10
CODE
#include <SimpleDHT.h>
#include <LiquidCrystal.h>
#include <SoftSerialSTM32.h>
// for DHT11,
// VCC: 5V or 3V
// GND: GND
// DATA: 2
/***************** Macros Defined ****************/
// *********** LCD ******/
#define p_D4 PB12
#define p_D5 PB13
#define p_D6 PB14
#define p_D7 PB15
#define p_RS PA8
#define p_EN PA11
void setup() {
Serial.begin(9600);
//Being serial communication witj Arduino and SIM800
serialSIM800.begin(9600);
delay(1000);
pinMode(LED_PIN, OUTPUT);
digitalWrite(LED_PIN, LOW);
Serial.println("GSM BASED WEATHER MONITOR SYSTEMS");
lcd.begin(16, 2);
lcd.print("LCD Init. OK");
delay(1000);
lcd.clear();
lcd.print("I CARE SOLUTIONS");
lcd.setCursor(0, 1);
lcd.print("EMBEDDED SYSTEMGSM");
delay(1000);
lcd.clear();
lcd.print("Testing call..");
lcd.setCursor(0, 1);
lcd.print("8143645131");
delay(1000);
serialSIM800.flush();
//Set GSM format to ASCII
serialSIM800.print("AT+CMGF=1\r\n");
delay(1000);
lcd.clear();
lcd.print("GSM + WEATHER");
lcd.setCursor(0, 1);
lcd.print("MONITOR SYSTEM");
delay(1000);
serialSIM800.print("ATD8143645131;\r\n");
//serialSIM800.print("ATD7396343885;\r\n");
delay(1000);
serialSIM800.begin(9600);
B.TECH [E.C.E.], PITS, CHINTALAPUDI Page 62
GSM BASED WEATHER MONITORING SYSTEM
}
byte temperature = 0;
byte humidity = 0;
void loop() {
// start working...
digitalWrite(HealthLED, HIGH);
lcd.begin(16, 2);
Serial.println("=================================");
Serial.println("Sample DHT11...");
//LDRSensor_PIN LdrSensor_val
LdrSensor_val = analogRead(LDRSensor_PIN);
LdrSensor_val= (LdrSensor_val/2.5)*2;
/*
ADC = analogRead (LDR_input);
lcd.print(temperature);
lcd.write(223);
lcd.write('C');
lcd.setCursor(0, 1);
lcd.print("HUMIDITY :");
lcd.print(humidity);
lcd.print(" %");
delay(2000);
if(LdrSensor_val>3000)
{
digitalWrite(LED_PIN,HIGH);
lcd.clear();delay(1);
lcd.setCursor(0, 0);
lcd.print("LDR :");
lcd.print(LdrSensor_val);//LDRSensor_PIN LdrSensor_val
// lcd.print(" lux");
lcd.setCursor(0, 1);
lcd.print("LIGHT ON");
delay(2000);
}
else
{
digitalWrite(LED_PIN, LOW);
}
if(SoilSensor_val>9)
{
lcd.clear();delay(1);
lcd.setCursor(0, 0);
lcd.print("WATER :");
lcd.print(SoilSensor_val);//LDRSenso nsor_val
lcd.print(" %");
delay(2000);
}
else
{
}
if(count>30)
{
send_GSM();
count=0;
}
digitalWrite(HealthLED, LOW);
delay(500);
}
void send_GSM(void)
{
//sscanf(buff,"AT+CMGS="
//Send new GSM command and message number
serialSIM800.print("AT+CMGS=\"8143645131\"\r\n");
delay(1000);
serialSIM800.print("TEMP=");serialSIM800.print(temperature);serialSIM800.write(2
23);serialSIM800.write('C');
serialSIM800.print("Humidity="
);serialSIM800.print(humidity);serialSIM800.write('%');
serialSIM800.print("WATER LEVEL=" );serialSIM800.print(
SoilSensor_val);serialSIM800.write('%');
serialSIM800.print("LIGHT=" );serialSIM800.print( LdrSensor_val);
//serialSIM800.print(" lux" );
delay(1000);
//Send Ctrl+Z / ESC to denote GSM message is complete
B.TECH [E.C.E.], PITS, CHINTALAPUDI Page 65
GSM BASED WEATHER MONITORING SYSTEM
serialSIM800.write((char)26);
delay(1000);
CHAPTER 11
KIT VISUALS&OUTPUT
11.1 Output in LCD display:
LCD
P1.21
P1.21
P1.22
P1.22
L P1.23
P1.23
P1.24
P1.24
S P1.25
P1.25
P 0.1 GSM
CHAPTER 12
APPLICATIONS & FUTURE SCOPE
APPLICATIONS
This electronic circuit is mainly used in Weather stations
To calculate and store the temperature and humidity of a boiler in the industry.
To store flow of the water flowing from the dam or a canal
To monitor / display the level of the liquid inside the container
Also this system communicates with a mobile and sends various data like
level of humidity, liquid flow, and temperature of water.
Future Development
We can monitor and store more parameters like PH of soil, pressure, by
replacing the existing sensors with respective sensor.
We can store this data to a memory location using memory IC or a memory
card
We can draw graphs of variations in these parameters using computer
CHAPTER 13
CONCLUSION
REFERENCES
[1 ] A. El-Sarah, N. Georgians, and E. Petri, “A prototype for 3-D hand tracking and
gesture estimation,” IEEE Trans. In strum. Meas., vol. 57,no. 8, pp. 1627–1636, Aug.
2008.
[2] D. G. Lowe, “Distinctive image features from scale-invariant key points,” Int. J.
Compute. Vis., vol. 60, no. 2, pp. 91–110, Nov. 2004
[3] A. Bosch, X. Munoz, and R. Marti, “Which is the best way to organize/ classify
images by content?” Image Vis. Compute., vol. 25, no. 6, pp. 778–791, Jun. 2007.
[4] H. Zhou and T. Huang, “Tracking articulated hand motion with Eigen dynamics
analysis,” in Proc. Int. Conf. Compute. Vis., 2003, vol. 2, pp. 1102–1109.
[5] B. Stanger, “Template based hand pose recognition using multiple cues,” in Proc.
7th ACCV, 2006, pp. 551–560.