Professional Documents
Culture Documents
INTRODUCTION TO PROJECT
1.1 INTRODUCTION
Solar energy conversion is one of the most addressed topics in the field of renewable
energy. Solar radiation is usually converted into two forms of energy: thermal and
electrical energy. The solar electricity has applications in many systems such as rural
electricity, water pumping and satellite communications. The efficiency of the
photovoltaic (PV) system depends on the climate conditions of solar radiation, ambient
temperature and wind speed, matching of the system with the load and appropriate
placement of the solar panels. A majority of solar panels in use today are stationary and
therefore do not consistently output the maximum amount of power that they can actually
produce. The use of a solar system is everywhere.
The sunlight is a natural and free source of energy. The Sun emits solar radiations or
electromagnetic radiations. In the solar energy system, these radiations are used to
generate electricity with the help of Photovoltaic cells or Solar cells. In this we are going
to learn about the prototype of the Sun Tracking Solar Panel Using Arduino.
Before understanding the working and advantages of the Solar Tracker, we need to know
why we have built this Solar Tracker.
A solar tracker will track the sun throughout the day and adjust the angle of the solar
panel to make the sun normal to the solar panels at all times. The orientation of the solar
panels may increase the efficiency of the conversion system from 20% up to 50%. . The
sun tracking solar power system is a mechatronic system that integrates electrical and
mechanical systems, and computer hardware and software.
Fixed Arrays
A fixed array of panels is the easiest type of solar system to build. First, we anchor a support
structure to the ground or a building. Then we attach solar panels on top of the structure.
These systems are simple to build with very little material, and in any shape or size. Since
they have no moving parts, fixed systems are resilient and need little maintenance.
There is a downside. Solar panels work best when the sun’s rays are perpendicular to the
panel. As the sun moves across sky during the day and throughout the seasons, the angle
between the sun and your panels changes. Your fixed system won’t be optimally aligned. This
means it will produce less energy.
Solar Trackers
The solution to the movement of the sun? Moving solar panels! Arrays of solar panels that
attach to a motor or other method of movement are called solar trackers. These arrays follow
the sun, increasing their energy production. Solar trackers are either single axis (they move in
one direction, following the sun throughout the day), or dual axis (they follow the sun
throughout the day, and adjust for the time of year).
This increased complexity means solar trackers have a higher cost to design and build, and
require more ongoing maintenance than fixed panels. These added costs mean that trackers
become more economically viable when the cost of panels is high, and you need to minimize
the number of panels and take advantage of all available light.
CED Co-op invests in a few large scale solar tracking systems. Most notable are Solvation-F,
Solvation-V, and Solvation-VF in Blind River, Ontario.
2.4.2Office automation:
The office automation products using embedded systems are copying machine, fax machine,
key telephone, modem, printer, scanner etc.
2.4.6 Telecommunications:
In the field of telecommunications, the embedded systems can be categorized as subscriber
terminals and network equipment. The subscriber terminals such as key telephones, ISDN
phones, terminal adapters, web cameras are embedded systems. The network equipment
includes multiplexers, multiple access systems, Packet Assemblers Dissemblers (PADs),
sate11ite modems etc. IP phone, IP gateway, IP gatekeeper etc. are the latest embedded
systems that provide very low-cost voice communication over the Internet.
2.4.8 Insemination:
Testing and measurement are the fundamental requirements in all scientific and engineering
activities. The measuring equipment we use in laboratories to measure parameters such as
weight, temperature, pressure, humidity, voltage, current etc. are all embedded systems. Test
equipment such as oscilloscope, spectrum analyzer, logic analyzer, protocol analyzer, radio
communication test set etc. are embedded systems built around powerful processors. Thank to
miniaturization, the test and measuring equipment are now becoming portable facilitating
easy testing and measurement in the field by field-personnel.
5
2.4.9 Security:
Security of persons and information has always been a major issue. We need to protect our
homes and offices; and, the information we transmit and store. Developing embedded systems
for security applications is one of the most lucrative businesses nowadays. Security devices at
homes, offices, airports etc. for authentication and verification are embedded systems.
Encryption devices are nearly 99 per cent of the processors that are manufactured end up in~
embedded systems. Embedded systems find applications in every industrial segment-
consumer electronics, transportation, avionics, biomedical engineering, manufacturing,
process control and industrial automation, data communication, telecommunication, defense,
security etc. Used to encrypt the data/voice being transmitted on communication links such as
telephone lines. Biometric systems using fingerprint and face recognition are now being
extensively used for user authentication in banking applications as well as for access control
in high security buildings.
2.4.10 Finance:
Financial dealing through cash and cheques are now slowly paving way for transactions using
smart cards and ATM (Automatic Teller Machine, also expanded as Any Time Money)
machines. Smart card, of the size of a credit card, has a small micro-controller and memory;
and it interacts with the smart card reader! ATM machine and acts as an electronic wallet.
Smart card technology has the capability of ushering in a cashless society. Well, the list goes
on. It is no exaggeration to say that eyes wherever you go, you can see, or at least feel, the
work of an embedded system.
6
Fig 1.1: Layered architecture of an embedded system
The same architecture is applicable to any computer including a desktop computer. However,
there are significant differences. It is not compulsory to have an operating system in every
embedded system. 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. For applications involving complex processing, it is advisable to have an
operating system. In such a case, you need to integrate the application software with the
operating system and then transfer the entire software on to the memory chip. Once the
software is transferred to the memory chip, the software will continue to run for a long time
you do not need to reload new software.
Now, let us see the details of the various building blocks of the hardware of an embedded
system. As shown in Fig. the building blocks are.
• Central Processing Unit (CPU)
• Memory (Read-only Memory and Random-Access Memory)
• Input Devices
• Output devices
• Communication interfaces
• Application-specific circuitry
7
Fig: 1.2 Block diagram of hardware components of embedded system
2.5.2 Memory:
The memory is categorized as Random-Access Memory (RAM) and Read Only Memory (ROM).
The contents of the RAM will be erased if power is switched off to the chip, whereas ROM
retains the contents even if the power is switched off. So, the firmware is stored in the ROM.
When power is switched on, the processor reads the ROM; the program is program is executed. In
combination with the embedded operating system (OS) that controls the resources like memory
subsystems, software instructs the processor (CPU) to send a burst of electricity along an address
line that identifies a transition’s location in the chip where data is stored. This pulse can turn on or
off a transistor connected to data lines. When the electrical pulse reaches an address line, the pulse
flows through a closed transistor and charges a capacitor that stores the equivalent of a 1 (on) bit
and, conversely, an uncharged capacitor represents a 0 (off) bit.
8
2.5.3 Input devices:
Unlike the desktops, the input devices to an embedded system have very limited capability. There
will be no keyboard or a mouse, and hence interacting with the embedded system is no easy task.
Many embedded systems will have a small keypad-you press one key to give a specific
command. A keypad may be used to input only the digits. Many embedded systems used in
process control do not have any input device for user interaction; they take inputs from sensors or
transducers 1’fnd produce electrical signals that are in turn fed to other systems.
2.5.4 Output devices:
The output devices of the embedded systems also have very limited capability. Some
embedded systems will have a few Light Emitting Diodes (LEDs) to indicate the health
status of the system modules, or for visual indication of alarms. A small Liquid Crystal
Display (LCD) may also be used to display some important parameters.
2.5.5 Communication interfaces:
The embedded systems may need to, interact with other embedded systems at they may have
to transmit data to a desktop. To facilitate this, the embedded systems are provided with one
or a few communication interfaces such as RS232, RS422, RS485, Universal Serial Bus
(USB), and IEEE 1394, Ethernet etc.
2.5.6 Application-specific circuitry:
Sensors, transducers, special processing, and control circuitry may be required fat an
embedded system, depending on its application. This circuitry interacts with the processor to
carry out the necessary work. The entire hardware must be given power supply either through
the 230 volts’ main supply or through a battery.
2.6 Conclusion:
Embedded Systems plays a vital role in our day today life. They are used for household
appliances like microwave oven to the satellite applications. They provide good man to
machine interface.
Automation is the further step in the world of Embedded Systems, which includes the
elimination of the human being in the mundane applications. They are cost effective,
accurate and can work in any conditions and round the clock.
CHAPTER-3
ARDUINO & ITS ARCHITECTURE
3.1 INTRODUCTION TO MICROCONTROLLERS:
The similarity between the 2 is that a micro-controller integrates the options of a chip
(ALU, CPU, Registers) at the side of the existence of additional characteristics like
existence of computer memory, RAM, counter, Input/ Output ports, etc. On the contrary, a
microcontroller controls the work of a device by using fastened programs accumulated in
computer memory that will no amend with period.
From an added purpose of read, the foremost similarity amid a usual small-processor and a
micro controller parting there space terms is that the area of their application. Usual
microprocessors like the Intel Core processors or Pentium processors are in computers as a
universally functioning programmable machine. In its generation it's to manage various
totally different assignments and programs such that to that. In distinction a microcontroller
of PIC family or arduino family or the other have detected their applications in small
embedded systems such as- system of traffic signals or some variety of robotic system.
Additionally these gadgets manage similar task or similar program in the course of their
entire life cycle. Another distinction is that the microcontroller usually has got to handle
instant tasks whereas on the contrary the micro-processors in an exceedingly system maybe
won't handle a right away task in the slightest degree times.
3.2.1Features:
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
256/512/512/1K Bytes EEPROM
512/1K/1K/2K Bytes Internal SRAM
Write/Erase Cycles: 10,000 Flash/100,000 EEPROM
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.
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.
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.4 Overview:
The ATmega48A/48PA/88A/88PA/168A/168PA/328/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
ATmega48A/48PA/88A/88PA/168A/168PA/328/328P achieves through- puts approaching
1 MIPS per MHz allowing the system designer to optimize power consumption versus
processing speed. 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 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 pro- gram 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
ATmega48A/48PA/88A/88PA/168A/168PA/328/328P is a powerful microcontroller that
provides a highly flexible and cost effective solution to many embedded con- trol
applications.
Summary
3.4.2 ATmega328:
MUR(4)
ATmega328-PU
Table:3.3 Atmega 328
Note:1. This device can also be supplied in wafer form. Please contact your local
Atmel sales office for detailed ordering information and minimum quantities.
2. Pb-free packaging complies to the European Directive for Restriction of
Hazardous Substances (RoHS directive).Also Halide free and fully Green.
3. Tape & Reel
3.5.1 Applications:
1. Military and part embedded software system applications
2. Communication Applications
3. Industrial automation and method management software system
3.5.2. Classification:
Real Time Systems.
RTS is one that must answer events inside such that point.
A right answers once the dead line may be a wrong answer
RTS Classification:
Hard Real Time Systems
Soft Real Time System
Hard Real Time System:
"Hard" time period systems have terribly slender latency.
Example: atomic energy system, cardiac muscle.
Soft Real Time System:
"Soft" time period systems have reduced constrains on "lateness" however still should
operate terribly quickly and repeatable.
Example: Railway reservation system – takes some further seconds the info remains valid.
Languages Used:
C
C++
Java
Linux
Ada
CHAPTER-4
SOFTWARE IMPEMENTATION
arts matter substitution usually wont to inscribe common short sequences of directions to
run inline rather than in an exceedingly subprogram. Assemblers are so much easier to write
down than compilers for high-level languages. Assembly Language has many Benefits:
Speed:
Assembly language programs are usually the quickest programs around.
Space:
Assembly language programs are typically the littlest.
24
• Inexpensive - Arduino boards are relatively inexpensive compared to other
microcontroller platforms. The least expensive version of the Arduino module can be
assembled by hand, and even the pre-assembled Arduino modules cost less than$50
• Cross-platform - The Arduino Software (IDE) runs on Windows, Macintosh OSX,
and Linux operating systems. Most microcontroller systems are limited to Windows.
• Simple, clear programming environment - The Arduino Software (IDE) is easy-to-use
for beginners, yet flexible enough for advanced users to take advantage of as well. For
teachers, it's conveniently based on the Processing programming environment, so students
learning to program in that environment will be familiar with how the Arduino IDE works.
• Open source and extensible software - The Arduino software is published as open
source tools, available for extension by experienced programmers. The language can be
expanded through C++ libraries, and people wanting to understand the technical details can
make the leap from Arduino to the AVR C programming language on which it's based.
Similarly, you can add AVR-C code directly into your Arduino programs if you want to.
• Open source and extensible hardware - The plans of the Arduino boards are published
under a Creative Commons license, so experienced circuit designers c an make their own
version.
• Of the module, extending it and improving it. Even relatively inexperienced users can
build the breadboard version of the module in order to understand how it works and save
money.
• Getting Started with Arduino and Genuino products:-
Get the latest version from the download page. You can choose between the Installer (.exe)
and the Zip packages. We suggest you use the first one that installs directly everything you
need to use the Arduino Software (IDE), including the drivers. With the Zip package you
need to install the drivers manually.
25
When the download finishes, proceed with the installation and please allow the driver
installation process when you get a warning from the operating system.
When the Arduino Software (IDE) is properly installed you can go back to the Getting
Started Home and choose your board from the list on the right of the page.
26
The Arduino Integrated Development Environment (IDE) is a cross-platform application
(for Windows, macOS, Linux) that is written in the programming language Java. It is used
to write and upload programs to Arduino compatible boards, but also, with the help of 3rd
party cores, other vendor development boards.
The source code for the IDE is released under the GNU General Public License, version 2.
The Arduino IDE supports the languages C and C++ using special rules of code structuring.
The Arduino IDE supplies a software library from the Wiring project, which provides many
common input and output procedures. User-written code only requires two basic functions,
for starting the sketch and the main program loop, that are compiled and linked with a
program stub main() into an executable cyclic executive program with the GNU toolchain,
also included with the IDE distribution. The Arduino IDE employs the program avrdude to
convert the executable code into a text file in hexadecimal encoding that is loaded into the
Arduino board by a loader program in the board's firmware.
In October 2019 the Arduino organization began providing early access to a new Arduino
Pro IDE with debugging and other advanced features
The bar appearing on the top is called Menu Bar that comes with five different options as
follows.
27
Fig.4.3: Menu Bar of Arduino IDE
You can open a new window for writing the code or open an existing one. Following table
shows the number of further subdivisions the file option is categorized into. Creating file
descriptors
,
open(),create() socket(),accept(),socketpair(),pipe(),epoll_create(),(Linux),signalfd()
(Linux),eventfd() (Linux)timerfd_create() (Linux) etc…,
28
As you go to the preference section and check the compilation section, the Output Pane will
show the code compilation as you click the upload button.
Used for copying and pasting the code with further modification for font
29
4.2.4 Tools Description:
Mainly used for testing projects. The Programmer section in this panel is used for burning a
bootloader to the new microcontroller.
In case you are feeling skeptical about software, complete help is available from getting
started to troubleshooting.
The Six Buttons appearing under the Menu tab are connected with the running program as
follows
While Arduino IDE is highly-rated by users according to ease of use, it is also capable of
performing complex processes without taxing computing resources
• You need to select the baud rate of the Arduino Board you are using right now. For my
Arduino Uno Baud Rate is 9600, as you write the following code and click the Serial
Monitor, the output will show as the image below.
The main screen below the Menu board is known as a simple text editor used for writing the
registration code.
31
The bottom of the main screen is described as an Output Pane that mainly highlights the
compilation status of the running code: the memory used by the code, and errors occurred in
the program. You need to fix those errors before you intend to upload the hex file into your
Arduino Module.
More or less, Arduino C language works similar to the regular C language used for any
embedded system microcontroller, however, there are some dedicated libraries used for
calling and executing specific functions on the board.
4.3 Libraries:
Libraries are very useful for adding the extra functionality into the Arduino Module. There
is a list of libraries you can add by clicking the Sketch button in the menu bar and going to
Include Library .The Arduino environment can be extended through the use of libraries, just
like most programming platforms. Libraries provide extra functionality for use in sketches,
e.g. working with hardware or manipulating data. To use a library in a sketch, select it from
Sketch > Import Library.
A number of libraries come installed with the IDE, but you can also download or create
your own. See these instructions for details on installing libraries. There's also a tutorial on
writing your own libraries. See the API Style Guide for information on making a good
Arduino-style API for your library.
32
Fig.4.11: ArduinoIDE Library
As you click the Include Library and Add the respective library it will on the top of the
sketch with a #include sign. Suppose, I Include the EEPROM library, it will appear on the
text editor as
#include <EEPROM.h>
Most of the libraries are preinstalled and come with the Arduino software. However, you
can also download them from the external sources.
4.4 Making Pins Input or Output:
The digitalRead and digitalWrite commands are used for addressing and making the
Arduino pins as an input and output respectively.
These commands are text sensitive i.e. you need to write them down the exact way they are
given like digitalWrite starting with small “d” and write with capital “W”. Writing it down
with Digitalwrite or digitalwrite won’t be calling or addressing any function.
4.5 How to Select the Board:
On the online IDE we are able to automatically detect the kind of board and the port it is
connected to without you having to individually select them.In order to upload sketch, you
need to select the relevant board you are using and the ports for that operating system. As
33
you click the Tools on the Menu, it will open like the figure below.You'll need to select the
entry in the Tools > Board menu that corresponds to your Arduino board.Select the serial
device of the board from the Tools | Serial Port menu. This is likely to be COM3 or higher
(COM1 and COM2 are usually reserved for hardware serial ports). To find out, you can
disconnect your board and re-open the menu; the entry that disappears should be the
Arduino board. Reconnect the board and select that serial port.
Just go to the “Board” section and select the board you aim to work on. Similarly, COM1,
COM2, COM4, COM5, COM7 or higher are reserved for the serial and USBboard. You can
look for the USB serial device in the port section of the Windows Device Manager.
Following figure shows the COM4 that I have used for my project, indicating the Arduino
Uno with COM4 port at the bottom right corner of the screen.
34
Fig.4.13: Example
● After correct selection of both Board and Serial Port, click the verify and then upload
button appearing in the upper left corner of the six button section or you can go to the
Sketch section and press verify/compile and then upload.
● The sketch is written in the text editor and is then saved with the file extension
It is important to note that the recent Arduino Modules will reset automaticallyas you
compile and press the upload button the IDE software, however, older version may require
the physical reset on the board.
● Once you upload the code, TX and RX LEDs will blink on the board, indicating the
desired program is running successfully.
Note: The port selection criteria mentioned above is dedicated for Windows operating
system only, you can check this Guide if you are using a MAC or Linux.
● The amazing thing about this software is that no prior arrangement or bulk of mess is
required to install this software, you will be writing your first program within 2 minutes
after the installation of the IDE environment.
35
4.6 Bootloader:
As you go to the Tools section, you will find a bootloader at the end. It is very helpful to
burn the code directly into the controller, setting you free from buying the external burner to
burn the required code.
Fig.4.14: Bootloader
When you buy the new Arduino Module, the bootloader is already installed inside the
controller. However, if you intend to buy a controller and put in the Arduino module, you
need to burn the bootloader again inside the controller by going to the Tools section and
selecting the burn bootloader.
BT Terminal is a terminal app with UART serial communication protocol that transmits &
36
receives data wirelessly through bluetooth connections.The app can be used for Robotics
Communication, Configuring Bluetooth Modules (using AT Commands), Home
Automation,etc.
HARDWARE IMPLEMENTATION
39
At first, this could look even as confusing because the unidirectional streets of Bean Town.
The factor to appreciate is that the diodes add pairs. because the voltage of the signal flips
back and forth, the diodes Shepard this to invariably flow within the same direction for the
output.
Here's what the circuit appears like to the signal because it alternates:
40
Figure:5.6: Bridge Rectifier with AC input
41
Low pass filter:
42
High pass filter:
The basic quantities that describe this circuit square measure the same as those used for the
Low Pass Filter. In effect, this circuit is simply a straightforward low-pass filter with the
elements swapped over.
T=R1C1 eqn1
The action of the circuit may also be delineate in terms of a connected amount, the flip over
Frequency, f0, that encompasses a worth As with the low-pass filter, the circuit's behavior
we will be understood as arising thanks to the time taken to alter the capacitor's charge after
we alter the applied input voltage. It continually takes a finite (i.e. non-zero) time to alter the
quantity of charge keep by the condenser. thus it takes time to alter the electric potential
across the condenser. As a result, any abrupt amendment within the input voltage produces
an analogous abrupt amendment on the opposite aspect of the condenser. This produces a
voltage across the resistance and causes a current to flow through it, charging the condenser
till all the voltage falls across it rather than the resistance. The result's that steady (or slowly
varying) voltages seem largely across the condenser and fast changes seem largely across
the resistance. The Voltage Gain:
43
eqn2
eqn3
Try mistreatment the higher than experimental system to gather results and plot a graph of
however the voltage gain, Av, (and the section change) rely on the input frequency and if we
have a tendency to check result agrees with the higher than formulae. Compare this with a
low-pass filter that uses a similar element values and you ought to see that they provide
'opposite' results. within the high-pass filter, the output wave form 'leads' the input wave
form - i.e. it peaks before the input.
5.1.4 Regulator Unit:
Regulator regulates the output voltage to be continually constant. The output voltage is
maintained regardless of the fluctuations within the input AC voltage. As and so the AC
voltage changes, the DC voltage conjointly changes. So to avoid this Regulators square
measure used. Conjointly once the interior resistance of the facility provide is larger than
thirty ohms, the output gets affected. So this may be with success reduced here. The
regulators square measure chiefly classified for low voltage and for top voltage. Additional
they'll even be classified as:
i) Positive regulator
1) Input pin/ First pin
2) Ground pin /Middle pin
44
3) Output pin/last or 3rd pin
It regulates the positive voltage.
ii) Negative regulator
1) Ground pin /first pin
2) Input pin/ middle pin
3) Output pin/last pin
It regulates the negative voltage.
5.2. Arduino Uno:[2]
5.2.1 ATMEGA 328 Pinout:[3]
VCC
GND
Ground.
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.
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.
5.2.3 Overview:
The ATmega48A/48PA/88A/88PA/168A/168PA/328/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 ATmega48A /48PA /88A /88PA /168A
/168PA/328/328P achieves through- puts approaching 1 MIPS per MHz allowing the system
designer to optimize power consumption versus processing speed. 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.
46
The ATmega48A/48PA/88A/88PA/168A/168PA/328/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 port, a 6-channel 10-bit ADC (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 pro- gram 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
ATmega48A/48PA/88A/88PA/168A/168PA/328/328P is a powerful microcontroller that
provides a highly flexible and cost effective solution to many embedded con- trol
applications.
47
5.2.4 Arduino Board:
An Arduino board is a one type of microcontroller based kit. The first Arduino technology
was developed in the year 2005 by David Cuartielles and Massimo Banzi. The designers
thought to provide easy and low cost board for students, hobbyists and professionals to build
devices. Arduino board can be purchased from the seller or directly we can make at home
using various basic components. The best examples of Arduino for beginners and hobbyists
includes motor detectors and thermostats, and simple robots. In the year 2011, Adafruit
industries expected that over 3lakhs Arduino boards had been produced. But, 7lakhs boards
were in user’s hands in the year 2013. Arduino technology is used in many operating
devices like communication or controlling.
Arduino is opensource hardware. The hardware reference designs are distributed under a
Creative Commons Attribution Share-Alike 2.5 license and are available on the Arduino
website. Layout and production files for some versions of the hardware are also available.
The pin configuration of the Arduino Uno board is shown in the above. It consists of 14-
digital i/o pins. Wherein 6 pins are used as pulse width modulation o/ps and 6 analog i/ps, a
USB connection, a power jack, a 16MHz crystal oscillator, a reset button, and an
48
ICSP header. Arduino board can be powered either from the personal computer through a
USB or external source like a battery or an adaptor. This board can operate with an external
supply of 7-12V by giving voltage reference through the IORef pin or through the pin Vin.
5.2.6 Digital Inputs:
It comprises of 14-digital I/O pins, each pin take up and provides 40mA current. Some of
the pins have special functions like pins 0 & 1, which acts as a transmitter and receiver
respectively. For serial communication, pins-2 & 3 are external interrupts, 3,5,6,9,11 pins
delivers PWM o/p and pin-13 is used to connect LED.
5.2.7 How to program an Arduino ?
The main advantage of the Arduino technology is you can directly load the programs into
the device without the need of a hardware programmer to burn the program. This is done
because of the presence of the 0.5KB of boot loader, that allows the program to be dumped
into the circuit. The Arduino tool window contains a toolbar with various buttons like new,
open, verify, upload and serial monitor. And additionally it comprises of a text editor
(employed to write the code), a message space (displays the feedback) like showing the
errors, the text console, that displays the o/p & a series of menus just like the file, tool menu
& edit.
Programming into the Arduino board is called as sketches. Each sketch contains three parts
such as Variables Declaration, Initialization and Control code. Where, Initialization is
written in the setup function and Control code is written in the loop function.
The sketch is saved with .ino and any operation like opening a sketch, verifying and saving
can be done using the tool menu.
The sketch must be stored in the sketchbook directory.
● Select the suitable board from the serial port numbers and tools menu.
● Select the tools menu and click on the upload button, then the boot loader uploads the
code on the microcontroller
49
Fig.5.12:Programming an Arduino
5.2.9 Comparison Between Processors:
The ATmega48A/48PA/88A/88PA/168A/168PA/328/328P differ only in memory sizes,
boot loader support, and interrupts vector sizes. Table 2-1 summarizes the different memory
and inters- rupt vector sizes for the devices.
50
Table:5.2 Memory Size Summary
Note:
1. This device can also be supplied in wafer form. Please contact your local Atmel sales
office for detailed ordering information and minimum quantities.
LCD stands for liquid crystal displays. Digital display is finding wide unfold use substitution
LEDs (seven phase LEDs or different multi-phase LEDs) thanks to the subsequent reasons:
2. The power to show numbers, characters and graphics. This is often in distinction to
3. Incorporation of a refreshing controller into the digital display, thereby relieving the
processor of the task of refreshing the digital display. In distinction, the crystal rectifier
These parts area unit “specialized” for being employed with the microcontrollers, which
implies that they can't be activated by customary IC circuits. They’re used for writing
A model represented here is for its low value and nice potentialities most often utilized in
follow. it's supported the HD44780 microcontroller (Hitachi) and might show messages in 2
lines with sixteen characters every. It displays all the alphabets, Greek letters, and
punctuation marks, mathematical symbols etc. additionally; it's attainable to show symbols
that user makes informed its own. Automatic shifting message on show (shift left and right),
look of the pointer, backlight etc. area unit thought of as helpful characteristics
Pin
Name LogicState Description
Function Number
Ground 1 Vss - 0V
Power supply 2 Vdd - +5V
Contrast 3 Vee - 0 –Vdd
D0 – D7 are interpreted as
0
4 RS commands
1
D0 – D7 are interpreted as data
Write data (from controller to
0 LCD)
Control of 5 R/W
1 Read data (from LCD to
operating
controller)
0 Access to LCD disabled
1 Normal operating
6 E
From 1 to Data/commands are transferred to
0 LCD
7 D0 0/1 Bit 0 LSB
8 D1 0/1 Bit 1
9 D2 0/1 Bit 2
10 D3 0/1 Bit 3
Data / commands
11 D4 0/1 Bit 4
12 D5 0/1 Bit 5
13 D6 0/1 Bit 6
14 D7 0/1 Bit 7 MSB
LCD screen:
LCD screen consists of 2 lines with sixteen characters every. Every character consists of 5x7
matrix. Distinction on show depends on the facility provide voltage and whether or not
messages area unit displayed in one or 2 lines. For that reason, variable voltage 0-Vdd is
applied on pin marked as Vee. Trimmer potentiometer is typically used for that purpose.
Some versions of displays have in-built backlight (blue or inexperienced diodes). Once used
throughout operative, a resistance for current limitation ought to be used (like with any
autoimmune disease diode).
Figure: LCD pin connection
All information transferred to LCD through outputs D0-D7 is going to be taken as commands
or as information, that depends on logic state on pin RS:
RS = one - Bits D0 - D7 area unit addresses of characters that ought to be displayed. In-built
processor addresses in-built “map of characters” and displays corresponding symbols.
Displaying position is set by DDRAM address. This address is either antecedently outlined or
the address of antecedently transferred character is mechanically incremented.
RS = zero - Bits D0 - D7 area unit commands that confirm show mode. List of commands
that LCD acknowledges area unit given within the table below:
Execution
Command RS RW D7 D6 D5 D4 D3 D2 D1 D0
Time
Clear display 0 0 0 0 0 0 0 0 0 1 1.64mS
Cursor home 0 0 0 0 0 0 0 0 1 x 1.64mS
Entry mode set 0 0 0 0 0 0 0 1 I/D S 40uS
Display on/off control 0 0 0 0 0 0 1 D U B 40uS
Cursor/Display Shift 0 0 0 0 0 1 D/C R/L x x 40uS
Function set 0 0 0 0 1 DL N F x x 40uS
Set CGRAM address 0 0 0 1 CGRAM address 40uS
Set DDRAM address 0 0 1 DDRAM address 40uS
Read “BUSY” flag (BF) 0 1 BF DDRAM address -
Write to CGRAM or
1 0 D7 D6 D5 D4 D3 D2 D1 D0 40uS
DDRAM
Read from CGRAM or
1 1 D7 D6 D5 D4 D3 D2 D1 D0 40uS
DDRAM
Connection of LCD:
Depending on what percentage lines are used for affiliation/connection to the microcontroller,
there are 8-bit and 4-bit alphanumeric display modes. The suitable mode is decided at the
start of the method in an exceedingly part known as “initialization”. Within the initial case,
the info are transferred through outputs D0-D7 because it has been already explained. just in
case of 4-bit crystal rectifier mode, for the sake of saving valuable I/O pins of the
microcontroller, there are solely four higher bits (D4-D7) used for communication, whereas
different could also be left unconnected.
Consequently, every information is shipped to alphanumeric display in 2 steps: four higher
bits are sent initial (that usually would be sent through lines D4-D7), four lower bits are sent
after. With the assistance of initialization, alphanumeric display can properly connect and
interpret every information received. Besides, with regards to the very fact that information is
seldom scanning from alphanumeric display (data chiefly are transferred from
microcontroller to LCD) an additional I/O pin could also be saved by easy connecting R/W
pin to the bottom. Such saving has its worth. Even if message displaying is usually
performed, it'll not be attainable to scan from busy flag since it's impractical to scan from
show.
LCD INITIALIZATION FORMAT:
Once the facility offer is turned on, alphanumeric display is mechanically cleared. This
method lasts for roughly 15mS. After that, show is prepared to control. The mode of
operative is ready by default. This implies that:
1. Display/screen is cleared
2. Mode
decilitre = one Communication through 8-bit interface
N = zero Messages area unit displayed in one line
F = zero Character font five x eight dots
3. Display/Cursor on/off
D = zero show off
U = zero pointer off
B = zero pointer blink off
4. Character entry
ID = one Addresses on show area unit mechanically incremented by one
S = zero show shift off
Automatic reset is especially performed with none issues. Primarily however not always! If
for any reason power offer voltage doesn't reach full price within the course of 10mS, show
can begin perform utterly unpredictably? If voltage offer unit cannot meet this condition or if
it's required to supply utterly safe operative, the method of format by that a brand new reset
sanctionative show to control usually should be applied.
Algorithm in line with the format is being performed depends on whether or not affiliation to
the microcontroller is thru 4- or 8-bit interface. All left over to be done then is to provide
basic commands and of course- to show messages.
CONTRAST CONTROL:
To have a transparent read of the characters on the alphanumeric display, distinction ought to
be adjusted. To regulate the distinction, the voltage ought to be varied. For this, a planned is
employed which may behave sort of a variable voltage device. Because the voltage of this
planned is varied, the distinction of the alphanumeric display will be adjusted.
POTENTIOMETER:
Variable resistors used as potentiometers have all 3 terminals connected.
This arrangement is generally wont to vary voltage, as an example to line the switch purpose
of a circuit with a device, or management the degree (loudness) in Associate in Nursing
electronic equipment circuit. If the terminals at the ends of the track area unit connected
across the facility offer, then the wiper terminal can give a voltage which may be varied from
zero up to the most of the provision.
PRESETS
These area unit miniature versions of the quality resistor. They’re designed to be mounted
directly onto the printed circuit and adjusted only the circuit is constructed. {Forexample|
forinstance as Associate in Nursing example} to line the frequency of an alarm tone or the
sensitivity of a sensitive circuit. little screwdriver or similar tool is needed to regulate presets.
Presets area unit less expensive than customary electrical device|rheostat|resistor|resistance} s
so that they area unit typically employed in comes wherever a customary variable resistor
would usually be used.
Multiturn presets area unit used wherever terribly precise changes should be created. The
screw should be turned repeatedly (10+) to maneuver the slider from one finish of the track to
the opposite, giving terribly fine management.
PROJECT WORKING
CHAPTER 8
CONCLUSION & FUTURE SCOPE
8.1 Conclusion