Vous êtes sur la page 1sur 300

PROJECT TITLE

ABSTRACT
CHAPTER 1

INTRODUCTION

Microcontroller

It’s like a small computer on a single IC. It contains a processor core, ROM, RAM and I/O pins
dedicated to perform various tasks. Microcontrollers are generally used in projects and applications that
require direct control of user. As it has all the components needed in its single chip, it does not need any
external circuits to do its task so microcontrollers are heavily used in embedded systems and major
microcontroller manufacturing companies are making them to be used in embedded market. A
microcontroller can be called the heart of embedded system. Some examples of popular microcontrollers are
8051, AVR, PIC series of microcontrollers,.
Microprocessor

Microprocessor has only a CPU inside them in one or few Integrated Circuits. Like microcontrollers
it does not have RAM, ROM and other peripherals. They are dependent on external circuits of peripherals to
work. But microprocessors are not made for specific task but they are required where tasks are complex and
tricky like development of software’s, games and other applications that require high memory and where
input and output are not defined. It may be called heart of a computer system. Some examples of
microprocessor are Pentium, I3, and I5 etc.
What is the difference between microprocessor and microcontroller?

As now you are basically aware of what is a microcontroller and microprocessor, it would be easy to identify
the major differences between a microcontroller and microprocessor.

1. Key difference in both of them is presence of external peripheral, where microcontrollers have RAM,
ROM, EEPROM embedded in it while we have to use external circuits in case of microprocessors.

2. As all the peripheral of microcontroller are on single chip it is compact while microprocessor is bulky.

3. Microcontrollers are made by using complementary metal oxide semiconductor technology so they are
far cheaper than microprocessors. In addition the applications made with microcontrollers are cheaper
because they need lesser external components, while the overall cost of systems made with microprocessors
are high because of the high number of external components required for such systems.

4. Processing speed of microcontrollers is about 8 MHz to 50 MHz, but in contrary processing speed of
general microprocessors is above 1 GHz so it works much faster than microcontrollers.

5. Generally microcontrollers have power saving system, like idle mode or power saving mode so overall it
uses less power and also since external components are low overall consumption of power is less. While in
microprocessors

generally there is no power saving system and also many external components are used with it, so its power
consumption is high in comparison with microcontrollers.
6. Microcontrollers are compact so it makes them favorable and efficient system for small products and
applications while microprocessors are bulky so they are preferred for larger applications.

7. Tasks performed by microcontrollers are limited and generally less complex. While task performed by
microprocessors are software development, Game development, website, documents making etc. which are
generally more complex so require more memory and speed so that’s why external ROM, RAM are used
with it.

8. Microcontrollers are based on Harvard architecture where program memory and data memory are separate
while microprocessors are based on von Neumann model where program and data are stored in same
memory module.

CHAPTER2

BLOCK DIAGRAM
CHAPTER3

HARDWARE COMPONENTS

REGULATED POWER SUPPLY

Regulated power supply section


In mains-supplied electronic systems the AC input voltage must be converted into a DC voltage with the
right value and degree of stabilization. In these basic configurations the peak voltage across the load is equal
to the peak value of the AC voltage supplied by the transformer’s secondary winding. For most applications
the output ripple produced by these circuits is too high. However, for some applications - driving small
motors or lamps, for example - they are satisfactory. If a filter capacitor is added after the rectifier diodes the
output voltage waveform is improved considerably. The section b-c is a straight line. During this time it is
the filter capacitor that supplies the load current.

The slope of this line increases as the current increases, bringing point c lower. Consequently the diode
conduction time (c-d) increases, increasing ripple. With zero load current the DC output voltage is equal to
the peak value of the rectified AC voltage. Figure shows how to obtain positive and negative outputs
referred to a common ground. In particular they are helpful in determining the voltage ripple for a given load
current and filter capacitor value. The value of the voltage ripple obtained is directly proportional to the load
current and inversely proportional to the filter capacitor value. The performance of a supply commonly used
in consumer applications – in audio amplifiers.

Often the degree of stability provided by the circuits described above is insufficient and a stabilizer
circuit is needed. This circuit is often used as a reference voltage to apply to the base of a transistor of to the
input of an op amp to obtain higher output current. The simplest example of a series regulator is shown in
Figure. In this circuit the transistor is connected as a voltage follower and the output voltage is about 600 -
700mV lower than the zener voltage.

The resistor R must be dimensioned so that the zener is correctly biased and that sufficient base current
is supplied to the base of Q1. For high load currents the base current of Q1 is no longer negligible. To avoid
that the current in the zener drops to the point where effective regulation is not possible a Darlington may be
used in place of the transistor. When better performance is required the op amp circuit shown in Figure is
recommended. In this circuit the output voltage is equal to the reference voltage applied to the input of the
op amp. With a suitable output buffer higher currents can be obtained. The output voltage of the Figure 14
circuit can be varied by adding a variable divider in parallel with the zener diode and with its wiper
connected to the op amp’s input.

The design of stabilized supplies has been simplified dramatically by the introduction of voltage
regulator ICs such as the L78xx and L79xx - three-terminal series regulators which provide a very stable
output and include current limiter and thermal protection functions. Regulated power supply is mainly used
to providing power to this project because it is providing regulated dc power and it converts 220v ac supply
into regulated dc power of 5v, 9v, 12v, 15v etc. Regulated power supply consists of step down transformer,
bridge rectifier which is combination of 4 diodes connected in bridge shape. Bridge rectifier has the
maximum efficiency and it is best than other rectifiers that’s why we prefer it. This rectifier converts ac into
pulsating dc. After rectifier filter circuit is employed, usually capacitor in parallel is used as filter or we can
use number of capacitors in parallel and number of inductors in series. All these filters are low pass filters as
we required dc at the o/p. Then after capacitor voltage regulator is used for observing the pure dc o/p. We
can use various voltage regulators for obtaining pure dc o/p but we prefer 78xx series voltage regulators as
they are simpler, cheaper and easier than others.

Fig. 2.1: Circuit diagram of regulated power supply section

1) AC Input: This is the input supply from the public utility where the device will be energized. It is also
supplied directly to the relay contacts in the device which connects the load to the supply when the supply is
within 200V – 240V range.

(2) Step down transformer: It steps down the AC supply into 5v on the secondary side. It is therefore a
230/5 v transformer. Any change in the primary reflects in the secondary of the transformer. So any
fluctuations in the input are also reflected as a fluctuation in the output.

(3) Rectifier: A center tapped transformer, with four diodes for full wave rectification is used to convert the
ac voltage to a pulsating dc voltage followed by a filter, comprising of a capacitor to filter out (smooth) the
pulsation. After the rectification and smoothening, a sample of the output voltage is fed to the micro
controller. This voltage is unregulated and therefore varies as the input mains voltage varies. Since the
system is to prevent against over voltage, the transformer was designed and the windings were so selected
for the device to be able to sense and withstand input mains voltage up to 600Vac.

MICRO CONTROLLERS
AT89S51
ARDUINO
PIC
ARM7 LPC2148
Raspberry pi
MODULES
RFID
Voice module
Voice regonization module
Wired modules
GSM
GPS
Wireless modules
ZIGBEE
Bluetooth
WIFI
RF Tx and RF Rx
Encoder and Decoder

SENSORS
ULTRASONIC SENSORS
IR SENSORS
HUMIDITY SENSOR
LM35 SENSOR
HEARTBEAT SENSOR
GAS SENSOR
PIR SENSOR
LDR SENSOR

DISPLAYS
LCD
Nokia5110
4 matrixes LED
SEVEN SEGMENT DISPLAY
SWITCHES
RELAY

TRANSISTOR

KEYPAD

SWITCH

ARDUINO

Introduction to the Arduino Board


The Arduino is a family of microcontroller boards to simplify electronic design, prototyping and
experimenting for artists, hackers, hobbyists, but also many professionals. People use it as brains for their
robots, to build new digital music instruments, or to build a system that lets your house plants tweet you
when they’re dry. Arduinos (we use the standard Arduino Uno) are built around an ATmega microcontroller
essentially a complete computer with CPU, RAM, Flash memory, and input/output pins, all on a single chip.
Unlike, say, a Raspberry Pi, it’s designed to attach all kinds of sensors, LEDs, small motors and speakers,
servos, etc. directly to these pins, which can read in or output digital or analog voltages between 0 and 5
volts. The Arduino connects to your computer via USB, where you program it in a simple language (C/C++,
similar to Java) from inside the free Arduino IDE by uploading your compiled code to the board. Once
programmed, the Arduino can run with the USB link back to your computer, or stand-alone without it no
keyboard or screen needed, just power.

Figure Structure of Arduino Board


Figure: Arduino Board

Looking at the board from the top down, this is an outline of what you will see (parts of the board
you might interact with in the course of normal use are highlighted).

Starting clockwise from the top center:

➢ Analog Reference pin (orange)

➢ Digital Ground (light green)

➢ Digital Pins 2-13 (green)


➢ Digital Pins 0-1/Serial In/Out - TX/RX (dark green) - These pins cannot be used for digital i/o
(DigitalRead and DigitalWrite) if you are also using serial communication (e.g. Serial.begin).

➢ Reset Button - S1 (dark blue)

➢ In-circuit Serial Programmer (blue-green)

➢ Analog In Pins 0-5 (light blue)

➢ Power and Ground Pins (power: orange, grounds: light orange)

➢ External Power Supply In (9-12VDC) - X1 (pink)

➢ Toggles External Power and USB Power (place jumper on two pins closest to desired supply) - SV1
(purple)

➢ USB (used for uploading sketches to the board and for serial communication between the board and
the computer; can be used to power the board) (yellow)
Digital Pins

In addition to the specific functions listed below, the digital pins on an Arduino board can be used for
general purpose input and output via the pin Mode(),Digital Read(),and DigitalWrite()commands. Each
pinhas an internal pull-up resistor which can be turned on and off using digitalWrite() (w/ a value of HIGH
or LOW, respectively) when the pin is configured as an input. The maximum current per pin is 40mA.

➢ Serial: 0 (RX) and 1 (TX). Used to receive (RX) and transmit (TX) TTL serial data. On the
ArduinoDiecimila, these pins are connected to the corresponding pins of the FTDI USB-to-TTL
Serial chip. On the Arduino BT, they are connected to the corresponding pins of the WT11Bluetooth
module. On the Arduino Mini and LilyPad Arduino, they are intended for use with an external TTL
serial module (e.g. the Mini-USB Adapter).

➢ External Interrupts: 2 and 3. These pins can be configured to trigger an interrupt on a low value,
arising or falling edge, or a change in value. See the attach Interrupt()function for details.

➢ PWM: 3, 5, 6, 9, 10, and 11 Provide 8-bit PWM output with theanalog Write()function.On
boardswith an ATmega8, PWM output is available only on pins 9, 10, and 11.

➢ BT Reset: 7.(Arduino BT-only) Connected to the reset line of the bluetooth module.

➢ SPI: 10 (SS), 11 (MOSI), 12 (MISO), 13 (SCK). These pins support SPI communication,
which,although provided by the underlying hardware, is not currently included in the Arduino
language.

➢ LED: 13. On the Diecimila and LilyPad, there is a built-in LED connected to digital pin 13.
Whenthe pin is HIGH value, the LED is on, when the pin is LOW, it's off.

