You are on page 1of 57

CHAPTER 1

INTRODUCTION
1.1 OVERVIEW
The project aims at designing a LED based scrolling message display controlled by
GSM technology and message are received from a mobile phone. The proposed
system makes use of GSM and Bluetooth technology to communicate from mobile
phone to GSM modem and Bluetooth device to android app on android phone. This
project is to develop an embedded system, which is used for spontaneous
advertisement using LED’s by using GSM and android Bluetooth module. Now a
day’s every advertisement or information is displayed digitally. The big shops and
shopping centers are using the digital moving/scrolling displays now. In railway
station, bus stands everything that is ticket information, platform number etc is
displaying in digital moving display. But in these displays if they wants to change the
message they can send message through using a register mobile number. If they want
to display messages about something crucial within minimum time, it displays
whatever wants. LED displays are used in variety of applications, like store signs,
billboards and many more. In recent years it is commonly used in destination signs on
public transport vehicles. LED panels are also used for the purpose of general
illumination, task lighting and for stage lighting. Display systems are classified into
single line displays, and multiline displays. A standard LED display board consists of
led lights arranged in 4 sets of 8 rows x 8 columns of dot-matrix display of common
cathode, with the length of character is 8x8. Displays boards of any length and
breadth can be made by combining more than one of these standard units. These
display units are capable of displaying messages of any kind, including alphanumeric,
numbers etc., in static or scrolling formats. This system is comprised of a red colour
matrix display panel. It also includes an executive program that runs on the
ARDUINO UNO ATmega328P microcontroller for the display control of data
information on the display board. Led provides several advantages over traditional
light bulbs, such as small size and longer life. A red colour led can be used to
advertise even day-light conditions. The led display board displays images and
messages entered by using a microcontroller. The LED display board is very efficient
and cost effective way to spread messages to thousands of people, without any
personal contact or door to door sales.

1
1.2 OBJECTIVE OF THE PROJECT
To design a wireless board that displays messages sent from registered mobile number
using GSM technology and enable the voice using Bluetooth technology.
1.3 EXISTING AND PROPOSED SYSTEM
1.3.1 EXISTING SYSTEM
Previously the system is used to design with wireless communication system such as
RF which requires more complicated hardware and user need to stay at one place to
give scrolling data. The design looks bulky in size and also ambiance of LED board is
less. The size of board and other hardware design requires more space.
1.3.2 PROPOSED SYSTEM
The proposed system is designed to avoid the existing system. With the help of this
we can send the data/text without any errors. The proposed system requires less
hardware structure compared to the existing system. The dot-matrix LED board
appears smaller in size and easy carry and install but high efficient and effective
luminous will be provided and power consumptions is highly reduced by these display
board. The proposed system is comprised of ARDUINO UNO board, 64x8 Dot matrix
LED display, GSM modem, HC-05 Bluetooth device.
1.4. BLOCK DIAGRAM

GSM MAX7219
Modem
ARDUINO 8x64 Dot matrix
UNO Scroll Board
RPS ATmega328P

Fig.1.1 General Block Diagram of LED scrolling display


Bluetooth

1.5 COMPONENTS AND TOOLS USED


15.1. HARDWARE TOOLS
 ARDUINO UNO ATmega328 is electronic circuits that can be programmed to
carry out a vast range of tasks. They can be programmed to be timers or to
control a production line and much more.
 GSM modem of SIM800 type is used which are triband modem. It functions
with ‘AT’ commands.

2
 BLUETOOTH Rx is a specialized type of module which has band width of
2.4GHz with 3MBPS modulation data rate. This module can cover the of
100meters/328ft for wireless applications.
 8x8 DOT-MATRIX LED Scrolling board display of 8 rows x 8 column of 8
blocks are used. So it is a 8x64 size display board. The board scrolls the
characters of alphanumeric, punctuations, images as per ASCII code set.
 MAX7219 are compact, serial input/output common-cathode display drivers
that interface microprocessors (μPs) to 7-segment numeric LED displays of up
to 8 digits, bar-graph displays, or 64 individual LEDs. Included on-chip are a
BCD code-B decoder, multiplex scan circuitry, segment and digit drivers, and
an 8x8 static RAM that stores each digit

1.5.2. SOFTWARE TOOLS


 ARDUINO software IDE 1.0 is used. "Uno" means one in Italian and was
chosen to mark the release of Arduino Software (IDE) 1.0. The Uno board and
version 1.0 of Arduino Software (IDE) were the reference versions of Arduino,
now evolved to newer releases. The Uno board is the first in a series of USB
Arduino boards, and the reference model for the Arduino platform; for an
extensive list of current, past or outdated boards
 Proteus VSM is a digital simulation and circuit design tool. It provides the
plat form for circuit layout, circuit design and real time simulation.
 Arduino software is the tool to burn the .hex file on the chip.

CHAPTER 2
TECHNOLOGY
2.1 GSM
2.1.1 GSM OVERVIEW
Global System for Mobile Communications (GSM) is a standard developed by the
European Telecommunications Standards Institute(ETSI) to describe protocols for
second generation(2G) digital cellular networks use by mobile phones. It is the default
global standard for mobile communication with over 90% global market and is
available in over 219 countries and territories. This ubiquity means that subscribers

3
can use their phones throughout the world, enabled by international roaming
arrangements between mobile network operators. GSM differs from its predecessor
technologies in that both signaling and speech channels are digital. This also
facilitates the wide-spread implementation of data communication applications into
the system. The GSM standard has been an advantage to both consumers, who
may benefit from the ability to roam and switch carriers without replacing phones,
and also to network operators, who can choose equipment from many GSM
equipment vendors. GSM also pioneered low-cost implementation of the short
message service (SMS), also called text messaging, which has since been supported
on other mobile phone standards as well.
2.1.2 GSM SPECIFICATIONS
Frequency: 900 MHz or 1800 MHz (Some countries in the Americas including
Canada and the United States use the 850 MHz and 1900 MHz bands, 400 and
450 MHz frequency bands are assigned in some countries, notably Scandinavia)
Modulation: Modulation is a form of change process where we change the
input information into a suitable format for the transmission medium. We also
changed the information by demodulating the signal at the receiving end. The GSM
uses Gaussian Minimum Shift Keying (GMSK) modulation method.
Access Methods: Because radio spectrum is a limited resource shared by all users, a
method must be devised to divide up the bandwidth among as many users as
possible.GSM chose a combination of TDMA/FDMA as its method. The FDMA part
involves the division by frequency of the total 25 MHz bandwidth into 124 carrier
frequencies of 200 kHz bandwidth. One or more carrier frequencies are then
assigned to each BS. Each of these carrier frequencies is then divided in time,
using a TDMA scheme, into eight time slots. One time slot is used for
transmission by the mobile and one for reception. They are separated in time
so that the mobile unit does not receive and transmit at the same time.
Transmission Rate: The total symbol rate for GSM at 1 bit per symbol in GMSK
produces270.833 K symbols/second. The gross transmission rate of the time slot is
22.8 Kbps.
Frequency Band: The uplink frequency range specified for GSM is 933 - 960 MHz
(basic 900 MHz band only). The downlink frequency band 890 - 915 MHz (basic 900
MHz band only).
Channel Spacing: This indicates separation between adjacent carrier frequencies. In
GSM, this is 200 kHz.

4
Speech Coding: GSM uses linear predictive coding (LPC). The purpose of LPC is to
reduce the bit rate. The LPC provides parameters for a filter that mimics the vocal
tract. The signal passes through this filter, leaving behind a residual signal. Speech is
encoded at 13 kbps.
Duplex Distance: The duplex distance is 80 MHz Duplex distance is the distance
between the uplink and downlink frequencies. A channel has two frequencies, 80
MHz apart.
2.1.3 GSM MODEM
GSM modem is a specialized type of modem which accepts a SIM card, and
operates over a subscription to a mobile operator, just like a mobile phone.
From the mobile operator perspective, a GSM modem looks just like a mobile phone.
A wireless modem behaves like a dial-up modem. The main difference between them
is that a dial-up modem sends and receives data through a fixed telephone line while a
wireless modem sends and receives data through radio waves.
A GSM modem can be an external device or a PC Card / PCMCIA Card.
Typically, an external GSM modem is connected to a computer through a serial
cable or a USB cable. A GSM modem in the form of a PC Card / PCMCIA
Card is designed for use with a laptop computer. It should be inserted into one of
the PC Card / PCMCIA Card slots of a laptop computer. Like a GSM mobile phone,
a GSM modem requires a SIM card from a wireless carrier in order to operate.
Both GSM modems and dial-up modems support a common set of standard AT
commands. You can use a GSM modem just like a dial-up modem.

