Professional Documents
Culture Documents
Major
Major
CHAPTER3
INTRODUCTION TO ARDUINO
3.1 SYSTEM
A system is a way of functioning, assembling or doing one or many tasks according to a
predetermined plan, program, or set of regulations. A system is also an arrangement in which all
its units connect and work together according to the plan or prearranged rules.
Consider a watch. It is a time-example system. Its parts are its hardware, needles and
battery with the alluring dial, frame and belt. These parts organize to show the real time every
second and continuously update the time every second.
An embedded system is a system that has three main components embedded into it:
1. It embeds hardware identical to a computer. Figure 3.1 shows the sections in the
hardware of an embedded system. As its software normally embeds in the ROM or flash
memory, it usually does not need a secondary hard disk or a CD memory as in a computer.
2. It embeds main application software. The application software may coincidently perform a
sequence of functions or processes or quests.
3. It embeds a real-time operating system [RTOS] that direct the application software running
on hardware and give standardize access to a resource according to the priorities of functions
in the system. It provides a procedure to let the processor run a process as programmable and
position-switch between the various processes.
Languages used in embedded systems are assembly language, embedded C language,
embedded java language.
Embedded systems are classified into three types
1. Small scale embedded systems.
2. Medium scale embedded systems.
The figure 3.2 shows about the embedded system architecture in which the operating
software is embedded in hardware.
An expansion of the embedded systems architectural structures is used to introduce the technical
concepts and fundamentals of an embedded device. The architecture of embedded systems shows
that all of them have a minimum one layer or all layers into which all the supplements fall. The
hardware layer consists of all the physical units placed on an embedded board. For small
appliances such as remote control units, air conditioners, toys etc., there is no need for an
operating system and you can write only the software specific to that application.
The layered approach allows readers to understand the parts of an embedded system and their
relationship internally. The hardware will acts like a base around the microprocessor or
microcontroller. The embedded system software is to do a particular task.
Now, let us see the details of the various building sections of the hardware of an embedded
system. As shown in Figure 3.3 the building sections are:
3. Input Devices.
4. Output devices.
5. Communication interfaces.
6. Application-specific circuitry.
The figure 3.3 shows the hardware architecture of the embedded system with input, outputs and
communication interferences. The CPU acts as an interface between input and the output
devices. It also consists of RAM and ROM memories, which will store the temporary and
permanent data respectively. Communication system acts as an interface between CPU and the
other systems. Application specific systems, they are the one that are used for special purposes
like water level sensor.
The Central Processing unit or simply it can be called as a processor which is used in an
embedded system can be a microcontroller, microprocessor or DSP. A micro-controller is a low- cost
processor. Its appeal is that it is the chip itself, and addition to it there will be many other units such as
memory, serial communication interface, ADC etc
For small operations, a micro-controller is best as the number of external units required is less.
On the other hand, microprocessors are very powerful, but many external components must be
used along with them. DSP is used mainly for applications in which signal processing is involved
such as audio, video and image processing.
3.3.2Memory
According to the storage type, the memories are classified as two types. They are
Random Access Memory (RAM) and Read Only Memory (ROM). If the power is switched off
to the chip the contents in the RAM will get erased. Whereas in the ROM the contents of the
memory will never be erase even if the power is switched off to the chip. The processor reads the
information from the ROM when the power is switched on again, then the program can be
executed.
3.3.3Input devices
Contrary to the desktops, the input devices in an embedded system have very limited
effectiveness. As there is neither keyboard nor a mouse, and hence collaborating with the
embedded system is not an easy task for a user. Several embedded systems will have a small
keypad when you press one key it gives a specialized command. A keypad may be used as input
for the display of digits, alphabets. As there is no input connection directly to the system, thus the
hardware in the embedded systems takes inputs from the sensors or transducers and produce
electrical signals that in turn fed to the other systems.
3.3.4Output devices
As like the input devices the output devices of the embedded systems are also having
very limited effectiveness. A few embedded systems will have a Light Emitting Diodes (LEDs)
to represent the current status of the system, or for optical expression of alarms. A small Liquid
Crystal Display (LCD) may also be used as an important parameter in the displaying the elements
3.3.5Communication interfaces
The embedded systems must interact with the other embedded systems as they have to
transmit data from one desktop to other desktop. To simplify this problem, the embedded
systems are provided with some communication interfaces like Serial Peripheral Interface (SPI),
RS232, RS422, RS485, Universal Serial Bus (USB), IEEE 1394 and Ethernet to access with the
other desktop or users.
Sensors, transducers, special processing and control circuitry may be required for an
embedded system, depending on its application. This circuitry interacts with the processor to
carry out the necessary work. The entire hardware has to be given power supply either through
the 230 volts main supply or through a battery’
The figure 3.4 shows the application specific circuits of an embedded system. It consists of
wireless as well as wired communication networks. Even ADC, Lasers, Signal conditioners are
also the components of application specific circuitry of an embedded systems .Embedded
Systems plays a key role in our life. They are used as household appliances in microwave oven,
as well as in satellite applications
The Arduino Uno is microcontroller board based on the ATmega328. It has 14digital pins, 6
analog pins, a 16 MHZ crystal oscillator, 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.
it features the ATmega8U2 programmed as a USB-to-serial converter.
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 version of Arduino, moving forward. The Uno is the
latest in a series of USB Arduino boards, and the reference for the Arduino platform.
3.5TECHNICAL SPECIFICATION
Microcontroller ATmega328
Operating Voltage 5V
Input Voltage 7-12V
Digital I/O pins 14
Analog input pins 6
DC Current per I/O pins 40mA
DC Current for 3.3V pin 50mA
Flash Memory 32KB of which 0.5 KB used by
bootloader
SRAM 2KB
EEPROM 1KB
Clock speed 16MHZ
3.6POWER
The Arduino Uno powered via the USB connection or with an external power supply. The
power source is selected automatically.
External power can come either from an AC-to-DC adapter 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 interested 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 12V, the voltage regulator may overheat and damage the board. The recommended
range is 7 to 12volts.
VIN. The input voltage to the Arduino board when it’s using an external power source.
we can supply voltage via the power jack, access it through this pin.
5V. the regulated power supply used to power the microcontroller and other components
on board. This can come either from Vin via an on-board regulator, or be supplied by
USB or another regulated 5V supply.
3.3V. A 3.3 volt supply generated by the on-board regulator. Maximum current draw is
50mA.
GND. Ground pins
3.7MEMORY
The ATmega328 has 32KB of flash memory for storing code. It has also 2KB of SRAM
and 1KB of EEPROM
3.8INPUT AND OUTPUT
Each of the 14 digital pins on the Uno can be used as an input or output, using pinmode(),
digitalWrite(), and digitalRead() functions. They operate at 5 volts. Each pin can provide or
receive a maximum if 40mA and has an internal pull-up resistor of 20-50 kOhms.some pins have
specialized functions.
Serial: 0(RX) AND 1(TX). Used to receive (RX) and transmit(TX) TTL serial data.
these pins are connected to the corresponding pins of the ATmega328 USB-to-TTL Serial
chip.
External interrupts: 2 and 3. these pins can be configured to trigger an interrupt on
allow value, a rising or falling edge or a change in the value.
PWM.3, 5, 6, 9, 10 and 11. Provide 8-bit PWM output with the analogWrite() function
SPI: 10 (SS), 11(MOSI), 12(MISO), 13(SCK). These pins support SPI communication,
which, although provided by underlying hardware, is not currently included in the
Arduino language.
LED: 13.There is a built-in LED connected to digital pin 13. When the pin is HIGH
value, the LED is on, When the pin is LOW, it’s off.
The Uno has 6 analog inputs, each of which provide 10 bits of resolution. By default the
measure from ground to 5 volts, through is it possible to change the upper end of their range
using the AREF pin. Additionally some pins have specialized functionality.
I2C: 4 (SDA) and 5 (SCL). Support I2C (TWI) communication using the wire library
CHAPTER4
MODULES AND COMPONENTS
4.1RF TRANSMITTER AND RECEIVER MODULE
This radio frequency (RF) transmission system employs Amplitude Shift Keying (ASK)
with transmitter/receiver (Tx/Rx) pair operating at 434KHZ. The transmitter module take serial
input and transmits these signal through RF. The transmitter signals are received by receiver
module placed away from the source of transmission
The system allows one way of communication between two nodes, namely, transmission
and reception. The RF module has been used in conjunction with a set of four channel
encoder/decoder ICs. Here HT12E & HT12D have been used as encoder and decoder
respectively. The encoder converts the parallel inputs into serial set of signals. These signals are
serially transferred through RF to the reception point. The decoder is used after the RF receiver
to decode the serial format and receive the original signals as outputs. These outputs can be
observed on corresponding LEDs.
Encoder IC (HT12E) receives parallel data in the form of address bits and control bits.
The control signals from remote switches along with 8 address bits constitute a set of 12 parallel
signals. The encoder HT12E encodes these parallel signals into serial bits. Transmission is
enable by providing ground to pin 14 which is active low. The control signals are given at pins
10-13 of HT12E. the serial data is fed to the RF transmitter through pin 17 of HT12E.
Transmitter, upon receiving serial data from encoder IC (HT12E), transmits it wirelessly
to the RF receiver. The receiver, upon receiving these signals, sends them to the decoder
IC(HT12D) through pin2. The serial data is received at the data pin (DIN, pin14) of HT12D. The
decoder then retrieves the original parallel format from the received serial data.
When no signal is received at data pin of HT12D, it remains in standby mode and
consumes very less current for a voltage of 5V. When signal is received by receiver, it is given to
DIN pin(pin14) of HT12D. on reception of signal, oscillator of HT12D gets activated. IC
HT12D, then decodes the serial data and checks the address bits three times. If these bits match
with the local address pins (pins 1-8) of HT12D, then it puts the data bits on its data pins (pin 10-
13) and makes the VT pin high. An LED is connected to VT pin (pin17) of the decoder. This
LED works as an indicator to indicate a valid transmission. The corresponding output is thus
generated at the data pins of decoder IC.
A signal is sent by lowering any or all the pins 10-13 of HT12E and corresponding signal
is received at receiver’s end. Address bits are configured by using the first 8 pins of both encoder
and decoder ICs. To send a particular signal, address bits be same at encoder and decoder Ics. By
configuring the address bits properly, a single RF transmitter can also be used to control different
RF receivers of same frequency.
To summarize, on each transmission, 12 bits of data is transmitted consisting of 8 address
bits and 4 data bits. The signal is received at receiver’s end which is then fed into used to drive
the LEDs. The outputs from this system can either be used in negative logic or NOT gates can be
incorporated at data pins.
4.1.1HT12D DECODER
Figure4.5HT12D Decoder
HT12D IC comes from HolTek company. HT12D is a decoder integrated circuit that
belongs to 2 series of decoders. This series of decoders are mainly used for remote control
system applications, like burglar alarm, car door controller, security system etc. it is mainly
provided to interface RF and infrared circuits. They are paired with 2 series of encoders. The
chosen pair of encoder/decoder should have same number of address and data format.
In simple terms, HT12D converts the serial input into outputs. It decodes the serial
address and data received by, say, an RF receiver, into parallel data and sends them to output
data pins. The serial input data is compared with the local address three times continuously. The
input data code is decoded when no error or unmatched codes are found. A valid transmission in
indicated by a high signal at VT pin.
HT12D is capable of decoding 12 bits, of which 8 are address bits and 4 are data bits. The
data on 4bits latch type output pins remain unchanged until new is received.
4.1.2HT12E ENCODER
figure4.7HT12E Encoder
HT12E is an encoder integrated circuit of 212 series of encoders. They are paired with
212 series of decoders for use in remote control system applications. It is mainly used in
interfacing RF and infrared circuits. The chosen pair of encoder/decoder should have same
number of addresses and data format.
Simply put, HT12E converts the parallel inputs into serial output. It encodes the 12 bit
parallel data into serial for transmission through an RF transmitter. These 12 bits are divided into
8 address bits and 4 data bits.
HT12E has a transmission enable pin which is active low. When a trigger signal is
received on TE pin, the programmed addresses/data are transmitted together with the header bits
via an RF or an infrared transmission medium. HT12E begins a 4-word transmission cycle upon
receipt of a transmission enable. This cycle is repeated as long as TE is kept low. As soon as TE
returns to high, the encoder output completes its final cycle and then stops.
Figure4.9RFmodules
The RF module, as the name suggests, operates at Radio Frequency. The corresponding
frequency range varies between 30 kHz & 300 GHz. In this RF system, the digital data is
represented as variations in the amplitude of carrier wave. This kind of modulation is known as
Amplitude Shift Keying (ASK).
Transmission through RF is better than IR (infrared) because of many reasons. Firstly,
signals through RF can travel through larger distances making it suitable for long range
applications. Also, while IR mostly operates in line-of-sight mode, RF signals can travel even
when there is an obstruction between transmitter & receiver. Next, RF transmission is more
strong and reliable than IR transmission. RF communication uses a specific frequency unlike IR
signals which are affected by other IR emitting sources.
This RF module comprises of an RF Transmitter and an RF Receiver. The
transmitter/receiver (Tx/Rx) pair operates at a frequency of 434MHz. An RF transmitter receives
serial data and transmits it wirelessly through RF through its antenna connected at pin4. The
transmission occurs at the rate of 1Kbps - 10Kbps.The transmitted data is received by an RF
receiver operating at the same frequency as that of the transmitter.
The RF module is often used along with a pair of encoder/decoder. The encoder is used
for encoding parallel data for transmission feed while reception is decoded by a decoder.
HT12E-HT12D, HT640-HT648, etc. are some commonly used encoder/decoder pair ICs.
If you want change record duration, an external resistor is necessary to select the record
duration and sampling frequency, which can range from 8 – 20 seconds (4‐12kHz sampling
frequency). The Voice Record Module of our provide default connect 100k resistor by short cap.
So the default record duration is 10s.
5. PLAYL – Playback, Level‐activated, when this input pin level transits for LOW to HIGH, a
playback cycle is initiated.
6. Speaker Outputs – The SP+ and SP‐ pins provide direct drive for loudspeakers with
impedances as low as 8Ω.
7. MIC – Microphone Input, the microphone input transfers its signals to the on‐chip
preamplifier.
8. FT – Feed Through: This mode enable the Microphone to drive the speaker directly.
9. P‐E – Play the records endlessly.
Record Operate Guide
1. Push REC button then the RECLED will light and keep push until record end.
2. Release the REC button
3. Select Playback mode: PLAYE, just need push one time, and will playback all of the record or
power down ; PLAYL, you need always push this button until you want to stop playback record
or end ; When short P‐E jumper the record will playback time a time until jumper off or power
down
4. FT mode, when short FT jumper, that means all of you speak to MIC will direct playback to
Speaker.
4.3.3POWER AMPLIFIER
If you want extern power amplifier circuit to Speakers, you can use LM386, D2283,
D2322, TA7368, MC34119 etc amplifier IC. Note, SP+ or SP‐ is you do not want to use, must
vacant, do not connect to GND. Used LM386 power amplifier circuit as