Analog Pins
In addition to the specific functions listed below, the analog input pins support 10-bit analog-to-
digital conversion (ADC) using the analog Read()function. Most of the analog inputs can also be used as
digital pins: analog input 0 as digital pin 14 through analog input 5 as digital pin 19. Analog inputs 6 and 7
(present on the Mini and BT) cannot be used as digital pins.
Power Pins:
➢ VIN (sometimes labeled "9V"): The input voltage to the Arduino board when it's using an
externalpowersource (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. Also note that the Lily Pad has no VIN pin and accepts only a regulated input.5V:

The regulated power supply used to power the microcontroller and other components on theboard.

This can come either from VIN via an on-board regulator, or be supplied by USB or another
regulated 5V supply.

➢ 3V3 (Diecimila-only) :A 3.3 volt supply generated by the on-board FTDI chip.
➢ GND:Ground pins.

Other Pins
➢ AREF:Reference voltage for the analog inputs. Used with analog reference().

➢ Reset: (Diecimila-only) Bring this line LOW to reset the microcontroller. Typically used to add
areset button to shields which block the one on the board.

Atmega328
Pin diagram

Figure :2.4 Pin Configuration of Atmega328

2.4.2 Pin Description and Features


VCC:
Digital supply voltage.
GND:
Ground
Port A (PA7-PA0):
Port A serves as the analog inputs to the A/D Converter. Port A also serves as an 8-bit bi-directional
I/O port, if the A/D Converter is not used. Port pins can provide internal pull-up resistors (selected for each
bit). The Port A output buffers have symmetrical drive characteristics with both high sink and source
capability. When pins PA0 to PA7 are used as inputs and are externally pulled low, they will source current
if the internal pull-up resistors are activated. The Port A pins are tri-stated when a reset condition becomes
active, even if the clock is not running.

Port B (PB7-PB0):

Port B is an 8-bit bi-directional I/O port with internal pull-up resistors (selected for each bit). The Port B
output buffers have symmetrical drive characteristics with both high sink and source capability. As inputs,
Port B pins that are externally pulled low will source current if the pull-up resistors are activated. The Port
B pins are tri-stated when a reset condition becomes active, even if the clock is not running. Port B also
serves the functions of various special features of the ATmega32.

Port C (PC7-PC0):
Port C is an 8-bit bidirectional I/O port with internal pull-up resistors (selected for each bit). The
Port

C output buffers have symmetrical drive characteristics with both high sink and source capability. As inputs,

Port C pins that are externally pulled low will source current if the pull-up resistors are activated. The Port C

pins are tri-stated when a reset condition becomes active, even if the clock is not running.

If the JTAGinterface is enabled, the pull-up resistors on pins PC5(TDI), PC3(TMS) and PC2(TCK) will be
activated

even if a reset occurs. The TD0 pin is tri-stated unless TAP states that shift out data are entered. Port C also

serves the functions of the JTAG interface.

Port D (PD7-PD0):
Port D is an 8-bit bidirectional I/O port with internal pull-up resistors (selected for each bit). The Port D
output buffers have symmetrical drive characteristics with both high sink and source capability. As inputs,
Port D pins that are externally pulled low will source current if the pull-up resistors are activated. The Port
D pins are tri-stated when a reset condition becomes active, even if the clock is not running. Port D also
serves the functions of various special features of the ATmega32.

Reset (Reset Input):

A low level on this pin for longer than the minimum pulse length will generate a reset, even if
the clock is not running. Shorter pulses are not guaranteed to generate a reset.

XTAL1:

Input to the inverting Oscillator amplifier and input to the internal clock operating circuit.

XTAL2:

Output from the inverting Oscillator amplifier.

AVCC:
AVCC is the supply voltage pin for Port A and the A/D Converter. It should be externally connected to
VCC, even if the ADC is not used. If the ADC is used, it should be connected to VCC through a low-pass
filter.

2.5 Features

➢ 1.8-5.5V operating range

➢ Part: ATMEGA328P-AU

➢ 32kB Flash program memory

➢ 1kB EEPROM

➢ 2kB Internal SRAM

➢ 2 8-bit Timer/Counters
➢ 16-bit Timer/Counter

➢ RTC with separate oscillator

➢ 6 PWM Channels

➢ 8 Channel 10-bit ADC

➢ Serial USART

➢ Master/Slave SPI interface

➢ 2-wire (I2C) interface

➢ Watchdog timer

➢ Analog comparator

➢ 23 IO lines

➢ Data retention: 20 years at 85C/ 100 years at 25C

➢ Digital I/O Pins are 14 (out of which 6 provide PWM output)

➢ Analog Input Pins are 6.

➢ DC Current per I/O is 40 mA

➢ DC Current for 3.3V Pin is 50mA

AVR CPU Core


The AVR core combines a rich instruction set with 32 general purpose working registers. All the 32
registers are directly connected to the Arithmetic Logic Unit (ALU), allowing two independent registers to
be accessed in one single instruction executed in one clock cycle. The resulting architecture is more code
efficient while achieving throughputs up to ten times faster than conventional CISC microcontrollers.

Figure : Block Diagram

Overview
This section discusses the AVR core architecture in general. The main function of the CPU core is to
ensure correct program execution. The CPU must therefore be able to access memories, perform
calculations, control peripherals, and handle interrupts.
Figure:AVR core architecture

In order to maximize performance and parallelism, the AVR uses a Harvard architecture with separate
memories and buses for program and data. Instructions in the program memory are executed with a single
level pipelining. While one instruction is being executed, the next instruction is prefetched from the program

This concept enables instructions to be executed in every clock cycle. The program memory is In-
System Reprogrammable Flash memory. The fast-access Register File contains 32 x 8-bit general purpose
working registers with a single clock cycle access time. This allows single-cycle Arithmetic Logic Unit
(ALU) operation. In a typical ALU operation, two operands are output from the Register File, the operation
is executed, and the result is stored back in the Register File in one clock cycle.

Six of the 32 registers can be used as three 16-bit indirect address register pointers for Data Space
addressing – enabling efficient address calculations. One of these address pointers can also be used as an
address pointer for look up tables in Flash program memory. These added function registers are the 16-bit
X-, Y-, and Z-register, described later in this section. The ALU supports arithmetic and logic operations
between registers or between a constant and a register. Single register operations can also be executed in the
ALU. After an arithmetic operation, the Status Register is updated to reflect information about the result of
the operation. Program flow is provided by conditional and unconditional jump and call instructions, able to
directly address the whole address space. Most AVR instructions have a single 16-bit word format. Every
program memory address contains a 16- or 32-bit instruction. Program Flash memory space is divided in
two sections, the Boot Program section and the Application Program section. Both sections have dedicated
Lock bits for write and read/write protection.
The SPM instruction that writes into the Application Flash memory section must reside in the Boot
Program section. During interrupts and subroutine calls, the return address Program Counter (PC) is stored
on the Stack. The Stack is effectively allocated in the general data SRAM, and consequently the Stack size
is only limited by the total SRAM size and the usage of the SRAM. All user programs must initialize the SP
in the Reset routine (before subroutines or interrupts are executed). The Stack Pointer (SP) is read/write
accessible in the I/O space. The data SRAM can easily be accessed through the five different addressing
modes supported in the AVR architecture.
The memory spaces in the AVR architecture are all linear and regular memory maps. A flexible
interrupt module has its control registers in the I/O space with an additional Global Interrupt Enable bit in
the Status Register. All interrupts have a separate Interrupt Vector in the Interrupt Vector table. The
interrupts have priority in accordance with their Interrupt Vector position. The lower the Interrupt Vector
address, the higher the priority.
Arduino with ATmega328
The Arduino Uno is a microcontroller board based on the ATmega328 (datasheet). It has 14 digital
input/output pins (of which 6 can be used as PWM outputs), 6 analog inputs, a 16 MHz ceramic resonator, a
USB connection, a power jack, an ICSP header, and a reset button. It contains everything needed to support
the microcontroller; simply connect it to a computer with a USB cable or power it with a AC-to-DC adapter
or battery to get started.
The Uno differs from all preceding boards in that it does not use the FTDI USB-to-serial driver chip.
Instead, it features the Atmega16U2 (Atmega8U2 up to version R2) programmed as a USB-to-serial converter.

➢ Pin out: Added SDA and SCL pins that are near to the AREF pin and two other new pins placed near to
the RESET pin, the IOREF that allow the shields to adapt to the voltage provided from the board. In
future, shields will be compatible with both the board that uses the AVR, which operates with 5V and
with the Arduino. Due that operates with 3.3V. The second one is a not connected pin that is reserved for
future purposes.

➢ Stronger RESET circuit

➢ Atmega 16U2 replace the 8U2.

"Uno" means one in Italian and is named to mark the upcoming release of Arduino 1.0. The Uno and
version 1.0 will be the reference versions of Arduino, moving forward. The Uno is the latest in a series of USB
Arduino boards, and the reference model for the Arduino platform; for a comparison with previous versions, see
the index of Arduino boards.

Arduino Characteristics:
Power:
12V, the voltage regulator may overheat and damage the board. The recommended range is 7 to 12 volts.
The Arduino Uno can be powered via the USB connection or with an external power supply. The power source
is selected automatically. External (non-USB) power can come either from an AC-to-DC adapter (wall-wart) or
battery. The adapter can be connected by plugging a 2.1mm center-positive plug into the board's power jack.
Leads from a battery can be inserted in the Gnd and Vin pin headers of the POWER connector. The board can
operate on an external supply of 6 to 20 volts. If supplied with less than 7V, however, the 5V pin may supply
less than five volts and the board may be unstable. If using more than. The power pins are as follows:
➢ VIN: The input voltage to the Arduino board when it's using an external power source (as opposed to5
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
withpower either from the DC power jack (7 - 12V), the USB connector (5V), or the VIN pin of the
board (7-12V). Supplying voltage via the 5V or 3.3V pins bypasses the regulator, and can damage your
board. We don't advise it.
➢ 3V3.A 3.3 volt supply generated by the on-board regulator. Maximum current draw is 50 mA.
➢ GND.Ground pins.
➢ IOREF. This pin on the Arduino board provides the voltage reference with which themicrocontroller
operates. A properly configured shield can read the IOREF pin voltage and select the appropriate power
source or enable voltage translators on the outputs for working with the 5V or 3.3V.

Memory:

The ATmega328 has 32 KB (with 0.5 KB used for 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).

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

A Software Serial libraryallows for serial communication on any of the Uno's digital pins. The
ATmega328 also supports I2C (TWI) and SPI communication. The Arduino software includes a Wire library to
simplify use of the I2C bus. For SPI communication, use the SPI library.

AT89S51/52
Microcontroller section
A microcontroller is basically a microprocessor in addition to a fixed amount of RAM, ROM, I/O ports and
timer all on a single chip. In other words, the processor, the RAM, ROM, I/O ports, and timer all are embedded
together on one chip. Therefore the designer cannot add any external memory, I/O, or timer to it.

Philips P89V51RD2 Microcontroller

I am using Philips P89V51RD2 as 8051 Microcontroller Unit (MCU). And I have been developing my code
with Open source C Compiler SDCC. Please visit my Tools page for software preparation guides.

The P89V51RD2 is a 80C51 microcontroller with 64 KB Flash and 1024 bytes of data RAM. A key feature
of the P89V51RD2 is its X2 mode option. The design engineer can choose to run the application with the
conventional 80C51 clock rate (12 clocks per machine cycle) or select the X2 mode (6 clocks per machine
cycle) to achieve twice the throughput at the same clock frequency. Another way to benefit from this feature is
to keep the same performance by reducing the clock frequency by half, thus dramatically reducing the EMI.

The Flash program memory supports both parallel programming and in serial In-System Programming
(ISP). Parallel programming mode offers gang-programming at high speed, reducing programming costs and
time to market. ISP allows a device to be reprogrammed in the end product under software control. The
capability to field/update the application firmware makes a wide range of applications possible. The
P89V51RD2 is also In-Application Programmable (IAP), allowing the Flash program memory to be
reconfigured even while the application is running.

Features

 80C51 Central Processing Unit


 5 V Operating voltage from 0 MHz to 40 MHz
 64 KB of on-chip Flash user code memory with ISP (In-System Programming) and IAP.
 Supports 12-clock (default) or 6-clock mode selection via software or ISP
 SPI (Serial Peripheral Interface) and enhanced UART
 PCA (Programmable Counter Array) with PWM and Capture/Compare functions
 Four 8-bit I/O ports with three high-current Port 1 pins (16 mA each)
 Three 16-bit timers/counters
 Programmable watchdog timer
 Eight interrupt sources with four priority levels
 Second DPTR register
 Low EMI mode (ALE inhibit)
 TTL- and CMOS-compatible logic levels
 Brown-out detection
 Low power modes
 Power-down mode with external interrupt wake-up
 Idle mode
 DIP40 packages

ARCHITECTURE AND PROGRAMMING OF 8051/89C51

Read Only Memory (ROM)

Read Only Memory (ROM) is a type of memory used to permanently save the program being executed. The
size of the program that can be written depends on the size of this memory. ROM can be built in the
microcontroller or added as an external chip, which depends on the type of the microcontroller. Both options
have some disadvantages. If ROM is added as an external chip, the microcontroller is cheaper and the program
can be considerably longer. At the same time, a number of available pins is reduced as the microcontroller uses
its own input/output ports for connection to the chip. The internal ROM is usually smaller and more expensive,
but leaves more pins available for connecting to peripheral environment. The size of ROM ranges from 512B to
64KB.

Random Access Memory (RAM)

Random Access Memory (RAM) is a type of memory used for temporary storing data and intermediate
results created and used during the operation of the microcontrollers. The content of this memory is cleared
once the power supply is off. For example, if the program perform an addition, it is necessary to have a register
standing for what in everyday life is called the “sum”. For that purpose, one of the registers in RAM is called
the "sum" and used for storing results of addition. The size of RAM goes up to a few KBs. Electrically Erasable
Programmable ROM (EEPROM) The EEPROM is a special type of memory not contained in all
microcontrollers. Its contents may be changed during program execution (similar to RAM), but remains
permanently saved even after the loss of power (similar to ROM). It is often used to store values, created and
used during operation (such as calibration values, codes, values to count up to etc.), which must be saved after
turning the power supply off. A disadvantage of this memory is that the process of programming is relatively
slow. It is measured in milliseconds.

Special Function Registers (SFR)

Special function registers are part of RAM memory. Their purpose is predefined by the manufacturer and
cannot be changed therefore. Since their bits are physically connected to particular circuits within the
microcontroller, such as A/D converter, serial communication module etc., any change of their state directly
affects the operation of the microcontroller or some of the circuits. For example, writing zero or one to the SFR
controlling an input/output port causes the appropriate port pin to be configured as input or output. In other
words, each bit of this register controls the function of one single pin.

3.3.4. Program Counter

Program Counter is an engine running the program and points to the memory address containing the next
instruction to execute. After each instruction execution, the value of the counter is incremented by 1. For this
reason, the program executes only one instruction at a time just as it is written. However…the value of the
program counter can be changed at any moment, which causes a “jump” to a new memory location. This is how
subroutines and branch instructions are executed. After jumping, the counter resumes even and monotonous
automatic counting +1, +1, +1.

3.4. INTERFACING TO EXTERNAL MEMORY

The number of bits that a semiconductor memory chip can store is called chip capacity

1. It can be in units of K bits (kilobits), M bits (megabits), and so on


2. This must be distinguished from the storage capacity of computer systems
3. While the memory capacity of a memory IC chip is always given bits, the memory capacity of a
computer system is given in bytes
4. 16M memory chip – 16 megabits
5. A computer comes with 16M memory – 16 megabytes
Memory chips are organized into a number of locations within the IC. Each location can hold 1 bit, 4 bits, 8
bits, or even 16 bits, depending on how it is designed internally. The number of locations within a memory IC
depends on the address pins. The number of bits that each location can hold is always equal to the number of
data pins.

One of the most important characteristics of a memory chip is the speed at which its data can be accessed.
To access the data, the address is presented to the address pins, the READ pin is activated, and after a certain
amount of time has elapsed, the data shows up at the data pins. The shorter this elapsed time, the better, and
consequently, the more expensive the memory chip. The speed of the memory chip is commonly referred to as
its access time.

In connecting a memory chip to the CPU, note the following points

1. The data bus of the CPU is connected directly to the data pins of the memory chip
2. Control signals RD (read) and WR (memory write) from the CPU are connected to the OE (output
enable) and WE (write enable) pins of the memory chip
3. In the case of the address buses, while the lower bits of the address from the CPU go directly to the
memory chip address pins, the upper ones are used to activate the CS pin of the memory chip
4. ALE (address latch enable) pin is an output pin for 8051
 ALE = 0, P0 is used for data path
 ALE = 1, P0 is used for address path

Fig. 3.1: Block diagram of 8051


3.5. PIN DESCRIPTION

Fig. 3.2: Pin Diagram

Pins 1-8 (Port 1): Each of these pins can be configured as an input or an output.

Pin 9 (RESET): It is an input and is active high. Upon applying a high pulse to this pin the microcontroller will
reset and terminate all activities. This is often referred to as a power on reset .Activating a power on reset will
cause all values the registers to be lost. It will set program counter to all 0s.In order for the RESET input to be
effective it must have a minimum duration of two machine cycles.

Pins 10-17 (Port 3): Similar to port 1, each of these pins can serve as general input or output. Besides, all of
them have alternative functions.

Pin 10 (RXD): Serial asynchronous communication input or Serial synchronous communication output.

Pin 11 (TXD): Serial asynchronous communication output or Serial synchronous communication clock output.

Pin 12 (INT0): Interrupt 0 inputs.

Pin 13 (INT1): Interrupt 1 input.


Pin 14 (T0): Timer 0 clock input.

Pin 15 (T1): Timer 1 clock input.

Pin 16 (WR): Write to external (additional) RAM.

Pin 17 (RD): Read from external RAM.

Pin 18, 19 (XTAL2, XTAL1): Internal oscillator input and output. A quartz crystal which specifies operating
frequency is usually connected to these pins. The quartz crystal oscillator connected to XTAL1 and XTAL2 also
needs two capacitors of 33 pf value. One side of each capacitor is connected to the ground. Speed refers to the
maximum oscillator frequency connected to XTAL .When the 8051 is connected to a crystal oscillator is
powered up we can observe the frequency on the XTAL2 pin using the oscilloscope.

Pin 20 (GND): Ground.

Pins 21-28 (Port 2): If there is no intention to use external memory then these port pins are configured as
general inputs/outputs. In case external memory is used, the higher address byte, i.e. addresses A8-A15 will
appear on this port. Even though memory with capacity of 64Kb is not used, which means that not all eight port
bits are used for its addressing, the rest of them are not available as inputs/outputs.

Pin 29 (PSEN): If external ROM is used for storing program then logic zero (0) appears on it every time the
microcontroller reads a byte from memory.

Pin 30 (ALE): Address Latch enable is an output pin and is active high.

When connecting an 8031 to external memory, port 0 provides both address and data. In other words the 8031
multiplexes address and data through port 0 to save pins. The ALE pin is used for de-multiplexing the address
and data by connecting to G pin of the 74LS373 chip.

Pin 31 (EA): EA which stands for “external access”. It is an input pin and must be connected to either VCC or
GND. By applying logic zero to this pin, P2 and P3 are used for data and address transmission with no regard to
whether there is internal memory or not. It means that even there is a program written to the microcontroller, it
will not be executed. Instead, the program written to external ROM will be executed. By applying logic one to
the EA pin, the microcontroller will use both memories, first internal then external (if exists).

Pins 32-39 (Port 0): Port 0 is also designated as AD0-AD7 allowing it to be used for both address and data.
When connecting an 8051/31 to an external memory, port 0 provides both address and data. The 8051
multiplexes address and data through port 0 to save pins. ALE indicates if p0 has address A0-A7.in the 8051
based systems where there is no external memory connection the pins of P0 must be connected externally to
10k-ohm pull-up resistor. This is due to the fact that P0 is an open drain, unlike P1, P2 and P3

Pin 40 (VCC): +5V power supply.


3.6. TMOD (Timer mode, Addresses 89H)

The Timer Mode SFR is used to configure the mode of operation of each of the two timers. Using this SFR
program may configure each timer to be a 16-bit timer, an 8-bit auto reload timer, a 13-bit timer, or two separate
timers. Additionally, one may configure the timers to only count when an external pin is activated or to count
"events" that are indicated on an external pin.

Fig. 3.3: TMOD register

TL0/TH0 (Timer 0 Low/High, Addresses 8AH/8CH):

These two SFRs, taken together, represent timer 0. Their exact behavior depends on how the timer is
configured in the TMOD SFR; however, these timers always count up. What is configurable is how and when
they increment in value.

TL1/TH1 (Timer 1 Low/High, Addresses 8BH/8DH)

These two SFRs, taken together, represent timer 1. Their exact behavior depends on how the timer is
configured in the TMOD SFR; however, these timers always count up. What is configurable is how and when
they increment in value.
Fig. 3.4: Circuit diagram of microcontroller board

Fig. : 3d view of microcontroller board


PIC CONTROLLER

PIC microcontroller was developed in the year 1993 by microchip technology. The term PIC stands for
Peripheral Interface Controller. Initially this was developed for supporting PDP computers to control its
peripheral devices, and therefore, named as a peripheral interface device. These microcontrollers are very fast
and easy to execute a program compared with other microcontrollers. PIC Microcontroller architecture is based
on Harvard architecture. PIC microcontrollers are very popular due to their ease of programming, wide
availability, easy to interfacing with other peripherals, low cost, large user base and serial programming
capability (reprogramming with flash memory), etc.

We know that the microcontroller is an integrated chip which consists of CPU, RAM, ROM, timers, and
counters, etc. In the same way, PIC microcontroller architecture consists of RAM, ROM, CPU, timers, counters
and supports the protocols such as SPI, CAN, and UART for interfacing with other peripherals. At present PIC
microcontrollers are extensively used for industrial purpose due to low power consumption, high performance
ability and easy of availability of its supporting hardware and software tools like compilers, debuggers and
simulators.
What is a PIC Microcontroller?

PIC (Programmable Interface Controllers) microcontrollers are the worlds smallest microcontrollers that
can be programmed to carry out a huge range of tasks. These microcontrollers are found in many electronic
devices such as phones, computer control systems, alarm systems, embedded systems, etc. Various types
of microcontrollers exist, even though the best are found in the GENIE range of
programmable microcontrollers. These microcontrollers are programmed and simulated by a circuit-wizard
software.

Every PIC microcontroller architecture consists of some registers and stack where registers function as
Random Access Memory( RAM) and stack saves the return addresses. The main features of PIC
microcontrollers are RAM, flash memory, Timers/Counters, EEPROM, I/O Ports, USART, CCP
(Capture/Compare/PWM module), SSP, Comparator, ADC (analog to digital converter), PSP(parallel slave
port), LCD and ICSP (in circuit serial programming) The 8-bit PIC microcontroller is classified into four types
on the basis of internal architecture such as Base Line PIC, Mid Range PIC, Enhanced Mid Range PIC and
PIC18

Architecture of PIC Microcontroller

The PIC microcontroller architecture comprises of CPU, I/O ports, memory organization, A/D converter,
timers/counters, interrupts, serial communication, oscillator and CCP module which are discussed in detailed
below.
Architecture of PIC Microcontroller

CPU (Central Processing Unit)

It is not different from other microcontrollers CPU and the PIC microcontroller CPU consists of the
ALU, CU, MU and accumulator, etc. Arithmetic logic unit is mainly used for arithmetic operations and to take
logical decisions. Memory is used for storing the instructions after processing. To control the internal and
external peripherals, control unit is used which are connected to the CPU and the accumulator is used for
storing the results and further process.

Memory Organization

The memory module in the PIC microcontroller architecture consists of RAM (Random Access
Memory), ROM (Read Only Memory) and STACK.

Random Access Memory (RAM)

RAM is an unstable memory which is used to store the data temporarily in its registers. The RAM memory
is classified into two banks, and each bank consists of so many registers. The RAM registers are classified into
two types: Special Function Registers (SFR) and General Purpose Registers (GPR).

 General Purpose Registers (GPR)

These registers are used for general purpose only as the name implies. For example, if we want to multiply
two numbers by using the PIC microcontroller. Generally, we use registers for multiplying and storing the
numbers in other registers. So these registers don’t have any special function,- CPU can easily access the data in
the registers.

 Special Function Registers

These registers are used for special purposes only as the name SFR implies. These registers will perform
according to the functions assigned to them , and they cannot be used as normal registers. For example, if you
cannot use the STATUS register for storing the data, these registers are used for showing the operation or status
of the program. So, user cannot change the function of the SFR; the function is given by the retailer at the time
of manufacturing.
Memory Organization

Read Only Memory (ROM)

Read only memory is a stable memory which is used to store the data permanently. In
PIC microcontroller architecture, the architecture ROM stores the instructions or program, according to the
program the microcontroller acts. The ROM is also called as program memory, wherein the user will write the
program for microcontroller and saves it permanently, and finally the program is executed by the CPU.
The microcontrollers performance depends on the instruction, which is executed by the CPU.

Electrically Erasable Programmable Read Only Memory (EEPROM)

In the normal ROM, we can write the program for only once we cannot use again the microcontroller for
multiple times. But, in the EEPROM, we can program the ROM multiple times.

Flash Memory

Flash memory is also programmable read only memory (PROM) in which we can read, write and erase
the program thousands of times. Generally, the PIC microcontroller uses this type of ROM.

Stack

When an interrupt occurs, first the PIC microcontroller has to execute the interrupt and the existing
process address. Then that is being executed is stored in the stack. After completing the execution of the
interrupt, the microcontroller calls the process with the help of address, which is stored in the stack and get
executes the process.
I/O Ports
 The series of PIC16 consists of five ports such as Port A, Port B, Port C, Port D & Port E.
 Port A is an 16-bit port that can be used as input or output port based on the status of the TRISA (Tradoc
Intelligence Support Activity) register.

 Port B is an 8- bit port that can be used as both input and output port.

 Port C is an 8-bit and the input of output operation is decided by the status of the TRISC register.

 Port D is an 8-bit port acts as a slave port for connection to the microprocessor BUS.

 Port E is a 3-bit port which serves the additional function of the control signals to the analog to digital
converter.

BUS

BUS is used to transfer and receive the data from one peripheral to another. It is classified into two types
such as data bus and address.

Data Bus: It is used for only transfer or receive the data.

Address Bus: Address bus is used to transmit the memory address from the peripherals to the CPU. I/O pins are
used to interface the external peripherals; UART and USART both are serial communication protocols which
are used for interfacing serial devices like GSM, GPS, Bluetooth, IR , etc.

A/D converters

The main intention of this analog to digital converter is to convert analog voltage values to digital
voltage values. A/D module of PIC microcontroller consists of 5 inputs for 28 pin devices and 8 inputs for 40
pin devices. The operation of the analog to digital converter is controlled by ADCON0 and ADCON1 special
registers. The upper bits of the converter are stored in register ADRESH and lower bits of the converter are
stored in register ADRESL. For this operation, it requires 5V of an analog reference voltage.
A/D CONVERTER

Timers/ Counters

PIC microcontroller has four timer/counters wherein the one 8-bit timer and the remaining timers have
the choice to select 8 or 16-bit mode. Timers are used for generating accuracy actions, for example, creating
specific time delays between two operations.

Interrupts

PIC microcontroller consists of 20 internal interrupts and three external interrupt sources which are associated
with different peripherals like ADC, USART, Timers, and so on.

Serial Communication

Serial communication is the method of transferring data one bit at a time sequentially over a communication
channel.

 USART: The name USART stands for Universal synchronous and Asynchronous Receiver and
Transmitter which is a serial communication for two protocols. It is used for transmitting and receiving
the data bit by bit over a single wire with respect to clock pulses. The PIC microcontroller has two pins
TXD and RXD. These pins are used for transmitting and receiving the data serially.

 SPI Protocol: The term SPI stands for Serial Peripheral Interface. This protocol is used to send data
between PIC microcontroller and other peripherals such as SD cards, sensors and shift registers.
PIC microcontroller support three wire SPI communications between two devices on a common clock
source. The data rate of SPI protocol is more than that of the USART.
 I2C Protocol: The term I2C stands for Inter Integrated Circuit , and it is a serial protocol which is used
to connect low speed devices such as EEPROMS, microcontrollers, A/D converters, etc.
PIC microcontroller support two wire Interface or I2C communication between two devices which can
work as both Master and Slave device.

Serial Communication

Oscillators

Oscillators are used for timing generation. Pic microcontroller consist of external oscillators like RC oscillators
or crystal oscillators. Where the crystal oscillator is connected between the two oscillator pins. The value of the
capacitor is connected to every pin that decides the mode of the operation of the oscillator. The modes are
crystal mode, high-speed mode and the low-power mode. In case of RC oscillators, the value of the resistor &
capacitor determine the clock frequency and the range of clock frequency is 30KHz to 4MHz.

CCP module

The name CCP module stands for capture/compare/PWM where it works in three modes such as capture
mode, compare mode and PWM mode.

 Capture Mode: Capture mode captures the time of arrival of a signal, or in other words, when the CCP
pin goes high, it captures the value of the Timer1.

 Compare Mode: Compare mode acts as an analog comparator. When the timer1 value reaches a certain
reference value, then it generates an output.

 PWM Mode: PWM mode provides pulse width modulated output with a 10-bit resolution and
programmable duty cycle.
PIC Microcontroller Applications

The PIC microcontroller projects can be used in different applications, such as peripherals, audio accessories,
video games, etc. For better understanding of this PIC microcontroller, the following project demonstrates PIC
microcontroller’s operations.

Street Light that Glows on Detecting Vehicle Movement:

The main intention of this project is to detect the movement of vehicles on highways to switch on a block of
street lights ahead of it, and also switch off the trailing lights to conserve energy. In this project, a PIC
microcontroller is done by using assembly language or embedded C.

Street Light that Glows on Detecting Vehicle Movement by Edgefxkits.com

The power supply gives the power to the total circuit by stepping down, rectifying, filtering and
regulating AC mains supply. When there are no vehicles on highway, then all lights will turn OFF so that the
power can be conserved. The IR sensors are placed on the road to sense the vehicle movement. When there are
vehicles on highway, then the IR sensor senses the vehicle movement immediately, it sends the commands to
the PIC microcontroller to switch ON/OFF the LEDs. A bunch of LEDS will be turned on when a vehicle come
near to the sensor and once the vehicle passes away from the sensor the intensity will become lower than the
LEDs will turn OFF

Advantages of PIC Microcontroller:


 PIC microcontrollers are consistent and faulty of PIC percentage is very less. The performance of the
PIC microcontroller is very fast because of using RISC architecture.
 When comparing to other microcontrollers, power consumption is very less and programming is also
very easy.

 Interfacing of an analog device is easy without any extra circuitry

Disadvantages of PIC Microcontroller:


 The length of the program is high due to using RISC architecture (35 instructions)
 One single accumulator is present and program memory is not accessible

ARM7

LPC2148
ARM based LPC2148

1 Introduction

The LPC2148 microcontrollers are based on a 32/16 bit ARM7TDMI-S CPU with real-time emulation and
embedded trace support, that combines the microcontroller with embedded high speed flash memory ranging
from 32 kB to 512 kB. A 128-bit wide memory interface and a unique accelerator architecture enable 32-bit
code execution at the maximum clock rate. For critical code size applications, the alternative 16-bit Thumb
mode reduces code by more than 30 % with minimal performance penalty. Due to their tiny size and low power
consumption, LPC2141/2/4/6/8 are ideal for applications where miniaturization is a key requirement, such as
access control and point-of-sale. A blend of serial communications interfaces ranging from a USB 2.0 Full
Speed device, multiple UARTS, SPI, SSP to I2Cs and on-chip SRAM of 8 kB up to 40 kB, make these devices
very well suited for communication gateways and protocol converters, soft modems, voice recognition and low
end imaging, providing both large buffer size and high processing power. Various 32-bit timers, single or dual
10-bit ADC(s), 10-bit DAC, PWM channels and 45 fast GPIO lines with up to nine edge or level sensitive
external
interrupt pins make these microcontrollers particularly suitable for industrial control and
medical systems.
2 Features

• 16/32-bit ARM7TDMI-S microcontroller in a tiny LQFP64 package.


• 8 to 40 kB of on-chip static RAM and 32 to 512 kB of on-chip flash program memory.128 bit wide
interface/accelerator enables high speed 60 MHz operation.
• In-System/In-Application Programming (ISP/IAP) via on-chip boot-loader software. Single flash sector or full
chip erase in 400 ms and programming of 256 bytes in 1 ms.
• Embedded ICE RT and Embedded Trace interfaces offer real-time debugging with the on-chip Real Monitor
software and high speed tracing of instruction execution.
• USB 2.0 Full Speed compliant Device Controller with 2 kB of endpoint RAM. In addition, the LPC2146/8
provides 8 kB of on-chip RAM accessible to USB by DMA.
• One or two (LPC2141/2 vs. LPC2144/6/8) 10-bit A/D converters provide a total of 6/14 analog inputs, with
conversion times as low as 2.44 μs per channel.
• Single 10-bit D/A converter provide variable analog output.
• Two 32-bit timers/external event counters (with four capture and four compare channels each), PWM unit (six
outputs) and watchdog.
• Low power real-time clock with independent power and dedicated 32 kHz clock input.
• Multiple serial interfaces including two UARTs (16C550), two Fast I2C-bus (400 kbit/s), SPI and SSP with
buffering and variable data length capabilities.
• Vectored interrupt controller with configurable priorities and vector addresses.
• Up to 45 of 5 V tolerant fast general purpose I/O pins in a tiny LQFP64 package.
• Up to nine edge or level sensitive external interrupt pins available.
• 60 MHz maximum CPU clock available from programmable on-chip PLL with settling time of 100 μs.
• On-chip integrated oscillator operates with an external crystal in range from 1 MHz to 30 MHz and with an
external oscillator up to 50 MHz
• Power saving modes include Idle and Power-down.
• Individual enable/disable of peripheral functions as well as peripheral clock scaling for
Additional power optimization.
• Processor wake-up from Power-down mode via external interrupt, USB, Brown-Out
Detect (BOD) or Real-Time Clock (RTC).
• Single power supply chip with Power-On Reset (POR) and BOD circuits:
– CPU operating voltage range of 3.0 V to 3.6 V (3.3 V ± 10 %) with 5 V tolerant I/O
Pads.
.3 Applications

• Industrial control
• Medical systems
• Access control
• Point-of-sale
• Communication gateway
• Embedded soft modem
• General purpose applications

Device information

2.1.4 Architectural overview

The LPC2148 consists of an ARM7TDMI-S CPU with emulation support, the ARM7 Local Bus for interface to
on-chip memory controllers, the AMBA Advanced High-performance Bus (AHB) for interface to the interrupt
controller, and the VLSI Peripheral Bus (VPB, a compatible superset of ARM’s AMBA Advanced Peripheral
Bus) for connection to on-chip peripheral functions. The LPC2148 configures the ARM7TDMI-S processor in
little-endian byte order. AHB peripherals are allocated a 2 megabyte range of addresses at the very top of the 4
gigabyte ARM memory space. Each AHB peripheral is allocated a 16 kB address space within the AHB address
space. LPC2148 peripheral functions (other than the interrupt controller) are connected to the VPB bus. The
AHB to VPB bridge interfaces the
VPB bus to the AHB bus. VPB peripherals are also allocated a 2 megabyte range of addresses, beginning at the
3.5 gigabyte address point. Each VPB peripheral is allocated a 16 kB address space within the VPB address
space. The connection of on-chip peripherals to device pins is controlled by a Pin Connect Block (see chapter
"Pin Connect Block" on page 75). This must be configured by software to fit
Specific application requirements for the use of peripheral functions and pins.

ARM7TDMI-S processor
The ARM7TDMI-S is a general purpose 32-bit microprocessor, which offers high performance and very low
power consumption. The ARM architecture is based on Reduced Instruction Set Computer (RISC) principles,
and the instruction set and related decode mechanism are much simpler than those of micro programmed
Complex Instruction Set Computers. This simplicity results in a high instruction throughput and impressive
real-time interrupt response from a small and cost-effective processor core.
Pipeline techniques are employed so that all parts of the processing and memory systems can operate
continuously. Typically, while one instruction is being executed, its successor is being decoded, and a third
instruction is being fetched from memory. The ARM7TDMI-S processor also employs a unique architectural
strategy known as THUMB, which makes it ideally suited to high-volume applications with memory
restrictions, or applications where code density is an issue. The key idea behind THUMB is that of a super-
reduced instruction set. Essentially, the ARM7TDMI-S processor has two instruction sets:

• The standard 32-bit ARM instruction set.


• A 16-bit THUMB instruction set.
The THUMB set’s 16-bit instruction length allows it to approach twice the density of standard ARM code while
retaining most of the ARM’s performance advantage over a traditional 16-bit processor using 16-bit registers.
This is possible because THUMB code operates on the same 32-bit register set as ARM code.
THUMB code is able to provide up to 65% of the code size of ARM, and 160% of the performance of an
equivalent ARM processor connected to a 16-bit memory system. The ARM7TDMI-S processor is described in
detail in the ARM7TDMI-S Datasheet that can be found on official ARM website.

On-chip Flash memory system


The LPC2141/2/4/6/8 incorporates a 32 kB, 64 kB, 128 kB, 256 kB, and 512 kB Flash memory system
respectively. This memory may be used for both code and data storage. Programming of the Flash memory may
be accomplished in several ways: over the serial built-in JTAG interface, using In System Programming (ISP)
and UART0, or by means of In Application Programming (IAP) capabilities. The application program, using the
IAP functions, may also erase and/or program the Flash while the application is running, allowing a great
degree of flexibility for data storage field firmware upgrades, etc. When the LPC2148 on-chip boot loader is
used, 32 kB, 64 kB, 128 kB, 256 kB, and 500 kB of Flash memory is available for user code. The LPC2148
Flash memory provides minimum of 100,000 erase/write cycles and 20 years of data-retention.

1.8 On-chip Static RAM (SRAM)


On-chip Static RAM (SRAM) may be used for code and/or data storage. The on-chip SRAM may be
accessed as 8-bits, 16-bits, and 32-bits. The LPC2148 provide 8/16/32 kB of static RAM respectively. The
LPC2148 SRAM is designed to be accessed as a byte-addressed memory.
Word and halfword accesses to the memory ignore the alignment of the address and access the naturally-aligned
value that is addressed (so a memory access ignores address bits 0 and 1 for word accesses, and ignores bit 0 for
halfword accesses).Therefore valid reads and writes require data accessed as halfwords to originate from
addresses with address line 0 being 0 (addresses ending with 0, 2, 4, 6, 8, A, C, and E in hexadecimal notation)
and data accessed as words to originate from addresses with address lines 0 and 1 being 0 (addresses ending
with 0, 4, 8, and C in hexadecimal notation). This rule applies to both off and on-chip memory usage. The
SRAM controller incorporates a write-back buffer in order to prevent CPU stalls during back-to-back writes.
The write-back buffer always holds the last data sent by software to the SRAM.
This data is only written to the SRAM when another write is requested by Software (the data is only
written to the SRAM when software does another write). If a chip reset occurs, actual SRAM contents will not
reflect the most recent write request (i.e. after a "warm" chip reset, the SRAM does not reflect the last write
operation). Any software that checks SRAM contents after reset must take this into account. Two identical
writes to a location guarantee that the data will be present after a Reset. Alternatively, a dummy write operation
before entering idle or power-down mode will similarly guarantee that the last data written will be present in
SRAM after a subsequent Reset.
5 Block diagram
5 Memory maps

The LPC2141/2/4/6/8 incorporates several distinct memory regions, shown in the following figures. Figure 2
shows the overall map of the entire address space from the user program viewpoint following reset. The
interrupt vector area supports address remapping, which is described later in this section.

LPC2141/2142/2144/2146/2148 memory re-mapping and boot block


Memory map concepts and operating modes
The basic concept on the LPC2141/2/4/6/8 is that each memory area has a "natural" location in the memory
map. This is the address range for which code residing in that area is written. The bulk of each memory space
remains permanently fixed in the same location, eliminating the need to have portions of the code designed to
run in different address ranges. Because of the location of the interrupt vectors on the ARM7 processor (at
addresses 0x0000 0000 through 0x0000 001C, as shown in Table 3 below), a small portion of the Boot Block
and SRAM spaces need to be re-mapped in order to allow alternative uses of interrupts in the different operating
modes described in Table 4.

Memory re-mapping

In order to allow for compatibility with future derivatives, the entire Boot Block is mapped to the top of the on-
chip memory space. In this manner, the use of larger or smaller flash modules will not require changing the
location of the Boot Block (which would require changing the Boot Loader code itself) or changing the
mapping of the Boot Block interrupt vectors. Memory spaces other than the interrupt vectors remain in fixed
locations. Shows the on-chip memory mapping in the modes defined above.
The portion of memory that is re-mapped to allow interrupt processing in different modes includes the
interrupt vector area (32 bytes) and an additional 32 bytes, for a total of 64 bytes. The re-mapped code locations
overlay addresses 0x0000 0000 through 0x0000 003F. A typical user program in the Flash memory can place
the entire FIQ handler at address 0x0000 001C without any need to consider memory boundaries. The vector
contained in the SRAM, external memory, and Boot Block must contain branches to the actual interrupt
handlers, or to other instructions that accomplish the branch to the interrupt handlers. There are three reasons
this configuration was chosen:
1. To give the FIQ handler in the Flash memory the advantage of not having to take a memory boundary caused
by the remapping into account.
2. Minimize the need to for the SRAM and Boot Block vectors to deal with arbitrary boundaries in the middle
of code space.
3. To provide space to store constants for jumping beyond the range of single word branch instructions.
Re-mapped memory areas, including the Boot Block and interrupt vectors, continue to appear in their original
location in addition to the re-mapped address.
4. Minimize the need to for the SRAM and Boot Block vectors to deal with arbitrary boundaries in the middle
of code space.
5. To provide space to store constants for jumping beyond the range of single word branch instructions.
Re-mapped memory areas, including the Boot Block and interrupt vectors, continue to appear in their original
location in addition to the re-mapped address.
2.1.6 Pin description for LPC2148
2.1.7 GPIO

Features

1. GPIO will give the direction control (whether the selected pin is used as input pin or output pin) of individual
bits. It can be achieved by IODIR [1].

2. We can set the values of register by writing one, produces high at the corresponding port pins, whereas
writing zero will have no effect. It can be done by using IOSET. Whenever we use i.e. when we set any value
we have to clear those bit using IOCLR. IOCLR will clear the particular bits we have selected [1].

3. After reset, by default all the I/O will act as input pins.

Pin Description

TheLPC2148 processor has totally four ports.

1. Port0 has 32 pins and all can be used as input/output. All pins of this port can be used as general purpose
input/output. The number of pins available for input/output operation will depends on the use of
alternate functions i.e. if we use less alternate functions more are the available input/output’s [1].Port
Pins P0.24,P0.26,P0.27 are not available.
2. Port1 has16 pins and all can be used as input/output. All pins of this port can be used as general purpose
input/output. This is same as port0, only difference is this port has only 16pins where as port0 has 32
pins [1].

Pin Name Type Description


General purpose input/output. The number of
GPIOs available depends on the use of functions.
P0.0 – P0.31 Input/

P1.16 – P1.31 Output

Table 2.1: GPIO PIN Description.

Register Description
As we seen in the above table it is clear that LPC2148 has two 32-bit general purpose input/output ports.
For Port0 29 pins (24,26,27 are not available) out of 32 pins are available for GPIO functions and for port1
only 16 (0-15pins are not available) out of 32 are available for GPIO functions. Port0 and port1 are controlled
by two groups of four registers (IOPIN, IOSET, IODIR and IOCLR) which are explained in detail below.

There are four registers associated with the GPIO and are shown below:

Generi Reset PORT0 PORT1


c
Description Access Valu Address & Address &
Nam e Name Name
e

GPIO Port Pin Value Register.


The current status of the GPIO
configured port pins can always
be read from this register, Read
regardless of pin direction and
IOPIN mode. Only NA 0xE0028000 0xE0028010

IO0PIN IO1PIN
GPIO Port Output Set Register.
This register controls the state of
output pins along with the IOCLR
register. Writing 1 produces highs Read/ 0x0000 0xE0028004 0xE0028014
at the corresponding port pins.
IOSET Writing zeros has no effect. Write 0000 IO0PIN IO1SET

GPIO Port Direction Control Read/ 0x0000 0xE0028008 0xE0028018


Register. This register is used to
IODIR control the direction of each port Write 0000 IO0DIR IO1DIR
pin.

GPIO Port Output Clear Register.


This register is used to control the
state of output pins. Writing ones
produces lows at the Write 0x0000 0xE0028008 0xE0028014
corresponding port pins and clears Only
IOCLR the corresponding bits in the 0000 IO0DIR IO1SET
IOSET register. Writing zeros has
no effect.

Table 2.2: GPIO Register Description .

GPIO Port Pin Value Register:


This is a 32 bit register. In our project we are not using this register as we are selecting the particular port pins as
outputs. Here we know the output pins. This register is used when we would like to know whether the particular port
pins used as output or not.

IOPIN Description Value after


Reset

31:0 GPIO pin value bits. Bit0 in IOPIN corresponds to P0.0.... Bit undefined
31 in IOPIN corresponds to P0.31.

Table 2.3: GPIO Port PIN Value Register (IOPIN Register).

GPIO Port Output Set Register:

GPIO Output Set Register is a 32 bit register used to make the particular bits to high level output at the port pins if they
are configured as GPIO in an output mode. Writing 1 makes a high level at the particular port pins, whereas writing 0 will
have no effect. If any pin is configured as input then writing to IOSET has no effect.

IOSET Description Value after


Reset

31:0 Output value SET bits. Bit0 in IOSET corresponds to P0.0.... Bit 0
31 in IOSET corresponds to P0.31.

Table 2.4: GPIO Port Output Set Register (IOSET Register) [1].
GPIO Port Direction Register:

GPIO Direction Register is a 32 bit register used to control the direction of the pins whether the port pins used
as input or output. If we write 1 then the corresponding port pin is selected or used as output. Direction bit for
any pin must be set according to the pin functionality.

IOSET Description Value after


Reset

31:0 Output value SET bits. Bit0 in IOSET corresponds to P0.0.... Bit 0
31 in IOSET corresponds to P0.31.

Table 2.5: GPIO Port Direction Register (IODIR Register) [1].

GPIO Port Output Clear Register:

GPIO Output Clear Register is a 32 bit register used to produce a low level at port pins if they are configured as GPIO in
output mode. In this register writing 1 will produce low level at the corresponding port pins and clears the corresponding
bits in the IOSET register, because once the bits are set using IOSET register, they must be made low by using IOCLR
register. Writing 0 will have no effect.

IOSET Description Value after


Reset

31:0 Output value SET bits. Bit0 in IOSET corresponds to P0.0.... Bit 0
31 in IOSET corresponds to P0.31.

Table 2.6: GPIO Port Output Clear Register (IOCLR Register) [1].
2.2.1 UART0

Features

1. It has 16 byte Transmit and Receive FIFO’s.

2. It has built-in baud rate generator.

3. UART0 Register locations are confirmed to 550 industry standards.

Pin Description

In LPC2148 we are having only one UART which is UART0. Generally RS-232 is used as the UART0. In
Every UART input is to receive the data and output is to transmit the data i.e. Receiver we will receive the input
data and transmitter will output the data. TXD pin of UART0 is connected to 8 th pin of port0 which is TDX1 of
the processor and RXD pin of UART0 is connected to 9th pin of port0 of the processor [1].

IOSET Description Value after


Reset

31:0 Output value SET bits. Bit0 in IOSET corresponds to P0.0.... Bit 0
31 in IOSET corresponds to P0.31.

Table 2.7: UART0 PIN Description [1].

Register Description

UART0 of LPC2148 contains ten 8-bit registers [1]. All these registers are listed below:

1. UART0 Receive Buffer Register (U0RBR).


2. UART0 Transmitter Holding Register (U0THR).
3. UART0 Interrupt Enable Register (U0IER).
4. UART0 Interrupt Identification Register (U0IIR).
5. UART0 FIFO Control Register (U0FCR).
6. UART0 Line Control Register (U0LCR).
7. UART0 Line Status Register (U0LSR).
8. UART0 Scratch Pad Register (U0SCR).
9. UART0 Divisor Latch LSB (U0DLL).
10. UART0 Divisor Latch MSB (U0DLM).

The below figure shows all the registers of UART0 along with their bit description, their access (whether
they are read only or write only or both read and write), their reset values and their address.

Rese
t
Name Descripti Bit Bit Bit Bit Bit Bit Bit Bit Acces Address
on 7 6 5 4 3 2 1 0 s Valu
e
Receive
Buffer
U0RB Register MSB READ DATA RO Un- 0xE000C0
LSB defin 00
e
DLAB =
0
Transmit
Holding
U0TH Register MSB WRITE DATA WO NA 0xE000C0
R LSB 00

DLAB =
0

0 0 0 0 0 R/W 0 0xE000C0
04
Interrupt
Enable DLAB =
U0IE Register 0
R

U0IIR Interrupt FIFO 0 0 IIR IIR IIR IIR RO 0x0 0xE000C0


ID Enabled 3 2 1 0 1 08
Register
FIFO - WO 0 0xE000C0
Control 08
U0FC Register Rx Reserved
R Trigger

Line 0xE000C0
Control 08
U0LC Register R/W 0
R
Rx

U0LS Line FIF TE TH BI FE PE O D RO 0x6 0xE000C0


R Status O MT RE E R 0 08
Register
Err

U0SC Scratch MSB R/W 0 0xE000C0


R Pad LSB 08
Register

U0DL Divisor MSB R/W 0x0 0xE000C0


L Latch LSB 1 08
LSB

U0DL Divisor MSB R/W 0 0xE000C0


M Latch LSB 08
MSB

Table 2.8: Registers of UART0 [1].

Out of these ten register only U0RBR, U0THR, U0LCR, U0LSR U0DLL, andU0DLM are used. The role of
these registers is discussed later in our project.

UART0 Receiver Buffer Register:

In order to access UART0 Receiver buffer register, firstly we have to make the Divisor Latch Access Bit
(DLAB) in Line Control Register (U0LCR) to zero. The UART0RBR is always read only. We know that
U0RBR is the top byte of the UART0 Rx FIFO. Here the top byte of the Rx FIFO contains the oldest character
received and can be read via the bus interface and the LSB represents the oldest received data bit. In our project
we are using the characters which are less than 8-bits. If the character is less than 8-bits, the unused MSB’s must
me padded with zeros [1] [9].

U0RBR Function Description Reset

value

7:0 Receive Buffer The UART0 Receive Buffer Register contains the Undefined
oldest received byte in the UART0 Rx FIFO.
Register

Table 2.9: UART0 Receive Buffer Register (U0RBR) [1].

UART0 Transmitter Holding Register:

In order to access UART0 Transmitter Holding Register, firstly we have to make the Divisor Latch Access Bit
(DLAB) which is present in Line Control Register (U0LCR) to zero. The U0THR is always write only. We
know that U0THR is the top byte of the UART0 Tx FIFO. Here the top byte is the newest character in the Tx
FIFO and can be written via the bus interface. We know that the LSB represents the first bit to transmit. In our
project we are keeping our command (values given to the processor in order to control the devices) in UART0
Transmitter Holding Register. If the data present in the UART0 THR matches with the predefined command, we
can get control to monitor the devices on the board. We are placing the command in between “$A__@” to
differentiate the next command with the previous command [1] [9].

U0THR Function Description Reset

value

Writing to the UART0 Transmit Holding


Register causes the data to be stored in the
7:0 Transmit UART0 Transmit FIFO. The byte will be sent Undefined
Holding when it reaches the bottom of the FIFO and the
Register
transmitter s available.

Table 2.10: UART0 Transmitter Holding Register (U0THR) [9].

UART0 Line Control Register:

The UART0 Line Control Register determines the format of the data character that is to be transmitted or
received. In our project U0LCR is used to get access to U0DLL, U0DLM, U0LCR and U0THR by using the
DLAB bit. In our program we are using 8bit character length, 1 start bit with no parity. After setting the DLAB
bit we can get access to set the baud rate. After setting the baud rate we have to disable this bit to keep the baud
rate constant [1] [9].

U0LCR Function Description Reset

value
00: 5 bit character length

01: 6 bit character length

1:0 Word Length 10: 7 bit character length 0

Select 11: 8 bit character length


2 Stop Bit 0:1 Stop bit

Select 1:2 Stop bits (1.5 if U0LCR[1:0]=00) 0

3 Parity Enable 0: Disable parity generation and checking 0

1: Enable parity generation and checking

00: Odd parity

5:4 Parity Select 01: Even parity 0

10: Forced “1” stick parity

11: Forced “0” stick parity


0: Disable break transmission

6 Break Control 1: Enable break transmission 0


Divisor Latch 0: Disable access to Divisor Latches
Access Bit
7 1: Enable access to Divisor Latches 0

Table 2.11: UART0 Line Control Register (U0LCR) [9].

UART0 Line Status Register:

The UART0 Line Status Register will provide the status information which is present on the UART0 Tx and Rx.
U0LSR is a read-only register. In our project we are using this register to check whether the data is received or
not. When we send a character, the control will stay there till the character is received or when next character is
pressed [1] [9].
UOLSR Function Description Reset
Value

0: U0RBR is empty

Receiver 1: U0RBR contains valid data

0 Data Ready U0LSR0 is set when the U0RBR holds an unread 0


(RDR) character and is cleared when the UART0 RBR FIFO is
empty.
0: Overrun error status is in inactive state.

1: Overrun error status is in active state.

Overrun The overrun error condition is set as soon as it occurs. An


U0LSR read clears U0LSR1. U0LSR1 is set when 0
1 Error UART0 RSR has a new character assembled and the
(OE) UART0 RBR FIFO is full. In this case, the UART0 RBR
FIFO will not be overwritten and the character in the
UART0 RSR will be lost.
0: Parity error status is in inactive stat.

1: Parity error status is in active state.

2 Parity Error A parity error occurs, when the parity bit of a received 0
character is in the wrong state. An U0LSR read clears
(PE) U0LSR2. Time of parity error detection is dependent on
U0FCR0. A prity error is associated with the character
being read from the UART0 RBR FIFO.
0: Framing error status is in inactive state.

1: Framing error status is in active state.

A framing error occurs, When the stop bit of a received


character is at logic 0,. An U0LSR read clears U0LSR3.
3 Framing The framing error time detection is dependent on
Error U0FCR0. Framing error is linked with the character being
read from the UART0 RBR FIFO. Upon detection of a
0
(FE) framing error, the Rx will attempt to resynchronize to the
data and assume that the bad stop bit is actually an early
start bit. However, it cannot be assumed that the next
received byte will be correct even if there is no Framing
Error.

0: Break interrupt status is in inactive state.

1: Break interrupt status is in active state.

When RxD0 is held in the spacing state (all 0’s), a break


interrupt occurs for one full character transmission (start,
4 Break data, parity, stop). The receiver goes idle until RxD0 goes
Interrupt to marking state (all 1’s),once the break condition has 0
been detected,. A
(BI)
n U0LSR clears the status bit when it has read. The break
detection time is dependent on U0FCR0.

The break interrupt is associated with the character being


read from the UART0 RBR FIFO.
Transmitter 0: U0THR contains valid data.
Holding
5 1
Register Empty 1:U0THR is empty.
(THRE) Upon detection of an empty UART0 THR, the THRE is
set immediately and is cleared on a U0THR write.
Transmitter 0: U0THR and/or the U0TSR contain valid data.

6 Empty 1: U0THR and U0TSR are empty.

(TEMT) TEMT is set when both U0THR and U0TSR are empty, 1
TEMT is cleared when either the U0TSR or the U0THR
contain valid data.
0: U0RBR contains no UART0 Rx errors or U0FCR0=0.

Error in Rx 1: UART0 RBR contains at least one UART0 Rx error.

7 FIFO U0LSR7 is set when a character with a Rx error such as 0


framing error, parity error or break interrupt, is loaded into
(RXFE) the U0RBR. This bit is cleared when the U0LSR register
is read and there are no subsequent errors in the UART0
FIFO.

Table 2.12: UART0 Line Status Register (U0LSR) [1].


UART0 Divisor Latch MSB Register:

When we are using UART0 Divisor Latches, the DLAB bit present in the U0LCR must be one. U0DLM along
with U0DLL is a 16-bit divisor. In this 16-bit divisor U0DLL will occupy the lower 8-bits and U0DLM will
have higher 8-bits of the divisor. The UART0 Divisor Latch is a part of UART0 baud rate generator. It will
divide the VPB clock in order to produce the baud rate clock. Baud rate clock must be 16x the desired baud rate
[1].

U0DLM Function Description Reset

value

Divisor Latch The UART0 Divisor Latch MSB Register along


MSB with U0DLL register determines the baud rate of
7:0 Register the UART0. Undefined

Table 2.13: UART0 Divisor Latch MSB Register (U0DLM) [1].

UART0 Divisor Latch LSB Register:

DLAB bit in U0LCR register must be one in order to access this register. By using this register we can set the
baud rate which is required. Generally we use baud rate of 9600.

This baud rate is achieved by passing 0x62 to this register.

Diagram of UART0 Divisor Latch LSB Register is shown below:

U0DLL Function Description Reset

Value

Divisor Latch The UART0 Divisor Latch LSB Register along


LSB with U0DLM register determines the baud rate of
the UART0.
7:0 Register Undefined

Table 2.14: UART0 Divisor Latch LSB Register (U0DLL) [1].

2.2.3 PIN CONNECT BLOCK

The pin connect block allows selected pins of the microcontroller to have more than one function.
Configuration registers control the multiplexers to allow connection between the pin and the on chip
peripherals.
Peripherals should be connected to the appropriate pins prior to being activated, and prior to any related
interrupt(s) being enabled. Activity of any enabled peripheral function that is not mapped to a related pin should
be considered undefined.
Selection of a single function on a port pin completely excludes all other functions otherwise available on the
same pin.
The only partial exception from the above rule of exclusion is the case of inputs to the A/D converter.
Regardless of the function that is selected for the port pin that also hosts the A/D input, this A/D input can be
read at any time and variations of the voltage level on this pin will be reflected in the A/D readings. However,
valid analog reading(s) can be obtained if and only if the function of an analog input is selected. Only in this
case proper interface circuit is active in between the physical pin and the A/D module. In all other cases, a part
of digital logic necessary for the digital function to be performed will be active, and will disrupt proper behavior
of the A/D.
7.4 Register description
The Pin Control Module contains 2 registers as shown in Table 59 below.
[1] Reset value reflects the data stored in used bits only. It does not include reserved bits content.

Register Description:

There are two registers in the Pin Control Module.

1. Pin Function Select Register 0 (PINSEL0).


2. Pin Function Select Register 1 (PINSEL1).
3. Pin Function Select Register 2 (PINSEL2).

In our project we are using both registers. We are using Pin Function Select Register 0 to select
the UART0 by passing a value of 0x0000005 to this register (PINSEL0|=0x00000005). We are selecting Pin
Function Select Register 1 to select ADC by passing a value of 0x15400000 to this register (PINSEL1|
=0x15400000) [1].(PINSEL2|=0xE002 C014)

Pin Function Select Register 0 (PINSEL0):

There are many functions provided by each port pins. This register is used to controls the functions of the pins which are
shown below:

PIN Pin Function Function Function Function Reset


Vale
SEL0 Nam when 00 When 01 When 10 When11
e
1:0 P0.0 GPIO Port0.0 TxD(UART0) PWM1 Reserved 00
3:2 P0.1 GPIO Port0.1 RxD(UART0) PWM3 EINT0 00
5:4 P0.2 GPIO Port0.2 SCL(I2C) Capture 0.0(T0) Reserved 00
7:6 P0.3 GPIO Port0.3 SDA(I2C) Match 0.0(T0) EINT1 00
9:8 P0.4 GPIO Port0.4 SCK(SPI0) Capture 0.1(T0) Reserved 00
11:10 P0.5 GPIO Port0.5 MISO(SPI0) Match 0.1(T0) Reserved 00
13:12 P0.6 GPIO Port0.6 MOSI(SPI0) Capture 0.2(T0) Reserved 00
15:14 P0.7 GPIO Port0.7 SSEL(SPI0) PWM2 EINT2 00
17:16 P0.8 GPIO Port0.8 TxD(UART1) PWM4 Reserved 00
19:18 P0.9 GPIO Port0.9 RxD(UART1) PWM6 EINT3 00
21:20 P0.10 GPIO Port0.10 RTS(UART1) Capture 1.0(T1) Reserved 00
23:22 P0.11 GPIO Port0.11 CTS(UART1) Capture 1.1(T1) Reserved 00
25:24 P0.12 GPIO Port0.12 DSR(UART1) Match 1.0(T1) Reserved 00
27:26 P0.13 GPIO Port0.13 DTR(UART1) Match 1.1(T1) Reserved 00
29:28 P0.14 GPIO Port0.14 CD(UART1) EINT 1 Reserved 00
31:30 P0.15 GPIO Port0.15 RI(UART1) EINT 2 Reserved 00

Table 2.17: PIN Function Select Register 0 (PINSEL0) [1].

From the above diagram we can select UART0 by using pins 0, 1, 2 and 3. If we give values 0101 to these pins
(P0.0=01 and P0.1=01), we can select UART0.

Pin Function Select Register 1 (PINSEL1):


This register is mainly used to select the UART’s of the processor and control the functions of the pins which are shown
below:

Res
et
PIN Pin Function Function Function Function Val
SEL1 Name when 00 When 01 When 10 When11
1:0 P0.16 GPIO Port0.16 EINT0 Match 0.2(T0) Capt0.2(T0) 00
3:2 P0.17 GPIO Port0.17 Capture 1.2(T1) SCK(SPl1) Mat1.2(T1) 00
5:4 P0.18 GPIO Port0.18 Capture 1.3(T1) MISO(SPl1) Mat1.3(T1) 00
7:6 P0.19 GPIO Port0.19 Match 1.2(T1) MOSI(SPl1) Mat1.3(T1) 00
9:8 P0.20 GPIO Port0.20 Match 1.3(T1) SSEL(SPl1) EINT3 00
11:10 P0.21 GPIO Port0.21 PMW5 Reserved Capt1.3(T1) 00
13:12 P0.22 GPIO Port0.22 Reserved Capture0.0(T0 Mat0.0(T1) 00
)
15:14 P0.23 GPIO Port0.23 RD2(CAN Con2 ) Reserved Reserved 00
17:16 P0.24 GPIO Port0.24 TD2(CAN Con2 ) Reserved Reserved 00
19:18 P0.25 GPIO Port0.25 RD1(CAN Con1 ) Reserved Reserved 00
21:20 P0.26 Reserved 00
23:22 P0.27 GPIO Port0.27 AIN0 (ADC) Capture0.1(T0) Mat0.1(T0) 01
25:24 P0.28 GPIO Port0.28 AIN1 (ADC) Capture Mat0.2(T0) 01
0.2(T0)
27:26 P0.29 GPIO Port0.29 AIN2 (ADC) Capture Mat0.3(T0) 01
0.3(T0)
29:28 P0.30 GPIO Port0.30 AIN3 (ADC) EINT 3 Capt0.0(T0) 01
31:30 P0.31 Reserved 00

Table 2.18: PIN Function Select Register 1 (PINSEL1) [1].

We are selecting ADC using the PINSEL1 register. From the above diagram we can clearly see that P0.27,
P0.28, P0.29 and P0.30 pins are used to select ADC and timer0. ADC is selected by passing values of 01010101
to the four port pins (P0.27=01, P0.28=01, P0.29=01 and P0.30=01)
Pin function Select register 2 (PINSEL2 - 0xE002 C014)
The PINSEL2 register controls the functions of the pins as per the settings listed in. The direction control bit in
the IO1DIR register is effective only when the GPIO function is selected for a pin. For other functions direction
is controlled automatically.
Warning: use read-modify-write operation when accessing PINSEL2 register. Accidental write of 0 to bit 2
and/or bit 3 results in loss of debug and/or trace functionality! Changing of either bit 4 or bit 5 from 1 to 0 may
cause an incorrect code execution!

Table 62: Pin function Select register 2 (PINSEL2 - 0xE002 C014) bit description
Bit Symbol Value Function Reset value
1:0 - - Reserved, user software should not write ones to reserved bits. The value read from a reserved bit is not
defined.

2 GPIO/DEBUG 0 Pins P1.31-26 are used as GPIO pins. P1.26/RTCK


1 Pins P1.36-26 are used as a Debug port.
3 GPIO/TRACE 0 Pins P1.25-16 are used as GPIO pins. P1.20/TRACESYNC
1 Pins P1.25-16 are used as a Trace port.
31:4 - - Reserved, user software should not write ones to reserved bits. The value read from a reserved
bit is not defined.
MODULES

BASIC COMPONENTS IN MICROCONTROLLER BOARD

1. Diode
In electronics, a diode is a component that restricts the direction of movement of charge carriers.
Essentially, it allows an electric current to flow in one direction, but blocks it in the opposite direction. Today
the most common diodes are made from semiconductor materials such as silicon or germanium.

Fig. : Diode
2. Semiconductor Diodes

Most modern diodes are based on semiconductor P-N junctions. In a P-N diode, conventional current
can flow from the P-type side (the anode) to the N-type side (the cathode), but not in the opposite direction.
A semiconductor diode s current-voltage, or I-V, characteristic curve is ascribed to the behavior of the so-
called depletion layer or depletion zone which exists at the P-N junction between the differing
semiconductors.

When a P-N junction is first created, conduction band (mobile) electrons from the N-doped region
diffuse into the P-doped region where there is a large population of holes (places for electrons in which no
electron is present) with which the electrons recombine. When a mobile electron recombines with a hole, the
hole vanishes and the electron is no longer mobile. Thus, two charge carriers have vanished. The region
around the P-N junction becomes depleted of charge carriers and thus behaves as an insulator.

1N4001 and 1N5400 series diodes

The 1N4001 series (or 1N4000 series) is a family of popular 1.0 amp general purpose silicon rectifier
diodes commonly used in AC adapters for common household appliances. Blocking voltage varies from 50
to 1000 volts. This diode is made in an axial-lead DO-41 plastic package. The 1N5400 series is a similarly
popular series for higher current applications, up to 3 A. These diodes come in the larger DO-201 axial
package.

These are fairly low-speed rectifier diodes, being inefficient for square waves of more than 15 kHz. The
series was second sourced by many manufacturers. The 1N4000 series were in the Motorola Silicon
Rectifier Handbook in 1966, as replacements for 1N2609 through 1N2617. The 1N5400 series were
announced in Electrical Design News in 1968, along with the now lesser known 1.5-ampere 1N5391 series.
These devices are widely used and recommended. The table below shows the maximum repetitive reverse
blocking voltages of each of the members of the 1N4000 and 1N5400 series.

TABLE .1. Diode part Numbers for different currents and voltages
VOLTAGE 1A PART 3A PART
50V 1N4001 1N5400
100V 1N4002 1N5401
200V 1N4003 1N5402
300V _ 1N5403
400V 1N4004 1N5404
500V _ 1N5405
600V 1N4005 1N5406
800V 1N4006 1N5407
1000V 1N4007 1N5408

3. Voltage regulator

7805 Voltage regulator

5V DC Voltage Regulator Data Sheet / Specs

The 7805 provides circuit designers with an easy way to regulate DC voltages to 5v.

Fig. : Voltage Regulator


Encapsulated in a single chip/package (IC), the 7805 is a positive voltage DC regulator that has only 3
terminals. They are: Input voltage, Ground, Output Voltage. Although the 7805 were primarily designed for
a fixed-voltage output (5V). 7812 Voltage regulator 12V DC Voltage Regulator Data Sheet / Specs. The
78012 provides circuit designers with an easy way to regulate DC voltages to 12v.

Encapsulated in a single chip/package (IC), the 78012 is a positive voltage DC regulator that has only 3
terminals. They are: Input voltage, Ground, Output Voltage. Although the 78012 were primarily designed for
a fixed-voltage output (12V). 7812 Voltage regulator. It is indeed possible to use external components in
order to obtain DC output voltages of: 5V, 6V, 8V, 9V, 10V, 12V, 15V, 18V, 20V, 24V. Note that the input
voltage must, of course, be greater than the required output voltage, so that it can be regulated downwards.

4. Capacitor

In the Regulated power supply the rating of the chosen capacitor filter is 1000µF.A capacitor (originally
known as condenser) is a passive two-terminal electrical component used to store energy in an electric field.
The forms of practical capacitors vary widely, but all contain at least two electrical conductors separated by
a dielectric (insulator); for example, one common construction consists of metal foils separated by a thin
layer of insulating film. Capacitors are widely used as parts of electrical circuits in many common electrical
devices. When there is a potential difference (voltage) across the conductors, a static electric field develops
across the dielectric, causing positive charge to collect on one plate and negative charge on the other plate.
Energy is stored in the electrostatic field. An ideal capacitor is characterized by a single constant value,
capacitance, measured in farads. This is the ratio of the electric charge on each conductor to the potential
difference between them.

Fig. : Capacitor

The capacitance is greatest when there is a narrow separation between large areas of conductor, hence
capacitor conductors are often called "plates," referring to an early means of construction. In practice, the
dielectric between the plates passes a small amount of leakage current and also has an electric field strength
limit, resulting in a breakdown voltage, while the conductors and leads introduce an undesired inductance
and resistance. Capacitors are widely used in electronic circuits for blocking direct current while allowing
alternating current to pass, in filter networks, for smoothing the output of power supplies, in the resonant
circuits that tune radios to particular frequencies, in electric power transmission systems for stabilizing
voltage and power flow, and for many other purposes.

5. Resistors

A resistor is a passive two-terminal electrical component that implements electrical resistance as a


circuit element. The current through a resistor is in direct proportion to the voltage across the resistor's
terminals. Thus, the ratio of the voltage applied across a resistor's terminals to the intensity of current
through the circuit is called resistance. This relation is represented by Ohm's law: where I is the current
through the conductor in units of amperes, V is the potential difference measured across the conductor in
units of volts, and R is the resistance of the conductor in units of ohms. More specifically, Ohm's law states
that the R in this relation is constant, independent of the current. Resistors are common elements of
electrical networks and electronic circuits and are ubiquitous in electronic equipment. Practical resistors can
be made of various compounds and films, as well as resistance wire (wire made of a high-resistivity alloy,
such as nickel-chrome). Resistors are also implemented within integrated circuits, particularly analog
devices, and can also be integrated into hybrid and printed circuits.

Fig. : Resistor

The electrical functionality of a resistor is specified by its resistance: common commercial resistors are
manufactured over a range of more than nine orders of magnitude. When specifying that resistance in an
electronic design, the required precision of the resistance may require attention to the manufacturing
tolerance of the chosen resistor, according to its specific application. The temperature coefficient of the
resistance may also be of concern in some precision applications. Practical resistors are also specified as
having a maximum power rating which must exceed the anticipated power dissipation of that resistor in a
particular circuit: this is mainly of concern in power electronics applications. Resistors with higher power
ratings are physically larger and may require heat sinks. In a high-voltage circuit, attention must sometimes
be paid to the rated maximum working voltage of the resistor.

6. Crystal RED LEDs

LED is an acronym for Light Emitting Diode. Well, you ask, what on earth is a diode. A diode is a
device that, in simplest terms, allows electricity to flow through one way but not the other. Those of you
who are knowledgeable about mechanical things could think of it as sort of a check valve. If you have no
mechanical knowledge, disregard that last sentence. Now that you know what a diode is, an LED is just one
that emits light (But you could probably figure that out just from reading the name).

Another important thing about all LED's (and all diodes) is that every one of them has exactly two
electrodes. These are important to know when you are wiring an LED into a circuit.

They are the...

Anode - The p-side which is the longer leg.

Cathode - Which is the n-side and shorter leg. Since you know these terms you can remember that
electricity flows easily from the anode to the cathode but not the other way around.

LED's are great for many reasons. First of all, they don't heat up like regular light bulbs do. This is great
because, well, you don't burn yourself. They are also smaller than a light bulb. Another important thing
about LED's is that they run on very low amounts of electricity, which is helpful because it makes them safer
to work with (you don't electrocute yourself). Most run on about 20mA.
Just like with everything, there are some tips that are helpful to make sure your LED's work well.

Clip the leads - Simple, I know, but people forget to. This is important because it prevents them from
bumping into other parts and messing up your circuit.
Remember which electrode is which - This is a big one because if you don't it won't work at all. It's a
diode; current only flows through it one way.
Read the package - Simple again, but each LED requires slightly different voltage and ampere. It always
helps to wire a resistor into your circuit. It will make the LED last longer by dropping the voltage. There are
some sites that make it easy to find which resistor you need. LEDs come in all sorts of sizes as well. Here is
a photo showing a 3mm, 5mm and 10mm LED. The "millimeter" size refers to the diameter of the LED.
For example, if you need to drill a hole in a box for your 5mm blink LED, the hole-size should be 5mm, and
you'd need a 5mm drill bit to make it. 5mm are the most common size you'll see, and they can be extremely
bright! Green 3mm, Red 5mm and White 10mm LEDs
 5mm LEDs can be so bright, they are often used as illumination (lighting something up, like a
flashlight, we'll talk about this next).
 3mm LEDs are not as bright but are smaller, and are good for indication (like an LED that tells you
something is on). They're not as good for illumination because they have a smaller area that is lit.

 10mm LEDs are a little rarer, they are huge and chunky but are usually just 5mm LEDs with a
bigger case so they aren't any brighter. They can be good indicators but we rarely see them as
illuminators.

Fig. : Red LED


SWITCH’S

KEYPAD 4X4

A matrix keypad is the kind of keypad you see on microwave ovens, gas pumps, and calculators. A
matrix keypad you can connect to a breadboard is also great for prototypes and inventions where things like
codes, times, or other values have to be entered.

Test Code

The test program updates the Terminal showing whichever single key is pressed, every 1.5 s. If
you're not pressing a key when it checks, the program will display -1. So, for best results, press and hold the
key you want to try. Keep in mind, this is just test code. The Try This and Your Turn examples will
demonstrate how to make it responsive as you type in numbers, how to do simple mathematic functions, and
more.

How it Works

This 4x4 matrix keypad has 16 built-in pushbutton contacts connected to row and column lines. A
microcontroller can scan these lines for a button-pressed state. In the keypad library, the Propeller sets all
the column lines to input, and all the row lines to input. Then, it picks a row and sets it high. After that, it
checks the column lines one at a time. If the column connection stays low, the button on the row has not
been pressed. If it goes high, the microcontroller knows which row (the one it set high), and which column,
(the one that was detected high when checked). See the schematic in the "Circuit" section, above, for a
visual reference of the keypad layout.

The keypad library supports pretty much any number of rows and columns. So, the program has to
tell it our keypad is has 4 rows and 4 columns, which I/O pins the lines are connected to, and what value
each button represents. The rows, cols, and values arrays store that information. The rows array will be
used to tell the keypad library that the top row is connected to P7, the second row to P6 and so on.
Likewise, the cols array lists the leftmost column as connected to P3, the next over connected to P2 and so
on. The values array stores the value we want the program to give us for each button press.

For example, if the top-left button is pressed, we want the number 1, and if the next one over is
pressed, we want the number two. If the top right button is pressed, we want the ASCII code for the 'A'
character, which is 65.

Inside the main function, keypad setup gets the number of rows (4), the number of columns (also 4),
the rows array, the cols array, and the values array.

After that, key = keypad read () will return -1 if no buttons are pressed. If a button is pressed, it will
return the value from the array that corresponds to that button.

For example, if you press a button on the 3rd row, second column, the keypad read function will
return the number 8, which will get stored in the keyvariable. To display it correctly, an if statement checks
for values less than or equal to 9, and displays them with %d, decimal-integer formatting flag. The ASCII
codes for '*', '#', 'A', 'B', 'C', and 'D' are 35, 42, 65, 66, 67, and 68, all of which are above 9, and get
displayed with the print statement that uses the %c character formatting flag.

Many combinations work fine, like 1, 5, 9, and D will all display correctly, as will 1, 4, 7, and *. But, try
pressing 1, 2, and 7. The program will tell you that detected 1, 2, 7, and 8. This phenomenon is
called ghosting, with the number 8 being the ghost number. Ghosting happens when you press 2 buttons on
the same row, and one button on the same column.
For example, 1 and 2 are on the same row, and 7 is on the same column as 1. The 7 press travels up
to 1, across to 2, and then down the 8 column and is detected there. Some keypads that are designed for
multiple, simultaneous key presses have built-in diodes that can prevent this.
Another problem with keypads that are designed for individual key presses is called masking.
Masking just means that if your program is waiting for a single key press, and you then press and release a
second key after the first, the second key is not detected. The change is "masked out" by the keypad circuit.
MOTOR

DC motors like this are great for battery-powered toys (things like model trains, radio-controlled cars, or
electric shavers), but you don't find them in many household appliances. Small appliances (things like coffee
grinders or electric food blenders) tend to use what are called universal motors, which can be powered by
either AC or DC. Unlike a simple DC motor, a universal motor has an electromagnet, instead of a permanent
magnet, and it takes its power from the DC or AC power you feed in:

 When you feed in DC, the electromagnet works like a conventional permanent magnet and produces
a magnetic field that's always pointing in the same direction. The commutator reverses the coil
current every time the coil flips over, just like in a simple DC motor, so the coil always spins in the
same direction.
 When you feed in AC, however, the current flowing through the electromagnet and the current
flowing through the coil both reverse, exactly in step, so the force on the coil is always in the same
direction and the motor always spins either clockwise or counter-clockwise. What about the
commutator? The frequency of the current changes much faster than the motor rotates and, because
the field and the current are always in step, it doesn't actually matter what position the commutator is
in at any given moment.
There are two ways to overcome this problem. One is to use a kind of electric current that periodically
reverses direction, which is known as an alternating current (AC). In the kind of small, battery-powered
motors we use around the home, a better solution is to add a component called a commutator to the ends of
the coil. (Don't worry about the meaningless technical name: this slightly old-fashioned word
"commutation" is a bit like the word "commute".
It simply means to change back and forth in the same way that commute means to travel back and
forth.) In its simplest form, the commutator is a metal ring divided into two separate halves and its job is to
reverse the electric current in the coil each time the coil rotates through half a turn. One end of the coil is
attached to each half of the commutator. The electric current from the battery connects to the motor's
electric terminals.
These feed electric power into the commutator through a pair of loose connectors called brushes,
made either from pieces of graphite (soft carbon similar to pencil "lead") or thin lengths of springy metal,
which (as the name suggests) "brush" against the commutator. With the commutator in place, when
electricity flows through the circuit, the coil will rotate continually in the same direction.

MAX232
Max232 is designed by Maxim Integrated Products. This IC is widely used in RS232
Communication systems in which the conversion of voltage level is required to make TTL devices to be
compatible with PC serial port and vice versa. This chip contains charge pumps which pumps the voltage to
the Desired Level. It can be powered by a single +5 volt power supply and its output can reach +_7.5
volts.MAX232 comes in 16 Pin Dip and many other packages and it contains Dual Drivers. It can be used as
a hardware layer convertor for 2 systems to communicate simultaneously.Max232 is one of the versatile IC
to use in most of the signal voltage level conversion problems.

Construction of MAX232:
Mostly MAX232 used in 16-pin DIP package. it consist of 3 major blocks .It can only be powered by
5 volts to make it power supply compatible with most of the embedded systems. First block is the voltage
doubler in this ic switched capacitor techniques is used to make the voltage double .Once the voltage is
doubled second block will converts that voltage to +10 and -10. The third block consists of 2 transmitters
and 2 receivers which actually convert the voltage levels.

External components:
Max232 requires minimum 4 external capacitor. Their Value can range from 1uf to 10uf and16 volts
or more rating. There are many different versions of this versatile ic available each of them Require different
capacitor value for proper working.

Application and uses of MAX232:


Premierly MAX232 is used in Serial communication. Problem arises when we have to communicate
between TTL logic and CMOS logic based systems. RS232 is internationally defined standard named as
EIA/TIA-232-E and in this standard logic 0 is the voltage between +3 to +15 and logic 1 is defined as the
voltage between -3 to -15.In TTL logic 0 is defined is by 0 volt and 1 is defined by 5 volt so in this scenario
this is a very handy IC to be incorporated.

Other Applications & Uses


 Battery Powered RS 232 Systems
 Interface Translation
 Low Power Modems
 RS 232 Networks (Multidrop)
 Portable Computing

PC Serial PORT communication by using MAX232 IC:


Desktop and some old Laptops have Serial port which comes in DB9 package. In Most of the Circuits
designer is concerned about the Tx and Rx pins only so the function of the rest of the pins are not used here
mostly.

In the above circuit only one Driver is used and second driver can be used for other purpose. TTL data is
available on pin 12 and pin 11 and these pins can be attached to Microcontroller or any system which accept
TTL logic.
GSM Modem Communication:
There are many GSM modems available in the market and most of them are on TTL logic but some
of them use RS232 standards and again it becomes a problem to communicate wilt GSM modem by using
Micro controller, aurdino or any other TTL platform.MAX232 is used to solve this problem.

Types of MAX232:
1)“MAX232N” where “N” Represent PDIP package Style this package is easy to sold and most widely used.

2) MAX232D where “D” indicates the SOIC package which is difficult to sold and required a trained
professional to be used correctly.