Fig.2.1 GSM modem


2.1.4 ARCHITECTURE
OF THE GSM NETWORK
In a GSM network, the user terminal is called a mobile station. A mobile station is
made up of a SIM (Subscriber Identity Module) card allowing the user to be uniquely
identified and a mobile terminal.
The terminals (devices) are identified by a unique 15-digit identification number
called IMEI (International Mobile Equipment Identity). Each SIM card also has a

5
unique (and secret) identification number called IMSI (International Mobile
Subscriber Identity). This code can be protected using a 4-digit key called a PIN code.
The SIM card therefore allows each user to be identified independently of the
terminal used during communication with a base station. Communications occur
through a radio link (air interface) between a mobile station and a base station.

Fig.2.2 GSM Architecture

All the base stations of a cellular network are connected to a base station
controller (BSC) which is responsible for managing distribution of the resources. The
system consisting of the base station controller and its connected base stations is
called the Base Station Subsystem (BSS).Finally, the base station controllers are
themselves physically connected to the Mobile Switching Centre (MSC), managed by
the telephone network operator, which connects them to the public telephone network
and the Internet. The MSC belongs to a Network Station Subsystem (NSS), which is
responsible for managing user identities, their location and establishment of
communications with other subscribers. The MSC is generally connected to databases
that provide additional functions:
 The Home Location Register (HLR) is a database containing information
(geographic position, administrative information etc.) of the subscribers
registered in the area of the switch (MSC).
 The Visitor Location Register (VLR) is a database containing information of
users other than the local subscribers. The VLR retrieves the data of a new user
from the HLR of the user's subscriber zone. The data is maintained as long as
the user is in the zone and is deleted when the user leaves or after a long period
of inactivity (terminal off).

6
 The Equipment Identify Register (EIR) is a database listing the mobile
terminals.
 The Authentication Centre (AUC) is responsible for verifying user identities.
 The cellular network formed in this way is designed to support mobility via
management of handovers (movements from one cell to another).

2.1.5 INTRODUCTION TO AT COMMANDS

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


Attention. Every command line starts with "AT" or "at". That's the reason, modem
commands are called AT commands. Many of the commands that are used to control
wired dial-up modems.

COMMANDS DESCRIPTION
A/ Re-Issue Last AT Command
ATA Answer Incoming Call
ATH Disconnect Existing Connection
AT+CMGD Delete SMS Message
AT+CMGF Select Message Format
AT+CMGL List of SMS Message
AT+CMGR Read the SMS Message
AT+CMGS Send SMS Message
AT+CNMI How Modem Will Response When A SMS is Recieved
AT+CPIN? To Check SIM is Ready
AT+CREG? Network Register

Tabel.2.1 AT Commands

7
Fig: Interfacing GSM modem with ARDUINO UNO

2.2. BLUETOOTH MODULE (HC-05)


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.

Fig 2.2. Physical component of HC-05 (Bluetooth Rx Module)

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

8
 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.
PINOUT
PIN Name PIN No Pad Type Description
GND 13, 21, 22 Vss Ground pot
3.3 VCC 12 3.3v Integrated 3.3v(+) supply with
on-chip regulator output
within 3.15-3.3v
AIO0 9 Bi-Directional Programmable i/o line
AIO1 10 Bi-Directional Programmable i/o line
PIO0 23 Bi-Directional RX Programmable i/o line, control
EN o/p for LNA
PIO1 24 Bi-Directional TX Programmable i/o line, control
EN o/p for PA
PIO2 25 Bi-Directional Programmable input line
PIO3 26 Bi-Directional Programmable input line
PIO4 27 Bi-Directional Programmable input line
PIO5 28 Bi-Directional Programmable input line
PIO6 29 Bi-Directional Programmable input line
PIO7 30 Bi-Directional Programmable input line
PIO8 31 Bi-Directional Programmable input line
PIO9 32 Bi-Directional Programmable input line
PIO10 33 Bi-Directional Programmable input line
PIO11 34 Bi-Directional Programmable input line
RESETB 11 CMOS input with Reset if low input debouncde
weak internal so must be low for>5MS to
pull-up cause a reset
UART-RTS 4 CMOS Output, UART Request to send, active
tristable with

9
weak internal low
pull-up
UART-CTS 3 CMOS input with UART clear to send, active
weak internal
low
pull-down
UART-RX 2 CMOS input with UART data input
weak internal
pull-down
UART-TX 1 CMOS Output, UART data output
tri-stable with
weak internal
pull-up
SPI MOSI 17 CMOS input with Serial Peripheral Interface data
weak internal
input
pull-down
SPI CSB 16 CMOS input with Chip select for SPI, active low
weak internal
pull-up
SPI CSK 19 CMOS input with Serial Peripheral Interface
weak internal
clock
pull-down
SPI MISO 18 CMOS input with Serial Peripheral Interface data
weak internal
output
pull-down
USB - 15 Bi directional
USB + 20 Bi directional
NC 14
PCM CLK 5 Bi directional Synchronous PCM data clock
PCM OUT 6 CMOS output Synchronous PCM data output
PCM IN 7 CMOS input Synchronous PCM data input
PCM SYNC 8 Bi directional Synchronous PCM data strobe

Table 2.1 Bluecore chip pin description


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).

10
AT commands: (all end with \r\n)

CHAPTER 3
HARDWARE MODULES

3.1. ARDUINO UNO (ATMEGA 328)

Fig 3.1. Physical component of ARDUINO UNO


3.1.1. Features
11
• High Performance, Low Power AVR® 8-Bit Microcontroller
• Advanced RISC Architecture
– 131 Powerful Instructions – Most Single Clock Cycle Execution
– 32 x 8 General Purpose Working Registers
– Fully Static Operation
– Up to 20 MIPS Throughput at 20 MHz
– On-chip 2-cycle Multiplier
• High Endurance Non-volatile Memory Segments
– 4/8/16/32K Bytes of In-System Self-Programmable Flash program memory
(ATmega48PA/88PA/168PA/328P)
– 256/512/512/1K Bytes EEPROM (ATmega48PA/88PA/168PA/328P)
– 512/1K/1K/2K Bytes Internal SRAM (ATmega48PA/88PA/168PA/328P)
– Write/Erase Cycles: 10,000 Flash/100,000 EEPROM
– Data retention: 20 years at 85°C/100 years at 25°C
– Optional Boot Code Section with Independent Lock Bits
In-System Programming by On-chip Boot Program
True Read-While-Write Operation
– Programming Lock for Software Security
• Peripheral Features
– Two 8-bit Timer/Counters with Separate Prescaler and Compare Mode
– One 16-bit Timer/Counter with Separate Prescaler, Compare Mode, and
Capture Mode
– Real Time Counter with Separate Oscillator
– Six PWM Channels
– 8-channel 10-bit ADC in TQFP and QFN/MLF package
Temperature Measurement
– 6-channel 10-bit ADC in PDIP Package
Temperature Measurement
– Programmable Serial USART
– Master/Slave SPI Serial Interface
– Byte-oriented 2-wire Serial Interface (Philips I2C compatible)
– Programmable Watchdog Timer with Separate On-chip Oscillator
– On-chip Analog Comparator

12
– Interrupt and Wake-up on Pin Change
• Special Microcontroller Features
– Power-on Reset and Programmable Brown-out Detection
– Internal Calibrated Oscillator
– External and Internal Interrupt Sources
– Six Sleep Modes: Idle, ADC Noise Reduction, Power-save, Power-down,
Standby, and Extended Standby
• I/O and Packages
– 23 Programmable I/O Lines
– 28-pin PDIP, 32-lead TQFP, 28-pad QFN/MLF and 32-pad QFN/MLF
• Operating Voltage:
– 1.8 - 5.5V for ATmega48PA/88PA/168PA/328P
• Temperature Range:
– -40°C to 85°C
• Speed Grade:
– 0 - 20 MHz @ 1.8 - 5.5V
• Low Power Consumption at 1 MHz, 1.8V, 25°C for ATmega328P:
– Active Mode: 0.2 mA
– Power-down Mode: 0.1 μA
– Power-save Mode: 0.75 μA (Including 32 kHz RTC)