Common mistakes:
 Capacitor voltage rating is less than 16.
 Interchange Tx and Rx pins on one side of MAX232 at one time.
 Distorted power supply. Use decoupling capacitor to remove distortion.
 Check all the connections again.
 Check the capacitor with capacitance meter.
 Use Tantalum Capacitor for better performance.
IC’S
L293D IC

L293D is a typical Motor driver or Motor Driver IC which allows DC motor to drive on either
direction. L293D is a 16-pin IC which can control a set of two DC motors simultaneously in any direction. It
means that you can control two DC motor with a single L293D IC. Dual H-bridge Motor Driver integrated
circuit (IC).

The l293d can drive small and quiet big motors as well, check the Voltage Specification at the end of this
page for more info.

Concept:

It works on the concept of H-bridge. H-bridge is a circuit which allows the voltage to be flown in
either direction. As you know voltage need to change its direction for being able to rotate the motor in
clockwise or anticlockwise direction, hence H-bridge IC are ideal for driving a DC motor.
In a single L293D chip there are two h-Bridge circuit inside the IC which can rotate two dc motor
independently. Due its size it is very much used in robotic application for controlling DC motors. Given
below is the pin diagram of a L293D motor controller.

There are two Enable pins on l293d. Pin 1 and pin 9, for being able to drive the motor, the pin 1 and
9 need to be high. For driving the motor with left H-bridge you need to enable pin 1 to high. And for right
H-Bridge you need to make the pin 9 to high. If anyone of the either pin1 or pin9 goes low then the motor in
the corresponding section will suspend working. It’s like a switch.

TIP: you can simply connect the pin16 VCC (5v) to pin 1 and pin 9 to make them high.

Working of L293D

There are 4 input pins for l293d, pin 2,7 on the left and pin 15 ,10 on the right as shown on the pin
diagram. Left input pins will regulate the rotation of motor connected across left side and right input for
motor on the right hand side. The motors are rotated on the basis of the inputs provided across the input pins
as LOGIC 0 or LOGIC 1.

In simple you need to provide Logic 0 or 1 across the input pins for rotating the motor.
L293D Logic Table.

Let’s consider a Motor connected on left side output pins (pin 3,6). For rotating the motor in
clockwise direction the input pins has to be provided with Logic 1 and Logic 0.

• Pin 2 = Logic 1 and Pin 7 = Logic 0 | Clockwise Direction


• Pin 2 = Logic 0 and Pin 7 = Logic 1 | Anticlockwise Direction
• Pin 2 = Logic 0 and Pin 7 = Logic 0 | Idle [No rotation] [Hi-Impedance state]
• Pin 2 = Logic 1 and Pin 7 = Logic 1 | Idle [No rotation]

In a very similar way the motor can also operate across input pin 15, 10 for motor on the right hand side.

Voltage Specification

VCC is the voltage that it needs for its own internal operation 5v; L293D will not use this voltage for
driving the motor. For driving the motors it has a separate provision to provide motor supply VSS (V
supply). L293d will use this to drive the motor. It means if you want to operate a motor at 9V then you need
to provide a Supply of 9V across VSS Motor supply.

The maximum voltage for VSS motor supply is 36V. It can supply a max current of 600mA per channel.
Since it can drive motors Up to 36v hence you can drive pretty big motors with this l293d.

VCC pin 16 is the voltage for its own internal Operation. The maximum voltage ranges from 5v and upto
36v.
74HC595 IC

WHERE TO USE 74HC595 IC

The 74HC595 is an 8-bit Serial In – Parallel Out Shift Register, i.e. it can receive (input) data
serially and control 8 output pins in parallel. This comes in very handy where do not have enough GPIO pins
on our MCU/MPU to control the required number of outputs. It is often used in projects where relatively a
large number of LED’s has to be controlled through the Microcontroller. It can also be used to interface LCD
screen since they can acts as the data bit for the LCD displays. It can also be used to control 5V loads like
relays through a 3.3V microcontroller since the high-level voltage is only 3.15. So if you are looking for an
IC to save on your GPIO pins on the Microcontroller then this IC might be the right choice for you.

How to Use a 74HC595 IC

The 74HC595 shift register is commonly used with microcontrollers or microprocessors to expand the
GIPO functionalities. It requires only 3 pins connected to the MCU, which are Clock, Data and Latch. It has
a wide operating voltage from 2V to 6V. An application circuit of the IC is shown below:

The pins 11, 14 and 12 are connected to the GPIO pins of the Microcontroller. In which pin 11 is the clock
which sends a constant pulse to keep timing. The pin 14 is Data which actually sends the Data about which
output pins has to stay low and which should go high. The Pin 12 is the Latch which updates the received
the data to the output pins when made high, this pin can also be permanently held high. The below image
will help you understand better.
As you can see the clock is continues train of pulses, and the data goes high only at the respective place
where the output has to get high. Here for example the binary value 0b10110011 is passed to the
microcontroller. The pin Master reset (MR) is used to reset the outputs, when not in use it is held high to
vcc, similarly the pin should be held low when not in use.

Another important advantage of the 74hc595 IC is that it can be cascaded to control more than 8 outputs. To
do this we use the Q7’ (pin 9), this pin should be connected to the data pin of the second 74HC595 IC. This
way the first 8-bit sent from MCU will be used by the 1st IC and the second 8-bit will be used by the 2nd IC.

Applications

 Expand the GPIO pin on a MCU/MPU


 LED Matrix/Cube Projects

 Interface LCD

 Cascading applications

 High logic level controller

Features

 8-bit, Serial In – Parallel out Shift register


 Operating Voltage: 2V to 6V

 Power Consumption: 80uA

 Output source/sink current: 35mA

 Output Voltage is equal to Operating voltage

 Minimum high-level Input Voltage: 3.15V @(Vcc=4.5V)

 Maximum low-level Input Voltage: 1.35V @(Vcc=4.5V)

 Can be easily cascaded with more IC to get more outputs

 Maximum Clock Frequency: 25Mhz @4.5V

 Available in 16-pin PDIP, GDIP, PDSO packages


Pin Configuration

Pin
Pin Name Description
Number

Output Pins (Q1 to The 74hc595 has 8 output pins out of which 7 are these pins. They can
1,2,3,4,5,6,7
Q7) be controlled serially

8 Ground Connected to the Ground of the circuit

9 (Q7) Serial Output This pin is used to connect more than one 74hc595 as cascading

10 (MR) Master Reset Resets all outputs as low. Must be held high for normal operation

This is the clock pin to which the clock signal has to be provided from
11 (SH_CP) Clock
MCU/MPU

The Latch pin is used to update the data to the output pins. It is active
12 (ST_CP) Latch
high

The Output Enable is used to turn off the outputs. Must be held low for
13 (OE) Output Enable
normal operation

This is the pin to which data is sent, based on which the 8 outputs are
14 (DS) Serial Data
controlled

15 (Q0) Output The first output pin.

16 Vcc This pin powers the IC, typically +5V is used.

Alternatives Shift Registers

S.No: Name Type

1 4035 4-Bit Parallel in Parallel out Shift Register


2 74LS379 Quad Parallel Shift Register

3 4014 4 Bit static shift register

4 74LS166 8 Bit Shift Register

5 74LS323 8 Bit Shift/Storage Register

6 74LS164 S/P Shift Register

7 4015 Dual 4 Bit Static Register

8 74LS299 8 Bit Shift/Storage Register

ULN2803A

ULN2803 is a High voltage, high current Transistor Array IC used especially with Microcontrollers
where we need to drive high power loads. Thic IC consists of a eight NPN Darlington connected transistors
with common Clamp diodes for switching the loads connected to the output. This IC is widely used to drive
high loads such Lamps, relays, motors etc. It is usually rated at 50v/500mA. This article brings out the
working of ULN2803 IC and how to use it in a circuit.
PURPOSE OF ULN2803:
Most of the Chips operates with low level signals such as TTL, CMOS, PMOS, NMOS which
operates at the range of (0-5)v and are incapable to drive high power inductive loads. However this chip
takes low level input signals (TTL) and use that to switch/turn off the higher voltage loads that is connected
to the output side.

WORKING OF ULN2803 IC:


The ULN2803 IC consists of eight NPN Darlington pair which provides the proper current
amplification required by the loads. We all know that the transistors are used to amplify the current but here
Darlington transistor pairs are used inside the IC to make the required amplification.
A Darlington pair is two transistors that act as a single transistor providing high current gain. In this
pair the current amplified by the first transistor is further amplified by the next transistor providing high
current to the output terminal.
When no base voltage is applied that when is no signal is given to the input pins of the IC , there will be no
base current and transistor remains in off state. When high logic is fed to the input both the transistors begin
to conduct providing a path to ground for the external load that the output is connected. Thus when an input
is applied corresponding output pin drops down to zero there by enabling the load connected to complete its
path.

Interfacing the Arduino MPU 6050

The MPU 6050 communicates with the Arduino through the I2C protocol. The
MPU 6050 is connected to Arduino as shown in the following diagram. If your MPU
6050 module has a 5V pin, then you can connect it to your Arduino's 5V pin. If not,
you will have to connect it to the 3.3V pin. Next, the GND of the Arduino is connected
to the GND of the MPU 6050.

Arduino MPU 6050 connections

The program we will be running here also takes advantage of the Arduino's interrupt
pin. Connect your Arduino's digital pin 2 (interrupt pin 0) to the pin labeled as INT on
the MPU 6050.

Next, we need to set up the I2C lines. To do this, connect the pin labeled SDA on the
MPU 6050 to the Arduino's analog pin 4 (SDA), and the pin labeled as SCL on the MPU
6050 to the Arduino's analog pin 5 (SCL). That's it! You have finished wiring up the
Arduino MPU 6050.

Uploading the code and testing the Arduino MPU 6050 To test the Arduino MPU 6050, first download the
arduino library for MPU 6050, developed by Jeff Rowberg. You can find the library here. Next you have to
unzip/extract this library. And then take the folder named “MPU6050” and paste it inside the arduino’s
“library” folder. That is, go to the location where you have installed arduino (Arduino –> libraries) and paste
it inside the libraries folder. You might also have to do the same thing to install the I2Cdev library as well, if
you don’t already have it for your arduino. Do the same procedure as above for installing it, you can find the
file here: I2Cdev library.
433 MHZ RF TRANSMITTER STT-433

The STT-433 is ideal for remote control applications where low cost and longer range is required.
The transmitter operates from a1.5-12V supply, making it ideal for battery-powered applications. The
transmitter employs a SAW-stabilized oscillator, ensuring accurate frequency control for best range
performance. Output power and harmonic emissions are easy to control, making FCC and ETSI compliance
easy. The manufacturing-friendly SIP style package and low-cost make the STT-433 suitable for high
volume applications.

Features
· 433.92 MHz Frequency
· Low Cost
· 1.5-12V operation
· 11mA current consumption at 3V
· Small size
· 4 dBm output power at 3V
3. Applications
Remote Keyless Entry (RKE)
Remote Lighting Controls
On-Site Paging
Asset Tracking
Wireless Alarm and Security Systems
Long Range RFID
Automated Resource Management

OPERATION
Theory
OOK(On Off Keying) modulation is a binary form of amplitude modulation. When a logical 0 (data line
low) is being sent, the transmitter is off, fully suppressing the carrier. In this state, the transmitter current is
very low, less than 1mA. When a logical 1 is being sent, the carrier is fully on. In this state, the module
current consumption is at its highest, about 11mA with a 3V power supply.
OOK is the modulation method of choice for remote control applications where power consumption and cost
are the primary factors. Because OOK transmitters draw no power when they transmit a 0, they exhibit
significantly better power consumption than FSK transmitters. OOK data rate is limited by the start-up time
of the oscillator. High-Q oscillators which have very stable center frequencies take longer to start-up than
low-Q oscillators. The start-up time of the oscillator determines the maximum data rate that the transmitter
can send.
Data Rate
The oscillator start-up time is on the order of 40uSec, which limits the maximum data rate to 4.8 kbit/sec.
SAW stabilized oscillator
The transmitter is basically a negative resistance LC oscillator whose center frequency is tightly controlled
by a SAW resonator. SAW (Surface Acoustic Wave) resonators are fundamental frequency devices that
resonate at frequencies much higher than crystals.
433 MHZ RF RECEIVER STR-433
Overview
The STR-433 is ideal for short-range remote control applications where cost is a primary concern.
The receiver module requires no external RF components except for the antenna. It generates virtually no
emissions, making FCC and ETSI approvals easy. The super-regenerative design exhibits exceptional
sensitivity at a very low cost. The manufacturing-friendly SIP style package and low-cost make the STR-433
suitable for high volume applications.

Features
· Low Cost
· 5V operation
· 3.5mA current drain
· No External Parts are required
· Receiver Frequency: 433.92 MHZ
· Typical sensitivity: -105dBm
· IF Frequency: 1MHz
Applications
· Car security system
· Sensor reporting
· Automation system
· Remote Keyless Entry (RKE)
· Remote Lighting Controls
· On-Site Paging
· Asset Tracking
· Wireless Alarm and Security Systems
· Long Range RFID
· Automated Resource Management

OPERATION
Super-Regenerative AM Detection

The STR-433 uses a super-regenerative AM detector to demodulate the incoming AM carrier. A


super regenerative detector is a gain stage with positive feedback greater than unity so that it oscillates. An
RC-time constant is included in the gain stage so that when the gain stage oscillates, the gain will be lowered
over time proportional to the RC time constant until the oscillation eventually dies. When the oscillation
dies, the current draw of the gain stage decreases, charging the RC circuit, increasing the gain, and
ultimately the oscillation starts again. In this way, the oscillation of the gain stage is turned on and off at a
rate set by the RC time constant. This rate is chosen to be super-audible but much lower than the main
oscillation rate. Detection is accomplished by measuring the emitter current of the gain stage. Any RF input
signal at the frequency of the main oscillation will aid the main oscillation in
Restarting. If the amplitude of the RF input increases, the main oscillation will stay on for a longer period of
time, and the emitter current will be higher. Therefore, we can detect the original base-band signal by simply
low-pass filtering the emitter current.
The average emitter current is not very linear as a function of the RF input level. It exhibits a 1/ln
response because of the exponentially rising nature of oscillator start-up. The steep slope of a logarithm near
zero results in high sensitivity to small input signals.

Data Slicer
The data slicer converts the base-band analog signal from the super-regenerative detector to a
CMOS/TTL compatible output. Because the data slicer is AC coupled to the audio output, there is a
minimum data rate. AC coupling also limits the minimum and maximum pulse width. Typically, data is
encoded on the transmit side using pulse-width modulation (PWM) or non-return-to-zero (NRZ). The most
common source for NRZ data is from a UART embedded in a micro-controller. Applications that use NRZ
data encoding typically involve microcontrollers. The most common source for PWM data
is from a remote control IC such as the HC-12E from Holtek
Data is sent as a constant rate square-wave. The duty cycle of that square wave will generally be either
33% (a zero) or 66% (a one). The data slicer on the STR-433 is optimized for use with PWM encoded data,
though it will work with NRZ data if certain encoding rules are followed.
Power Supply
The STR-433 is designed to operate from a 5V power supply. It is crucial that this power supply be
very quiet. The power supply should be bypassed using a 0.1uF low-ESR ceramic capacitor and a 4.7Uf
tantalum capacitor. These capacitors should be placed as close to the power pins as possible. The STR- 433
is designed for continuous duty operation. From the time power is applied, it can take up to 750mSec for the
data output to become valid.

Antenna Input
It will support most antenna types, including printed antennas integrated directly onto the PCB and
simple single core wire of about 17cm. The performance of the different antennas varies. Any time a trace is
longer than 1/8th the wavelength of the frequency it is carrying, it should be a 50 ohm microstrip.
Typical Application
Remark: Antenna length about: 17cm for 433MHz
FM TRANSMITTER

The FM transmitter is a single transistor circuit. In the telecommunication, the frequency modulation
(FM) transfers the information by varying the frequency of carrier wave according to the message signal.
Generally, the FM transmitter uses VHF radio frequencies of 87.5 to 108.0 MHz to transmit & receive the
FM signal. This transmitter accomplishes the most excellent range with less power. The performance and
working of the wireless audio transmitter circuit is depends on the induction coil & variable capacitor. This
article will explain about the working of the FM transmitter circuit with its applications.
What is an FM Transmitter?

The FM transmitter is a low power transmitter and it uses FM waves for transmitting the sound, this
transmitter transmits the audio signals through the carrier wave by the difference of frequency. The carrier
wave frequency is equivalent to the audio signal of the amplitude and the FM transmitter produce VHF band
of 88 to 108MHZ.Plese follow the below link for: Know all About Power Amplifiers for FM Transmitter
Block Diagram of FM Transmitter

The following image shows the block diagram of the FM transmitter and the required components of
the FM transmitter are; microphone, audio pre amplifier, modulator, oscillator, RF- amplifier and antenna.
There are two frequencies in the FM signal, first one is carrier frequency and the other one is audio
frequency. The audio frequency is used to modulate the carrier frequency. The FM signal is obtained by
differing the carrier frequency by allowing the AF. The FM transistor consists of oscillator to produce the RF
signal.

Working of FM Transmitter Circuit

The following circuit diagram shows the FM transmitter circuit and the required electrical and
electronic components for this circuit is the power supply of 9V, resistor, capacitor, trimmer capacitor,
inductor, mic, transmitter, and antenna. Let us consider the microphone to understand the sound signals and
inside the mic there is a presence of capacitive sensor. It produces according to the vibration to the change of
air pressure and the AC signal.
The formation of the oscillating tank circuit can be done through the transistor of 2N3904 by using the
inductor and variable capacitor. The transistor used in this circuit is an NPN transistor used for general
purpose amplification. If the current is passed at the inductor L1 and variable capacitor then the tank circuit
will oscillate at the resonant carrier frequency of the FM modulation. The negative feedback will be the
capacitor C2 to the oscillating tank circuit.
To generate the radio frequency carrier waves the FM transmitter circuit requires an oscillator. The
tank circuit is derived from the LC circuit to store the energy for oscillations. The input audio signal from
the mic penetrated to the base of the transistor, which modulates the LC tank circuit carrier frequency in
FM format. The variable capacitor is used to change the resonant frequency for fine modification to the FM
frequency band. The modulated signal from the antenna is radiated as radio waves at the FM frequency band
and the antenna is nothing but copper wire of 20cm long and 24 gauge. In this circuit the length of the
antenna should be significant and here you can use the 25-27 inches long copper wire of the antenna.

Application of Fm Transmitter

The FM transmitters are used in the homes like sound systems in halls to fill the sound with the audio
source.
These are also used in the cars and fitness centers.
The correctional facilities have used in the FM transmitters to reduce the prison noise in common areas.
Advantages of the FM Transmitters

 The FM transmitters are easy to use and the price is low


 The efficiency of the transmitter is very high
 It has a large operating range
 This transmitter will reject the noise signal from an amplitude variation.
Disadvantages of the FM Transmitter

 In the FM transmitter the huge wider channel is required.


 The FM transmitter and receiver will tend to be more complex.
 Due to some interference there is poor quality in the received signals

DISPLAYS

LCD

( LIQUID CRYSTAL DISPLAY)


This is an example for the Parallel Port. This doesn't use the Bi-directional feature found on newer
ports, thus it should work with most, if no all Parallel Ports. It however doesn't show the use of the Status
Port as an input.. These modules are preferred over seven segments and other multi segment LEDs. The
reasons being: LCDs are economical; easily programmable; have no limitation of displaying special & even
custom characters (unlike in seven segments), animations and so on.
The command register stores the command instructions given to the LCD. A command is an
instruction given to LCD to do a predefined task like initializing it, clearing its screen, setting the cursor
position, controlling display etc. The data register stores the data to be displayed on the LCD. The data is the
ASCII value of the character to be displayed on the LCD.

Figure 5.6.1

LCD BACKGROUND:

The 44780 standard requires 3 control lines as well as either 4 or 8 I/O lines for the data bus. The
user may select whether the LCD is to operate with a 4-bit data bus or an 8-bit data bus. If a 4-bit data bus is
used the LCD will require a total of 7 data lines (3 control lines plus the 4 lines for the data bus). If an 8-bit
data bus is used the LCD will require a total of 11 data lines (3 control lines plus the 8 lines for the data bus).
The three control lines are referred as EN, RW and RS
EN: The EN line is called "Enable." This control line is used to tell the LCD that you are sending it data. To
send data to the LCD, your program should make sure this line is low (0) and then set the other two control
lines and/or put data on the data bus. When the other lines are completely ready, bring EN high (1) and wait
for the minimum amount of time required by the LCD datasheet (this varies from LCD to LCD), and end by
bringing it low (0) again.
RS: The RS line is the "Register Select" line. When RS is low (0), the data is to be treated as a command or
special instruction (such as clear screen, position cursor, etc.). When RS is high (1), the data being sent is
text data which should be displayed on the screen. For example, to display the letter "T" on the screen you
would set RS high.
RW: The RW line is the "Read/Write" control line. When RW is low (0), the information on the data bus is
being written to the LCD. When RW is high (1), the program is effectively querying (or reading) the LCD.
Only one instruction ("Get LCD status") is a read command. All others are write commands--so RW will
almost always be low.
Finally, the data bus consists of 4 or 8 lines (depending on the mode of operation selected by the user). In the
case of an 8-bit data bus, the lines are referred to as DB0, DB1, DB2, DB3, DB4, DB5, DB6, and DB7.

LCD PIN OUT


PIN DESCRIPTION

Pin No: Name Function


1 VSS This pin must be connected
to the ground
2 VCC Positive supply voltage pin
(5V DC)
3 VEE Contrast adjustment
4 RS Register selection
5 R/W Read or write
6 E Enable
7 DB0 Data
8 DB1 Data
9 DB2 Data
10 DB3 Data
11 DB4 Data
12 DB5 Data
13 DB6 Data
14 DB7 Data
15 LED+ Back light LED+
16 LED- Back light LED

INTERFACING LCD WITH AN ARDUINO


The circuit diagram of interfacing LCD to Arduino for displaying a text message is shown above. RS
pin of the LCD module is connected to digital pin 12 of the Arduino. R/W pin of the LCD is grounded.
Enable pin of the LCD module is connected to digital pin 11 of the Arduino. In this project, the LCD module
and Arduino are interfaced in the 4-bit mode. That means only four of the digital input lines (DB4 to DB7 of
the LCD are used). This method is very simple, requires less connections and you can almost utilize the full
potential of the LCD module. Digital lines DB4, DB5, DB6 and DB7 are interfaced to digital pins 5, 4, 3
and 2 of the Arduino. The 10K potentiometer is used for adjusting the contrast of the display. 560 ohm
resistor R1 limits the current through the back light LED. The Arduino can be powered through the external
power jack provided on the board. +5V required in some other parts of the circuit can be tapped from the 5V
source on the Arduino board. The Arduino can be also powered from the PC through the USB port.

SCROOLING LED

LED DISPLAY UNIT


The actual concepts of these scrolling led displays are the presence of the LED in it. They use the
Red led in most of the cases because the Red color will attract the attention of the visitors a lot. The LED’s
will ‘ON‘at a particular time period and ‘OFF‘ on a specific time.

There is an electronic circuit in the internal part of the device which consists of the Integrated
Circuits(IC’s). The circuit works by power supplied. According to the program written in the circuit, this
will work. It gives supply to specific led’s present in the scrolling led display such that, they
will ON and OFF for a particular time intervals.
The circuit has the sense to display all types of alphabets on the scrolling led display. There will be
some particular information to display. If this information once displays on the scrolling led display
immediately after a mean time the LED’s light pattern is will shift off to the next segment of the led column.

This will occur in a fraction of a second. Our eyes can’t detect this movement. This principle is
called “Persistence of vision (P0V)”. Thus, the information displayed on the screen will move so we called
it as scrolling led display.

On the field of Digital electronics the use of Matrix display is very huge. This unit consist a Matrix
form display of LEDs. LEDs are arranged in matrix form with equal-spaced. The LEDs are connected with
Register output pins (Qa - Qh). The advantage of Using this display is that Massage Moving speed, direction
can be controlled with sufficient logical operation. This type of display provides very small power
consumption facility.
The massage is displayed on the display by configuring each and every LEDs of the display. This
configuration is done by a logical device e.g. Microcontroller, Microprocessors etc.

It consists of mainly power supply unit, register unit, control unit (microcontroller & timer) and
display unit.
First power is supplied to all the sections of the circuit from the power supply unit. 230v main ac
power is first converted into 15v step down dc supply to operate the digital circuit. Then the microcontroller
generates and provides the digital signal. It performs the logical operations.
The digital information created here is synchronized by some delay program of the microcontroller. The
digital information is created here by running some instructions in the form of microcontroller program. The
execution time of this program is totally depends on the crystal oscillator frequency of the microcontroller.
Microcontroller resets the whole circuit after switching on the power.
The digital signal provided by the microcontroller is fed to the register unit which consists of shift registers.
Here the information shifts from right to left. This data moves with certain delay introduced by the
microcontroller itself.
The rate of shifting of the signals depends on the timer frequency. Register IC 74164 can be reset by sending
a logical high signal at the pin clr (pin no:- 09). Signals are shifted from Qa to Qh.

The display unit is a matrix display, we used here. It is connected to the register unit. The pins Qa to Qh
of register unit are connected to the display. No of light emitting diodes (LED) are used here to form the
display section.
NOKIA 5110 LCD

This is a our 84x48 pixel monochrome LCD display. These displays are small, only about 1.5"
diameter, but very readable due and comes with a backlight. This display is made of 84x48 individual pixels,
so you can use it for graphics, text or bitmaps. These displays are inexpensive, easy to use, require only a
few digital I/O pins and are fairly low power as well. To drive the display, you will need 3 to 5 digital output
pins (depending on whether you want to manually control the chip select and reset lines). Another pin can be
used to control (via on/off or PWM) the backlight. To make things easy for you, we've written a nice
graphics library that can print text, pixels, rectangles, circles and lines! The library is written for the Arduino
but can easily be ported to your favorite microcontroller.
Power Requirements The display uses the PCD8544 controller chip from Philips and were used in
Nokia 3310 and 5110 cell phones. This chip is designed to run only at 3.3V and have 3v communication
levels, so for 5V microcontrollers a logic level shifter is required (otherwise you could easily damage the
display).
If you want to use the backlight, that can draw up to 80mA (4 white LEDs at 20mA each). The
backlight pin is connected to a transistor so you can PWM all 4 LEDs at once from a microcontroller pin.
Pin Configuration:

Pin
Pin Name: Description
No:

1 Reset This pin resets the module. It an active low pin (resets when 0V is provided)

This pin is made low (0V) to select this particular display when more than one
2 Chip Enable (CE)
SPI peripherals are used.

This pin is used to switch between Data mode (high) and Command mode
3 Data/Command (DC)
(low)

4 Serial Input (DIN) This is the input pin (MOSI) through which serial instructions are sent

All SPI modules require a common clock, this clock source is supplied to this
5 Clock (CLK)
pin

6 Power (Vcc) This pin is used to power the display the supply voltage is from 2.7V to 3.3V

7 Back Light (BL) This pin powers the backlight of the display (3.3V maximum).

8 Ground (Gnd) Connects to the ground of the circuit.


Features of Nokia5110 LCD module:

 Operating Voltage is 2.7V to 3.3V


 Current consumption is 6mA

 Consists of 48 rows and 84 columns (84×48) monochrome pixels

 Works using SPI interface

 Consists of Philips PCD8544 interface chip for easy interfacing

 Can be easily interfaced with Arduino

 Supports decent graphics of bitmap images

 Available in Green and Blue Backlight

Alternative Display Modules:

16×2 LCD Display, Dot Matrix LED Display, 7-Segment LED Display, OLED Display, TFT LCD Screen
Display
Where to use Nokia 5110 Display module:

As the name suggests this module was originally developed to be used with the iconic Nokia 5110
mobile phone. So it is capable of displaying alphanumeric characters, draw lines and other shapes and even
displays a bitmap image. All this is possible because of its (84×48) monochrome pixels.

The module comes with the PCD8544 interface IC which makes this module easy to use with low-
level microcontrollers. It communicates through SPI protocol and hence does not require more pins. The
module also has a readily available library for Arduino which makes it ideal even for novice programmers.

So if you are looking for a display that is better than the standard 16*2 LCD to showcase some
decent graphics or custom characters then this display might be the right choice for you.

How to use Nokia 5110 Display module:

The Nokia 5110 module is commonly used with Arduino but it can also be used with any
microcontroller that supports SPI communication. The module works on 3.3V and hence all the pins are
only 3.3V tolerant according to the datasheet. So if you are using a 5V microcontroller (which most of us
do) then it is recommended to use a logic level shifter like a potential divider to access the SPI pins of the
display module.

The graphical LCD shown above is from spark fun, and hence you can find the soldering pad sets on
both on top and to the bottom of the LCD of which we can use any desired set. However you can also find
many clones in the market with pads on only one side, but still, they have the same pinouts and same
functionality so you need not worry about the difference. All clones have the same dimensions (1.72’ ×
1.72’) with 6 input pins.

You can easily interface Nokia 5110 module with Arduino by following the link and using the readily
available libraries. If you are planning to interface with other microcontrollers then you should read through
the PCD8544 datasheet to know how to access its registers through SPI

Nokia 5110 LCD Interface with Arduino Board


Applications:

 Can be used to display alphanumeric characters and bitmap images


 Used in application where fancy graphics are required

 Requires only a maximum of 5 pins to operate hence I/O friendly

 Comes with a backlight and hence can be used even in darker environment

 Can be used to create retro games using microcontrollers

 Graphics are decent enough to create a basic UI


SEVEN SEGMENT DISPLAY

The emission of these photons occurs when the diode junction is forward biased by an external
voltage allowing current to flow across its junction, and in Electronics we call this process
electroluminescence.

The actual colour of the visible light emitted by an LED, ranging from blue to red to orange, is
decided by the spectral wavelength of the emitted light which itself is dependent upon the mixture of the
various impurities added to the semiconductor materials used to produce it.

Light emitting diodes have many advantages over traditional bulbs and lamps, with the main ones
being their small size, long life, various colours, cheapness and are readily available, as well as being easy to
interface with various other electronic components and digital circuits.
But the main advantage of light emitting diodes is that because of their small die size, several of them can be
connected together within one small and compact package producing what is generally called a 7-segment
Display.

The 7-segment display, also written as “seven segment display”, consists of seven LEDs (hence its
name) arranged in a rectangular fashion as shown. Each of the seven LEDs is called a segment because
when illuminated the segment forms part of a numerical digit (both Decimal and Hex) to be displayed. An
additional 8th LED is sometimes used within the same package thus allowing the indication of a decimal
point, (DP) when two or more 7-segment displays are connected together to display numbers greater than
ten.

Each one of the seven LEDs in the display is given a positional segment with one of its connection
pins being brought straight out of the rectangular plastic package. These individually LED pins are labeled
from a through to g representing each individual LED. The other LED pins are connected together and wired
to form a common pin.

So by forward biasing the appropriate pins of the LED segments in a particular order, some segments
will be light and others will be dark allowing the desired character pattern of the number to be generated on
the display. This then allows us to display each of the ten decimal digits 0 through to 9 on the same 7-
segment display.

The displays common pin is generally used to identify which type of 7-segment display it is. As each LED
has two connecting pins, one called the “Anode” and the other called the “Cathode”, there are therefore two
types of LED 7-segment display called: Common Cathode (CC) and Common Anode (CA).

The difference between the two displays, as their name suggests, is that the common cathode has all
the cathodes of the 7-segments connected directly together and the common anode has all the anodes of the
7-segments connected together and is illuminated as follows.
The 7-segment display, also written as “seven segment display”, consists of seven LEDs (hence its
name) arranged in a rectangular fashion as shown. Each of the seven LEDs is called a segment because
when illuminated the segment forms part of a numerical digit (both Decimal and Hex) to be displayed. An
additional 8th LED is sometimes used within the same package thus allowing the indication of a decimal
point, (DP) when two or more 7-segment displays are connected together to display numbers greater than
ten.

Each one of the seven LEDs in the display is given a positional segment with one of its connection
pins being brought straight out of the rectangular plastic package. These individually LED pins are labelled
from a through to g representing each individual LED. The other LED pins are connected together and wired
to form a common pin.

So by forward biasing the appropriate pins of the LED segments in a particular order, some segments
will be light and others will be dark allowing the desired character pattern of the number to be generated on
the display. This then allows us to display each of the ten decimal digits 0 through to 9 on the same 7-
segment display.

The displays common pin is generally used to identify which type of 7-segment display it is. As each
LED has two connecting pins, one called the “Anode” and the other called the “Cathode”, there are therefore
two types of LED 7-segment display called: Common Cathode (CC) and Common Anode (CA).

The difference between the two displays, as their name suggests, is that the common cathode has all
the cathodes of the 7-segments connected directly together and the common anode has all the anodes of the
7-segments connected together and is illuminated as follows.

1. The Common Cathode (CC) – In the common cathode display, all the cathode connections of the LED
segments are joined together to logic “0” or ground. The individual segments are illuminated by application
of a “HIGH”, or logic “1” signal via a current limiting resistor to forward bias the individual Anode
terminals (a-g).

2. The Common Anode (CA) – In the common anode display, all the anode connections of the LED
segments are joined together to logic “1”. The individual segments are illuminated by applying a ground,
logic “0” or “LOW” signal via a suitable current limiting resistor to the Cathode of the particular segment
(a-g).

In general, common anode displays are more popular as many logic circuits can sink more current than they
can source. Also note that a common cathode display is not a direct replacement in a circuit for a common
anode display and vice versa, as it is the same as connecting the LEDs in reverse, and hence light emission
will not take place.
Depending upon the decimal digit to be displayed, the particular set of LEDs is forward biased. For instance,
to display the numerical digit 0, we will need to light up six of the LED segments corresponding to a, b, c, d,
e and f. Thus the various digits from 0 through 9 can be displayed using a 7-segment display as shown.

Driving a 7-segment Display

Although a 7-segment display can be thought of as a single display, it is still seven individual LEDs
within a single package and as such these LEDs need protection from over current. LEDs produce light only
when it is forward biased with the amount of light emitted being proportional to the forward current.

This means then that an LEDs light intensity increases in an approximately linear manner with an
increasing current. So this forward current must be controlled and limited to a safe value by an external
resistor to prevent damage to the LED segments.

The forward voltage drop across a red LED segment is very low at about 2-to-2.2 volts, (blue and
white LEDs can be as high as 3.6 volts) so to illuminate correctly, the LED segments should be connected to
a voltage source in excess of this forward voltage value with a series resistance used to limit the forward
current to a desirable value.

Typically for a standard red coloured 7-segment display, each LED segment can draw about 15 mA
to illuminated correctly, so on a 5 volt digital logic circuit, the value of the current limiting resistor would be
about 200Ω (5v – 2v)/15mA, or 220Ω to the nearest higher preferred value.
So to understand how the segments of the display are connected to a 220Ω current limiting resistor
consider the circuit below.

In this example, the segments of a common anode display are illuminated using the switches. If
switch a is closed, current will flow through the “a” segment of the LED to the current limiting resistor
connected to pin a and to 0 volts, making the circuit. Then only segment a will be illuminated. So a LOW
condition (switch to ground) is required to activate the LED segments on this common anode display.

But suppose we want the decimal number “4” to illuminate on the display. Then switches b, c,
f and g would be closed to light the corresponding LED segments. Likewise for a decimal number “7”,
switches a, b, c would be closed. But illuminating 7-segment displays using individual switches is not very
practical.

7-segment Displays are usually driven by a special type of integrated circuit (IC) commonly known
as a 7-segment decoder/driver, such as the CMOS 4511. This 7-segment display driver which is known as a
Binary Coded Decimal or BCD to 7-segment display decoder and driver, is able to illuminate both common
anode or common cathode displays. But there are many other single and dual display drivers available such
as the very popular TTL 7447.

This BCD-to-7 segment decoder/driver takes a four-bit BCD input labelled A, B, C and D for the
digits of the binary weighting of 1, 2, 4 and 8 respectively, has seven outputs that will pass current through
the appropriate segments to display the decimal digit of the numeric LED display.
The digital outputs of the CD4511 are different from the usual CMOS outputs because they can
provide up to 25mA of current each to drive the LED segments directly allowing different coloured LED
displays to be used and driven.

In this simple circuit, each LED segment of the common cathode display has its own anode terminal
connected directly to the 4511 driver with its cathodes connected to ground. The current from each output
passes through a 1kΩ resistor that limits it to a safe amount. The binary input to the 4511 is via the four
switches. Then we can see that using a BCD to 7-segment display driver such as the CMOS 4511, we can
control the LED display using just four switches (instead of the previous 8) or a 4-bit binary signal allowing
up to 16 different combinations.

Most digital equipment use 7-segment Displays for converting digital signals into a form that can be
displayed and understood by the user. This information is often numerical data in the form of numbers,
characters and symbols. Common anode and common cathode seven-segment displays produce the required
number by illuminating the individual segments in various combinations.

LED based 7-segment displays are very popular amongst Electronics hobbyists as they are easy to
use and easy to understand. In most practical applications, 7-segment displays are driven by a suitable
decoder/driver IC such as the CMOS 4511 or TTL 7447 from a 4-bit BCD input. Today, LED based 7-
segment displays have been largely replaced by liquid crystal displays (LCDs) which consume less current.

WIRED MODULES

GSM

GSM is a mobile communication modem; it is stands for global system for mobile communication
(GSM). The idea of GSM was developed at Bell Laboratories in 1970. It is widely used mobile
communication system in the world. GSM is an open and digital cellular technology used for transmitting
mobile voice and data services operates at the 850MHz, 900MHz, 1800MHz and 1900MHz frequency
bands.

GSM system was developed as a digital system using time division multiple access (TDMA)
technique for communication purpose. A GSM digitizes and reduces the data, then sends it down through a
channel with two different streams of client data, each in its own particular time slot. The digital system has
an ability to carry 64 kbps to 120 Mbps of data rates.

There are various cell sizes in a GSM system such as macro, micro, pico and umbrella cells. Each
cell varies as per the implementation domain. There are five different cell sizes in a GSM network macro,
micro, pico and umbrella cells. The coverage area of each cell varies according to the implementation
environment.

Time Division Multiple Access

TDMA technique relies on assigning different time slots to each user on the same frequency. It can easily
adapt to data transmission and voice communication and can carry 64kbps to 120Mbps of data rate.

GSM Architecture

A GSM network consists of the following components:

 A Mobile Station: It is the mobile phone which consists of the transceiver, the display and the
processor and is controlled by a SIM card operating over the network.
 Base Station Subsystem: It acts as an interface between the mobile station and the network
subsystem. It consists of the Base Transceiver Station which contains the radio transceivers and handles
the protocols for communication with mobiles. It also consists of the Base Station Controller which
controls the Base Transceiver station and acts as a interface between the mobile station and mobile
switching centre.
 Network Subsystem: It provides the basic network connection to the mobile stations. The basic part
of the Network Subsystem is the Mobile Service Switching Centre which provides access to different
networks like ISDN, PSTN etc. It also consists of the Home Location Register and the Visitor Location
Register which provides the call routing and roaming capabilities of GSM. It also contains the Equipment
Identity Register which maintains an account of all the mobile equipments wherein each mobile is
identified by its own IMEI number. IMEI stands for International Mobile Equipment Identity.
Features of GSM Module:

 Improved spectrum efficiency


 International roaming
 Compatibility with integrated services digital network (ISDN)
 Support for new services.
 SIM phonebook management
 Fixed dialing number (FDN)
 Real time clock with alarm management
 High-quality speech
 Uses encryption to make phone calls more secure
 Short message service (SMS)
The security strategies standardized for the GSM system make it the most secure telecommunications
standard currently accessible. Although the confidentiality of a call and secrecy of the GSM subscriber is
just ensured on the radio channel, this is a major step in achieving end-to- end security.

GSM Modem

A GSM modem is a device which can be either a mobile phone or a modem device which can be used to
make a computer or any other processor communicate over a network. A GSM modem requires a SIM card
to be operated and operates over a network range subscribed by the network operator. It can be connected to
a computer through serial, USB or Bluetooth connection.

A GSM modem can also be a standard GSM mobile phone with the appropriate cable and software driver to
connect to a serial port or USB port on your computer. GSM modem is usually preferable to a GSM mobile
phone. The GSM modem has wide range of applications in transaction terminals, supply chain management,
security applications, weather stations and GPRS mode remote data logging.
Working of GSM Module:

From the below circuit, a GSM modem duly interfaced to the MC through the level shifter IC
Max232. The SIM card mounted GSM modem upon receiving digit command by SMS from any cell phone
send that data to the MC through serial communication. While the program is executed, the GSM modem
receives command ‘STOP’ to develop an output at the MC, the contact point of which are used to disable the
ignition switch. The command so sent by the user is based on an intimation received by him through the
GSM modem ‘ALERT’ a programmed message only if the input is driven low. The complete operation is
displayed over 16×2 LCD display.

Intelligent GSM Device for Automation and Security

In these days, the GSM mobile terminal has become one of the items that are constantly with us. Just
like our wallet/purse, keys or watch, the GSM mobile terminal provides us a communication channel that
enables us to communicate with the world. The requirement for a person to be reachable or to call anyone at
any time is very appealing.

In this project, as the name says project is based on GSM network technology for transmission of
SMS from sender to receiver. SMS sending and receiving is used for ubiquitous access of appliances and
allowing breach control at home. The system proposes two sub-systems. Appliance control subsystem
enables the user to control home appliances remotely and the security alert subsystem gives the automatic
security monitoring.

The system is capable enough to instruct user via SMS from a specific cell number to change the
condition of the home appliance according to the user’s needs and requirements. The second aspect is that of
security alert which is achieved in a way that on the detection of intrusion, the system allows automatic
generation of SMS thus alerting the user against security risk.
GSM will allow communication anywhere, anytime, and with anyone. The functional architecture of
GSM employing intelligent networking principles, and its ideology, which provides the development of
GSM is the first step towards a true personal communication system that enough standardization to ensure
compatibility.

Interface GSM with Arduino


GPS

What is GPS?

GPS or Global Positioning System is a satellite navigation system that furnishes location and time
information in all climate conditions to the user. GPS is used for navigation in planes, ships, cars and trucks
also. The system gives critical abilities to military and civilian users around the globe. GPS provides
continuous real time, 3-dimensional positioning, navigation and timing worldwide.

How does GPS System Work

The GPS system consists of three segments:

The space segment: the GPS satellites

2) The control system, operated by the U.S. military,


3) The user segment, which includes both military and civilian users and their GPS equipment.

Space Segment:

The space segment is the number of satellites in the constellation. It comprises of 29 satellites
circling the earth every 12 hours at 12,000 miles in altitude. The function of the space segment is utilized to
route/navigation signals and to store and retransmit the route/navigation message sent by the control
segment. These transmissions are controlled by highly stable atomic clocks on the satellites. The GPS Space
Segment is formed by a satellite constellation with enough satellites to ensure that the users will have, at
least, 4 simultaneous satellites in view from any point at the Earth surface at any time.