3.1.2. Pin-out (Atmega328 PDIP)


Fig 3.2 Pin-out of ATmega328P

13
3.1.3. Pin descriptions of Atmega328p (ARDUINO UNO)

3.1.3.1 VCC
Digital supply voltage.
3.1.3.2GND
Ground.
3.1.3.3 Port B (PB7:0) XTAL1/XTAL2/TOSC1/TOSC2
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. Depending on the clock selection fuse settings, PB6 can be
used as input to the inverting Oscillator amplifier and input to the internal clock
operating circuit. Depending on the clock selection fuse settings, PB7 can be
used as output from the inverting Oscillator amplifier. If the Internal Calibrated
RC Oscillator is used as chip clock source, PB7..6 is used as TOSC2..1 input for
the Asynchronous Timer/Counter2 if the AS2 bit in ASSR is set.
The various special features of Port B are elaborated in table

14
Table 3.1. Pin description of port B
The alternate pin configuration is as follows:
• XTAL2/TOSC2/PCINT7 – Port B, Bit 7
XTAL2: Chip clock Oscillator pin 2. Used as clock pin for crystal Oscillator or
Low-frequency crystal Oscillator. When used as a clock pin, the pin can not be
used as an I/O pin.
TOSC2: Timer Oscillator pin 2. Used only if internal calibrated RC Oscillator is
selected as chip clock source, and the asynchronous timer is enabled by the
correct setting in ASSR. When the AS2 bit in ASSR is set (one) and the EXCLK
bit is cleared (zero) to enable asynchronous clocking of Timer/Counter2 using
the Crystal Oscillator, pin PB7 is disconnected from the port, and becomes the
inverting output of the Oscillator amplifier. In this mode, a crystal Oscillator is
connected to this pin, and the pin cannot be used as an I/O pin.
PCINT7: Pin Change Interrupt source 7. The PB7 pin can serve as an external
interrupt source. If PB7 is used as a clock pin, DDB7, PORTB7 and PINB7 will
all read 0.
• XTAL1/TOSC1/PCINT6 – Port B, Bit 6
XTAL1: Chip clock Oscillator pin 1. Used for all chip clock sources except
internal calibrated RC Oscillator. When used as a clock pin, the pin can not be
used as an I/O pin.
TOSC1: Timer Oscillator pin 1. Used only if internal calibrated RC Oscillator is
selected as chip clock source, and the asynchronous timer is enabled by the
correct setting in ASSR. When the AS2 bit in ASSR is set (one) to enable
asynchronous clocking of Timer/Counter2, pin PB6 is disconnected from the
port, and becomes the input of the inverting Oscillator amplifier. In this mode, a
crystal Oscillator is connected to this pin, and the pin can not be used as an I/O
pin.
PCINT6: Pin Change Interrupt source 6. The PB6 pin can serve as an external
interrupt source. If PB6 is used as a clock pin, DDB6, PORTB6 and PINB6 will
all read 0.
• SCK/PCINT5 – Port B, Bit 5
SCK: Master Clock output, Slave Clock input pin for SPI channel. When the
SPI is enabled as a Slave, this pin is configured as an input regardless of the

15
setting of DDB5. When the SPI is enabled as a Master, the data direction of this
pin is controlled by DDB5. When the pin is forced by the SPI to be an input, the
pull-up can still be controlled by the PORTB5 bit.
PCINT5: Pin Change Interrupt source 5. The PB5 pin can serve as an external
interrupt source.

• MISO/PCINT4 – Port B, Bit 4


MISO: Master Data input, Slave Data output pin for SPI channel. When the SPI
is enabled as a Master, this pin is configured as an input regardless of the setting
of DDB4. When the SPI is enabled as a Slave, the data direction of this pin is
controlled by DDB4. When the pin is forced by the SPI to be an input, the pull-
up can still be controlled by the PORTB4 bit.
PCINT4: Pin Change Interrupt source 4. The PB4 pin can serve as an external
interrupt source.
• MOSI/OC2/PCINT3 – Port B, Bit 3
MOSI: SPI Master Data output, Slave Data input for SPI channel. When the SPI
is enabled as a Slave, this pin is configured as an input regardless of the setting
of DDB3. When the SPI is enabled as a Master, the data direction of this pin is
controlled by DDB3. When the pin is forced by the SPI to be an input, the pull-
up can still be controlled by the PORTB3 bit.
OC2, Output Compare Match Output: The PB3 pin can serve as an external
output for the Timer/Counter2 Compare Match. The PB3 pin has to be
configured as an output (DDB3 set (one)) to serve this function. The OC2 pin is
also the output pin for the PWM mode timer function.
PCINT3: Pin Change Interrupt source 3. The PB3 pin can serve as an external
interrupt source.
• SS/OC1B/PCINT2 – Port B, Bit 2
SS: Slave Select input. When the SPI is enabled as a Slave, this pin is
configured as an input regardless of the setting of DDB2. As a Slave, the SPI is
activated when this pin is driven low. When the SPI is enabled as a Master, the
data direction of this pin is controlled by DDB2. When the pin is forced by the
SPI to be an input, the pull-up can still be controlled by the PORTB2 bit.

16
OC1B, Output Compare Match output: The PB2 pin can serve as an external
output for the Timer/Counter1 Compare Match B. The PB2 pin has to be
configured as an output (DDB2 set (one)) to serve this function. The OC1B pin
is also the output pin for the PWM mode timer function.
PCINT2: Pin Change Interrupt source 2. The PB2 pin can serve as an external
interrupt source.

• OC1A/PCINT1 – Port B, Bit 1


OC1A, Output Compare Match output: The PB1 pin can serve as an external
output for the Timer/Counter1 Compare Match A. The PB1 pin has to be
configured as an output (DDB1 set (one)) to serve this function. The OC1A pin
is also the output pin for the PWM mode timer function.
PCINT1: Pin Change Interrupt source 1. The PB1 pin can serve as an external
interrupt source.
• ICP1/CLKO/PCINT0 – Port B, Bit 0
ICP1, Input Capture Pin: The PB0 pin can act as an Input Capture Pin for
Timer/Counter1. CLKO, Divided System Clock: The divided system clock can
be output on the PB0 pin. The divided system clock will be output if the
CKOUT Fuse is programmed, regardless of the PORTB0 and DDB0 settings. It
will also be output during reset. PCINT0: Pin Change Interrupt source 0. The
PB0 pin can serve as an external interrupt source.
3.1.3.4. Port C (PC5:0)
Port C is a 7-bit bi-directional I/O port with internal pull-up resistors (selected
for each bit). The PC5..0 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.
PC6/RESET
If the RSTDISBL Fuse is programmed, PC6 is used as an I/O pin. Note that the
electrical characteristics of PC6 differ from those of the other pins of Port C.
If the RSTDISBL Fuse is unprogrammed, PC6 is used as a Reset input. A low
level on this pin for longer than the minimum pulse length will generate a Reset,

17
even if the clock is not running. Shorter pulses are not guaranteed to generate a
Reset.

Table 3.2. Pin description of port C


The various special features of Port C are elaborated in table
The alternate pin configuration is as follows:
• RESET/PCINT14 – Port C, Bit 6
RESET, Reset pin: When the RSTDISBL Fuse is programmed, this pin
functions as a normal I/O pin, and the part will have to rely on Power-on Reset
and Brown-out Reset as its reset sources. When the RSTDISBL Fuse is
unprogrammed, the reset circuitry is connected to the pin, and the pin can not be
used as an I/O pin. If PC6 is used as a reset pin, DDC6, PORTC6 and PINC6
will all read 0.PCINT14: Pin Change Interrupt source 14. The PC6 pin can serve
as an external interrupt source.
• SCL/ADC5/PCINT13 – Port C, Bit 5
SCL, 2-wire Serial Interface Clock: When the TWEN bit in TWCR is set (one)
to enable the 2-wire Serial Interface, pin PC5 is disconnected from the port and
becomes the Serial Clock I/O pin for the 2-wire Serial Interface. In this mode,
there is a spike filter on the pin to suppress spikes shorter than 50 ns on the input
signal, and the pin is driven by an open drain driver with slew-rate limitation.
PC5 can also be used as ADC input Channel 5. Note that ADC input channel 5