Control Segment:

The control segment comprises of a master control station and five monitor stations outfitted with
atomic clocks that are spread around the globe. The five monitor stations monitor the GPS satellite signals
and then send that qualified information to the master control station where abnormalities are revised and
sent back to the GPS satellites through ground antennas. Control segment also referred as monitor station.

User Segment:

The user segment comprises of the GPS receiver, which receives the signals from the GPS satellites
and determine how far away it is from each satellite. Mainly this segment is used for the U.S military,
missile guidance systems, civilian applications for GPS in almost every field. Most of the civilian uses this
from survey to transportation to natural resources and from there to agriculture purpose and mapping too.

How GPS Determines a Position:

The working/operation of Global positioning system is based on the ‘trilateration’ mathematical


principle. The position is determined from the distance measurements to satellites. From the figure, the four
satellites are used to determine the position of the receiver on the earth. The target location is confirmed by
the 4th satellite. And three satellites are used to trace the location place. A fourth satellite is used to confirm
the target location of each of those space vehicles. Global positioning system consists of satellite, control
station and monitor station and receiver. The GPS receiver takes the information from the satellite and uses
the method of triangulation to determine a user’s exact position.
GPS is used on some incidents in several ways, such as:

1. To determine position locations; for example, you need to radio a helicopter pilot the coordinates of
your position location so the pilot can pick you up.
2. To navigate from one location to another; for example, you need to travel from a lookout to the fire
perimeter.
3. To create digitized maps; for example, you are assigned to plot the fire perimeter and hot spots.
4. To determine distance between two different points.
3 Advantages of GPS:

 GPS satellite based navigation system is an important tool for military, civil and commercial users
 Vehicle tracking systems GPS-based navigation systems can provide us with turn by turn directions
 Very high speed
2 Disadvantages of GPS:

 GPS satellite signals are too weak when compared to phone signals, so it doesn’t work as well
indoors, underwater, under trees, etc.
 The highest accuracy requires line-of-sight from the receiver to the satellite, this is why GPS doesn’t
work very well in an urban environment.
Using a GPS Receiver:

There are several different models and types of GPS receivers. While working with a GPS receiver it is
important to have :

 A compass and a map.


 A downloaded GPS cable.
 Some extra batteries.
 Knowledge about the memory capacity of the GPS receiver to prevent loss of data, decrease in
accuracy of data, or other problems.
 An external antenna whenever possible, especially under tree canopy, in canyons, or while driving.
 A set up GPS receiver according to incident or agency standard regulation; coordinate system.
 Notes that describe what you are saving in the receiver.

GPS Error

There are many sources of possible errors that will degrade the accuracy of positions computed by a
GPS receiver. The travel time taken by the GPS satellite signals can be changed by atmospheric effects;
when a GPS signal passes through the ionosphere and troposphere it is refracted, causing the speed of the
signal to be different from the speed of a GPS signal in space. Another source of error is noise, or distortion
of the signal which causes electrical interference or errors inherent in the GPS receiver itself.

The information about satellite orbits will also cause errors in determining the positions, because the
satellites are not really where the GPS receiver “thought” based on the information it received when it
determine the positions. Small variations in the atomic clocks on board the satellites can translate to large
position errors; a clock error of 1 nanosecond translates to 1 foot or .3 meters user error on the ground. A
multipath effect occurs when signals transmitted from the satellites bounce off a reflective surface before
getting to the receiver antenna. During this process, the receiver gets the signal in straight line path as well
as delayed path (multiple paths). The effect is similar to a ghost or double image on a TV set.

Geometric Dilution of Precision (GDOP)

Satellite geometry can also affect the accuracy of GPS positioning. This effect is refers as Geometric
Dilution of Precision (GDOP). Which is refers to where the satellites are in related to one another, and is a
measure of the quality of the satellite configuration. It can be able to modify other GPS errors. Most GPS
receivers select the satellite constellation that will give the least uncertainty, the best satellite geometry.

GPS receivers usually report the quality of satellite geometry in terms of Position Dilution of
Precision, or PDOP. PDOP are of two types, horizontal (HDOP) and vertical (VDOP) measurements
(latitude, longitude and altitude). We can check the quality of the satellite positioning the receiver is
currently available by the PDOP value. A low DOP indicates a higher probability of accuracy, and a high
DOP indicates a lower probability of accuracy. Another term of PDOP is TDOP (Time Dilution of
Precision). TDOP refers to satellite clock offset. On a GPS receiver can set a parameter known as the PDOP
mask. This will cause the receiver to ignore satellite configurations that have a PDOP higher than the limit
specified.
Selective Availability (SA):
Selective Availability occurs when the DOD intentionally degraded; the accuracy of GPS signals is
introducing artificial clock and ephemeris errors. During the implementation of SA, it was the largest
component of GPS error, causing error of up to 100 meters. SA is a component of the Standard Positioning
Service (SPS).

WIRELESS COMMUNICATION MODULES


BLUETOOTH
HC-05 module is an easy to use Bluetooth SPP (Serial Port Protocol) module, designed for
transparent wireless serial connection setup. Serial port Bluetooth module is fully qualified Bluetooth
V2.0+EDR (Enhanced Data Rate) 3Mbps Modulation with complete 2.4GHz radio transceiver and
baseband. It uses CSR Bluecore 04-External single chip Bluetooth system with CMOS technology and with
AFH(Adaptive Frequency Hopping Feature). It has the footprint as small as 12.7mmx27mm. Hope it will
simplify your overall design/development cycle.

Specifications Hardware features


Typical -80dBm sensitivity
Up to +4dBm RF transmit power
Low Power 1.8V Operation ,1.8 to 3.6V I/O
PIO control
UART interface with programmable baud rate
With integrated antenna
With edge connector
Software features
Default Baud rate: 38400, Data bits:8, Stop bit:1,Parity:No parity, Data control: has.
Supported baud rate: 9600,19200,38400,57600,115200,230400,460800.
Given a rising pulse in PIO0, device will be disconnected. Status instruction port PIO1: low-disconnected,
high-connected;
PIO10 and PIO11 can be connected to red and blue led separately. When master and slave are paired, red
and blue led blinks 1time/2s in interval, while disconnected only blue led blinks 2times/s. Auto-connect to
the last device on power as default.
Permit pairing device to connect as default. Auto-pairing PINCODE:”0000” as default Auto-reconnect
in 30 min when disconnected as a result of beyond the range of connection
AT command Default: How to set the mode to server (master): 1. Connect PIO11 to high level. 2. Power on,
module into command state.
3. Using baud rate 38400, sent the “AT+ROLE=1\r\n” to module, with “OK\r\n” means setting successes.
4. Connect the PIO11 to low level, repower the module, the module work as server (master). AT commands:
(all end with \r\n)

1. Test command: Command Respond Parameter AT OK –


2. Reset Command Respond Parameter AT+RESET OK –
3. Get firmware version Command Respond Parameter AT+VERSION? +VERSION: OK Param : firmware
version

Example: AT+VERSION?\r\n +VERSION:2.0-20100601 OK


4. Restore default Command Respond Parameter AT+ORGL OK - Default state: Slave mode, pin code :
1234, device name: H-C-2010-06-01 ,Baud 38400bits/s.
5. Get module address Command Respond Parameter AT+ADDR? +ADDR: OK Param: address of
Bluetooth module Bluetooth address: NAP: UAP : LAP Example: AT+ADDR?\r\n +ADDR:1234:56:abcdef
OK
6. Set/Check module name: Command Respond Parameter AT+NAME= OK
Param: Bluetooth module name (Default :HC-05) AT+NAME? +NAME: OK (/FAIL) Example:
AT+NAME=HC-05\r\n set the module name to “HC-05” OK AT+NAME=ITeadStudio\r\n OK
AT+NAME?\r\n +NAME: ITeadStudio OK
6. Get the Bluetooth device name: Command Respond Parameter
AT+RNAME? 1. +NAME: OK
2. FAIL Param1,Param 2 : the address of Bluetooth device
Example: (Device address 00:02:72:od:22:24,name:ITead) AT+RNAME?
0002,72,od2224\r\n +RNAME:ITead OK 8. Set/Check module mode: Command Respond
Parameter AT+ROLE= OK Param: AT+ ROLE? +ROLE: 0- Slave
ZIGBEE

Zigbee communication is specially built for control and sensor networks on IEEE 802.15.4 standard
for wireless personal area networks (WPANs), and it is the product from Zigbee alliance.
This communication standard defines physical and Media Access Control (MAC) layers to handle many
devices at low-data rates. These Zigbee’s WPANs operate at 868 MHz, 902-928MHz and 2.4 GHz
frequencies. The date rate of 250 kbps is best suited for periodic as well as intermediate two way
transmission of data between sensors and controllers.
Zigbee is low-cost and low-powered mesh network widely deployed for controlling and monitoring
applications where it covers 10-100 meters within the range. This communication system is less expensive
and simpler than the other proprietary short-range wireless sensor networks as Bluetooth and Wi-Fi.
Zigbee supports different network configurations for master to master or master to slave
communications. And also, it can be operated in different modes as a result the battery power is conserved.
Zigbee networks are extendable with the use of routers and allow many nodes to interconnect with each
other for building a wider area network

Zigbee Architecture

Zigbee system structure consists of three different types of devices such as Zigbee coordinator,
Router and End device. Every Zigbee network must consist of at least one coordinator which acts as a root
and bridge of the network. The coordinator is responsible for handling and storing the information while
performing receiving and transmitting data operations. Zigbee routers act as intermediary devices that permit
data to pass to and fro through them to other devices. End devices have limited functionality to communicate
with the parent nodes such that the battery power is saved as shown in the figure.
The number of routers, coordinators and end devices depends on the type of network such as star,
tree and mesh networks. Zigbee protocol architecture consists of a stack of various layers where IEEE
802.15.4 is defined by physical and MAC layers while this protocol is completed by accumulating Zigbee’s
own network and application layers.

Physical Layer: This layer does modulation and demodulation operations up on transmitting and receiving
signals respectively. This layer’s frequency, date rate and number of channels are given below.
MAC Layer: This layer is responsible for reliable transmission of data by accessing different networks with
the carrier sense multiple access collision avoidance (CSMA). This also transmits the beacon frames for
synchronizing communication.
Network Layer: This layer takes care of all network related operations such as network setup, end device
connection and disconnection to network, routing, device configurations, etc.
Application Support Sub-Layer: This layer enables the services necessary for Zigbee device object and
application objects to interface with the network layers for data managing services. This layer is responsible
for matching two devices according to their services and needs.
Application Framework: It provides two types of data services as key value pair and generic message
services. Generic message is a developer defined structure, whereas the key value pair is used for getting
attributes within the application objects. ZDO provides an interface between application objects and APS
layer in Zigbee devices. It is responsible for detecting, initiating and binding other devices to the network.
Zigbee Operating Modes and Its Topologies

Zigbee Communication Operation

Zigbee two way data is transferred in two modes: Non-beacon mode and Beacon mode. In a beacon
mode, the coordinators and routers continuously monitor active state of incoming data hence more power is
consumed. In this mode, the routers and coordinators do not sleep because at any time any node can wake up
and communicate. However, it requires more power supply and its overall power consumption is low
because most of the devices are in an inactive state for over long periods in the network.

In a beacon mode, when there is no data communication from end devices, then the routers and
coordinators enter into sleep state. Periodically this coordinator wakes up and transmits the beacons to the
routers in the network. These beacon networks are work for time slots which means, they operate when the
communication needed results in lower duty cycles and longer battery usage. These beacon and non-beacon
modes of Zigbee can manage periodic (sensors data), intermittent (Light switches) and repetitive data types.

Zigbee supports several network topologies; however, the most commonly used configurations are
star, mesh and cluster tree topologies. Any topology consists of one or more coordinator. In a star topology,
the network consists of one coordinator which is responsible for initiating and managing the devices over the
network. All other devices are called end devices that directly communicate with coordinator. This is used in
industries where all the end point devices are needed to communicate with the central controller, and this
topology is simple and easy to deploy.
In mesh and tree topologies, the Zigbee network is extended with several routers where coordinator
is responsible for staring them. These structures allow any device to communicate with any other adjacent
node for providing redundancy to the data. If any node fails, the information is routed automatically to other
device by these topologies. As the redundancy is the main factor in industries, hence mesh topology is
mostly used. In a cluster-tree network, each cluster consists of a coordinator with leaf nodes, and these
coordinators are connected to parent coordinator which initiates the entire network.

Due to the advantages of Zigbee technology like low cost and low power operating modes and its
topologies, this short range communication technology is best suited for several applications compared to
other proprietary communications, such as Bluetooth, Wi-Fi, etc. some of these comparisons such as range
of Zigbee, standards, etc., are given below.

Applications of Zigbee Technology

Industrial Automation: In manufacturing and production industries, a communication link continually


monitors various parameters and critical equipments. Hence Zigbee considerably reduce this communication
cost as well as optimizes the control process for greater reliability.
Home Automation: Zigbee is perfectly suited for controlling home appliances remotely as a lighting system
control, appliance control, heating and cooling system control, safety equipment operations and control,
surveillance, and so on.
Smart Metering: Zigbee remote operations in smart metering include energy consumption response, pricing
support, security over power theft, etc.
Smart Grid monitoring: Zigbee operations in this smart grid involve remote temperature monitoring, fault
locating, reactive power management, and so on.
WI-FI(ESP8266)

Introduction
ESP8266 is Wi-Fi enabled system on chip (SoC) module developed by Espressif system. It is mostly used
for development of IoT (Internet of Things) embedded applications.

ESP8266 comes with capabilities of

 2.4 GHz Wi-Fi (802.11 b/g/n, supporting WPA/WPA2),


 general-purpose input/output (16 GPIO),

 Inter-Integrated Circuit (I²C) serial communication protocol,

 analog-to-digital conversion (10-bit ADC)

 Serial Peripheral Interface (SPI) serial communication protocol,

 I²S (Inter-IC Sound) interfaces with DMA(Direct Memory Access) (sharing pins with GPIO),

 UART (on dedicated pins, plus a transmit-only UART can be enabled on GPIO2), and

 pulse-width modulation (PWM).


It employs a 32-bit RISC CPU based on the Tensilica Xtensa L106 running at 80 MHz (or overclocked to
160 MHz). It has a 64 KB boot ROM, 64 KB instruction RAM and 96 KB data RAM. External flash
memory can be accessed through SPI.

ESP8266 module is low cost standalone wireless transceiver that can be used for end-point IoT
developments.

To communicate with the ESP8266 module, microcontroller needs to use set of AT commands.
Microcontroller communicates with ESP8266-01 module using UART having specified Baud rate.

There are many third-party manufacturers that produce different modules based on this chip. So, the module
comes with different pin availability options like,

 ESP-01 comes with 8 pins (2 GPIO pins) – PCB trace antenna. (shown in above figure)
 ESP-02 comes with 8 pins, (3 GPIO pins) – U-FL antenna connector.

 ESP-03 comes with 14 pins, (7 GPIO pins) – Ceramic antenna.

 ESP-04 comes with 14 pins, (7 GPIO pins) – No ant.

ESP8266-01 Module Pin Description

3V3: - 3.3 V Power Pin.

GND: - Ground Pin.

RST: - Active Low Reset Pin.

EN: - Active High Enable Pin.

TX: - Serial Transmit Pin of UART.

RX: - Serial Receive Pin of UART.


GPIO0 & GPIO2: - General Purpose I/O Pins. These pins decide what mode (boot or normal) the module
starts up in. It also decides whether the TX/RX pins are used for Programming the module or for serial I/O
purpose.

To program the module using UART, Connect GPIO0 to ground and GPIO2 to VCC or leave it open. To use
UART for normal Serial I/O leave both the pins open (neither VCC nor Ground).

For more information refer http://esp8266.net/

Now, before we start with ESP8266 interfacing, we need to update its firmware.

ESP8266 Firmware has been provided in binary format files (.BIN) that can be downloaded directly on the
ESP8266 chip.

These binaries are generated using ESP8266 SDK (Software Development Kit), which is an application
development platform produced by Espressif. Linux OS is required to compile the ESP8266 SDK. Windows
user can use virtual machine.

For more information about ESP8266 SDK compilation refer -

ESP8266_Getting_Started_Guide or download below attached ESP8266 Getting Started Guide

After compilation, download firmware directly on ESP8266 chip over serial port.

Let’s download Espressif NON-OS SDK Firmware in to the ESP8266 module.

First download ESP8266 FLASH DOWNLOAD TOOL which is the official firmware download tool
developed by Espressif.

Second download Espressif NON-OS SDK Firmware

Now select .bin files with their respective address as shown in below figure.

boot_v1.2.bin ------------------------------------------------> 0x00000

user1.1024.new.2.bin ------------------------------------------------> 0x01000

esp_init_data_default.bin ------------------------------------------------> 0xfc000

blank.bin ------------------------------------------------> 0x7e000

blank.bin ------------------------------------------------> 0xfe000


ESP8266 AT Command Set

Function AT Commands Response

Working AT OK

OK

Restart AT+RST .......

Ready
Function AT Commands Response

<AT version info> information about AT version

<SDK version info> information about SDK


Firmware
AT+GMR version
Version
<compile time> time of the bin was compiled

OK
+CWLAP:<ecn>,<ssid>,<rssi>,<mac>,<ch>,<fre
List Access
AT+CWLAP q offset>
Point
OK
Query
Joined +CWJAP:<ssid>,<bssid>,<channel>,<rssi>
AT+CWJAP?
Access OK
Point

WIFI CONNECTED
Join Access
AT+CWJAP=”SSID”,”Password” WIFI GOT IP
Point
OK

Quit Access OK
AT+CWQAP
Point WIFI DISCONNECTED
+CIFSR:APIP,<IP address>

+CIFSR:APMAC,<mac address>
Get IP AT+CIFSR
+CIFSR:STAIP,<IP address>
Address (Assuming AT+CWMODE=3)
+CIFSR:STAMAC,<mac address>

OK
Query WiFi
AT+CWMODE? +CWMODE:<mode>
Mode

Set WiFi AT+CWMODE=<mode> OK


Mode
Mode: -

1 = STA (station)

2 = AP (Access Point)
Function AT Commands Response

3 = BOTH i.e. STA & AP


Query
TCP/UDP AT+CIPMUX? +CIPMUX:<mode>
Connection

AT+CIPMUX=<mode>
Set
Mode: -
TCP/UDP OK
Connection 0 = Single Connection
1 = Multiple Connection
STATUS:<status>

Possible statuses are


TCP/IP
Connection AT+CIPSTATUS 2: Got IP
status
3: Connected

4: Disconnected
Query TCP
transmissio AT+CIPMODE? +CIPMODE:<mode>
n mode

AT+CIPMODE=<mode>
Set TCP
Mode: -
transmissio OK
n mode 0 = Normal mode

1 = Transparent mode
(CIPMUX=0) AT+CIPSTART =
<type>,<addr>,<port>

Set up (CIPMUX=1) AT+CIPSTART=


CONNECT
TCP/UDP <id>,<type>,<addr>, <port>
connection Example (CIPMUX=0): OK

AT+CIPSTART="TCP","192.168.101.110",8
0
Send Data (CIPMUX=0) AT+CIPSEND=<data length> OK
Function AT Commands Response

>

(Note: write your data after > and enter it to send


it will return status like.)

Recv <data length> bytes


(CIPMUX=1) AT+CIPSEND=<id>,<data
SEND OK
length>
(after we receive response from server if any for
default auto receive mode)

(CIPMUX=0): + IPD, <length>: <data>

(CIPMUX=1): + IPD, <id>, <length>: <data>


Close
CLOSED
TCP/UDP AT+CIPCLOSE
Connection OK

CABLES
Usb to serial cable

USB-UART Cable
USB-UART Cable Introduction
USB - UART Cable, called USB serial port that is a very common debugging tools .The tool can
redirect a serial console to your PC and you can use any command. The terminal can obtain lots of printed
information, so that can easily monitoring and debug your Cubieboards . This document introduces to use
Cubietech USB - UART Cable which connect Cubieboard development board of debugging .Mainly
introduce how to use the USB - UART Cable debugging Cubieboard under Windows and Ubuntu.
2. The experiment equipment
1) PC
2) Cubieboard with installed system
3) USB-UART Cable
Hardware connection
1) Use USB-UART Cable connected to the development board UART debugging
2) interface, for example:
3) black -GND
4) red -Don't connect it
5) Green-RX
6) white –TX
The application platform The serial debugging of Cubieboard development board can use in
Windows and Linux platform, we can used Linux Ubuntu system and the Windows system using USB -
UART Cable debugging Cubieboard. 4.1.Windows We can use the relevant software to connect to the
Cubieboard terminal to complete serial debugging under Windows , this is two kinds of software are
introduced :putty and SecureCRT.
Set up debugging environment Driver installation Installed USB serial port driver (HL2303) in PC, connect
to the PC with USB - UART Cable.
The driver and software under the attachment ( http://dl.cubieboard.org/tools/Usb-Uart-Cable/) 。 Right
click computer choose management 、device manager port, check your PC using the port(according to their
actual port number). The port number will be used in behind. 4.1.2. Two ways Here are two kinds of
methods, you can choose one.
SENSORS

IR SENSOR

An infrared sensor is an electronic device, that emits in order to sense some aspects of the
surroundings. An IR sensor can measure the heat of an object as well as detects the motion. These types of
sensors measures only infrared radiation, rather than emitting it that is called as a passive IR sensor. Usually
in the infrared spectrum, all the objects radiate some form of thermal radiations. These types of radiations
are invisible to our eyes, that can be detected by an infrared sensor. The emitter is simply an IR LED ( Light
Emitting Diode) and the detector is simply an IR photodiode which is sensitive to IR light of the same
wavelength as that emitted by the IR LED. When IR light falls on the photodiode, The resistances and these
output voltages, change in proportion to the magnitude of the IR light received.
IR Sensor Circuit Diagram and Working Principle
An infrared sensor circuit is one of the basic and popular sensor module in an electronic device. This
sensor is analogous to human’s visionary senses, which can be used to detect obstacles and it is one of the
common applications in real time. This circuit comprises of the following components
 LM358 IC 2 IR transmitter and receiver pair
 Resistors of the range of kilo ohms.
 Variable resistors.
 LED (Light Emitting Diode).

In this project, the transmitter section includes an IR sensor, which transmits continuous IR rays to
be received by an IR receiver module. An IR output terminal of the receiver varies depending upon its
receiving of IR rays. Since this variation cannot be analyzed as such, therefore this output can be fed to a
comparator circuit. Here an operational amplifier (op-amp) of LM 339 is used as comparator circuit.
When the IR receiver does not receive a signal, the potential at the inverting input goes higher than
that non-inverting input of the comparator IC (LM339). Thus the output of the comparator goes low, but the
LED does not glow. When the IR receiver module receives signal to the potential at the inverting input goes
low. Thus the output of the comparator (LM 339) goes high and the LED starts glowing. Resistor R1 (100 ),
R2 (10k ) and R3 (330) are used to ensure that minimum 10 mA current passes through the IR LED Devices
like Photodiode and normal LEDs respectively. Resistor VR2 (preset=5k ) is used to adjust the output
terminals. Resistor VR1 (preset=10k ) is used to set the sensitivity of the circuit Diagram. Read more about
IR sensors.

Different Types of IR Sensors and Their Applications


IR sensors are classified into different types depending on the applications. Some of the typical
applications of different types of sensors are
The speed sensor is used for synchronizing the speed of multiple motors. The temperature sensor is used for
industrial temperature control. PIR sensor is used for automatic door opening system and Ultrasonic
sensor are used for distance measurement.
IR Sensor Applications

IR sensors are used in various Sensor based projects and also in various electronic devices which measures
the temperature that are discussed in the below.
Radiation Thermometers

IR sensors are used in radiation thermometers to measure the temperature depend upon the temperature and
the material of the object and these thermometers have some of the following features

 Measurement without direct contact with the object


 Faster response
 Easy pattern measurements
Flame Monitors

These types of devices are used for detecting the light emitted from the flames and to monitor how the
flames are burning. The Light emitted from flames extend from UV to IR region types. PbS, PbSe, Two-
color detector, pyro electric detector are some of the commonly employed detector used in flame monitors.

Moisture Analyzers

Moisture analyzers use wavelengths which are absorbed by the moisture in the IR region. Objects are
irradiated with light having these wavelengths(1.1 µm, 1.4 µm, 1.9 µm, and 2.7µm) and also with reference
wavelengths. The Lights reflected from the objects depend upon the moisture content and is detected by
analyzer to measure moisture (ratio of reflected light at these wavelengths to the reflected light at reference
wavelength). In GaAs PIN photodiodes, Pbs photoconductive detectors are employed in moisture analyzer
circuits.

Gas Analyzers

IR sensors are used in gas analyzers which use absorption characteristics of gases in the IR region. Two
types of methods are used to measure the density of gas such as dispersive and non dispersive.

Dispersive: An Emitted light is spectroscopically divided and their absorption characteristics are used to
analyze the gas ingredients and the sample quantity.
Non dispersive: It is most commonly used method and it uses absorption characteristics without dividing
the emitted light. Non dispersive types use discrete optical band pass filters, similar to sunglasses that are
used for eye protection to filter out unwanted UV radiation.
This type of configuration is commonly referred to as non dispersive infrared (NDIR) technology. This type
of analyzer is used for carbonated drinks, whereas non dispersive analyzer is used in most of the commercial
IR instruments, for an automobile exhaust gas fuel leakages.

IR Imaging Devices

IR image device is one of the major applications of IR waves, primarily by virtue of its property that is not
visible. It is used for thermal imagers, night vision devices, etc.

IR Imaging Devices

For examples Water, rocks, soil, vegetation, an atmosphere, and human tissue all features emit IR radiation.
The Thermal infrared detectors measure these radiations in IR range and map the spatial temperature
distributions of the object/area on an image. Thermal imagers usually composed of a Sb (indium
antimonite), Gd Hg (mercury-doped germanium), Hg Cd Te (mercury-cadmium-telluride) sensors.

An electronic detector is cooled to low temperatures using liquid helium or liquid nitrogen’s. Then the
Cooling the detectors ensures that the radiant energy (photons) recorded by the detectors comes from the
terrain and not from the ambient temperature of objects within the scanner itself an IR imaging electronic
devices.
TEMPERATURE SENSOR (LM35)
Temperature is the most often-measured environmental quantity. This might be expected since most
physical, electronic, chemical, mechanical, and biological systems are affected by temperature. Certain
chemical reactions, biological processes, and even electronic circuits perform best within limited
temperature ranges. Temperature is one of the most commonly measured variables and it is therefore not
surprising that there are many ways of sensing it. Temperature sensing can be done either through direct
contact with the heating source, or remotely, without direct contact with the source using radiated energy
instead. There are a wide variety of temperature sensors on the market today, including Thermocouples,
Resistance Temperature Detectors (RTDs), Thermistors, Infrared, and Semiconductor Sensors.
5 Types of Temperature Sensors

 Thermocouple: It is a type of temperature sensor, which is made by joining two dissimilar metals at
one end. The joined end is referred to as the HOT JUNCTION. The other end of these dissimilar metals is
referred to as the COLD END or COLD JUNCTION. The cold junction is actually formed at the last
point of thermocouple material. If there is a difference in temperature between the hot junction and cold
junction, a small voltage is created. This voltage is referred to as an EMF (electro-motive force) and can
be measured and in turn used to indicate temperature.

 The RTD is a temperature sensing device whose resistance changes with temperature. Typically built
from platinum, though devices made from nickel or copper are not uncommon, RTDs can take many
different shapes like wire wound, thin film. To measure the resistance across an RTD, apply a constant
current, measure the resulting voltage, and determine the RTD resistance. RTDs exhibit fairly linear
resistance to temperature curves over their operating regions, and any nonlinearity are highly predictable
and repeatable. The PT100 RTD evaluation board uses surface mount RTD to measure temperature. An
external 2, 3 or 4-wire PT100 can also be associated with measure temperature in remote areas. The RTDs
are biased using a constant current source. So as to reduce self-heat due to power dissipation, the current
magnitude is moderately low. The circuit shown in figure is the constant current source uses a reference
voltage, one amplifier, and a PNP transistor.

 Thermistors: Similar to the RTD, the thermistor is a temperature sensing device whose resistance
changes with temperature. Thermistors, however, are made from semiconductor materials. Resistance is
determined in the same manner as the RTD, but thermistors exhibit a highly nonlinear resistance vs.
temperature curve. Thus, in the thermistors operating range we can see a large resistance change for a
very small temperature change. This makes for a highly sensitive device, ideal for set-point applications.
 Semiconductor sensors: They are classified into different types like Voltage output, Current output,
Digital output, Resistance output silicon and Diode temperature sensors. Modern semiconductor
temperature sensors offer high accuracy and high linearity over an operating range of about 55°C to
+150°C. Internal amplifiers can scale the output to convenient values, such as 10mV/°C. They are also
useful in cold-junction compensation circuits for wide temperature range thermocouples. A brief details
about this type of temperature sensor are given below.
Sensor ICs

There are a wide variety of temperature sensor ICs that are available to simplify the broadest possible
range of temperature monitoring challenges. These silicon temperature sensors differ significantly from the
above mentioned types in a couple of important ways. The first is operating temperature range. A
temperature sensor IC can operate over the nominal IC temperature range of -55°C to +150°C. The second
major difference is functionality.

A silicon temperature sensor is an integrated circuit, and can therefore include extensive signal
processing circuitry within the same package as the sensor. There is no need to add compensation circuits for
temperature sensor Ics. Some of these are analogue circuits with either voltage or current output. Others
combine analogue-sensing circuits with voltage comparators to provide alert functions. Some other sensor
ICs combine analogue-sensing circuitry with digital input/output and control registers, making them an ideal
solution for microprocessor-based systems.
Digital output sensor usually contains a temperature sensor, analog-to-digital converter (ADC), a
two-wire digital interface and registers for controlling the IC’s operation. Temperature is continuously
measured and can be read at any time. If desired, the host processor can instruct the sensor to monitor
temperature and take an output pin high (or low) if temperature exceeds a programmed limit. Lower
threshold temperature can also be programmed and the host can be notified when temperature has dropped
below this threshold. Thus, digital output sensor can be used for reliable temperature monitoring in
microprocessor-based systems.

Above temperature sensor has three terminals and required Maximum of 5.5 V supply. This type of
sensor consists of a material that performs the operation according to temperature to vary the resistance. This
change of resistance is sensed by circuit and it calculates temperature. When the voltage increases then the
temperature also rises. We can see this operation by using a diode.
Temperature sensors directly connected to microprocessor input and thus capable of direct and
reliable communication with microprocessors. The sensor unit can communicate effectively with low-cost
processors without the need of A/D converters.

An example for a temperature sensor is LM35. The LM35 series are precision integrated-circuit
temperature sensors, whose output voltage is linearly proportional to the Celsius temperature. The LM35 is
operates at -55˚ to +120˚C.

The basic centigrade temperature sensor (+2˚C to +150˚C) is shown in figure below.

Features of LM35 Temperature Sensor:

 Calibrated directly in ˚ Celsius (Centigrade)


 Rated for full l −55˚ to +150˚C range
 Suitable for remote applications
 Low cost due to wafer-level trimming
 Operates from 4 to 30 volts
 Low self-heating,
 ±1/4˚C of typical nonlinearity
Operation of LM35:

The LM35 can be connected easily in the same way as other integrated circuit temperature sensors. It can
be stuck or established to a surface and its temperature will be within around the range of
0.01˚C of the surface temperature.

This presumes that the ambient air temperature is just about the same as the surface temperature; if
the air temperature were much higher or lower than the surface temperature, the actual temperature of the
LM35 die would be at an intermediate temperature between the surface temperature and the air temperature.
The temperature sensors have well known applications in environmental and process control and also in
test, measurement and communications. A digital temperature is a sensor, which provides 9-bit temperature
readings. Digital temperature sensors offer excellent precise accuracy, these are designed to read from 0°C to
70°C and it is possible to achieve ±0.5°C accuracy. These sensors completely aligned with digital
temperature readings in degree Celsius.
Digital Temperature Sensors:
Digital temperature sensors eliminate the necessity for extra components, such as an A/D converter,
within the application and there is no need to calibrate components or the system at specific reference
temperatures as needed when utilizing thermostats. Digital temperature sensors deal with everything,
empowering the basic system temperature monitoring function to be simplified.
The advantages of a digital temperature sensor are principally with its precision output in degrees
Celsius. The sensor output is a balanced digital reading. This intends no other components, such as an
analogue to digital converter and much simpler to use than, a simple thermistor which provides a non-linear
resistance with temperature variation.

An example for a digital temperature sensor is DS1621, which provides a 9 bit temperature reading
LDR SENSOR
An LDR or light dependent resistor is also known as photo resistor, photocell, and photoconductor. It
is a one type of resistor whose resistance varies depending on the amount of light falling on its surface.
When the light falls on the resistor, then the resistance changes. These resistors are often used in many
circuits where it is required to sense the presence of light. These resistors have a variety of functions and
resistance. For instance, when the LDR is in darkness, then it can be used to turn ON a light or to turn OFF a
light when it is in the light. A typical light dependent resistor has a resistance in the darkness of 1MOhm,
and in the brightness a resistance of a couple of KOhm

This resistor works on the principle of photo conductivity. It is nothing but, when the light falls on its
surface, then the material conductivity reduces and also the electrons in the valence band of the device are
excited to the conduction band. These photons in the incident light must have energy greater than the band
gap of the semiconductor material. This makes the electrons to jump from the valence band to conduction.

These devices depend on the light, when light falls on the LDR then the resistance decreases, and
increases in the dark. When a LDR is kept in the dark place, its resistance is high and, when the LDR is kept
in the light its resistance will decrease.
What is a Light Dependent Resistor and Its Applications

Light Dependent Resistor

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.

Light Dependent Resistor

An LDR or light dependent resistor is also known as photo resistor, photocell, photoconductor. It is a
one type of resistor whose resistance varies depending on the amount of light falling on its surface. When
the light falls on the resistor, then the resistance changes. These resistors are often used in many circuits
where it is required to sense the presence of light. These resistors have a variety of functions and resistance.
For instance, when the LDR is in darkness, then it can be used to turn ON a light or to turn OFF a light when
it is in the light. A typical light dependent resistor has a resistance in the darkness of 1MOhm, and in the
brightness a resistance of a couple of KOhm

Working Principle of LDR

This resistor works on the principle of photo conductivity. It is nothing but, when the light falls on its
surface, then the material conductivity reduces and also the electrons in the valence band of the device are
excited to the conduction band. These photons in the incident light must have energy greater than the band
gap of the semiconductor material. This makes the electrons to jump from the valence band to conduction.
Working Principle of LDR

These devices depend on the light, when light falls on the LDR then the resistance decreases, and
increases in the dark. When a LDR is kept in the dark place, its resistance is high and, when the LDR is kept
in the light its resistance will decrease.

Variation of LDR Resistance with Variation in Light Intensity

If a constant “V’ is applied to the LDR, the intensity of the light increased and current increases. The
figure below shows the curve between resistance Vs illumination curve for a particular light dependent
resistor.
Light Intensity vs LDR Resistance

Types of light Dependent Resistors

Light dependent resistors are classified based on the materials used.

Intrinsic Photo Resistors

These resistors are pure semiconductor devices like silicon or germanium. When the light falls on the
LDR, then the electrons get excited from the valence band to the conduction band and number of charge
carriers increases.

Extrinsic Photo Resistors

These devices are doped with impurities and these impurities creates a new energy bands above the
valence band. These bands are filled with electrons. Hence this decrease the band gap and small amount of
energy is required in moving them. These resistors are mainly used for long wavelengths.

Circuit Diagram of a Light Dependent Resistor

The circuit diagram of a LDR is shown below. When the light intensity is low, then the resistance of
the LDR is high. This stops the current flow to the base terminal of the transistor. So, the LED does not
light. However, when the light intensity onto the LDR is high, then the resistance of the LDR is low. So
current flows onto the base of the first transistor and then the second transistor. Consequently the LED
lights. Here, a preset resistor is used to turn up or down to increase or decrease the resistance.

PIEZO ELECTRIC SENSOR

A sensor that utilizes the piezoelectric effect, to measure changes in acceleration, strain, pressure,
and force by converting them into electrical charge is called as a piezoelectric sensor. Piezo is a Greek word
which means ‘press’ or ‘squeeze’. Piezoelectric effect causes the occurrence of electric dipole moments in
solids due to the pressure applied to certain solid materials such as piezoelectric crystals, ceramics, bone,
DNA, and some proteins that generates electric charge. This generated piezoelectricity is proportional to the
pressure applied to the solid piezoelectric crystal materials. In this article, we will discuss about one of the
most frequently used piezoelectric sensor applications, that is, piezo sensor switch.

An electrical switch that works based on the principle of piezoelectric effect is called as
a piezo sensor switch. The Piezoelectric sensor switch can be turned on, by activating the output of
semiconductor device such as a field effect transistor. This can be done using the charge generated by the
pressure applied to the piezoelectric sensor element. If the field effect transistor is on, then current will flow
through the FET acting as a metal contact-based switch. If the voltage pulse in the gate resistor is dissipated,
then the FET turns off or turns into its regular high impedance state.

Piezoelectric Sensor Switch Circuit Working Procedure

We know that piezoelectric sensors generate an electric charge proportional to the pressure applied to
certain materials. But, in case of piezoelectric sensor switches, typically the disc-shaped piezo element tend
to bend very slightly like a drumhead due to the force or compressive pressure applied to certain
materials. The voltage generated due to a single on pulse, produced by the pressure applied to
the piezo switch can be varied by varying the amount of pressure. If the pressure applied to the piezoelectric
sensor switch is increased, then higher voltages can be generated, which take a long time for dissipation.

We can also increase the pulse width by lengthening the time constant of the gate circuit using a
capacitor that stores charge. If we use a flip-flop, then by toggling flip-flop, we can change the output state
from steady off to steady on. Compared to conventional mechanical switches the piezoelectric sensor
switches don’t have moving parts, but the front plate and piezo element get little deformed typically by a
few micrometers. As there are no moving parts, the lifetime of the piezoelectric sensor switch is more and
these switches can be used for tens of millions of operations.

These piezoelectric sensor switches are weatherproof as they are completely sealed from the
environment. As, stainless steel is used for construction of piezo sensor switches, they can withstand the
damage and are resistant to heavy use.

The piezoelectric sensor switch is an alternative for impact or vibration detection and momentary
switch applications. Strain is induced on the laminated piezo film sensor element due to the direct contact of
the force applied to the stainless steel cantilever beam. Piezoelectric sensor element will generate an output
that activates a normally opened, built-in circuit. If a circuit is activated, then it resembles a contact switch
closure and due to corrosion, bouncing and pitting the contact points exhibits.
Thus, a single digital pulse is provided for triggering digital circuits. Because of the features like
improved reliability and elasticity of the piezoelectric sensor element, it is suitable for applications
demanding reliability and consistency in performance for tens of millions of cycles of operations.

Pressure is applied to the surface of the piezoelectric sensor switch that deflects about 2microns and
this applied pressure is converted into an electrical signal by the piezoelectric crystal. This electrical signal
generated by the piezoelectric sensor material is given to the electronics embedded in the piezoelectric
sensor switch housing for amplification.

Piezo Knock Sensor Switch Circuit Working

Piezo knock sensor generates voltage proportional to the amount of stress, such as vibration or knock
applied to piezoelectric crystal. It is used to detect knocks and hence it is also called as a piezo knock
sensor. Piezo knock sensor Switch can be implemented using Arduino board based real time project.

Piezo Sensor Switch Cross Sectional View

It is a polarized electronic component, which consists of two leads: one positive and the other
negative lead that are connected with a 1M ohm resistor between them. The Positive lead is represented by
red color lead and is connected to A0 analog pin on the Arduino board. The Negative lead is represented by
black color lead and it is connected to GND ground terminal on the Arduino board.

The Pizeoelectric sensor knock circuit is designed to turn on or turn off the load connected to the
circuit by applying knocks to activate the piezo knock switch. Consider Light Emitting Diode(LED), such
that the LED anode is connected to the digital pin 13 and its cathode is connected to the ground terminal of
the Arduino. If a knock or vibration is detected by the circuit, then the circuit will turn on LED (load) for a
predefined time based on the program.

The Program code to turn on the LED for 10 seconds, whenever a knock is detected by the circuit:

const int sensorPin=0;


const int ledpin= 13;
const int threshold= 100;
void setup()
{
pinMode(ledPin, OUTPUT);
}
void loop()
{
int val= analogRead(sensorPin);
if (val>=threshold)
{
digitalWrite(ledPin, HIGH);
delay(10000);
digitalWrite(ledPin, LOW);
}
else
digitalWrite(ledPin, LOW);
}

From the above program, we can understand that the initialization process is done with the first block of
code. The sensor pin is initialized to pin 0 as the positive lead of the knock sensor is connected to the
Arduino board analog pin A0, and the LEDs are initialized to pin 13. As there are always some vibrations in
the environment, a threshold of 100 is created such that the senor will not be triggered for small vibrations
less than the threshold value.
Arduino Based Piezo Knock Sensor Switch

Thus, we can decrease the threshold value for triggering knock sensor for low-sounding knocks and
we can increase the threshold value for triggering knock sensor for louder knocks. Then, in the program’s
second block, the LED is connected to an output pin. Finally, in the program’s third block, an integer
called val is created for reading value obtained from piezoelectric sensor or knock sensor.

Thus, if the value obtained from the knock sensor is greater than the threshold value, then the LED
will be turned on for 10 seconds and if the value obtained from the knock sensor is less than the threshold
value, then LED remains turn off. Here the load is represented by LED and thus, we can use piezoelectric
sensor switch or piezo knock sensor switch for turning on and off the load based on the piezoelectric effect.

Do you know any applications in which piezoelectric sensor switches are used? If yes, then share
your technical knowledge regarding this article and feel free to contact us for any technical assistance
regarding the piezoelectric sensor switch based electronics projects by posting your comments in the
comment section below.
ULTRASONIC SENSOR
An ultrasonic sensor is an instrument that measures the distance to an object using ultrasonic sound
waves.An ultrasonic sensor uses a transducer to send and receive ultrasonic pulses that relay back
information about an object’s proximity. High-frequency sound waves reflect from boundaries to produce
distinct echo patterns.

Sound is a mechanical wave travelling through the mediums, which may be a solid, or liquid or gas.
Sound waves can travel through the mediums with specific velocity depends on the medium of propagation.
The sound waves which are having high frequency reflect from boundaries and produces distinctive echo
patterns.

Laws of physics for sound waves


Sound waves are having specific frequencies or number of oscillations per second. Humans can
detect sounds in a frequency range from about 20Hz to 20 KHz. However the frequency range normally
employed in ultrasonic detection is 100 KHz to 50MHz. The velocity of ultrasound at a particular time and
temperature is constant in a medium.

Transducers for Wave Propagation and particle detection

For sending sound waves and receiving echo, ultrasonic sensors, normally called transceivers or
transducers will be used. They work on a principle similar to radar that will convert electrical energy into
mechanical energy in the form of sound, and vice versa.

The commonly used transducers are contact transducers, angle beam transducers, delay line
transducers, immersion transducers, and dual element transducers. Contact transducers are typically used for
locating voids and cracks to the outside surface of a part as well as measuring thickness. Angle beam
transducers use the principle of reflection and mode conversion to produce refracted shear or longitudinal
waves in the test material.

Delay line transducers are single element longitudinal wave transducers used in conjunction with a
replaceable delay line. One of the reasons for choosing delay line transducer is that near surface resolution
can be improved. The delay allows the element to stop vibrating before a return signal from the reflector can
be received.

How Ultrasonic Sensors Work.

Ultrasonic sound vibrates at a frequency above the range of human hearing. Transducers are the
microphones used to receive and send the ultrasonic sound.Our ultrasonic sensors, like many others, use a
single transducer to send a pulse and to receive the echo. The sensor determines the distance to a target by
measuring time lapses between the sending and receiving of the ultrasonic pulse.
Why use an ultrasonic sensor?

Ultrasound is reliable in any lighting environment and can be used inside or outside. Ultrasonic
sensors can handle collision avoidance for a robot, and being moved often, as long as it isn’t too fast.
Ultrasonics are so widely used, they can be reliably implemented in grain bin sensing applications, water
level sensing, drone applications and sensing cars at your local drive-thru restaurant or bank.Ultrasonic
rangefinders are commonly used as devices to detect a collision.

Ultrasonic Sensors are best used in the non-contact detection of:

 Presence
 Presence
 Level
 Position
 Distance

Non-contact sensors are also referred to as proximity sensors.

Ultrasonics are Independent of :

 Light
 Smoke
 Dust
 Color

Material (except for soft surfaces, i.e. wool, because the surface absorbs the ultrasonic sound wave and
doesn’t reflect sound.)
Applications Involving Ultrasonic Detection

Ultrasonic Distance Measurement

Ex. Distance measurement would be applied in a garage parking application, sensing when a vehicle is
pulled completely into a garage.

Ultrasonic Sensors for water level detection

Tank level measurement, Fuel gauging, irrigation control.

Ultrasonic Obstacle Detection

Our UAV Sensors for Drones as well as our proximity sensors that are used for robots are for obstacle
detection.

PIR SENSOR

PIR sensors allow you to sense motion, almost always used to detect whether a human has moved in
or out of the sensors range. They are small, inexpensive, low-power, easy to use and don't wear out. For that
reason they are commonly found in appliances and gadgets used in homes or businesses. They are often
referred to as PIR, "Passive Infrared", "Pyroelectric", or "IR motion" sensors.

PIRs are basically made of a pyroelectric sensor (which you can see below as the round metal can
with a rectangular crystal in the center), which can detect levels of infrared radiation. Everything emits some
low level radiation, and the hotter something is, the more radiation is emitted. The sensor in a motion
detector is actually split in two halves. The reason for that is that we are looking to detect motion (change)
not average IR levels. The two halves are wired up so that they cancel each other out. If one half sees more
or less IR radiation than the other, the output will swing high or low.
Along with the pyroelectic sensor is a bunch of supporting circuitry, resistors and capacitors. It
seems that most small hobbyist sensors use the BISS0001 ("Micro Power PIR Motion Detector IC")
undoubtedly a very pir-passive-infrared-proximity-motion-sensor Page 3 of 28 inexpensive chip. This chip
takes the output of the sensor and does some minor processing on it to emit a digital output pulse from the
analog sensor.
For many basic projects or products that need to detect when a person has left or entered the area, or
has approached, PIR sensors are great. They are low power and low cost, pretty rugged, have a wide lens
range, and are easy to interface with. Note that PIRs won't tell you how many people are around or how
close they are to the sensor, the lens is often fixed to a certain sweep and distance (although it can be hacked
somewhere) and they are also sometimes set off by housepets. Experimentation is key
How PIRs Work
PIR sensors are more complicated than many of the other sensors explained in these tutorials (like
photocells, FSRs and tilt switches) because there are multiple variables that affect the sensors input and
output. To begin explaining how a basic sensor works, we'll use this rather nice diagram The PIR sensor
itself has two slots in it, each slot is made of a special material that is sensitive to IR. The lens used here is
not really doing much and so we see that the two slots can 'see' out past some distance (basically the
sensitivity of the sensor).
When the sensor is idle, both slots detect the same amount of IR, the ambient amount radiated from
the room or walls or outdoors. When a warm body like a human or animal passes by, it first intercepts one
half of the PIR sensor, which causes a positive differential change between the two halves. When the warm
body leaves the sensing area, the reverse happens, whereby the sensor generates a negative differential
change. These change pulses are what is detected.
The PIR Sensor The IR sensor itself is housed in a hermetically sealed metal can to improve
noise/temperature/humidity immunity. There is a window made of IR-transmissive material (typically coated
silicon since that is very easy to come by) that protects the sensing element. Behind the window are the two
balanced sensors.
Lenses PIR sensors are rather generic and for the most part vary only in price and sensitivity. Most of
the real magic happens with the optics. This is a pretty good idea for manufacturing: the PIR sensor and
circuitry is fixed and costs a few dollars. The lens costs only a few cents and can change the breadth, range,
sensing pattern, very easily. In the diagram up top, the lens is just a piece of plastic, but that means that the
detection area is just two rectangles. Usually we'd like to have a detection area that is much larger. To do
that, we use a simple lens such as those found in a camera: they condenses a large area (such as a landscape)
into a small one (on film or a CCD sensor). For reasons that will be apparent soon, we would like to make
the PIR lenses small and thin and moldable from cheap plastic, even though it may add distortion. For this
reason the sensors are actually Fresnel lenses

HEART BEAT SENSOR

A person’s heartbeat is the sound of the valves in his/her’s heart contracting or expanding as they force
blood from one region to another. The number of times the heart beats per minute (BPM), is the heart beat
rate and the beat of the heart that can be felt in any artery that lies close to the skin is the pulse.
 Manual Way: Heart beat can be checked manually by checking one’s pulses at two locations- wrist
(the radial pulse) and the neck (carotid pulse). The procedure is to place the two fingers (index and
middle finger) on the wrist (or neck below the windpipe) and count the number of pulses for 30 seconds
and then multiplying that number by 2 to get the heart beat rate. However pressure should be applied
minimum and also fingers should be moved up and down till the pulse is felt.
 Using a sensor: Heart Beat can be measured based on optical power variation as light is scattered or
absorbed during its path through the blood as the heart beat changes.
Principle of Heartbeat Sensor

The heartbeat sensor is based on the principle of photo phlethysmography. It measures the change in
volume of blood through any organ of the body which causes a change in the light intensity through that
organ (a vascular region). In case of applications where heart pulse rate is to be monitored, the timing of the
pulses is more important. The flow of blood volume is decided by the rate of heart pulses and since light is
absorbed by blood, the signal pulses are equivalent to the heart beat pulses.

There are two types of photophlethysmography:

Transmission: Light emitted from the light emitting device is transmitted through any vascular region of the
body like earlobe and received by the detector.
Reflection: Light emitted from the light emitting device is reflected by the regions.

Working of a Heartbeat Sensor

The basic heartbeat sensor consists of a light emitting diode and a detector like a light detecting resistor or a
photodiode. The heart beat pulses causes a variation in the flow of blood to different regions of the body.
When a tissue is illuminated with the light source, i.e. light emitted by the led, it either reflects (a finger
tissue) or transmits the light (earlobe). Some of the light is absorbed by the blood and the transmitted or the
reflected light is received by the light detector. The amount of light absorbed depends on the blood volume
in that tissue. The detector output is in form of electrical signal and is proportional to the heart beat rate.

This signal is actually a DC signal relating to the tissues and the blood volume and the AC component
synchronous with the heart beat and caused by pulsatile changes in arterial blood volume is superimposed on
the DC signal. Thus the major requirement is to isolate that AC component as it is of prime importance.

Practical Heartbeat Sensor

Practical heartbeat Sensor examples are Heart Rate Sensor (Product No PC-3147). It consists of an
infrared led and an ldr embedded onto a clip like structure. The clip is attached to the organ (earlobe or the
finger) with the detector part on the flesh.

Another example is TCRT1000, having 4 pins-

Pin1: To give supply voltage to the LED

Pin2 and 3 are grounded. Pin 4 is the output. Pin 1 is also the enable pin and pulling it high turns the LED on
and the sensor starts working. It is embedded on a wearable device which can be worn on the wrist and the
output can be sent wirelessly (through Bluetooth) to the computer for processing.
As described above regarding the principle of heart beat sensor, when the finger tissue or the earlobe
tissue is illuminated using a light source, the light is transmitted after getting modulated i.e. a part getting
absorbed by the blood and the rest being transmitted. This modulated light is received by the light detector.

Here a Light Dependant Resistor (LDR) is used as a light detector. It works on the principle that
when light falls on the resistor, its resistance changes. As the light intensity increases, the resistance
decreases. Thus the voltage drop across the resistor decreases.

Here a comparator is used which compares the output voltage from the LDR to that of the threshold
voltage. The threshold voltage is the voltage drop across the LDR when the light with fixed intensity, from
the light source falls directly on it. The inverting terminal of the comparator LM358 is connected to the
potential divider arrangement which is set to the threshold voltage and the non inverting terminal is
connected to the LDR.

When a human tissue is illuminated using the light source, the intensity of the light reduces. As this
reduced light intensity falls on the LDR, the resistance increases and as a result the voltage drop increases.
When the voltage drop across the LDR or the non inverting input exceeds that of the inverting input, a logic
high signal is developed at the output of the comparator and in case voltage drop being lesser a logic low
output is developed. Thus the output is a series of pulses. These pulses can be fed to the Microcontroller
which accordingly processes the information to get the heart beat rate and this is displayed on the Display
interfaced to the Microcontroller.

HUMIDITY SENSOR

HUMIDITY SENSOR

Types and Working Principle

Humidity Sensor is one of the most important devices that has been widely in
consumer, industrial, biomedical, and environmental etc. applications for measuring and
monitoring Humidity.

Humidity is defined as the amount of water present in the surrounding air. This water content
in the air is a key factor in the wellness of mankind. For example, we will feel comfortable
even if the temperature is 00C with less humidity i.e. the air is dry.

But if the temperature is 100C and the humidity is high i.e. the water content of air is high,
then we will feel quite uncomfortable. Humidity is also a major factor for operating sensitive
equipment like electronics, industrial equipment, electrostatic sensitive devices and high
voltage devices etc. Such sensitive equipment must be operated in a humidity environment
that is suitable for the device

Hence, sensing, measuring, monitoring and controlling humidity is a very important


task. Some of the important areas of application for sensing, measuring and controlling
Humidity are mentioned below.

Domestic: Sensing and controlling humidity in our homes and offices is important as higher
humidity conditions will affect the blood flow. Other areas include cooking, indoor
plantation etc.

Industrial: In industries like refineries, chemical, metal, or other industries where furnaces
are used, high humidity will reduce the amount of oxygen in the air and hence reduces the
firing rate. Other industries like food processing, textile, paper etc. also need control of
humidity.

Agriculture: Irrigation techniques like drip irrigation need accurate moisture content for
plants. Also, the moisture in the soil plays an important role in the proper growth of the
plant. Other areas where humidity control is required is indoor vegetation.

Electronics and Semiconductor: Almost all electronic devices are rated with a range of
humidity values in which they work as expected. Generally, this value will be something like
10% – 50% Humidity. Semiconductor Fabs (Fabrication Plants) should maintain very precise
temperature and humidity values as even minute difference can show a huge impact in the
production.

Medical: Medical equipment like ventilators, incubators, sterilizers etc. need humidity
control. It is also used in pharmaceutical plants and biological processes.

All the above mentioned and many other applications need sensing of Humidity and is done
using Humidity Sensors. Before discussing about Humidity Sensors, its types and working
principle, we will first see some important terms and definitions related to Humidity.
Important Terms Related to Humidity

Moisture: Generally, the term Moisture means water content of any material or substance.
But practically, the term Moisture refers to the water content in solids and liquids. The term
Humidity refers to the water content in gases (air).

Absolute Humidity: Absolute Humidity (AH) is the ratio of mass of the water vapour to the
volume of the air. If m is the mass of the water vapour and V is the total volume i.e. volume
of air and water vapour mixture, then Absolute Humidity AH is given by

AH = m/V

Absolute Humidity doesn’t take temperature in to account but it changes with temperature
and pressure.
Relative Humidity: Whenever we talk about measuring Humidity, it usually Relative
Humidity that we are talking about (unless otherwise specified).

Relative Humidity or RH is the ratio of the actual water vapour pressure present in the air at
a temperature to the maximum water vapour pressure present in the air at the same
temperature.

In weather reports and forecasts, the probability of precipitation or dew or fog is indicated
using Relative Humidity and hence, it is considered an important metric.

Relative Humidity takes both temperature and pressure in to consideration. Hence, the
Humidity Sensors which measure Relative Humidity, measure both the moisture content as
well as the air temperature.

NOTE: For temperatures above 1000C, measuring Relative Humidity (RH) is of no use as it
would deliver misleading values.

Specific Humidity: Specific Humidity (SH) is the ratio of mass of the water vapor to the total
mass of the air.
Mixing Ratio or Humidity Ratio: Mixing Ratio is the ratio of mass of the water vapor to
mass of the dry air.

Dew Point Temperature: Dew Point Temperature is the temperature at with the water vapor
content is saturated in the air. At Dew Point temperature, the Relative Humidity RH is 100%.
In other words, for the air to hold maximum amount of water vapor (or moisture), it has to
reach Dew Point Temperature.

Humidity Sensors – Classification and Working Principles

Humidity Sensors are very important devices that help in measuring the environmental
humidity. Technically, the device used to measure the humidity of the atmosphere is called
Hygrometer. Humidity Sensors or Hygrometers can be classified based on the type of
humidity it is used for measuring i.e.

Absolute Humidity (AH) sensors or Relative Humidity (RH) sensors. Humidity Sensors can
also be classified based on the parameter used for measuring Humidity i.e. Capacitive
Humidity Sensors, Electrical Conductivity (or Resistive) Humidity Sensors and Thermal
Conductivity Humidity Sensors.

There are other types of Humidity Sensors or Hygrometers like Optical Hygrometer,
Oscillating Hygrometer and Gravimetric Hygrometer.

Let us see about different types of Humidity Sensors or Hygrometers along with their
working principles.

Capacitive Humidity Sensors

Humidity Sensors based on capacitive effect or simply Capacitive Humidity Sensors are one
of the basic types of Humidity Sensors available.

They are often used in applications where factors like cost, rigidity and size are s of concern.
In Capacitive Relative Humidity (RH) Sensors, the electrical permittivity of the dielectric
material changes with change in humidity.
Working of Capacitive RH Sensors

A simple Capacitive RH Sensor can be made from an air filled capacitor as the moisture in
the atmosphere changes its permittivity. But for practical applications, air as a dielectric is
not feasible.

Hence, the space between the capacitor plates is usually filled with an appropriate dielectric
material (isolator), whose dielectric constant varies when it is subjected to change in
humidity.

The common method of constructing a capacitive RH sensor is to use a hygroscopic polymer


film as dielectric and depositing two layers of electrodes on the either side.

Another way to use the capacitive RH sensors is to observe the changes in the frequency of
the oscillator constructed using a capacitor with RH sensitive test subject as dielectric. This
setup is often employed in pharmaceutical products.

The test samples like medical tablets are placed between two plates (which form the
capacitor electrodes) to form a capacitor in the LC Oscillator circuit. The frequency of the
oscillator changes with humidity surrounding the test sample.

Let us see the construction of a thin thermostat polymer film based capacitive RH Sensor. It
is fabricated on a silicon substrate. On this substrate, two metal electrodes made of either
aluminium, platinum or chromium are deposited. The shape of these electrodes is carved out
such that, the electrodes form an interdigitized pattern.

On top of this layer, a dielectric layer is deposited. The following image shows a top and
cross section view of the capacitive humidity sensor. Note that two temperature sensitive
resistors are deposited on the same substrate to provide temperature compensation.
Advantages of Capacitive Humidity Sensors

 The output voltage is near linear.


 They provide stable results over long usage.

 Can detect wide range of RH.

Disadvantages of Capacitive Humidity Sensors

 The distance from the sensor and signalling circuit is very limited.

Applications of Capacitive Humidity Sensors

Capacitive Humidity Sensors are used in a wide range of applications including but not
limited to:

 HVAC Systems
 Printers and Fax Machines

 Weather Stations

 Automobiles

 Food Processing

 Refrigerators, Ovens and Dryers

Resistive Humidity Sensors (Electrical Conductivity Sensors)

Resistive Humidity Sensors are another important type of Humidity Sensors that measure the
resistance (impedance) or electrical conductivity. The principle behind resistive humidity
sensors is the fact that the conductivity in non – metallic conductors is dependent on their
water content.

Working of Resistive Humidity Sensors


The Resistive Humidity Sensor is usually made up of materials with relatively low resistivity
and this resistivity changes significantly with changes in humidity. The relationship between
resistance and humidity is inverse exponential. The low resistivity material is deposited on
top of two electrodes.

The electrodes are placed in interdigitized pattern to increase the contact area. The resistivity
between the electrodes changes when the top layer absorbs water and this change can be
measured with the help of a simple electric circuit.

Some of the commonly used materials are salt, specially treated substrates, solid
polyelectrolytes and conductive polymers. Modern Resistive Humidity Sensors are coated
with ceramic substance to provide extra protection. The electrodes in the sensor are usually
made of noble metals like gold, silver or platinum.

Advantages of Resistive Humidity Sensors

 Low cost
 Small Size

 The distance between the sensor and signal circuit can be large (suitable for remote
operations).

 Highly interchangeable as there are no calibration standards.

Disadvantages of Resistive Humidity Sensors

 Resistive Humidity Sensors are sensitive to chemical vapors and other contaminants
 The output readings may shift if used with water soluble products.

Applications of Resistive Humidity Sensors

Resistive or Electrical Conductive Humidity sensors are low cost sensors with relatively
small size. They are often used in several industrial, domestic or residential and commercial
applications.
Thermal Conductivity Humidity Sensors

Thermal Conductivity Humidity Sensors are also known as Absolute Humidity (AH) Sensors
as they measure the Absolute Humidity. Thermal Conductivity Humidity Sensors measure
the thermal conductivity of both dry air as well as air with water vapor. The difference
between the individual thermal conductivities can be related to absolute humidity.

Working of Thermal Conductivity Humidity Sensors

The best component to accomplish thermal conductivity based humidity sensor is thermistor.
Hence, two tiny thermistors with negative temperature coefficient are used to for a bridge
circuit.

In that, one thermistor is hermetically sealed in a chamber filled with dry Nitrogen while the
other is exposed to open environment through small venting holes. When the circuit is
powered on, the resistance of the two thermistors are calculated and the difference between
those two values is directly proportional to Absolute Humidity (AH).

Advantages of Thermal Conductivity Humidity Sensors

 Suitable for high temperature environments and high corrosive situations.


 Very durable

 Higher resolution compared to other types

Disadvantage of Thermal Conductivity Humidity Sensors

 Exposure to any gas with thermal properties different than Nitrogen might affect
reading measurement.
Applications of Thermal Conductivity Humidity Sensors

Some of the common applications of Thermal Conductivity Humidity Sensors are:

 Drying kilns
 Pharmaceutical plants

 Owens

 Clothes dryers and drying machines

 Food dehydration

Important Considerations when Selecting a Humidity Sensor

The following are some of the factor that must be taken into consideration when selecting a
Humidity Sensor.

 Accuracy of the sensor.


 Calibration – requirements and methods

 Size of the sensor

 Cost of the sensor and cost of replacement

 Output repeatability

 Circuit complexity

 Resistance to contamination

 Reliability of the sensor


SOIL MOISTURE SENSOR

The Moisture sensor is used to measure the water content (moisture) of soil. When the soil is having
water shortage, the module output is at high level, else the output is at low level. This sensor reminds the
user to water their plants and also monitors the moisture content of soil. It has been widely used in
agriculture, land irrigation and botanical gardening.

SPECIFICATIONS

 Working Voltage:5V
 Working Current:<20mA

 Interface type: Analog

 Working Temperature:10°C~30°C
WORKING

The Soil Moisture Sensor uses capacitance to measure dielectric permittivity of the surrounding
medium. In soil, dielectric permittivity is a function of the water content. The sensor creates a voltage
proportional to the dielectric permittivity, and therefore the water content of the soil. The sensor averages the
water content over the entire length of the sensor. There is a 2 cm zone of influence with respect to the flat
surface of the sensor, but it has little or no sensitivity at the extreme edges.The Soil Moisture Sensor is used
to measure the loss of moisture over time due to evaporation and plant uptake,evaluate optimum soil
moisture contents for various species of plants,monitor soil moisture content to control irrigation in
greenhouses and enhance bottle biology experiments.

The soil moisture sensor consists of two probes which are used to measure the volumetric content of
water. The two probes allow the current to pass through the soil and then it gets the resistance value to
measure the moisture value.

When there is more water, the soil will conduct more electricity which means that there will be less
resistance. Therefore, the moisture level will be higher. Dry soil conducts electricity poorly, so when there
will be less water, then the soil will conduct less electricity which means that there will be more resistance.
Therefore, the moisture level will be lower.

This sensor can be connected in two modes; Analog mode and digital mode. First, we will connect it
in Analog mode and then we will use it in Digital mode.

The soil Moisture sensor FC-28 has four pins

 VCC: For power


 A0: Analog output
 D0: Digital output
 GND: Ground

The Module also contains a potentiometer which will set the threshold value and then this threshold
value will be compared by the LM393 comparator. The output LED will light up and down according to this
threshold value.

Digital Mode – Interfacing Arduino and Soil Moisture Sensor

To connect the soil moisture sensor FC-28 in the digital mode, we will connect the digital output of
the sensor to the digital pin of the Arduino. The Sensor module contains a potentiometer with it, which is
used to set the threshold value. This threshold value is then compared with the sensor output value using the
LM393 comparator which is placed on the sensor module.

The LM393 comparator will compare the sensor output value and the threshold value and then gives
us the output through the digital pin. When the sensor value will be greater than the threshold value, then the
digital pin will give us 5V and the LED on the sensor will light up and when the sensor value will be less
than this threshold value, then the digital pin will give us 0V and the light will go down.

Analog Mode – Interfacing Soil Moisture Sensor and Arduino

To connect the sensor in the analog mode, we will need to use the analog output of the sensor. When
taking the analog output from the soil moisture sensor FC-28, the sensor gives us the value from 0-1023.
The moisture is measured in percentage, so we will map these values from 0 -100 and then we will show
these values on the serial monitor.

You can further set different ranges of the moisture values and turn on or off the water pump according to it.

Hardware and Software Required

 Moisture Sensor Module


 Arduino Uno

 Arduino IDE(1.0.6 Version)

The moisture sensor module should be connected to the as follows:

 Vcc to 5V
 GND to GND

 A0 to Analog 0 of Arduino

SMOKE SENSOR

Introduction

The MQ-2 Gas Sensor module detects gas leakage in home and industry. The MQ series of gas sensors use a
small heater inside with an electrochemical sensor. They are sensitive to a range of gasses and are used
indoors at room temperature. The output is an analog signal and can be read with an analog input of the
Arduino.
Features
1. Wide detecting scope
2. High sensitivity and fast response
3. Long life and stable
4. Simple drive circuit
Due to its fast response time and high sensitivity, measurements can be taken as soon as possible. The sensor
sensitivity can be adjusted by using the potentiometer.

Application
They are useful in gas leakage detection of LPG, propane, methane, i-butane, alcohol, Hydrogen, and
smoke.

Working Principle

The MQ2 has an electrochemical sensor, which changes its resistance for different concentrations of varied
gasses. The sensor is connected in series with a variable resistor to form a voltage divider circuit (Fig 1), and
the variable resistor is used to change sensitivity. When one of the above gaseous elements comes in contact
with the sensor after heating, the sensor’s resistance change. The change in the resistance changes the
voltage across the sensor, and this voltage can be read by a microcontroller. The voltage value can be used to
find the resistance of the sensor by knowing the reference voltage and the other resistor’s resistance. The
sensor has different sensitivity for different types of gasses. The sensitivity characteristic curve (Fig 2) is
shown below for the different type of gasses.
Procedure to Calculate the Concentration of a Particular Type of Gas
To find the concentration of gas, two values has to be measured using a microcontroller with ADC such as
Arduino,

1.Ro–The resistance of the sensor when measured in clean air,


2. Rs – The resistance of the sensor when it is exposed to any of the mentioned gasses
To find Ro, connect the sensor to one of the Analog pins of Arduino, note 100 values, and select the
median value. This will reduce if any dynamic errors present in the values. The sensor is connected in the
series with a variable resistor (Potentiometer on the sensor board). So, to find the resistance of the sensor
(Ro or Rs), the resistance of the variable resistor (R1) is required. In most of the MQ2 sensor modules, any
one end of the potentiometer and the middle pin of potentiometer will be connected between Sig or Vout Pin
and Ground. Find the resistance of R1 using a multimeter and note it down

The voltage across the sensor Vs (Vs is Vo in Clean Air) is calculated by using the following formula:

Vs=VRef – ADC_Value * (VRefH-VRefL)/(2R)


Where,
VRefH is the higher Reference voltage of the ADC, in Arduino, it is usually 5V or 3.3V
VRefL is the lower reference voltage of the ADC, in Arduino, it is usually 0V
R is the resolution of the ADC, in most of the Arduino boards, it is 10 Bits

Once the voltage across the sensor and value of R1 is known, the resistance of the sensor can be calculated
by using the formula

Ro=R1 Vo/ (VRef-Vo)


Where Vo is the voltage across the sensor in clean Air
Similarly, the Resistance of the sensor when exposed to gas can be calculated by repeating the above steps
and using the formula
Rs=R1 Vs / (VRef-Vs)
Where Vs is the voltage across the sensor in the Air contaminated with LPG molecules
Note:The value of R1 is only for finding the value of Rs and Ro. For finding the concentration of gas, R1 is
not required as the concentration is dependent on the Rs/Ro ratio. R1 is not required for finding just the
ratio.
Finding the Concentration of a Gas
The concentration of a gas can be calculated by measuring the sensor’s Ro and Rs values and using the
following formula
Concentration = Xo (Y/ Yo) Φ
Where Φ is the slope, which can be found using the Sensitivity Characteristic curve and the following
formula
Φ = Log (Y2/Y1) / Log(X2/X1)
Where (X2, Y2) and (X1, Y1) are any two points on a section (lines between indicated points on the curve)
of the curve. Since the curve has different slopes at different concentrations the (X2, Y2) and (X1, Y1)
values should be taken from the corresponding sections
The Xo and Yo values are Initial Concentration and Rs/Ro ratio on a section of the curve (lines between
marked points), these values are the starting points of each section (each line between marked points has
different slopes)
Y is the Rs/Ro Ratio for the current concentration of the gas

ALCOHOL SENSOR
An alcohol sensor detects the attentiveness of alcohol gas in the air and an analog voltage is an
output reading. The sensor can activate at temperatures ranging from -10 to 50° C with a power supply is
less than 150 Ma to 5V. The sensing range is from 0.04 mg/L to 4 mg/L, which is suitable for breathalyzers.

MQ-135 Gas Sensor

The MQ-135 gas sensor senses the gases like ammonia nitrogen, oxygen, alcohols, aromatic
compounds, sulfide and smoke. The boost converter of the chip MQ-3 gas sensor is PT1301. The operating
voltage of this gas sensor is from 2.5V to 5.0V. The MQ-3 gas sensor has a lower conductivity to clean the
air as a gas sensing material. In the atmosphere we can find polluting gases, but the conductivity of gas
sensor increases as the concentration of polluting gas increases. MQ-135 gas sensor can be implementation
to detect the smoke, benzene, steam and other harmful gases. It has potential to detect different harmful
gases. The MQ-135 gas sensor is low cost to purchase. The basic image of the MQ-135 sensor is shown in
the below figure.

Basic Pin Configuration Of Alcohol Sensor

The MQ-3 alcohol gas sensor consists of total 6-pins including A, H, B and the other three pins are
A, H, B out of the total 6-pins we use only 4 pins. The two pins A, H are used for the heating purpose and
the other two pins are used for the ground and power. There is a heating system inside the sensor, which is
made up of aluminium oxide, tin dioxide. It has heat coils to produce heat, and thus it is used as a heat
sensor. The below diagram shows the pin diagram and the configuration of the MQ-3 alcohol sensor.
Working Principle And Circuit Diagram

The MQ-135 alcohol sensor consists of a tin dioxide (SnO2), a perspective layer inside aluminium
oxide micro tubes (measuring electrodes) and a heating element inside a tubular casing. The end face of the
sensor is enclosed by a stainless steel net and the back side holds the connection terminals. Ethyl alcohol
present in the breath is oxidized into acetic acid passing through the heat element. With the ethyl alcohol
cascade on the tin dioxide sensing layer, the resistance decreases. By using the external load resistance the
resistance variation is converted into a suitable voltage variation. The circuit diagram and the connection
arrangement of an MQ 135 alcohol is shown below.

MQ – 135 Air Quality Sensor

The air quality sensor is also a MQ-135 sensor for detecting venomous gases that are present in the
air in homes and offices. The gas sensor layer of the sensor unit is made up of tin dioxide (SnO2); it has
lower conductivity compare to clean hair and due to air pollution the conductivity is increases. The air
quality sensor detects ammonia, nitrogen oxide, smoke, CO2 and other harmful gases. The air quality sensor
has a small potentiometer that permits the adjustment of the load resistance of the sensor circuit. The
5V power supply is used for air quality quality sensor.
The air quality sensor is a signal output indicator instruction. It has two outputs: analog output
and TTL output. The TTL output is low signal light which can be accessed through the IO ports on the
Microcontroller. The analog output is an concentration, i.e. increasing voltage is directly proportional to
increasing concentration. This sensor has a long life and reliable stability as well.
Applications Of MQ 135 Gas Sensor

The following are the applications of the MQ 135 gas sensor:

 Air quality monitor


 Detection of harmful gases
 Domestic air pollution detection
 Industrial pollution detection
 Portable air pollution detection
Characteristics Of MQ 135

 Good sensitivity to harmful gases in wide range.


 It has long life and low cost.
 Possesses high sensitivity to ammonia, benzene, sulfide gases.
 It is a simple drive circuit
SWITCH’S

RELAY

A relay is a device which is operated by a variation in its electrical or physical conditions to effect
the operation of other devices in an electric circuit. A protective relay is a relay, the principal function of
which is to protect service from interruption or to prevent or limit damage to apparatus. In electrical
engineering, a protective relay is a device designed to trip a circuit breaker when a fault is detected. The
first protective relays were electromagnetic devices, relying on coils operating on moving parts to provide
detection of abnormal operating conditions such as over-current, over-voltage, reverse power flow, over- and
under- frequency.
There are always a chance of suffering an electrical power system from abnormal over voltages.
These abnormal over voltages may be caused due to various reason such as, sudden interruption of heavy
load, lightening impulses, switching impulses etc. These over voltage stresses may damage insulation of
various equipments, all the over voltage stresses are not strong enough to damage insulation of system, but
still these over voltages also to be avoided to ensure the smooth operation of electrical power system.

TYPES OF OVER VOLTAGE RELAY


The below are the types of over voltage relay:
 Define Time Overvoltage Relay

 Inverse Time Overvoltage Relay

1. Definite Time Overvoltage Relays


In this type, two conditions must be satisfied for operation (tripping), voltage must exceed the setting value
and the fault must be continuous at least a time equal to time setting of the relay.
Modern relays may contain more than one stage of protection each stage includes each own current and time
setting.
1. For Operation of Definite Time Overvoltage Relay operating time is constant
2. Its operation is independent of the magnitude of voltage above the pick-up value.
3. It has pick-up and time dial settings, desired time delay can be set with the help of an intentional time
delay mechanism.
4. Easy to coordinate.
5. Constant tripping time independent of in feed variation and fault location.
Applications:
1. Back up protection of distance relay of transmission line with time delay.
2. Back up protection to differential relay of power transformer with time delay.
3. Main protection to outgoing feeders and bus couplers with adjustable time delay setting.
2. Inverse Time Overvoltage Relays
In this type of relays, operating time is inversely changed with voltage. So, high voltage will operate
overvoltage relay faster than lower ones. There are standard inverse, very inverse and extremely inverse
types.
Discrimination by both ‘Time’ and ‘Voltage’, the relay operation time is inversely proportional to the fault
voltage.
The operating time of an overvoltage relay can be moved up (made slower) by adjusting the ‘time dial
setting’. The lowest time dial setting (fastest operating time) is generally 0.5 and the slowest is 10.
• Operates when voltage exceeds its pick-up value.
• Operating time depends on the magnitude of voltage.
• It gives inverse time voltage characteristics at lower values of fault voltage and definite time characteristics
at higher values
• An inverse characteristic is obtained if the value of plug setting multiplier is below 10, for values between
10 and 20 characteristics tend towards definite time characteristics.
Normal Inverse Time Overvoltage Relay
The accuracy of the operating time may range from 5 to 7.5% of the nominal operating time as specified in
the relevant norms. The uncertainty of the operating time and the necessary operating time may require a
grading margin of 0.4 to 0.5 seconds.
Application:
Most frequently used in utility and industrial circuits. especially applicable where the fault magnitude is
mainly dependent on the system generating capacity at the time of fault.
2.2 Inverse Time Overvoltage Relay
• Gives more inverse characteristics than that of IDMT.
• Used where there is a reduction in fault voltage, as the distance from source increases.
• Particularly effective with ground faults because of their steep characteristics.
• Suitable if there is a substantial reduction of fault voltage as the fault distance from the power source
increases.
• Very inverse overvoltage relays are particularly suitable if the short-circuit voltage drops rapidly with the
distance from the substation.
• The grading margin may be reduced to a value in the range from 0.3 to 0.4 seconds when overvoltage
relays with very inverse characteristics are used.
• Used when Fault Voltage is dependent on fault location.
• Used when Fault Voltage independent of normal changes in generating capacity.
CIRCUIT DIAGRAM OF RELAY
LEAD ACID BATTERY
Definition: The battery which uses sponge lead and lead peroxide for the conversion of the chemical energy
into electrical power, such type of battery is called a lead acid battery. The lead acid battery is most
commonly used in the power stations and substations because it has higher cell voltage and lower cost.

Construction of Lead Acid Battery

The various parts of the lead acid battery are shown below. The container and the plates are the main part of
the lead acid battery. The container stores chemical energy which is converted into electrical energy by the
help of the plates.

1. Container – The container of the lead acid battery is made of glass, lead lined wood, ebonite, the hard
rubber of bituminous compound, ceramic materials or moulded plastics and are seated at the top to avoid the
discharge of electrolyte. At the bottom of the container, there are four ribs, on two of them rest the positive
plate and the others support the negative plates.

The prism serves as the support for the plates and at the same time protect them from a short-circuit. The
material of which the battery containers are made should be resistant to sulfuric acid, should not deform or
porous, or contain impurities which damage the electrolyte.
2. Plate – The plate of the lead-acid cell is of diverse design and they all consist some form of a grid which
is made up of lead and the active material. The grid is essential for conducting the electric current and for
distributing the current equally on the active material. If the current is not uniformly distributed, then the
active material will loosen and fall out.

The grids are made up of an alloy of lead and antimony. These are usually made with the transverse rib that
crosses the places at a right angle or diagonally. The grid for the positive and negative plates are of the same
design, but the grids for the negative plates are made lighter because they are not as essential for the uniform
conduction of the current.

The plates of the battery are of two types. They are the formed plates or plante plates and pasted or faure
plates.

Plante’s plates are used largely for stationary batteries as these are heavier in weight and more costly than
the pasted plates. But the plates are more durable and less liable to lose active material by rapid charging and
discharging. The plantes plate has low capacity weight-ratio.

Faure process is much suitable for manufacturing of negative plates rather than positive plates. The negative
active material is quite tough, and it undergoes a comparatively low change from charging and discharging.

3. Active Material – The material in a cell which takes active participation in a chemical reaction
(absorption or evolution of electrical energy) during charging or discharging is called the active material of
the cell. The active elements of the lead acid are
1. Lead peroxide (PbO2) – It forms the positive active material. The PbO 2are dark chocolate broom in
colour.
2. Sponge lead – Its form the negative active material. It is grey in colour.

3. Dilute Sulfuric Acid (H2SO4) – It is used as an electrolyte. It contains 31% of sulfuric acid.

The lead peroxide and sponge lead, which form the negative and positive active materials have the little
mechanical strength and therefore can be used alone.

4. Separators – The separators are thin sheets of non-conducting material made up of chemically treated
leadwood, porous rubbers, or mats of glass fibre and are placed between the positive and negative to insulate
them from each other. Separators are grooved vertically on one side and are smooth on the other side.

5. Battery Terminals – A battery has two terminals the positive and the negative. The positive terminal with
a diameter of 17.5 mm at the top is slightly larger than the negative terminal which is 16 mm in diameter.

Working Principle of Lead Acid Battery

When the sulfuric acid dissolves, its molecules break up into positive hydrogen ions (2H +) and sulphate
negative ions (SO4—) and move freely. If the two electrodes are immersed in solutions and connected to DC
supply then the hydrogen ions being positively charged and moved towards the electrodes and connected to
the negative terminal of the supply. The SO4— ions being negatively charged moved towards the electrodes
connected to the positive terminal of the supply main (i.e., anode).

Each hydrogen ion takes one electron from the cathode, and each sulphates ions takes the two negative ions
from the anodes and react with water and form sulfuric and hydrogen acid.

The oxygen, which produced from the above equation react with lead oxide and form lead peroxide (PbO 2.)
Thus, during charging the lead cathode remain as lead, but lead anode gets converted into lead peroxide,
chocolate in colour.

If the DC source of supply is disconnected and if the voltmeter connects between the electrodes, it will show
the potential difference between them. If wire connects the electrodes, then current will flow from the
positive plate to the negative plate through external circuit i.e. the cell is capable of supplying electrical
energy.
Chemical Action During Discharging

When the cell is full discharge, then the anode is of lead peroxide (PbO 2) and a cathode is of metallic sponge
lead (Pb). When the electrodes are connected through a resistance, the cell discharge and electrons flow in a
direction opposite to that during charging.

The hydrogen ions move to the anode and reaching the anodes receive one electron from the anode and
become hydrogen atom. The hydrogen atom comes in contacts with a PbO 2, so it attacks and forms lead
sulphate (PbSO4), whitish in colour and water according to the chemical equation.

The each sulphate ion (SO4—) moves towards the cathode and reaching there gives up two electrons becomes
radical SO4, attack the metallic lead cathode and form lead sulphate whitish in colour according to the
chemical equation.

Chemical Action During Recharging

For recharging, the anode and cathode are connected to the positive and the negative terminal of the DC
supply mains. The molecules of the sulfuric acid break up into ions of 2H + and SO4—. The hydrogen ions
being positively charged moved towards the cathodes and receive two electrons from there and form a
hydrogen atom. The hydrogen atom reacts with lead sulphate cathode forming lead and sulfuric acid
according to the chemical equation.
SO4— ion moves to the anode, gives up its two additional electrons becomes radical SO4, react with the lead
sulphate anode and form leads peroxide and lead sulphuric acid according to the chemical equation.

The charging and discharging are represented by a single reversible equation given below.

BUZZER
A buzzer or beeper is an audio signaling device, which may be mechanical, electromechanical, or
piezoelectric. Typical uses of buzzers and beepers include alarm devices, timers and confirmation of user
input such as a mouse click or keystroke.

Buzzer is an integrated structure of electronic transducers, DC power supply, widely used in


computers, printers, copiers, alarms, electronic toys, automotive electronic equipment, telephones, timers
and other electronic products for sound devices. Active buzzer 5V Rated power can be directly connected to
a continuous sound, this section dedicated sensor expansion module and the board in combination, can
complete a simple circuit design, to "plug and play."

Specifications:

• On-board passive buzzer

• On-board 8550 triode drive

• Can control with single-chip microcontroller IO directly

• Working voltage: 5V

• Board size: 22 (mm) x12 (mm)

Pin Configuration:

1. VCC
2. Input
3. Ground
How to test:
1. Connect your Arduino microcontroller to the computer.

2. Connect the VCC pin of your module to the to the 5V pin of your Arduino.

3. Connect the GND pin of your module to the GND pin of your Arduino.

4. Connect the Input pin of your module to the pin 13 of your Arduino.

5. Enter this program to your Arduino Integrated Development Environment (IDE):

int buzzer = 13;


void setup()
{
pinMode(buzzer, OUTPUT);
}
void loop()
{
digitalWrite(buzzer, HIGH);
delay(1000);
digitalWrite(buzzer, LOW);
delay(1000);
}
6. Lastly, click the Upload Button.

Schematic Diagram:

Frequency Response

How efficiently a buzzer produces sound at a given frequency.

Sound Pressure Level (Unit: dB Pa)

Sound pressure level, SPL, is the deviation from atmospheric pressure caused by the soundwave expressed
in decibel Pascals. It is generally proportional to input voltage and decays by 6 dB's when doubling the
distance from the buzzer.

Resonant Frequency (Unit: F0 Hz)

All things have a specific frequency at which they tend to vibrate. This frequency is called the resonant
frequency. For buzzers, the resonant frequency is the frequency at which they will be the loudest.

Impedance (Unit: ohm)

Electrical impedance is the ratio of applied voltage to current. The electrical impedance varies with
frequency.
As mentioned earlier in the presentation, piezo and magnetic indicators have the driving circuitry
built into the design, creating a "plug and play" solution. Because of this, engineers do not need to worry
about building a complex circuit to drive the buzzer. The disadvantage, however, is that indicators operate
on a fixed frequency, reducing the flexibility offered to achieve an alternate frequency as application
requirements change. Transducers, on the other hand, do not have the driving circuit built-in, so engineers
are offered a greater range of flexibility when designing their circuit. The downside comes in the fact that
transducers do require an external driving signal to operate properly, potentially adding complexity and time
to the design cycle.

Buzzers are typically used for identification and alarm purposes across many major industries. The major
application categories that utilize buzzers for indication or alert purposes include: home appliances,
automotive electronics, medical, safety and security, industrial, and office automation.

SOLAR CELL

Introduction

A solar cell, or photovoltaic cell, is an electrical device that converts the energy of light directly into
electricity by the photovoltaic effect, which is a physical and chemical phenomenon. It is a form of
photoelectric cell, defined as a device whose electrical characteristics, such as current, voltage, or resistance,
vary when exposed to light. Individual solar cell devices can be combined to form modules, otherwise
known as solar panels. In basic terms a single junction silicon solar cell can produce a maximum open-
circuit voltage of approximately 0.5 to 0.6 volts.
Solar cells are described as being photovoltaic, irrespective of whether the source is sunlight or an
artificial light. They are used as a photodetector (for example infrared detectors), detecting light or other
electromagnetic radiation near the visible range, or measuring light intensity.

In contrast, a solar thermal collector supplies heat by absorbing sunlight, for the purpose of either
direct heating or indirect electrical power generation from heat. A "photoelectrolytic cell"
(photoelectrochemical cell), on the other hand, refers either to a type of photovoltaic cell (like that
developed by Edmond Becquerel and modern dye-sensitized solar cells), or to a device that splits water
directly into hydrogen and oxygen using only solar illumination.

Multiple solar cells in an integrated group, all oriented in one plane, constitute a solar photovoltaic
panel or module. Photovoltaic modules often have a sheet of glass on the sun-facing side, allowing light to
pass while protecting the semiconductor wafers. Solar cells are usually connected in series and parallel
circuits or series in modules, creating an additive voltage. Connecting cells in parallel yields a higher
current.

Figure: Solar Cel

Operation

Silicon is the stuff from which the transistors (tiny switches) in microchips are made—and solar cells
work in a similar way. Silicon is a type of material called a semiconductor. Some materials, notably metals,
allow electricity to flow through them very easily; they are called conductors. Other materials, such as
plastics and wood, don't really let electricity flow through them at all; they are called insulators.
Semiconductors like silicon are neither conductors nor insulators: they don't normally conduct electricity,
but under certain circumstances we can make them do so.
A solar cell is a sandwich of two different layers of silicon that have been specially treated or doped
so they will let electricity flow through them in a particular way. The lower layer is doped so it has slightly
too few electrons. It's called p-type or positive-type silicon (because electrons are negatively charged and
this layer has too few of them). The upper layer is doped the opposite way to give it slightly too many
electrons. It's called n-type or negative-type silicon. (You can read more about semiconductors and doping in
our articles on transistors and integrated circuits.)