18
uses digital power. PCINT13: Pin Change Interrupt source 13. The PC5 pin can
serve as an external interrupt source.
• SDA/ADC4/PCINT12 – Port C, Bit 4
SDA, 2-wire Serial Interface Data: When the TWEN bit in TWCR is set (one) to
enable the 2-wire Serial Interface, pin PC4 is disconnected from the port and
becomes the Serial Data I/O pin for the 2-wire Serial Interface. In this mode,
there is a spike filter on the pin to suppress spikes shorter than 50 ns on the input
signal, and the pin is driven by an open drain driver with slewrate limitation.
PC4 can also be used as ADC input Channel 4. Note that ADC input channel 4
uses digital power. PCINT12: Pin Change Interrupt source 12. The PC4 pin can
serve as an external interrupt source.
• ADC3/PCINT11 – Port C, Bit 3
PC3 can also be used as ADC input Channel 3. Note that ADC input channel 3
uses analog power. PCINT11: Pin Change Interrupt source 11. The PC3 pin can
serve as an external interrupt source.
• ADC2/PCINT10 – Port C, Bit 2
PC2 can also be used as ADC input Channel 2. Note that ADC input channel 2
uses analog power. PCINT10: Pin Change Interrupt source 10. The PC2 pin can
serve as an external interrupt source.
3.1.3.5. Port D (PD7:0)
Port D is an 8-bit bi-directional 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.

19
Table 3.3. Pin description of port D

The alternate pin configuration is as follows:


• AIN1/OC2B/PCINT23 – Port D, Bit 7
AIN1, Analog Comparator Negative Input. Configure the port pin as input with
the internal pull-up switched off to avoid the digital port function from
interfering with the function of the Analog Comparator. PCINT23: Pin Change
Interrupt source 23. The PD7 pin can serve as an external interrupt source.
• AIN0/OC0A/PCINT22 – Port D, Bit 6
AIN0, Analog Comparator Positive Input. Configure the port pin as input with
the internal pull-up switched off to avoid the digital port function from
interfering with the function of the Analog Comparator.

20
OC0A, Output Compare Match output: The PD6 pin can serve as an external
output for the
Timer/Counter0 Compare Match A. The PD6 pin has to be configured as an
output (DDD6 set (one)) to serve this function. The OC0A pin is also the output
pin for the PWM mode timer function. PCINT22: Pin Change Interrupt source
22. The PD6 pin can serve as an external interrupt source.
• T1/OC0B/PCINT21 – Port D, Bit 5
T1, Timer/Counter1 counter source. OC0B, Output Compare Match output: The
PD5 pin can serve as an external output for the Timer/Counter0 Compare Match
B. The PD5 pin has to be configured as an output (DDD5 set (one)) to serve this
function. The OC0B pin is also the output pin for the PWM mode timer
function. PCINT21: Pin Change Interrupt source 21. The PD5 pin can serve as
an external interrupt source.
• XCK/T0/PCINT20 – Port D, Bit 4
XCK, USART external clock. T0, Timer/Counter0 counter source. PCINT20:
Pin Change Interrupt source 20. The PD4 pin can serve as an external interrupt
source.
• INT1/OC2B/PCINT19 – Port D, Bit 3
INT1, External Interrupt source 1: The PD3 pin can serve as an external
interrupt source.
OC2B, Output Compare Match output: The PD3 pin can serve as an external
output for the Timer/Counter0 Compare Match B. The PD3 pin has to be
configured as an output (DDD3 set (one)) to serve this function. The OC2B pin
is also the output pin for the PWM mode timer function. PCINT19: Pin Change
Interrupt source 19. The PD3 pin can serve as an external interrupt source.
• INT0/PCINT18 – Port D, Bit 2
INT0, External Interrupt source 0: The PD2 pin can serve as an external
interrupt source. PCINT18: Pin Change Interrupt source 18. The PD2 pin can
serve as an external interrupt source.
• TXD/PCINT17 – Port D, Bit 1
TXD, Transmit Data (Data output pin for the USART). When the USART
Transmitter is enabled, this pin is configured as an output regardless of the value

21
of DDD1. PCINT17: Pin Change Interrupt source 17. The PD1 pin can serve as
an external interrupt source.
• RXD/PCINT16 – Port D, Bit 0
RXD, Receive Data (Data input pin for the USART). When the USART
Receiver is enabled this pin is configured as an input regardless of the value of
DDD0. When the USART forces this pin to be an input, the pull-up can still be
controlled by the PORTD0 bit. PCINT16: Pin Change Interrupt source 16. The
PD0 pin can serve as an external interrupt source.
3.1.3.6. AVCC
AVCC is the supply voltage pin for the A/D Converter, PC3:0, and ADC7:6. 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. Note that
PC6..4 use digital supply voltage, VCC.
3.1.3.7. AREF
AREF is the analog reference pin for the A/D Converter.
3.1.3.8. ADC7:6 (TQFP and QFN/MLF Package Only)
In the TQFP and QFN/MLF package, ADC7:6 serve as analog inputs to the A/D
converter. These pins are powered from the analog supply and serve as 10-bit
ADC channels.
3.1.3.9. Overview
The ATmega48PA/88PA/168PA/328P is a low-power CMOS 8-bit
microcontroller based on the AVR enhanced RISC architecture. By executing
powerful instructions in a single clock cycle, the
ATmega48PA/88PA/168PA/328P achieves throughputs approaching 1 MIPS per
MHz allowing the system designer to optimize power consumption versus
processing speed.

3.1.4. BLOCK DIAGRAM

22
Fig3.3. Architecture of ATmega328P

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.
The ATmega48PA/88PA/168PA/328P provides the following features: 4K/8K
bytes of In-System Programmable Flash with Read-While-Write capabilities,
256/512/512/1K bytes EEPROM, 512/1K/1K/2K bytes SRAM, 23 general
purpose I/O lines, 32 general purpose working registers, three flexible
Timer/Counters with compare modes, internal and external interrupts, a serial
programmable USART, a byte-oriented 2-wire Serial Interface, an SPI serial

23
port, a 6-channel 10-bitADC (8 channels in TQFP and QFN/MLF packages), a
programmable Watchdog Timer with internal Oscillator, and five software
selectable power saving modes. The Idle mode stops the CPU while allowing
the SRAM, Timer/Counters, USART, 2-wire Serial Interface, SPI port, and
interrupt system to continue functioning. The Power-down mode saves the
register contents but freezes the Oscillator, disabling all other chip functions
until the next interrupt or hardware reset.
In Power-save mode, the asynchronous timer continues to run, allowing the user
to maintain a timer base while the rest of the device is sleeping. The ADC Noise
Reduction mode stops the CPU and all I/O modules except asynchronous timer
and ADC, to minimize switching noise during ADC conversions. In Standby
mode, the crystal/resonator Oscillator is running while the rest of the device is
sleeping. This allows very fast start-up combined with low power consumption.
The device is manufactured using Atmel’s high density non-volatile memory
technology. The On-chip ISP Flash allows the program memory to be
reprogrammed In-System through an SPI serial interface, by a conventional non-
volatile memory programmer, or by an On-chip Boot program running on the
AVR core. The Boot program can use any interface to download the application
program in the Application Flash memory. Software in the Boot Flash section
will continue to run while the Application Flash section is updated, providing
true Read-While-Write operation. By combining an 8-bit RISC CPU with In-
System Self-Programmable Flash on a monolithic chip, the Atmel
ATmega48PA/88PA/168PA/328P is a powerful microcontroller that provides a
highly flexible and cost effective solution to many embedded control
applications.
The ATmega48PA/88PA/168PA/328P AVR is supported with a full suite of
program and system development tools including: C Compilers, Macro
Assemblers, Program Debugger/Simulators, In-Circuit Emulators, and
Evaluation kits.
3.1.5. Comparison between various Atmega
The ATmega48PA, ATmega88PA, ATmega168PA and ATmega328P differ only in
memory sizes, boot loader support, and interrupt vector sizes. Table summarizes
the different memory and interrupt vector sizes for the three devices.