Solar power is arguably the cleanest, most reliable form of renewable energy available, and it can be
used in several forms to help power your home or business. Solar-powered photovoltaic (PV) panels convert
the sun's rays into electricity by exciting electrons in silicon cells using the photons of light from the sun

Figure: Working of Solar Cell

Applications

Concentrating Solar Power (CSP):


Concentrating solar power (CSP) plants are utility-scale generators that produce electricity using
mirrors or lenses to efficiently concentrate the sun’s energy. The four principal CSP technologies are
parabolic troughs, dish-Stirling engine systems, central receivers, and concentrating photovoltaic systems
(CPV).

Solar Thermal Electric Power Plants: Solar thermal energy involves harnessing solar power for practical
applications from solar heating to electrical power generation. Solar thermal collectors, such as solar hot
water panels, are commonly used to generate solar hot water for domestic and light industrial applications.
This energy system is also used in architecture and building design to control heating and ventilation in both
active solar and passive solar designs.

Photovoltaics: Photovoltaic or PV technology employs solar cells or solar photovoltaic arrays to convert
energy from the sun into electricity. Solar cells produce direct current electricity from the sun’s rays, which
can be used to power equipment or to recharge batteries. Many pocket calculators incorporate a single solar
cell, but for larger applications, cells are generally grouped together to form PV modules that are in turn
arranged in solar arrays. Solar arrays can be used to power orbiting satellites and other spacecraft, and in
remote areas as a source of power for roadside emergency telephones, remote sensing, and cathodic
protection of pipelines.

Solar Heating Systems: Solar hot water systems use sunlight to heat water. The systems are composed of
solar thermal collectors and a storage tank, and they may be active, passive or batch systems

Advantages

 Renewable energy - The energy can be used both to generate electricity and heat in the house.
Renewable energy is recovered from the sun, the wind and waves - which in this case is the sun. Solar
cells harness the energy from the sun and transform this into usable electricity.

 Economy-friendly energy - Solar cells provide a great opportunity to create savings on your electric
bill since you do not pay for the energy that you generate. At the same time you have the opportunity to
monetize your photovoltaic system, if you have a solar system with a grid connected installation, you
can buy and sell electricity to the collective electricity network. At the same time, you can obtain several
grants for solar cells and there will be more economic benefits to be gained in the future.

 Environmentally friendly energy - With solar cells occurs almost no pollution. The discharge of
waste and pollution is unavoidable in relation to the production of solar cells, the transport of these and
when you install them. However, this is a minimal fraction, compared to if one draws its energy from
elsewhere.
LITHIUM-ION BATTERY

Introduction

A lithium-ion battery or Li-ion battery (abbreviated as LIB) is a type of rechargeable battery in which
lithiumions move from the negative electrode to the positive electrode during discharge and back when
charging. Li-ion batteries use an intercalated lithium compound as one electrode material, compared to the
metallic lithium used in a non-rechargeablelithium battery. The electrolyte, which allows for ionic
movement, and the two electrodes are the constituent components of a lithium-ion battery cell.

Lithium-ion batteries are common in home electronics. They are one of the most popular types of
rechargeable batteries for portable electronics, with a high energy density, tiny memory effect and low self-
discharge. LIBs are also growing in popularity for military, battery electric vehicle and aerospace
applications.

Chemistry, performance, cost and safety characteristics vary across LIB types. Handheld electronics
mostly use LIBs based on lithium cobalt oxide , which offers high energy density but presents safety risks,
especially when damaged. Lithium iron phosphate, lithium ion manganese oxide battery, and lithium nickel
manganese cobalt oxideoffer lower energy density but longer lives and less likelihood of unfortunate events
in real-world use (e.g., fire, explosion, etc.). Such batteries are widely used for electric tools, medical
equipment, and other roles. NMC in particular is a leading contender for automotive applications. Lithium
nickel cobalt aluminum oxideand lithium titanateare specialty designs aimed at particular niche roles. The
newer lithium–sulfur batteries promise the highest performance-to-weight ratio.
Figure: Li-ion Battery

Operation