24
Table 3.4. Specification comparison of various ATmega controllers
The Arduino Uno is a microcontroller board based on the ATmega328. It has a 16
MHz ceramic resonator, 14 digital input/output pins (of which 6 can be used as
PWM outputs), 6 analog inputs, a USB connection, a power jack, an ICSP header,
and a reset button. This board is very simple and can be easily used, everything
you need to support the microcontroller is in this board, just plug it in a computer
via USB cable and power using an AC-to-DC adapter or battery to get started.
The difference seen in the Arduino Uno is that it does not use the FTDI USB-to-
serial driver chip but, it has the Atmega16U2 (Atmega8U2 up to version R2)
programmed as a USB to-serial converter.

Fig 3.4. Arduino-Uno Structure

3.1.6. Arduino-Uno specifications

Microcontroller ATmega328
Operating-Voltage(OV) 5Volts
Recommended input voltage 7 to 12 Volts
Limits of inputs voltage 6 to 20 Volts

25
Digital I/O Pins 14 (of which 6 provides PWM output)
Analog Input Pins 6 Pin
DC Current per I/O 40 mA
DC Current for 3.3V Pin 50 mA
Flash Memory 32 KB (ATmega328) of which 0.5
KB used by bootloader
SRAM 2 KB (ATmega328)
EEPROM 1 KB (ATmega328)
Clock Speed 16 MHz
Table 3.5.Arduino-Uno Specification

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. Revision 2 of the Uno board has a
resistor pulling the 8U2 HWB line to ground, making it easier to put into DFU
mode. Revision 3 of the board has the following new features:
 pinout: 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 both with the board that use the AVR, which operate with 5V and
with the Arduino Due that operate 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.

26
3.1.7. Power
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 12V, the voltage regulator may overheat and damage the
board. The recommended range is 7 to 12 volts.
The power pins are as follows:
 VIN. The input voltage to the Arduino board when it's using an external power
source (as opposed to 5 volts from the USB connection or other regulated
power source). You can supply voltage through this pin, or, if supplying
voltage via the power jack, access it through this pin.
 5V.This pin outputs a regulated 5V from the regulator on the board. The board
can be supplied with power either from the DC power jack (7 - 12V), the USB
connector (5V), or the VIN pin of the board (7-12V). Supplying voltage via
the 5V or 3.3V pins bypasses the regulator, and can damage your board. We
don't advise it.
 3V3. A 3.3 volt supply generated by the on-board regulator. Maximum current
draw is 50 mA.
 GND. Ground pins.

3.1.8. Memory
The ATmega328 has 32 KB (with 0.5 KB used for the bootloader). It also has 2 KB of
SRAM and 1 KB of EEPROM (which can be read and written with the EEPROM
library).
3.1.9. Input and Output

27
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 of 40 mA and has an internal pull-up resistor
(disconnected by default) of 20-50 kOhms. In addition, some pins have specialized
functions:
 Serial: 0 (RX) and 1 (TX). Used to receive (RX) and transmit (TX) TTL
serial data. These pins are connected to the corresponding pins of the
ATmega8U2 USB-to-TTL Serial chip.
 External Interrupts: 2 and 3. These pins can be configured to trigger an
interrupt on a low value, a rising or falling edge, or a change in value. See the
attachInterrupt() function for details.
 PWM: 3, 5, 6, 9, 10, and 11. Provide 8-bit PWM output with the
analogWrite() function.
 SPI: 10 (SS), 11 (MOSI), 12 (MISO), 13 (SCK). These pins support SPI
communication using the SPI library.
 LED: 13. There is a built-in LED 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, labeled A0 through A5, each of which provide 10
bits of resolution (i.e. 1024 different values). By default they measure from
ground to 5 volts, though is it possible to change the upper end of their range
using the AREF pin and the analogReference() function. Additionally, some pins
have specialized functionality:
 TWI: A4 or SDA pin and A5 or SCL pin. Support TWI communication
using the Wire library.
There are a couple of other pins on the board:
 AREF. Reference voltage for the analog inputs. Used with analogReference().
 Reset. Bring this line LOW to reset the microcontroller. Typically used to add
a reset button to shields which block the one on the board.

3.1.10. Communication
The Arduino Uno has a number of facilities for communicating with a computer,
another Arduino, or other microcontrollers. The ATmega328 provides UART TTL

28
(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 be sent 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 SoftwareSerial library allows 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; see the
documentation for details. For SPI communication, use the SPI library.
What is a Library?
Libraries are great places, and not yet illegal in the United States! If you ever need
to learn how to do something, like say fix a motorcycle, you can go to your local
library and take out a book. Sure you could buy the book but the library is nice
because as a resource you can get the book whenever you need it, keeping your
house uncluttered.
Software Libraries are very similar. A procedure is a list of things to do. A library
is a big collection of procedures, where all the procedures are related! If you, say,
want to control a motor, you may want to find a Motor Control Library: a
collection of procedures that have already been written for you that you can use
without having to do the dirty work of learning the nuances of motors.
The library we will be using is the Serial Library, which allows the Arduino to
send data back to the computer:

29
What is Serial?
Serial may sound like a tasty breakfast food, but its actually quite different. The
word serial means "one after the other." For example, a serial killer doesn't stop
with one murder, but stabs many people one after the other. Serial data transfer is
when we transfer data one bit at a time, one right after the other.
Information is passed back & forth between the computer and Arduino by,
essentially, setting a pin high or low. Just like we used that technique to turn an
LED on and off, we can also send data. One side sets the pin and the other reads it.
It's a little like Morse code, where you can use dits and dahs to send messages
by telegram. In this case, instead of a long cable, its only a few feet.

3.1.11. Bits & Bytes


The world isn't run by weapons anymore, or energy, or money. It's run by little
ones and zeroes, little bits of data. It's all just electrons. - Sneakers
Now is a good time to review how data is measured. For example, we measure
weight with "ounces" and "pounds" (or grams and kilograms) and distances with

30
"inches," "feet," and "miles" (or centimeters, meters and kilometers). Information
has its own system of measurements:
A single bit is either a zero or a one. You can group bits together into 8
bits which is 1 byte. 1024 bytes (8192 bits) is one Kilobyte (sometimes written
KB). 1024 KB (1048576 bytes) is one Megabyte (MB). 1024 MB is
1 Gigabyte (GB)
An interesting thing to note is while 1000 grams is a kilogram, nearly all computer
systems consider 1024 bytes to be a kilobyte. That is, a 1.0 Kilobyte file on your
computer is 1024 bytes:

A familiar friend?
We've actually used the Serial communications capability already quite a
bit...that's how we send sketches to the Arduino! When you Compile/Verify what
you're really doing is turning the sketch into binary data (ones and zeros). When
you Upload it to the Arduino, the bits are shoved out one at a time through the
USB cable to the Arduino where they are stored in the main chip.
Next time you upload a sketch, look carefully at the two LEDs near the USB
connector, they'll blink when data is being transmitted. One blinks when the
Arduino is receiving data (RX) and one blinks when the Arduino is transmitting
data (TX)

31
Time for our first sketch
Our first sketch is going to be the hello world! program. When it starts up, it will
say "hello world!"
Create a New Sketch... and save it as HelloWorld

Into the new sketch, copy and paste the following source code, then save it

/* Hello World!
* This is the Hello World! for Arduino.
* It shows how to send data to the computer*/

void setup() // run once, when the sketch starts

{
Serial.begin(9600); // set up Serial library at 9600 bps
Serial.println("Hello world!"); // prints hello with ending line break

}
void loop() // run over and over again

{
// do nothing!
}

32
OK first thing to notice is that there's nothing in the loop procedure! We've gutted
it...and put some stuff into the setup procedure.

3.1.12. Programming
The Arduino Uno can be programmed with the Arduino software (download). Select
"Arduino Uno from the Tools > Board menu (according to the microcontroller on
your board). For details, see the reference and tutorials. The ATmega328 on the
Arduino Uno comes preburned with a bootloader that allows you to upload new code
to it without the use of an external hardware programmer. It communicates using the
original STK500 protocol (reference, C header files).
You can also bypass the bootloader and program the microcontroller through the ICSP
(In-Circuit Serial Programming) header; see these instructions for details. The
ATmega16U2 (or 8U2 in the rev1 and rev2 boards) firmware source code is
available . The ATmega16U2/8U2 is loaded with a DFU bootloader, which can be
activated by:
 On Rev1 boards: connecting the solder jumper on the back of the board (near
the map of Italy) and then resetting the 8U2.
 On Rev2 or later boards: there is a resistor that pulling the 8U2/16U2 HWB line
to ground, making it easier to put into DFU mode.

You can then use Atmel's FLIP software (Windows) or the DFU programmer (Mac
OS X and Linux) to load a new firmware. Or you can use the ISP header with an
external programmer (overwriting the DFU bootloader). See this user-contributed
tutorial for more information.
Automatic (Software) Reset
Rather than requiring a physical press of the reset button before an upload, the
Arduino Uno is designed in a way that allows it to be reset by software running on
a connected computer. One of the hardware flow control lines (DTR) of the
ATmega8U2/16U2 is connected to the reset line of the ATmega328 via a 100
nanofarad capacitor. When this line is asserted (taken low), the reset line drops

33
long enough to reset the chip. The Arduino software uses this capability to allow
you to upload code by simply pressing the upload button in the Arduino
environment. This means that the bootloader can have a shorter timeout, as the
lowering of DTR can be well-coordinated with the start of the upload.
This setup has other implications. When the Uno is connected to either a computer
running Mac OS X or Linux, it resets each time a connection is made to it from
software (via USB). For the following half-second or so, the bootloader is running
on the Uno. While it is programmed to ignore malformed data (i.e. anything
besides an upload of new code), it will intercept the first few bytes of data sent to
the board after a connection is opened. If a sketch running on the board receives
one-time configuration or other data when it first starts, make sure that the software
with which it communicates waits a second after opening the connection and
before sending this data.
The Uno contains a trace that can be cut to disable the auto-reset. The pads on
either side of the trace can be soldered together to re-enable it. It's labeled "RESET-
EN". You may also be able to disable the auto-reset by connecting a 110 ohm
resistor from 5V to the reset line; see this forum thread for details.
USB Overcurrent Protection
The Arduino Uno has a resettable polyfuse that protects your computer's USB ports
from shorts and overcurrent. Although most computers provide their own internal
protection, the fuse provides an extra layer of protection. If more than 500 mA is
applied to the USB port, the fuse will automatically break the connection until the
short or overload is removed.
Physical Characteristics
The maximum length and width of the Uno PCB are 2.7 and 2.1 inches
respectively, with the USB connector and power jack extending beyond the former
dimension. Four screw holes allow the board to be attached to a surface or case.
Note that the distance between digital pins 7 and 8 is 160 mil (0.16"), not an even
multiple of the 100 mil spacing of the other pins.
3.1.13. How to use arduino
Arduino can sense the environment by receiving input from a variety of sensors
and can affect its surroundings by controlling lights, motors, and other actuators.
The microcontroller on the board is programmed using the Arduino programming

34
language (based on Wiring) and the Arduino development environment (based on
Processing). Arduino projects can be stand-alone or they can communicate with
software on running on a computer (e.g. Flash, Processing, MaxMSP). Arduino is
a cross-platoform program. You’ll have to follow different instructions for your
personal OS. Check on the Arduino site for the latest instructions.
http://arduino.cc/en/Guide/HomePage

Once you have downloaded/unzipped the arduino IDE, you can Plug the Arduino
to your PC via USB cable.
Now you’re actually ready to “burn” your first program on the arduino board. To
select “blink led”, the physical translation of the well known programming “hello
world”, select File>Sketchbook> Arduino-0017>Examples> Digital>Blink Once
you have your skecth you’ll see something very close to the screenshot on the
right. In Tools>Board select Now you have to go to Tools>SerialPort and select
the right serial port, the one arduino is attached to.

Fig 3.5. The SKETCH window for Programming

3.2. BASIC REQUIRMENT


3.2.1. REGULATED POWER SUPPLY
In mains-supplied electronic systems the AC input voltage must be converted
into a DC voltage with the right value and degree of stabilization. The common
DC voltages that are required to power up the devices are generally in the range

35
of 3 VDC to 30 VDC. Typically the fixed types of DC voltages are 5V, 9V, 12V,
15V and 18V DC.

Fig: 3.6 Block diagram of RPS

POWER SUPPLY MODULES:


 Step down transformer
 Bridge rectifier with filter
 Voltage regulators
TRANSFORMER
Transformers convert AC electricity from one voltage to another with little loss
of power. Transformers work only with AC and this is one of the reasons why
mains electricity is AC. Step-up transformers increase voltage, step-down
transformers reduce voltage.
A step down power transformer is used to step down the AC voltage from the
line voltage of 110 VAC or 220 VAC i.e, it converts higher voltage at the input
side to a lower voltage at the output.

36
RECTIFIER
There are several ways of connecting diodes to make a rectifier to convert AC to
DC. The bridge rectifier is the most important and it produces full-wave varying
DC

Bridge rectifier Output: Bridge full-wave


VARYINGDC
Alternate pairs of diodes conduct, changing over(using all the AC wave)

FILTER
Filtering is performed by a large value electrolytic capacitor connected across
the DC supply to act as a reservoir, supplying current to the output when the
varying DC voltage from the rectifier is falling. The diagram shows the
unfiltered varying DC (dotted line) and the filtered DC (solid line). The
capacitor charges quickly near the peak of the varying DC, and then discharges
as it supplies current to the output. Typically 1000 μf capacitor is used.

REGULATOR

37
This is a simple DC regulated supply project using 7805 voltage regulator to
obtain a variable DC voltage range from 5V to 15V

Pin out of the 7805 regulator IC.


1. Unregulated voltage in
2. Ground
3. Regulated voltage out
If you need other voltages than +5V, you can modify the circuit by replacing
the 7805 chips with another regulator with different output voltage from
regulator 78xx chip family. The last numbers in the the chip code tells the
output voltage. Remember that the input voltage must be at least 3V greater
than regulator output voltage ot otherwise the regulator does not work well.

Fig: 3.7 Circuit diagram of RPS

3.2.2. Crystal 16.00 MHz Oscillator


It works on the mechanism of piezoelectric material to create an electrical signal with
a very precise frequency. This frequency is commonly used to keep track of time.
Crystal is used In order to have a baud rate of 9600 for serial communication with
modem. Also a higher value of crystal is of prime importance in this project which has
the effect of reducing the flicker seen in the LEDs.

38
CHAPTER 4
EMBEDDED SYSTEMS

4.1 INTRODUCTION TO EMBEDDED SYSTEMS

Each day, our lives become more dependent on 'embedded systems', digital
information technology that is embedded in our environment. More than 98% of
processors applied today are in embedded systems, and are no longer visible to the
customer as 'computers' in the ordinary sense. An Embedded System is a special-
purpose system in which the computer is completely encapsulated by or dedicated to
the device or system it controls. Unlike a general-purpose computer, such as a
personal computer, an embedded system performs one or a few pre-defined tasks,
usually with very specific requirements. Since the system is dedicated to specific
tasks, design engineers can optimize it, reducing the size and cost of the product.
Embedded systems are often mass-produced, benefiting from economies of scale. The
increasing use of PC hardware is one of the most important developments in high-end
embedded systems in recent years. Hardware costs of high-end systems have dropped
dramatically as a result of this trend, making feasible some projects which previously
would not have been done because of the high cost of non-PC-based embedded
hardware. But software choices for the embedded PC platform are not nearly as
attractive as the hardware.

Typically, an embedded system is housed on a single microprocessor board


with the programs stored in ROM. Virtually all appliances that have a digital interface
-- watches, microwaves, VCRs, cars -- utilize embedded systems. Some embedded
systems include an operating system, but many are so specialized that the entire logic
can be implemented as a single program.

39
Physically, Embedded Systems range from portable devices such as digital
watches and MP3 players, to large stationary installations like traffic lights, factory
controllers, or the systems controlling nuclear power plants.

In terms of complexity embedded systems can range from very simple with a
single microcontroller chip, to very complex with multiple units, peripherals and
networks mounted inside a large chassis or enclosure.

Definition of an Embedded System

Embedded system is defined as, for a particular/specific application


implementing the software code to interact directly with that particular hardware what
we built. Software is used for providing features and flexibility, hardware =
{processors, asics, memory,...} Is used for performance (& sometimes security)

(or)

An embedded system is a special-purpose computer system designed to


perform one or a few dedicated functions, often with real-time computing constraints.
It is usually embedded as part of a complete device including hardware and
mechanical parts. In contrast, a general-purpose computer, such as a personal
computer, can do many different tasks depending on programming.

(or)

An embedded system is a single-purpose computer built into a larger system


for the purposes of controlling and monitoring the system. A specialized computer
system that is part of a larger system or machine.

There are many definitions of embedded system but all of these can be
combined into a single concept. An embedded system is a special purpose computer
system that is used for particular task.

4.2. FEATURES OF EMBEDDED SYSTEMS

40
The versatility of the embedded computer system lends itself to utility in all
kinds of enterprises, from the simplification of deliverable products to a reduction in
costs in their development and manufacture. Complex systems with rich functionality
employ special operating systems that take into account major characteristics of
embedded systems. Embedded operating systems have minimized footprint and may
follow real-time operating system specifics.

The special computers system is usually less powerful than general-purpose


systems, although some expectations do exist where embedded systems are very
powerful and complicated. Usually a low power consumption CPU with a limited
amount of memory is used in embedded systems. Many embedded systems use very
small operating systems; most of these provide very limited operating system
capabilities.

Since the embedded system is dedicated to specific tasks, design engineers can
optimize it, reducing the size and cost of the product, or increasing the reliability and
performance. Some embedded systems are mass-produced, benefiting from
economies of scale.

Some embedded systems have to operate in extreme environment conditions


such as very high temperature & humidity.

For high volume systems such as portable music players or mobile phones,
minimizing cost is usually the primary design consideration. Engineers typically
select hardware that is just “good enough” to implement the necessary functions.

For low volume or prototype embedded systems, general purpose computers


may be adapted by limiting the programs or by replacing the operating system with a
real-time operating system.

4.3. CHARACTERISTICS OF EMBEDDED SYSTEMS

Embedded computing systems generally exhibit rich functionality—complex


functionality is usually the reason for introducing cpus into the design. However, they

41
also exhibit many non-functional requirements that make the task especially
challenging:

 Real-time deadlines that will cause system failure if not met;


 Multi-rate operation;
 In many cases, low power consumption;
 Low manufacturing cost, which often means limited code size.
Workstation programmers often concentrate on functionality. They may consider
the performance characteristics of a few computational kernels of their software, but
rarely analyze the total application. They almost never consider power consumption
and manufacturing cost. The need to juggle all these requirements makes embedded
system programming very challenging and is the reason why embedded system
designers need to understand computer architecture.

4.4. EMBEDDED SYSTEM ARCHITECTURE

Every Embedded system consists of a custom-built hardware built around a


central processing unit. This hardware also contains memory chips onto which the
software is loaded.

Application Software

Operating
System

H
/
W

The operating system runs above the hardware and the application software
runs above the operating system. The same architecture is applicable to any computer

42
including desktop computer. However these are significant differences. It is not
compulsory to have an operating system in every embedded system. For small
applications such as remote control units, air conditioners, toys etc.

Applications of Embedded Systems

Some of the most common embedded systems used in everyday life are

Small embedded controllers: 8-bit cpus dominate, simple or no operating system


(e.g., thermostats)
Control systems: often use dsp chip for control computations
(e.g., automotive engine control)
Distributed embedded control: mixture of large and small nodes on a real-time
embedded networks
(e.g., cars, elevators, factory automation)
System on chip: asic design tailored to application area
(e.g., consumer electronics, set-top boxes)
Network equipment: emphasis on data movement/packet flow
(e.g., network switches; telephone switches)
Critical systems: safety and mission critical computing
(e.g., pacemakers, automatic trains)
Signal processing: often use dsp chips for vision, audio, or other signal
processing (e.g., face recognition)
Robotics: uses various types of embedded computing
(especially
vision and control) (e.g., autonomous vehicles)
Computer peripherals: disk drives, keyboards, laser printers, etc.
Wireless systems: wireless network-connected “sensor networks” and
“motes” to gather and report information
Embedded pcs: palmtop and small form factor pcs embedded into
equipment
Command and control: often huge military systems and “systems of systems”
(e.g., a fleet of warships with interconnected
computers)

Home appliances, intercom, telephones, security systems, garage door openers,


answering machines, fax machines, home computers, tvs, cable tv tuner, vcr,
camcorder, remote controls, video games, cellular phones, musical instruments,
sewing machines, lighting control, paging, camera, pinball machines, toys, exercise
equipment

43
Office telephones, computers, security systems, fax machines, microwave, copier,
laser printer, color printer, paging
Auto trip computer, engine control, air bag, abs, instrumentation, security system,
transmission control, entertainment, climate control, cellular phone, keyless entry

4.5. TYPES OF EMBEDDED SYSTEMS


Based on functionality and performance embedded systems categorized as 4 types
1. Stand alone embedded systems
2. Real time embedded systems
3. Networked information appliances
4. Mobile devices

1.Stand alone embedded systems:-


As the name implies, stand alone systems work in stand alone mode. They
take i/p, process them and produce the desire o/p. The i/p can be an electrical signal
from transducer or temperature signal or commands from human being. The o/p can
be electrical signal to drive another system an led or lcd display

Ex digital camera, microwave oven, cd player, air conditioner etc

2.Real time embedded systems:-


In this type of an embedded system a specific work has to be complete in a
particular period of time.
Hard real time systems:- embedded real time used in missiles
Soft real time systems:- dvd players

3.Networked information appliances:-


Embedded systems that are provided with n/w interfaces and accessed by
n/w's such as local area n/w or internet are called network information appliances

Ex a web camera is connected to the internet. Camera can send pictures in real time to
any computers connected to the internet

4. Mobile devices:-
Actually it is a combination of both VLSI and Embedded system Mobile
devices such as mobile phone, personal digital assistants, smart phones etc are special

44
category of embedded systems

4.6. INTRODUCTION TO MICROCONTROLLER

Based on the processor side embedded systems is mainly divided into 3 types
1. Micro processor : - are for general purpose eg: our personal computer
2. Micro controller:- are for specific applications, because of cheaper cost we will go
for these
3. Dsp ( digital signal processor ):- are for high and sensitive application purpose

4.7. MICROCONTROLLER VERSUS MICROPROCESSOR

A system designer using a general-purpose microprocessor such as the pentium or the


68040 must add ram, rom, i/o ports, and timers externally to make them functional.
Although the addition of external ram, rom, and i/o ports makes these systems bulkier
and much more expensive, they have the advantage of versatility such that the
designer can decide on the amount of ram, rom and i/o ports needed to fit the task at
hand.

A Microcontroller has a CPU (a microprocessor) in addition to a fixed amount of


RAM, ROM, I/O ports, and a timer all on a single chip. In other words, the processor,
the RAM, ROM, I/O ports and the timer are all embedded together on one chip;
therefore, the designer cannot add any external memory, I/O ports, or timer to it. The
fixed amount of on-chip ROM, RAM, and number of I/O ports in Microcontrollers
makes them ideal for many

Fig 4.1: Block diagram of microprocessor

45
Fig 4.2. Block diagram of microcontroller

Fig 4.3. Differences between Microprocessor and Microcontroller

46
CPU platform: Embedded processors can be broken into two distinct
categories: microprocessors (μP) and microcontrollers (μC). Microcontrollers have
built-in peripherals on the chip, reducing size of the system. There are many different
CPU architectures used in embedded designs such as ARM, MIPS, Coldfire/68k,
PowerPC, x86, PIC, 8051, Atmel AVR, Renesas H8, SH, V850, FR-V, M32R, Z80,
Z8, etc. This in contrast to the desktop computer market, which is currently limited to
just a few competing architectures.

PC/104 and PC/104+ are a typical base for small, low-volume embedded and
ruggedized system design. These often use DOS, Linux, NetBSD, or an embedded
real-time operating system such as QNX or VxWorks. A common configuration for
very-high-volume embedded systems is the system on a chip (SoC), an application-
specific integrated circuit (ASIC), for which the CPU core was purchased and added
as part of the chip design. A related scheme is to use a field-programmable gate array
(FPGA), and program it with all the logic, including the CPU.

Embedded systems are based on the concept of the microcontroller, a single


integrated circuit that contains all the technology required to run an application.
Microcontrollers make integrated systems possible by combining several features
together into what is effectively a complete computer on a chip, including:
*CentralProcessingUnit
*Input/Outputinterfaces(suchasserialports)
*Peripherals(suchastimers)
*ROM,EEPROM(or)Flashmemoryforprogramstorage
*RAMfordatastorage
*Clockgenerator
By integrating all of these features into a single chip it is possible to greatly reduce the
number of chips and wiring necessary to control an electronic device, dramatically
reducing its complexity, size and cost.

* Size & Weight: Microcontrollers are designed to deliver maximum performance for
minimum size and weight. A centralized on-board computer system would greatly
outweigh a collection of microcontrollers.

47
* Efficiency: Microcontrollers are designed to perform repeated functions for long
periods of time without failing or requiring service.

MICRO CONTROLLER: It is a chip through which we can connect many other


devices and also those are controlled by the program the program which burn into that
chip

CHAPTER 5
SOFTWARE IMPLEMENTATION

5.1 ARDUINO SOFTWARE IDE USER’S GUIDE

Arduino is an open-source project, enabling hobbyists to easily take advantage of


the powerful Atmega chips. The Arduino IDE is the software where you can write
code and upload it to the Atmega chip. The code is then executed on the chip.
Most 3D-printer electronics are Arduino-compatible, they use the Atmega chip
and enable the user to upload their code using Arduino. This includes
Megatronics, Minitronics and RAMPS. Before you can start using the electronics
you need software 'firmware', that translates machine instructions (gcode) into
actual movements. There are a few options here, including Marlin and Sprinter
and Repetier. The actual firmware is not discussed in this document. You can use
Arduino to upload this firmware onto your electronics. This document will guide
you in the steps you need to take.

To upload a firmware, you must first open the files using File → Open. Select
the .ino file from the directory containing the firmware. Arduino will open several
tabs with files. Next step is to select the correct electronics board. From the Tools
menu, locate the Board item. This item should include a few sub items, including
Megatronics, Minitronics, Arduino mega 2560 (RAMPS with mega 2560) and

48
Arduino Mega 1280 (RAMPS with mega1280). Select the board that fits your
electronics. Also we need to select the serial port the electronics is connected to.
In the Tools menu, locate the Serial port item. This should include at least one
item if the board is connected and the drivers are installed properly. If there are
multiple items here, you need to find out which is the correct one by unplugging
the board and checking which port was removed. Once you have set the board and
serial port, you can upload the firmware by pressing File → Upload. Arduino will
try to compile the firmware, if any errors occur the process will stop and you will
need to fix the errors before trying again. Once compilation is complete, the actual
upload will start. This may take a minute for a large sketch.
Program Structure:
All Arduino programs have two functions, setup() and loop(). The instructions you
place in the startup() function are executed once when the program begins and are
used to initialize. Use it to set directions of pins or to initialize variables. The
instructions placed in loop are executed repeatedly and form the main tasks of the
program. Therefore every program has this structure
void setup()
{ // commands to initialize go here
}
void loop()
{ // commands to run your machine go here
}
The absolute, bare-minimum, do-nothing program that you can compile and run is
void setup() {} void loop() {} The program performs no function, but is useful for
clearing out any old program. Note that the compiler does not care about line
returns, which is why this program works if typed all on one line.

49
50
51
52
CHAPTER 6
SCHEMATIC DIAGRAM AND ITS WORKING
6.1. CIRCUIT DIAGRAM OF TRANSMITTING SECTION
Fig 6.1 Circuit diagram of LED scrolling Display using GSM Technology
6.2 CIRCUIT DESCRIPTION

53
This system is actually divided in main two parts, one is message transmission section
which is user mobile number and another is reception and displaying section.
The Android phone is service which is used to enable the voice of scrolling message
which is displaying on LED board. The software used is arduino development tool. In
that tool APK application is used for sending texts or numbers using Bluetooth access.
The message sent by user from registered mobile number is received by GSM modem
using the 1800MHz frequency. The SIM800 modem converts the message in to 8 bit
serial data and transmit to microcontroller. The microcontroller stores the received
message in its EEPROM location and flush the previous data in that location. Then
the message is transmitted to 64x8 dot matrix LED display board in SPI protocol. The
Max7219 is a LED driver IC which controls the LED system.
The proposed system is designed with simple components such as ARDUINO UNO,
GSM SIM800, HC-05 bluetooth module and MAX7219 Dot-matrix LED of 64x8
size. The regulated power supply is developed with transformer, bridge rectifier, filter
capacitor of 1000µF/25v, and 7805 voltage regulator IC. The RPS board takes
230v/AC as source of input voltage and convert to +5v/DC out voltage.
The 12v/Dc from the filter output is given to ARDUINO UNO board with the help of
power jack pin to operate the ARDDUINO UNO board. The board also gives 5v and
3.3 supply voltage levels to other external peripherals.
The ARDUINO UNO board pins are interfaced with Dot-matrix LED. The 8x8 size of
dot matrix pin has Din, Dout, CLK, CS, Vcc, GND pins. Here 1 block of 8x8 is
interface with other 8x8 LED block in parallel connection. Like Dout pin of 1 st block
is interfaced with Din of 2nd block of LED matrix, CSK to CSK, CS to CS, Vcc to
Vcc, GND to GND are interfaced. Like this all 8 blocks of 8x8 LED matrix are
interfaced. Hence it becomes as 64x8 size of LED matrix. The columns and rows are
interfaced with MAX7219 IC. Every block is interfaced with one MAX7219 IC. The
max 7219 IC control the LED’s as per the character. The dot matrix LED’s are
common cathode type and The LED controller (Max7219) makes particular row to get
+ve voltage hence the particular row of that column LED get ON. The MAX7219 and
Arduino uno are interfaced in serial communication. The SPI (Serial peripheral
interface) communication is done with the Din, CLK, CS pins. The Din is given to
11th pin, CS is given to 10th pin and CLK is given to 13th pin of ARDUINO UNO
board. Whenever data is transmitted from microcontroller to Din of Max7219, the 8

54
bits of data is transmitted as per ASCII code system and the LED controller makes
high the particular LEDs to get ON.
The GSM modem is used to make wireless communication with mobile user and the
distance is unlimited. The GSM modem makes serial communication with Arduino
uno board and here we used serial software header file to make 8 and 9 digital pins as
Rx and Tx. When a message is received by GSM modem it convert into 8 bit serial
data and transmit to Arduino. The 8 th pin receives the serial data and stores in
EEPROM buffer. The data in buffer will send to scrolling board to scroll. And the
Bluetooth device is connected to 2,3 pins in serial mode and the buffer data is
transmitted to Bluetooth in serial communication and the data then transmitted to user
smart phone app (Talking Serial Monitor) and the voice will be enabled.
6.3 FLOW CHART

55
CHAPTER-7
CONCLUSION & FUTURE SCOPE
56
7.1 CONCLUSION
The introducing concept of wireless technology using GSM in the field of
communication we can make our communication more efficient and faster, with
higher efficiency. We can display the messages with less errors and maintenance. This
model can be used very efficiently used in schools, chain restaurants in colleges
wherein students and staffs can be informed simultaneously in time. It will used at
public transport places like railways, bus station, and airport and also at roadside for
traffic control and in emergency situations. It is cost efficient system and user
friendly. Latency involved in using of papers in displaying of notices is avoided and
the information can be updated by the authorized persons.

7.2. FUTURE SCOPE


The proposed system of scrolling display has limitations such as unknown messages
are not filtering. These kind of noise are scrolling in the display board as unknown
characters. The messages should be filter and messages from unknown mobile
numbers should not scroll. To avoid such noise and filtering of messages, Bluetooth
technology is very much reliable and fast. Messages can send android app and
economical low cost whereas GSM need to economically cost for SMS.

7.3. APPLICATIONS

 Colleges: for displaying important messages . eg : placement news, cultural


activities news ,etc.
 Hotels : to display the availability of the rooms and the room rents , the type of
rooms.
 Restaurants :to display the menu and offers etc.
 Railway stations : to display the scheduling time of the train and the platform,
the services offered by the railways .
 Nursing homes : to display the staff attendance ,the availability of the doctors,
the list of the specialized doctors, no of in patients etc.

57

You might also like