Like any other battery, a rechargeable lithium-ion battery is made of one or more power-generating
compartments called cells. Each cell has essentially three components: a positive electrode (connected to the
battery's positive or + terminal), a negative electrode (connected to the negative or − terminal), and a
chemical called an electrolyte in between them. The positive electrode is typically made from a chemical
compound called lithium-cobalt oxide (LiCoO2) or, in newer batteries, from lithium iron phosphate
(LiFePO4). The negative electrode is generally made from carbon (graphite) and the electrolyte varies from
one type of battery to another—but isn't too important in understanding the basic idea of how the battery
works.

All lithium-ion batteries work in broadly the same way. When the battery is charging up, the lithium-
cobalt oxide, positive electrode gives up some of its lithium ions, which move through the electrolyte to the
negative, graphite electrode and remain there. The battery takes in and stores energy during this process.
When the battery is discharging, the lithium ions move back across the electrolyte to the positive electrode,
producing the energy that powers the battery. In both cases, electrons flow in the opposite direction to the
ions around the outer circuit. Electrons do not flow through the electrolyte: it's effectively an insulating
barrier, so far as electrons are concerned.

The movement of ions (through the electrolyte) and electrons (around the external circuit, in the
opposite direction) are interconnected processes, and if either stops so does the other. If ions stop moving
through the electrolyte because the battery completely discharges, electrons can't move through the outer
circuit either—so you lose your power. Similarly, if you switch off whatever the battery is powering, the
flow of electrons stops and so does the flow of ions. The battery essentially stops discharging at a high rate
(but it does keep on discharging, at a very slow rate, even with the appliance disconnected).

Unlike simpler batteries, lithium-ion ones have built in electronic controllers that regulate how they
charge and discharge. They prevent the overcharging and overheating that can cause lithium-ion batteries to
explode in some circumstances.

Advantages

Generally, lithium ion batteries are more reliable than older technologies such as nickel-cadmium
(NiCd, pronounced "nicad") and don't suffer from a problem known as the "memory effect" (where nicad
batteries appear to become harder to charge unless they're discharged fully first). Since lithium-ion batteries
don't contain cadmium (a toxic, heavy metal), they are also (in theory, at least) better for the environment—
although dumping any batteries (full of metals, plastics, and other assorted chemicals) into landfills is never
a good thing. Compared to heavy-duty rechargeable batteries (such as the lead-acid ones used to start cars),
lithium-ion batteries are relatively light for the amount of energy they store.
SOLAR PANEL

Solar cells and solar panels have lots of uses. They are in everyday things like calculators, watches,
and fl ashlights. There are solar-powered toys, radios, and MP3 players. There are solar-powered cell phones
and pagers. Using solar power with devices like these means you never have to worry about batteries. Solar
panels are sometimes used to make the electricity to light up road signs and bus stops. They may make the
electricity that makes roadside emergency phones or parking meters work.

The Sun constantly gives off energy. The energy is carried through space as electromagnetic radiation. There
are several types of electromagnetic radiation. Light is one type. Radio waves are another. Electromagnetic
radiation travels like waves in water. Like water waves, it is a series of ups and downs. One way various
types of electromagnetic waves differ is in their wavelength. This is the distance between two ups (or two
downs) in a row. The wavelengths of radio waves are longer than those of light. Among types of light, red
has a longer wavelength than blue

How Solar Cells Use Light

Only part of the energy sent toward Earth by the Sun actually makes it to Earth’s surface. Some solar
energy gets bounced back into space. Some gets absorbed by the air. Most of the solar energy that does
make it to Earth’s surface is in the form of visible light. Solar cells can use the energy of this light to make
electricity. But they don’t work equally well with all forms of light. Different types of solar cells use
different wavelengths. This means a cell can use only some of the solar energy that it receives.

Solar cells come in various sizes. Some are tinier than a stamp. Some are 5 inches (12 centimeters)
across. The cells are made of a type of material known as a semiconductor. Often, they are made of silicon.
Semiconductors can conduct, or carry, electricity. They don’t do this as well as metals, however. That is why
they are called “semi.” Because they only “semi” conduct electricity, they can be used to control electric
current. On their top and bottom they typically have metal contacts through which current can fl ow. A
typical simple cell has two layers of silicon. One is known as n-type. The other is p-type. The layers are
different from each other.
How Solar Cells Make Electricity The process of making electricity begins when the silicon atoms
absorb some light. The light’s energy knocks some electrons out of the atoms. The electrons fl ow between
the two layers. The flow makes an electric current. The current can leave the cell through the metal contacts
and be used. When light hits a solar cell, much of its energy is wasted. Some light bounces off or passes
through the cell. Some is turned into heat. Only light with the right wavelengths, or colors, is absorbed and
then turned into electricity.

A single simple solar cell makes only a little electricity. For most purposes more is needed. For this
reason, cells are often linked together in groups known as solar modules. A solar module has a frame that
holds the cells. Some modules are several feet long and wide. They usually can produce up to a few hundred
watts of electricity. If more power is needed, modules can be joined together to form a large solar array
Real Time Clock (RTC)

A real time clock (RTC) has been built in the FBs-PLC's MC/MN main unit. No matter whether the
PLC is switched on or off, the RTC will always keep accurate time. It provides 7 kinds of time value data-
week, year, month, day, hour, minute and second. Users can take advantage of the real time clock to do 24
hour controls throughout the year (for example, businesses or factories can switch lights on and off at set
times each day, control gate access, and do pre-cooling and pre-heating before business or operations begin).
It can enable your control system to automatically coordinate with people's living schedules, and not only
will it raise the level of automatic control, it will improve efficiency.

Within PLC, there are special purpose registers (RTCR) for storing the time values of the RTC. There
are 8 RTCR registers in all, going from R4128 to R4135. R4128 to R4134 are used to store the 7 kinds of
time values mentioned above, from weeks to seconds. Because in practical daily application, certain hour
and minute time data is often used, we have specially merged the time values of the hour register (R4130)
and minute register (R4129) within RTCR, and put them in R4135 high byte and low byte, so they can be
accessed by the user. The diagram below shows the correspondence between RTC and the RTCR within
PLC, as well as the control switch and status flag (M1952-M1955) related to RTC accessing.
RTC read out (RTC→R4128~R4135): whenever the M1952 relay is 0 (RTC timing active). With
every scan, CPU will take the time value data within RTC and move it to R4128~R4135. When it is 1, it will
not read out. In this case R4128~R4135 can load in the set values and they won't be overridden. 3. ±30
second adjustment: At the moment that the status of relay M1953 goes 1, CPU will check the value of the
second register (R4128) within RTC. If its value is between 0 and 29 seconds then it will be cleared to 0. If
its value is between 30 and 59 seconds then besides being cleared to 0, the minute register (R4129) will be
increased by 1 (ie, one minute will be added). This can be used to adjust your RTC time value. 4. M1954
RTC installation detecting flag: When RTC is fitted to the PLC, relay M1954 will be set as 1; otherwise it
will be 0. 5. M1955 set value error flag: When the time value which is set to RTC's IC is illegal, then the
error flag relay M1955 will be set as 1, and the setting action will not be executed..

TRANSISTOR
INTRODUCTION

A transistor is a solid-state, semiconductor device with three electrical connections (emitter, base,
collector). A small current flowing between base and emitter has the ability to control a much larger current
flowing between the collector and emitter. Transistors can be manufactured in two distinct configurations: PNP
or NPN. The N's and P's refer to the kind of impurity introduced into the crystal structure of the various regions
of the transistor. This determines which way the currents flow through the transistor. The circuit symbol for a
transistor reveals its configuration by the direction of an arrow placed on the emitter lead and distinguishes the
emitter from the collector as shown in Figure 1.

P N P Transistor
N P N Transistor

Figure 1. Construction and circuit symbol for PNP and NPN transistors.

If, in the case of an NPN transistor, a positive voltage is applied to the collector (and the emitter connected to
the negative terminal to complete the circuit) no current will flow unless a small current is allowed to flow
through the base to the emitter. (For older types of transistor a small leakage current, uncontrolled by the I B, but
dependent on the temperature, flows between the emitter and collector).

The amount of collector current depends almost entirely on the amount of base current and the first part of the
experiment is concerned with determining the extent of this dependence by plotting a set of curves known as the
collector characteristics. The collector characteristics are a family of curves showing the collector current
flowing as a function of collector voltage for various values of base current as shown in Figure 2. From the
collector characteristics the current amplification of the transistor may be determined.
Figure 2. Characteristic curves for a transistor

At any point X (in Figure 2) we may define a current ratio

Ic (X)
h FE =
IB (X)
(1)

which typically may be from 10 to 500 depending on the transistor. Few are less than 10 (unless they are faulty)
and a value in excess of 500 would indicate a rather exceptional transistor. In some references α FE or ß may be
used instead of hFE.

The symbol h refers to what are known as "hybrid parameters", of which there are four to describe most of the
circuit properties of a transistor at low frequencies. The F identifies the h-parameter as the Forward Current
Amplification Factor and the E refers to circuit operation with the Emitter common to both the input and output
circuits surrounding the transistor, as shown in Figure 3.
Figure 3. Identification of Input and Output circuits for an NPN transistor

A small current IB in the input circuit will control a larger current and

IC = hFE IB (2)

In most applications, such as amplifiers or radios, an alternating (AC) signal current is amplified. An alternating
current flows in both forward and reverse directions but transistor action occurs only for current flowing in one
direction through the transistor. This is achieved by adding a D.C. bias to the signal. The forward half-cycles of
the A.C. signal add to the bias current and the reverse half-cycles subtract from it. To measure the amplification
produced by the transistor for A.C. signals we use

Δ IC (X)
h fe = (3)
Δ IB (X)

at a constant VCE as shown in Figure 4.

Figure 4. Measurement parameters for hfe (see equation 3)

ADC0808

8-Bit μP Compatible A/D Converters with 8-Channel Multiplexer


General Description:

The ADC0808, ADC0809 data acquisition component is a monolithic CMOS device with an 8-bit
analog-to-digital converter, 8-channel multiplexer and microprocessor compatible control logic. The 8-bit
A/D converter uses successive approximation as the conversion technique. The converter features a high
impedance chopper stabilized comparator, a 256R voltage divider with analog switch tree and a successive
approximation register. The 8-channel multiplexer can directly access any of 8-single-ended analog signals.
The device eliminates the need for external zero and full-scale adjustments. Easy interfacing to
microprocessors is provided by the latched and decoded multiplexer address inputs and latched TTL TRI-
STATE outputs. The design of the ADC0808, ADC0809 has been optimized by incorporating the most
desirable aspects of several A/D conversion techniques. The ADC0808, ADC0809 offers high speed, high
accuracy, minimal temperature dependence, excellent long-term accuracy and repeatability, and consumes
minimal power. These features make this device ideally suited to applications from process and machine
control to consumer and automotive applications. For 16-channel multiplexer with common output
(sample/hold port) see ADC0816 data sheet.

Features:
■ Easy interface to all microprocessors
■ Operates ratiometrically or with 5 VDC or analog span adjusted voltage reference
■ No zero or full-scale adjust required
■ 8-channel multiplexer with address logic
■ 0V to VCC input range
■ Outputs meet TTL voltage level specifications
■ ADC0808 equivalent to MM74C949
■ ADC0809 equivalent to MM74C949-1

Key Specifications:
■ Resolution 8 Bits
■ Total Unadjusted Error ±½ LSB and ±1 LSB
■ Single Supply 5 VDC
■ Low Power 15 mW
■ Conversion Time 100 μs

BlockDiagram:
Dual-In-Line Package

Order Number ADC0808CCN


Functional Description:

MULTIPLEXER
The device contains an 8-channel single-ended analog signal multiplexer. A particular input channel
is selected by using the address decoder. Table 1 shows the input states for the address lines to select any
channel. The address is latched into the decoder on the low-to-high transition of the address latch enable
signal.
TABLE 1. Analog Channel Selection
SELECTED ANALOG ADDRESS LINE
CHANNEL C B A

IN0 L L L
IN1 L L H
IN2 L H L
IN3 L H H
IN4 H L L
IN5 H L H
IN6 H H L
IN7 H H H
CONVERTER
CHARACTERISTICS

The Converter
The heart of this single chip data acquisition system is its 8- bit analog-to-digital converter. The
converter is designed to give fast, accurate, and repeatable conversions over a wide range of temperatures.
The converter is partitioned into 3 major the 256R ladder network, the successive approximation register,
and the comparator. The converter's digital outputs are positive true. The 256R ladder network approach was
chosen over the conventional R/2R ladder because of its inherent monotonicity, which guarantees no
missing digital codes.
Monotonicity is particularly important in closed loop feedback control systems. A non-monotonic
relationship can cause oscillations that will be catastrophic for the system. Additionally, the 256R network
does not cause load variations on the reference voltage The bottom resistor and the top resistor of the ladder
network
in are not the same value as the remainder of the network. The difference in these resistors causes the output
characteristic to be symmetrical with the zero and full-scale points of the transfer curve. The first output
transition occurs when the analog signal has reached +½ LSB and succeeding output transitions occur every
1 LSB later up to full-scale. The successive approximation register (SAR) performs 8 iterations to
approximate the input voltage. For any SAR type converter, n-iterations are required for an n-bit converter.
Figure 2 shows a typical example of a 3-bit converter. In the ADC0808, ADC0809, the approximation
technique is extended to 8 bits using the 256R network. The A/D converter's successive approximation
register (SAR) is reset on the positive edge of the start conversion start pulse. The conversion is begun on
the falling edge of the start conversion pulse. A conversion in process will be interrupted by receipt of a new
start conversion pulse. Continuous conversion may be accomplished by tying the end-of-conversion (EOC)
output to the SC input. If used in this mode, an external
start conversion pulse should be applied after power up. End of- conversion will go low between 0 and 8
clock pulses after the rising edge of start conversion.
The most important section of the A/D converter is the comparator. It is this section which is responsible for
the ultimate accuracy of the entire converter. It is also the comparator drift which has the greatest influence
on the repeatability of the device. A chopper-stabilized comparator provides the most effective method of
satisfying all the converter requirements. The chopper-stabilized comparator converts the DC input signal
into an AC signal. This signal is then fed through a high gain AC amplifier and has the DC level restored.
This technique limits the drift component of the amplifier since the drift is a DC component which is not
passed by the AC amplifier. This makes the entire A/D converter extremely insensitive to temperature, long
term drift and input offset errors. shows a typical error curve for the ADC0808 a measured using the
procedures outlined in AN-179.

Applications Information:
OPERATION:
1.0 RATIOMETRIC CONVERSION
The ADC0808, ADC0809 is designed as a complete Data Acquisition System (DAS) for ratiometric
conversion systems. In ratiometric systems, the physical variable being measured is expressed as a
percentage of full-scale which is not necessarily related to an absolute standard. The voltage input to the
ADC0808 is expressed by the equation VIN= Input voltage into the ADC0808.

Vfs= Full-scale voltage


VZ= Zero voltage
DX= Data point being measured
DMAX= Maximum data limit
DMIN= Minimum data limit

A good example of a ratiometric transducer is a potentiometer used as a position sensor. The position of the
wiper is directly proportional to the output voltage which is a ratio of the full scale voltage across it. Since
the data is represented as a proportion of full-scale, reference requirements are greatly reduced, eliminating a
large source of error and cost for many applications. A major advantage of the ADC0808, ADC0809 is that
the input voltage range is equal to the supply range so the transducers can be connected directly across the
supply and their outputs connected directly into the multiplexer inputs. Ratiometric transducers such as
potentiometers, strain gauges, thermistor bridges, pressure transducers, etc., are suitable for measuring
proportional relationships; however, many types of measurements must be referred to an absolute standard
such as voltage or current. This means a system reference must be used which relates the full-scale voltage
to the standard volt. For example, if VCC=VREF=5.12V, then the full-scale range is divided into 256
standard steps. The smallest standard step is 1 LSB which is then 20 mV.

2.0 RESISTOR LADDER LIMITATIONS


The voltages from the resistor ladder are compared to the selected into 8 times in a conversion. These
voltages are coupled to the comparator via an analog switch tree which is referenced to the supply. The
voltages at the top, center and bottom of the ladder must be controlled to maintain proper operation.
The top of the ladder, Ref(+), should not be more positive than the supply, and the bottom of the
ladder, Ref(−), should not be more negative than ground. The center of the ladder volt age must also be near
the center of the supply because the analog switch tree changes from N-channel switches to P channel
switches. These limitations are automatically satisfied in ratiometric systems and can be easily met in
ground referenced systems. shows a ground referenced system with a separate supply and reference. In this
system, the supply must be trimmed to match the reference voltage. For instance, if a 5.12V is used, the
supply should be adjusted to the same voltage within 0.1V.
The ADC0808 needs less than a milliamp of supply current so developing the supply from the reference is
readily accomplished. a ground referenced system is shown which generates the supply from the reference.
The buffer shown can be an op amp of sufficient drive to supply the milliamp of supply current and the
desired bus drive, or if a capacitive bus is driven by the outputs a large capacitor will supply the transient
supply current as seen in. The LM301 is overcompensated to insure stability when loaded by the 10 μF
output capacitor. The top and bottom ladder voltages cannot exceed VCC and ground, respectively, but they
can be symmetrically less than VCC and greater than ground. The center of the ladder voltage should always
be near the center of the supply. The sensitivity of the converter can be increased, (i.e., size of the LSB steps
decreased) by using a symmetrical reference system. A 2.5V reference is symmetrically centered about
VCC/2 since the same current flows in identical resistors. This
system with a 2.5V reference allows the LSB bit to be half the size of a 5V reference system.
Fig. Ground Referenced Conversion System with
Reference Generating VCC Supply

RA=RB
fig. *Ratiometric transducers FIGURE. Symmetrically Centered Reference

3.0 CONVERTER EQUATIONS


The transition between adjacent codes N and N+1 is given

by:

The center of an output code N is given by:


The output code N for an arbitrary input are the integers within
the range:

Where: VIN=Voltage at comparator input


VREF(+)=Voltage at Ref(+)
VREF(−)=Voltage at Ref(−)
VTUE=Total unadjusted error voltage (typically
VREF(+)÷512)
4.0 ANALOG COMPARATOR INPUTS
The dynamic comparator input current is caused by the periodic switching of on-chip stray
capacitances. These are connected alternately to the output of the resistor ladder/switch tree network and to
the comparator input as part of the operation of the chopper stabilized comparator. The average value of the
comparator input current varies directly with clock frequency and with VIN as shown in If no filter
capacitors are used at the analog inputs and the
signal source impedances are low, the comparator input current should not introduce converter errors, as the
transient created by the capacitance discharge will die out before the comparator output is strobed. If input
filter capacitors are desired for noise reduction and signal conditioning they will tend to average out the
dynamic comparator input current. It will then take on the characteristics of a DC bias current whose effect
can be predicted conventionally.
VOICE MODULE

DESCRIPTION

Today’s consumers demand the best in audio/voice. They want crystal-clear sound wherever
they are in whatever format they want to use. APLUS delivers the technology to enhance a
listener’s audio/voice experience.

The aPR33A series are powerful audio processor along with high performance audio analog-to-
digital converters (ADCs) and digital-to-analog converters (DACs). The aPR33A series are a fully
integrated solution offering high performance and unparalleled integration with analog input,
digital processing and analog output functionality. The aPR33A series incorporates all the
functionality required to perform demanding audio/voice applications. High quality audio/voice
systems with lower bill-of-material costs can be implemented with the aPR33A series because of
its integrated analog data converters and full suite of quality-enhancing features such as sample-
rate convertor.

The aPR33A series C2.0 is specially designed for simple key trigger, user can record and
playback the message averagely for 1, 2, 4 or 8 voice message(s) by switch, It is suitable in
simple interface or need to limit the length of single message, e.g. toys, leave messages system,
answering machine etc. Meanwhile, this mode provides the power-management system. Users
can let the chip enter power-down mode when unused. It can effectively reduce electric current
consuming to 15uA and increase the using time in any projects powered by batteries.

FEATURES
oOperating Voltage Range: 3V ~ 6.5V
oSingle Chip, High Quality Audio/Voice Recording & Playback Solution
 No External ICs Required
 Minimum External Components
oUser Friendly, Easy to Use Operation
 Programming & Development Systems Not Required
o170/ 340/ 680 sec. Voice Recording Length in aPR33A1/aPR33A2/aPR33A3
oPowerful 16-Bits Digital Audio Processor.
oNonvolatile Flash Memory Technology
 No Battery Backup Required
oExternal Reset pin.
oPowerful Power Management Unit
 Very Low Standby Current: 1uA
 Low Power-Down Current: 15uA
 Supports Power-Down Mode for Power Saving
oBuilt-in Audio-Recording Microphone Amplifier
 No External OPAMP or BJT Required
 Easy to PCB layout
oConfigurable analog interface
 Differential-ended MIC pre-amp for Low Noise
 High Quality Line Receiver
oHigh Quality Analog to Digital, DAC and PWM module
 Resolution up to 16-bits
oSimple And Direct User Interface
oAveragely 1,2,4 or 8 voice messages record & playback
Pin Names Pin No TYPE Description
VDDP 8
VDD 10
Positive power supply.
VDDA 18
VDDL 24
VSSP 5
VSSL 11 Power ground.
VSSA 17
VLDO 25 Internal LDO output.
VCORE 16 Positive power supply for core.
VREF 19 Reference voltage.
VCM 20 Common mode voltage.
Rosc 26 INPUT Oscillator resistor input.
RSTB 27 INPUT Reset. (Low active)
SRSTB 28 INPUT System reset, pull-down a resistor to the VSSL.
MIC+ 21
INPUT Microphone differential input.
MIC- 22
MICG 23 OUTPUT Microphone ground.
PWM output to drive speaker directly.
VOUT1 7 INPUT
DAC option.
PWM output to drive speaker directly.
VOUT2 6 INPUT
DAC output.
/REC 12 INPUT Record Mode. (Low active)
M0 13 INPUT Message-0.
M1 14 INPUT Message-1.
M2 15 INPUT Message-2.
M3 9 INPUT Message-3.
M4 3 INPUT Message-4.
M5 4 INPUT Message-5.
M6 / MSEL0 1 INPUT Message-6, Message select 0.
M7 / MSEL1 2 INPUT Message-7, Message select 1.
 MESSAGE MODE

In fixed 1/ 2/ 4/ 8 message mode (C2.0), user can divide the memory averagely for 1, 2, 4 or 8
message(s). The message mode will be applied after chip reset by the MSEL0 and MSEL1 pin.

Please note the message should be recorded and played in same message mode, we CAN NOT
guarantee the message is complete after message mode changed. For example, user recorded 8
messages in the 8-message mode, those messages can be played in 8-message mode only. If user
changed to 1, 2 or 4 message mode, system will discard those messages.
 8-Message Mode

The memory will be divided to 8 messages averagely when both MSEL0 and MSEL1
pin float after chip reset.

 4-Message Mode

The memory will be divided to 4 messages averagely when MSEL0 pin connected to VSS and
MSEL1 pin float after chip reset.
 2-Message Mode

The memory will be divided to 2 messages averagely when MSEL1 pin connected to VSS and
MSEL0 pin float after chip reset.

 RECORD MESSAGE

During the /REC pin drove to VIL, chip in the record mode.

When the message pin (M0, M1, M2 … M7) drove to VIL in record mode, the chip will
playback “beep” tone and message record starting.

The message record will continue until message pin released or full of this message, and the chip
will playback “beep” tone 2 times to indicate the message record finished.

If the message already exist and user record again, the old one’s message will be replaced.
The following fig. showed a typical record circuit for 8-message mode. We connected a slide-
switch between /REC pin and VSS, and connected 8 tact-switches between M0 ~ M7 pin and
VSS. When the slide-switch fixed in VSS side and any tact-switch will be pressed, chip will start
message record and until the user releases the tact-switch.

Note: After reset, /REC and M0 to M7 pin will be pull-up to VDD by internal resistor.

 PLAYBACK MESSAGE

During the /REC pin drove to VIH, chip in the playback mode.

When the message pin (M0, M1, M2 … M7) drove from VIH to VIL in playback mode, the
message playback starting.

The message playback will continue until message pin drove from VIH to VIL again or end of
this message.

The following fig. showed a typical playback circuit for 8-message mode. We connected a slide-
switch between /REC and VSS, and connected 8 tact-switches between M0 ~ M7 and VSS. When
the slide-switch fixed in float side and any tact-switch will be pressed, chip will start message
playback and until the user pressed the tact-switch again or end of message.

Note: After reset, /REC and M0 to M7 pin will be pull-up to VDD by internal resistor.

 VOICE INPUT

The aPR33A series supported single channel voice input by microphone or line-in. The following
fig. showed circuit for different input methods: microphone, line-in and mixture of both.
(A) Microphone
 EXAMPLE

The aPR33DB is one of the simplest solutions for achieve fixed 1/ 2/ 4/ 8 message mode demo. The
circuit board already includes the peripheral circuit which containing microphone. Developers only
need to notice how to connect with their development environment. It can effectively decrease the
time of circuit connecting & any possible mistakes. Below figure shows how to connect aPR33DB
with external key in fixed 1/ 2/ 4/ 8 message mode:
NOISE DETECT (SOUND) SENSOR MODULE

Description

The sound sensor module provides an easy way to detect sound and is generally used for detecting
sound intensity. This module can be used for security, switch, and monitoring applications. Its accuracy can be
easily adjusted for the convenience of usage. It uses a microph one which supplies the input to an amplifier,
peak detector and buffer.

When the sensor detects a sound, it processes an output signal voltage which is sent to a microcontroller then
performs necessary processing.

Specifications

 Operating voltage 3.3V-5V

 Output model: digital switch outputs (0 and 1, high or low level)

 With a mounting screw hole

 PCB size: 3.4cm * 1.6cm


Pin Configuration

1. VCC: 3.3V-5V DC

2. GND: ground

3. DO: digital output

4. AO: analog output

How to test

The components to be used are: Microcontroller (any compatible arduino) Sound sensor module 1
Pin M-M connectors Breadboard USB cable 1. Connect the components based on the figure shown in
the wiring diagram using a M-M pin connector. VCC pin is connected to the 3.3V or 5V power supply,
GND pin is connected to the GND, DO pin is connected to a digital I/O pin and AO pin is connected to an
analog pin. Pin number will be based on the actual program code. 2. After hardware connection, insert the
sample sketch into the Arduino IDE. 3. Using a USB cable, connect the ports from the microcontroller to the
computer. 4. Upload the program. 5. See the results in the serial monitor.
CHAPTER4
SOFTWARE TOOLS
KEIL
This project used Keil to provide you with software development tools for your embedded
microcontroller applications. This book, Getting Started, describes the µVision IDE, µVision Debugger and
Analysis Tools, the simulation, and debugging and tracing capabilities. In addition to describing the basic
behavior and basic screens of µVision, this book provides a comprehensive overview of the supported
microcontroller architecture types, their advantages and highlights, and supports you in selecting the appropriate
target device. This book incorporates hints to help you to write better code.

As with any Getting Started book, it does not cover every aspect and the many available configuration
options in detail. We encourage you to work through the examples to get familiar with µVision and the
components delivered. The Keil Development Tools are designed for the professional software developer,
however programmers of all levels can use them to get the most out of the embedded microcontroller
architectures that are supported. Tools developed by Keil endorse the most popular microcontrollers and are
distributed in several packages and configurations, dependent on the architecture.

MDK-ARM: Microcontroller Development Kit, for several ARM7, ARM9, and Cortex-Mx based
devices PK166: Keil Professional Developer’s Kit, for C166, XE166, and XC2000 devices DK251: Keil 251
Development Tools, for 251 devices PK51: Keil 8051 Development Tools, for Classic & Extended 8051
devices In addition to the software packages, Keil offers a variety of evaluation boards, USB-JTAG adapters,
emulators, and third-party tools, which completes the range of products. The following illustrations show the
generic component blocks of µVision in conjunction with tools provided by Keil, or tools from other vendors,
and the way the components relate.
Software Development Tools Like all software based on Keil’s µVision IDE, the toolsets provide a
powerful, easy to use and easy to learn environment for developing embedded applications. They include the
components you need to create, debug, and assemble your C/C++ source files, and incorporate simulation for
microcontrollers and related peripherals. The RTX RTOS Kernel helps you to implement complex and time-
critical software.

RTOS and Middleware Components These components are designed to solve communication and real-
time challenges of embedded systems. While it is possible to implement embedded applications without using a
real-time kernel, a proven kernel saves time and shortens the development cycle. This component also includes
the source code files for the operating system.

Step 1: Downloading Keil UVision IDE

Keil provides a code limited (2K bytes) evaluation version for 8051 architecture (C51) which is sufficient for
learning purposes.

The main limitations of the evaluation version are the following.

 8051 compiler, assembler, linker, and debugger are limited to 2 Kbytes of object code
 Programs that generate more than 2 Kbytes of object code will not compile

 The debugger supports programs that are 2 Kbytes or smaller

 No hardware support for multiple DPTR registers is provided

Keil uVision IDE (Evaluation Version) can be downloaded using this link.

On Clicking the above link you will be redirected to Keil Website Download section.

Please click on the C51 icon to download 8051 development tools (above Figure) .
and download your Windows Executable.

More Info here.


Step 2: Creating a 8051/8052 Project Using Keil Uvision IDE

After you have installed the Keil uVision tools for 8051 ,Double click on the Keil icon on your Windows
Desktop to launch the IDE.

To create a new 8051 project using Keil IDE, Click on the ' Project ' item on the IDE Menu bar and select '
New uVision Project... ' as shown in the above image.

Now create a Folder to store your project and give a name to your Project files (*.uvproj), for eg Test
(Test.uvproj).
Step 3: Selecting an Atmel company in Keil

Step 4: Selecting an 8051 Device in Keil


You will then be taken to the device selection dialog, where you can select the 8051 derivative for which you
want to develop software.

Keil has support for a wide variety of 8051 derivatives on its IDE.The 8051 derivatives are organised according
to their manufacturer's.

On selecting the particular microcontroller the Keil IDE also displays the features of the selected
microcontroller on its left pane .You can Click OK to confirm your choice.

Step 5: Save the file in Keil


Step 6: Adding C Files to Keil Project
Now your Project pane on the Kiel IDE would look something like this (above image)
Now you can add C files to you Project.

Right Click on the Source Group 1 folder on your Project pane and select Add New Item to Group 'Source
Group1'...

Now you can select the type of file you want to add to your project using the top pane.

Select C File(.c) and give it a name (here main.c) and Click Add.

Step 8: Building a C Project Using Keil UVision IDE


After you have typed out the above c program to your main.c file,You can compile the C file by pressing F7
key or by going to ' Project -> Build Target ' on the IDE menu bar.
Inorder to download the code into the 8051 microcontroller we have to generate the corresponding hex code .

In Keil uVision IDE you can generate hex file for your 8051 derivative by, Right Clicking on the ' Target 1 '
Folder and Selecting Options for Target 'Target1'....

Then on the Options for Target ' Target 1' Dialog ,

Select the Output tab and check the Create Hex File option and Press OK.

Now rebuild your project by pressing F7.


Kiel IDE would generate a hex file with same name (here Test.hex) as your project in the Objects folder .

You can open the Test.hex file with notepad to view the contents after creation.
Uploading hex code is specific to the 8051 derivative you are using.For example some microcontrollers like
P89V51 and Nuvoton W78E05D have build in boot loader which can upload hex code through their serial port.
ARDUINO SOFTWARE

Download Arduino Software

You’ll need to download the Arduino Software package for your operating system from the Arduino download
page.

When you’ve downloaded and opened the application you should see something like this:
This is where you type the code you want to compile and send to the Arduino board.

The Initial Setup


We need to setup the environment to Tools menu and select Board.

Tools Menu < Board


Then select the type of Arduino you want to program, in our case it’s the Arduino Uno.
Arduino Uno

The Code
The code you write for your Arduino are known as sketches. They are written in C++.
Every sketch needs two void type functions, setup() and loop(). A void type function doesn’t return any value.
The setup() method is ran once at the just after the Arduino is powered up and the loop() method is ran
continuously afterwards. The setup() is where you want to do any initialisation steps, and in loop() you want to
run the code you want to run over and over again.

So, your basic sketch or program should look like this:


1
2
void setup()
3
{
4
}
5
void loop()
6
{
7
}
8
9

If you notice on the top edge of the board there’s two black rectangles with several squares in. These are
called headers. Headers make it easy to connect components to the the Arduino. Where they connect to the
board is called pins. Knowing what pin something is connected to is essential for programming an Arduino.

The pin numbers are listed next to the headers on the board in white.

The onboard LED we want to control is on pin 13.

In our code above the setup() method let’s create a variable called ledPin. In C++ we need to state
why type our variable is before hand, in this case it’s an integer, so it’s of type int.

int ledPin = 13;


void setup()
{
}
void loop()
{
}

Each line is ended with a semicolon (;).


In the setup() method we want to set the ledPin to the output mode. We do this by calling a special
function called pinMode() which takes two variables, the first the pin number, and second, whether it’s an input
or output pin. Since we’re dealing with an output we need to set it to a constant called OUTPUT. If you were
working with a sensor or input it would be INPUT.
1
2
int ledPin = 13;
3
void setup()
4
{
5
pinMode(ledPin, OUTPUT);
6
}
7
void loop()
8
{
9
}
10
11

Next we want to compile to machine code and deploy or upload it to the Arduino.
Compiling the Code
If this is your first time you’ve ever compiled code to your Arduino before plugging it in to the computer go to
the Tools menu, then Serial Port and take note of what appears there.

Here’s what mine looks like before plugging in the Arduino UNO:

Plug your Arduino UNO board in to the USB cable and into your computer. Now go back to the Tools > Serial
Portmenu and you should see at least 1 new option. On my Mac 2 new serial ports appear.

They tty and cu are two ways that computers can talk over a serial port. Both seem to work with the Arduino
software so I selected the tty.* one. On Windows you should see COM followed by a number. Select the new
one that appears.

Once you have selected your serial or COM port you can then press the button with the arrow pointing to the
right.
Once that happens you should see the TX and RX LEDs below the L LED flash. This is the
communication going on between the computer and the Arduino. The L may flicker too. Once this dance is
complete your program should be running. And your LED should be off.
Now let’s try and switch it on using the HIGH constant.
PROTEUS
Proteus is a simulation and design software tool developed by Labcenter Electronics for Electrical
and Electronic circuit design. It also possess 2D CAD drawing feature. It deserves to bear the tagline “From
concept to completion”.

About Proteus

It is a software suite containing schematic, simulation as well as PCB designing.

 ISIS is the software used to draw schematics and simulate the circuits in real time.The simulation allows
human access during run time,thus providing real time simulation.
 ARES is used for PCB designing.It has the feature of viewing output in 3D view of the designed PCB
along with components.
 The designer can also develop 2D drawings for the product.

Features

ISIS has wide range of components in its library. It has sources, signal generators, measurement and analysis
tools like oscilloscope, voltmeter, ammeter etc., probes for real time monitoring of the parameters of the
circuit, switches, displays, loads like motors and lamps, discrete components like resistors, capacitors,
inductors, transformers, digital and analog Integrated circuits, semi-conductor switches, relays,
microcontrollers, processors, sensors etc.

ARES offers PCB designing up to 14 inner layers, with surface mount and through hole packages. It is
embedded with the foot prints of different category of components like ICs, transistors, headers, connectors and
other discrete components. It offers Auto routing and manual routing options to the PCB Designer. The
schematic drawn in the ISIS can be directly transferred ARES.

Starting New Design

Step 2: A dialogue box appears to save the current design. However, we are creating a new design file so you
can click Yes or No depending on the content of the present file. Then a Pop-Up appears asking to select the
template. It is similar to selecting the paper size while printing. For now select default or according to the
layout size of the circuit.
Step 3: An untitled design sheet will be opened, save it according to your wish,it is better to create a new folder
for every layout as it generates other files supporting your design. However,it is not mandatory.
Step 4:To Select components, Click on the component mode button.

Component Mode

Step 5: Click On Pick from Libraries. It shows the categories of components available and a search option to
enter the part name.
Steps :
1. Open Proteus ISIS Schematic Capture
2. Select the Component Mode from the left Toolbar

3. Click On P (Pick From Libraries)

4. Add all the required components

5. Place the components on the workspace

6. Wire up the circuit

7. Click on Play Button on the bottom left to start simulation

LAB VIEW
LabVIEW stands for Laboratory Virtual Instrument Engineering Workbench, which is the innovation
software product by NATIONAL INSTRUMENTS. LabVIEW has become the most widely used, fastest
growing and most powerful integrated graphical software development environment.
LabVIEW is a fast and efficient graphical development environment with simple programming and
particularly suitable for data acquisition and control, data analysis, and data presentation. LabVIEW has rich
graphical interface which allows the users easily produce a variety of graphical interface.

LabVIEW’s programming method is different from the traditional programming methods, which gets
rid of the linear structure problems of traditional language. LabVIEW’s execution order is determined by the
data stream, rather than in the order of appearance of lines of code, so it can design a flow chart of simultaneous
execution of multiple programs. In the human-computer interface design, the users could select the desired
control and data display objects from the control template.
In LabVIEW, virtual instrument consists of the front panel and block-diagram. The front panel
corresponds to the instrument control panel which is a graphical user interface for viewing the main input and
output. The user’s inputs are achieved by the input controls and the completions of the outputs are achieved by
the output indicator. The buttons’ panel, parameter inputs are completed by the mouse and keyboard.
Operating template is a necessary tool for the formation of the front panel and block diagram. LabVIEW
has a plurality of graphical user templates for creating and running programs. These templates are freely move
around the screen, and be placed anywhere on the screen. There are three types of manipulating templates:
Tools template, Controls template and Functions template, as shown in Figure 2 respectively.

History of LabVIEW

LabVIEW was first launched 1986 as a tool for scientists and engineers to facilitate automated measurements -
the aim was that it would be a tool that would be as productive for scientists and engineers as spreadsheets were
for financial analysts.

Says Jeff Kodowsky of National Instruments who came up with the initial idea and developed it: ”We weren’t
seeking to create a language but that’s what we ended up doing because we needed that level of flexibility and
control in order to deal with the kinds of IO and processing required.”

In addition to this, Kodowsky had been using an early Apple Mac which utilised graphics more than any other
computing system. Kodowsky wanted to be able to utilise this capability to enable quicker programming of the
control for instruments.
LabVIEW key concepts

Within LabVIEW there are several elements and concepts that are key to the format and operation of the
environment. These include:

 LabVIEW environment: The LabVIEW environment consists of LabVIEW VI manager (project


explorer), the programming tools, debugging features, templates and ready built sample examples, and an
easy interface to the hardware drivers. Read more about LabVIEW environment.
 LabVIEW VI’s: The Lab VIEW VI is a “Virtual Instrument” that enables a user interface to be built
and it contains the programming code. Read more about Lab VIEW Virtual Instruments, VI’s.
 LabVIEW programming: This is the graphical programming language where the functional
algorithms are built using “drag and drop” techniques. Read more about LabVIEW programming.
 LabVIEW dataflow: This is the core concept that determines the running order for the programming.
LabVIEW Applications

LabVIEW provides a powerful platform for undertaking a wide variety of different applications. It
started as an environment for managing test programming, but since its inception, the applications for which it
can be used have considerably expanded. It has expanded from being a graphical test management language to
become a graphical system design environment.

This means that it can be used for an enormous variety of interesting and diverse applications. Not only
can it be used for equipment control (including the control of the large Hadron Collider at CERN) and a variety
of data acquisition applications (including car development simulation where Big Data monitoring is
undertaken) to the system design arena where it has been used for development of projects from RF circuitry to
biomedical equipment, green technology and much more.

 Wind turbine monitoring


 Oil and gas pressure monitoring

 Power quality monitoring

 Machine control monitoring

 Commercial and industrial robotics

 Customized control and measurement

 Machine condition monitoring

 Data acquisition

 Signal processing

 Instrumentation control

 Aerospace and transportation systems control and monitoring

 Embedded systems testing

 Device and component prototyping

 Industrial automation

 Weather monitoring and warning systems

 UI design for instrumentation


 Industrial and commercial result/output generation systems

The Programming

 Using LabVIEW is deceptively easy in the beginning since it just involves connections and components,
but once you dig deep, it gets much more complex. What’s even more interesting is that LabVIEW also
lets you create user interfaces in the programming cycle, eliminating the need of making the code or
function more ‘user friendly’. So how does it work? Here’s a lowdown.
 First of all, LabVIEW programs are called ‘virtual instruments’ or Vis, even the file extension is .vi.
Once you open it up and start a new project, you get two windows, namely, the front panel and block
diagram. Both of these windows are used simultaneously to create your functions/programs. The front
panel has components called ‘controls’ and ‘indicators’. The former refers to inputs, while the latter
refers to outputs. There’s multiple forms and types, so depending on application, you can use any one, or
multiple, for that matter!

LabVIEW Advantages / Disadvantages

Like any product or platform, LabVIEW has its advantages and disadvantages. These must be carefully
considered before starting its use.
LabVIEW Advantages

 Graphical interface is flexible and simple to use. Most engineers and scientists can learn to use it
quickly.

 LabVIEW provides a universal platform for numerous applications in diverse fields.

 LabVIEW can be used with 3rd party hardware: it can be interfaced with C/C++, VB, Fortran etc etc.

 Easy to interface to many hardware items like data acquisition and test equipment products.

 It has excellent customer support and a large active community forum.

LabVIEW Disadvantages

 LabVIEW is single sourced and some companies may not like to use a product that is single sourced and
not standardised by the industry.

 Cost of ownership – although in line with many other industry products of a similar nature, its cost
should be considered before it is introduced.

 For those more accustomed to text programming, graphical programming can take a little familiarisation
time.
CHAPTER 5
PROJECT CODE
CHAPTER 6
PROJECT RESULT
CHAPTER 7
PROJECT APPLICATIONS AND ADVANTAGES
CHAPTER 8
CONCLUSION AND FUTURE SCOPE
BTS 7960
Product Summary

The BTS 7960 is a fully integrated high current half bridge for motor drive applications. It is part of the
NovalithICTM family containing one p-channel highside MOSFET and one n-channel lowside MOSFET with
an integrated driver IC in one package. Due to the p-channel high side switch the need for a charge pump is
eliminated thus minimizing EMI. Interfacing to a microcontroller is made easy by the integrated driver IC
which features logic level inputs, diagnosis with current sense, slew rate adjustment, dead time generation and
protection against over temperature, overvoltage, under voltage, over current and short circuit. The BTS 7960
provides a cost optimized solution for protected high current PWM motor drives with very low board space
consumption.
Basic Features

• Path resistance of typ. 16 mΩ @ 25 °C

• Low quiescent current of typ. 7 µA @ 25 °C

• PWM capability of up to 25 kHz combined with active freewheeling

• Switched mode current limitation for reduced power dissipation in overcurrent

• Current limitation level of 43 A typ.

• Status flag diagnosis with current sense capability

• Over temperature shut down with latch behavior

• Overvoltage lock out

• Undervoltage shut down

• Driver circuit with logic level inputs

• Adjustable slew rates for optimized EMI

Overview

The BTS 7960 is part of the NovalithIC

 family containing three separate chips in one package: One p-channel highside MOSFET and one n-channel
lowside MOSFET together with a driver IC, forming a fully integrated high current half-bridge. All three chips
are mounted on one common leadframe, using the chip on chip and chip by chip technology. The power
switches utilize vertical MOS technologies to ensure optimum on state resistance. Due to the p-channel highside
switch the need for a charge pump is eliminated thus minimizing EMI. Interfacing to a microcontroller is made
easy by the integrated driver IC which features logic level inputs, diagnosis with current sense, slew rate
adjustment, dead time generation and protection against overtemperature, overvoltage, undervoltage,
overcurrent and short circuit. The BTS 7960 can be combined with other BTS 7960 to form H-bridge and 3-
phase drive configurations.

Vous aimerez peut-être aussi