Professional Documents
Culture Documents
On
GUI BASED DEVICE CONTROL USING ARDUINO
PROCESSING
Submitted to
BACHELOR OF TECHNOLOGY
In
Electronics & Communication Engineering
Submitted by
K. Asritha 18E31A0450
K. Sai Prasanna 18E31A0451
K. Prashanth 18E31A0452
Under the Guidance
Of
V. Himaja M. Devaraju Dr. Jaspal
kumar
Assistant Professor Associate Professor Professor
Internal Guide Project Co-Ordinator Head of the
Dept
CERTIFICATE
This is certify that the project work entitled “RFID based electronic health card”
is submitted by
K. Asritha 18E31A0450
K. Sai Prasanna 18E31A0451
K. Prashanth 18E31A0452
It is indeed a great pleasure and immense satisfaction for us to express our deep
sense of gratitude, to our project Guide V. Himaja, and Project Coordinator Mr.
M. Devaraju, Associate professor in the Electronics and Communication
Engineering department, for their guidance in the completion of the project.
We convey our sincere gratitude to Dr. Jaspal Kumar, Professor, and Head of
the Department of Electronics and Communication Engineering for his
encouragement in the completion of the project.
K. Asritha 18E31A0450
K. Sai Prasanna 18E31A0451
K. Prashanth 18E31A0452
ABSTRACT
Within the ambit of wireless technology, appearance of remote control based devices
and appliances have become the order of the day. It reduces human affords and increase the
efficiency. Every sector needs automation, ranging from home to industries. Automation
Systems perform by allowing a number of devices to communicate with a central controller
which in turn communicates all information to the user or the owner of the system as per the
instructions and the structure of the system. The application of such automation systems could
be in areas such as heating, lighting, defense, energy management, audio and video systems,
health monitoring, and entertainment. Keeping all these facts in mind, this paper propose a
system which based on GUI controlling through a PC(personal computer) or LAPTOP.
Automation is the use of control devices such as PC/PLCs/PACs etc. to control industrial
processes and machinery by removing as much labour intervention as possible, and replacing
dangerous assembly operations with automated ones. Automation is a broad term applied to
any mechanism that moves by itself or is self dictated. Here we use Arduino processing
software for making GUI application for controlling devices.
CONTENTS
Chapter 1: INTRODUCTION
1.1 Introduction 01
1.2 Existing System 02
1.3 Proposed System
1.4 Block Diagram
1.5 Hardware Requirements
1.6 Software Requirements
2.1 Introduction 05
2.2 History and Future
2.3 Real Time Systems
2.4 Application Areas
2.4.1 Consumer Appliances
2.4.2 Office Automation
2.4.3 Industrial Automation
2.4.4 Medical Electronics
2.4.5 Computer Networking
2.4.6 Telecommunications
2.4.7 Wireless technologies
2.4.8 Insemination
2.4.9 Security
2.4.10 Finance
2.5 Overview of Embedded System Architecture
2.5.1 Central Processing Unit
2.5.2 Memory
2.5.3 Input Devices
2.5.4 Output Devices
2.5.5 Communication Interfaces
2.5.6 Application – Specific Circuitry
2.6 Conclusion
Chapter 3: ARDUNIO AND ITS ARCHITECTURE
3.1 Introduction to Microcontrollers
3.1.1 Forms of Microprocessors
3.1.2 How are Microcontrollers totally different from Microprocessors
3.1.3 How are Microcontrollers classified
3.1.4 Classification based on Bits
3.1.5 Classification based on Memory Devices
3.2 Arduino Microcontroller
3.2.1 Features
3.3 ATMEGA 328 Pinout
3.3.1 Pin Description
3.4 Overview
3.4.1 Comparison between Processors
3.4.2 ATMEGA 328
3.5 Introduction about Embedded Systems
3.5.1 Applications
Chapter 4: SOFTWARE IMPLEMENTAION
4.1 Software Requirements
4.1.1Proteus Software 09-10
4.1.2 “Arduino” What does it mean?
4.1.2.1 Why Arduino?
4.2 Arduino IDE Introduction
4.2.1 File Description
4.2.2 Edit Description
4.2.3 Sketch Description
4.2.4 Tools Description
4.2.5 Help Description
4.3 Libraries
4.4. Making Pins Input or Output
4.5 How to Select the Board
4.6 Bootloader
4.7 Android Application 11-12
4.8 Arduino Histroy
4.8.1 Types of Arduino
4.9 Proteus Software
4.10 Processing Arduino Software
Chapter 5: HARDWARE IMPLEMENTATION
5.1 Power Supply
5.1.1 Step-Down Transformer
5.1.2 Rectifier Unit
5.1.3 Input Filter
5.1.4 Regulator Unit
5.2 Arduino UNO
5.21 ATMEGA 328 Pinout
5.2.2 Pin Descriptions
5.2.3 Overview
5.2.4 Arduino Board
5.2.5 Arduino Technology
5.2.6 Digital Inputs
5.2.7 How to program an Arduino?
5.2.8 Arduino Program
5.2.9 Comparison Between Processors
5.210 ATMEGA 328
5.3 LCD (Liquid Crystal Display)
5.4 Relay
5.5 AC Lamp
5.6 Fan
Chapter 6: RESULTS
6.1 SNAPSHOTS 60
6.2 ADVANTAGES 61
6.3 DISADVANTAGES
61
6.4 APPLICATIONS 61
Chapter 7: CONCLUSION & FUTURE SCOPE
7.1 CONCLUSION 62
7.2 FUTURE SCOPE 63
Chapter 8: REFERENCE 64
CHAPTER 1
INTRODUCTION
1.1 INTRODUCTION
While these systems simplify a given infrastructure, their components are quite complex.
There are five essential composing parts of a SCADA system:
The uses of a pointer that serves as navigation to interact with different visually
appealing Graphical icons. Abstraction is a major concept that has been used in a GUI
operating system. Users can use the pointer to click on the icon, which initiates a series of
actions. Normally an application or functionality will get started. Then the user will have to
provide input or tasks to generate the desired action from the machine. The GUI actually
translates user language, which comprises simple one-line commands, single click and double
clicks to machine language or assembly language. The machine understands machine
language, and hence the machine responds to the task initiated, which is translated to use
language and communicated to the user via GUI.
1.2 EXISTING SYSTEM
Previously existing system before the graphical user interface doesn’t have the
software to interact with the devices in graphical mode instead they use text or command
based interface to control the devices. The existing system doesn’t have the software that
represents the data in the form of symbols, shapes and icons. Using symbols and other
graphical representations of data means that it can be recognized faster than textual forms.
Especially for a non-programmer, it is convenient since they don't have to know much about
computing commands. They are free from the task of writing and debugging codes. Therefore,
users can find GUI an interface that is much easier to learn.
The previous existing system before the automation is manual working. In manual
working human intervention is more and it is impossible to control several devices at a time.
Manual systems put pressure on people to be correct in all details of their work at all times,
the problem being that people aren’t perfect, however much each of us wishes we were. With
manual systems the level of service is dependent on individuals and this puts a requirement on
management to run training continuously for staff to keep them motivated and to ensure they
are following the correct procedures. It can be all to easy to accidentally switch details and
end up with inconsistency in data entry or in hand written orders. This has the effect of not
only causing problems with customer service but also making information unable be used for
reporting or finding trends with data discovery. Reporting and checking that data is robust can
be timely and expensive. This is often an area where significant money can be saved by
automation. In manual working continuous mass production 24/7 is not possible so it
decreases productivity and increases assembly times and in manual working the adaptive
&monitoring in different stages is impossible so it results in human error and thus decrease the
quality and homogeneity of the products manufactured.
Regulated DC Power
Supply
Processing
software
REALY + DC
Fan
CHAPTER -2
2.1 Introduction
All the topics and examples presented in this book are applicable to the designers of real-
time system who is more delight in his work. He must guarantee reliable operation of the
software and hardware under all the possible conditions and to the degree that human lives
depend upon three systems’ proper execution, engineering calculations and descriptive
paperwork.
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.7 Wireless technologies:
Advances in mobile communications are paving way for many interesting applications
using embedded systems. The mobile phone is one of the marvels of the last decade of the
20’h century. It is a very powerful embedded system that provides voice communication
while we are on the move. The Personal Digital Assistants and the palmtops can now be used
to access multimedia services over the Internet. Mobile communication infrastructure such as
base station controllers, mobile switching centers are also powerful embedded systems.
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.
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.
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.
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:
3.2.1Features:
GND
Ground.
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 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.
3.1.2 ATmega328:
MUR(4)
ATmega328-PU
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
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.
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.
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.
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.
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…,
Used for copying and pasting the code with further modification for font
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.
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.
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
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.
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.
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.
Processing is an open source programming language and environment for people who
want to program images, animation, and interactions. It is used by students, artists, designers,
researchers, and hobbyists for learning, prototyping, and production. It is created to teach
fundamentals of computer programming within a visual context and to serve as a software
sketchbook and professional production tool. Processing is developed by artists and designers
as an alternative to proprietary software tools in the same domain.
We will make the communication between the Arduino and Processing. We will make the
communication in both the ways, from the Arduino to Processing and from Processing to the
Arduino. We will change the color of the serial window in the Processing IDE through the
potentiometer value sent from the Arduino IDE. We will turn the LED ON and OFF
depending upon the mouse button pressed in the Processing Serial window.
• Mark a word in the Processing code and ctrl click (Macintosh) on it to display
Each sketch resides in its own folder where the main program file is located with
the ending “.pde”. You can browse to this folder by choosing Sketch > Show
Example:
Sketch name: “Sketch_01", the directory for the sketch will be called "Sketch_01",
About Processing
Processing is a great source for creating graphics. The Processing IDE works for a
computer like the Arduino IDE works for a micro-controller. The Processing IDE is similar
to Arduino in terms of structure. It has setup functions and draw functions like an Arduino
has a setup and loop function. The Processing IDE can communicate with the Arduino IDE
through serial communication. This way, we can send data from the Arduino to the
Processing IDE and also from the Processing IDE to the Arduino.
InstallingProcessing
If you do not have already installed the Processing IDE, then you need to install it first.
To install it, go to the link below and download the latest version of processing
IDE. https://processing.org/download/
After downloading the latest version, open the Processing IDE setup and install it. After
installing, open the Processing IDE and you will see something like this.
Looks a lot like Arduino, huh? The Arduino software was actually based in part off of
Processing - that's the beauty of open-source projects. Once we have an open sketch, our first
step is to import the Serial library. Go to Sketch->Import Library->Serial, as shown below:
If you hit the 'run' button (and your Arduino is plugged in with the code on the previous page
loaded up), you should see a little window pop-up, and after a sec you should see `Hello,
World!' appear in the Processing console. Over and over. Like this:
Arduino Circuit Diagram:
The connections for this tutorial are very easy. Connect the two end pins of the 1k
potentiometer to the 5V and the GND pin of the Arduino. Then connect the middle pin of the
potentiometer to the A0 on Arduino. Then connect the positive pin of the LED to pin 7 on the
Arduino and the negative pin of the LED to the GND pin through the 220 ohm resistor.
How Does It Work?
The Arduino IDE and the Processing IDE will communicate with each other through serial
communication. The Processing IDE has a serial library which makes it easy to communicate
with the Arduino.
When we move the potentiometer knob, the Arduino will send a value between 0 and 255 to
the Processing IDE. The Processing IDE will then change the color of the serial window
according to the movement of the potentiometer knob.
Similarly, when we press the mouse button in the serial window of the Processing IDE, the
Processing IDE will send a ‘1’ or ‘0’ depending on the left or right mouse button to the
Arduino IDE. The Arduino IDE will then turn the LED ON or OFF according to the button
pressed.
CHAPTER-5
HARDWARE IMPLEMENTATION
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:
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
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.
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 control
applications.
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.
A typical example of the Arduino board is Arduino Uno .It includes an ATmega328
microcontroller and it has 28-pins
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
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.
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
Fig.5.12:Programming an Arduino
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).
Fig.1.14: 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.
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.
POTENTIOMETER:
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}
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.
5.4 RELAY
Relay could be an important device currently days. They’re utilized in varied circuits and
lots of people have drawback of a way to use a relay. With the assistance of this text I
actually have tried to clarify 2 things.
1.Operation of relay
2. The way to use a relay
As we all know relay could be a device that is employed to supply association between 2 or a
lot of points or device in response to the sign applied. In another words relay offer isolation
between the controller and therefore the device as we all know devices may go on AC yet as
on DC. However, they receive signals from microcontroller that works on DC thus we have a
tendency to need a relay to bridge the gap. Relay is very helpful after you have to be
compelled to management an outsized quantity of current or voltage with tiny electrical
signal.
Parts of Relay Switch
There are a unit five elements in each relay -
1. Electromagnet- It consists of iron core wounded by coil of wires. Once electricity is tried
and true it become magnetic thus it's referred to as magnet.
2. Armature-The movable magnetic strip is thought as coil. Once current flows through
them, it energizes the coil and turn out force field that is employed to form or break the
usually open (N/O) or usually shut (N/C) points. Coil is affected with electrical energy (DC)
yet as AC (AC).
3. Spring - once no current flow through coil magnet, the spring pulls the coil away so circuit
can't be completed.
4. Set of electrical contacts- There are a unit 2 contact points:
A. usually open-In this device connected to that can work once relay is activated and
disconnect it once relay is inactive.
B. usually close- during this the device connected to that won't work once relay is activated
and therefore the circuit is connected once relay is inactive.
5. Moulded frame-Relays area unit coated with plastic or glass so we are able to observe its
operating while not gap or removing its cowl.
5.5 AC LAMP
An incandescent lightweight bulb, {incandescent lamp| light bulb| light bulb| bulb|
electric bulb} or incandescent lightweight globe is an electrical lightweight that produces light
with a wire filament heated to a warm temperature by an electrical current passing through it,
till it glows (see Incandescence). the new filament is protected against chemical reaction with
a glass or quartz bulb that's crammed with chemical element or exhausted. in a very grouping
lamp, filament evaporation is prevented by a natural process that re deposits metal vapor onto
the filament, extending its life. the sunshine bulb is furnished with electrical phenomenon by
feed-through terminals or wires embedded within the glass. Most bulbs square measure
employed in a socket that provides mechanical support and electrical connections.
Incandescent bulbs square measure a lot of less economical than most different styles
of electrical lighting; incandescent bulbs convert but five-hitter of the energy they use into
actinic ray (with the remaining energy being reborn into heat). The aglow effectiveness of a
typical incandescent bulb is sixteen lumens per watt, compared to the sixty lm/W of a
compact fluorescent bulb. Some applications of the incandescent bulb deliberately use the
warmth generated by the filament. Such applications embrace incubators, brooding boxes for
poultry, heat lights for reptilian tanks, infrared heating for industrial heating and drying
processes, lava lamps, and also the Easy-Bake kitchen appliance toy. Incandescent bulbs
generally have short lifetimes compared with different styles of lighting; around one,000
hours for home lightweight bulbs versus generally ten,000 hours for compact fluorescents and
thirty,000 hours for lighting LEDs.
5.6 FAN
A mechanical fan may be a machine wont to produce flow among a fluid, usually a
gas like air. The fan consists of a rotating arrangement of vanes or blades that act on the
fluid. The rotating assembly of blades associate degree hub is understood as an vane, a
rotor, or a runner. Usually, it's contained among some style of housing or case. This could
direct the flow of air or increase safety by preventing objects from contacting the fan
blades. Most fans square measure battery-powered by electrical motors, however different
sources of power could also be used, as well as hydraulic motors and combustion engines.
Fans turn out flows with high volume and air mass (although on top of close pressure), as
against compressors that turn out high pressures at a relatively low volume. an
acquaintance blade can usually rotate once exposed to a fluid stream, and devices that cash
in of this, like anemometers and wind turbines, usually have styles like that of an
acquaintance.
Typical applications embody climate management and private thermal comfort (e.g.,
an electrical table or floor fan), vehicle and machinery cooling systems, ventilation, fume
extraction, winnow (e.g., separating chaff of cereal grains), removing mud (e.g. during a
vacuum cleaner), drying (usually together with heat) and to produce draft for a fireplace.
whereas fans square measure usually wont to cool folks, they are doing not really cool air
(if something, electrical fans heat it slightly because of the warming of their motors),
however work by phase transition cooling of sweat and augmented heat convection into
the encompassing air because of the flow of air from the fans. Thus, fans could become
ineffective at cooling the body if the encompassing air is close to temperature and contains
high humidness. additionally to their utilitarian perform, vintage or antique fans, and
above all electrical fans factory-made from the late nineteenth century through the
Nineteen Fifties, became a recognized collectible category; as an example, in the U.S.A.
there's the Antique Fan Collectors Association.
CHAPTER 6
PROJECT WORKING
The GUI based device control using Arduino Processing has been presented. Here an
elaborate and immaculate discussion of all our associated work pertaining to the study, that
includes GUI , programming and designing of microcontroller for controlling the various
loads.The various loads used in our project demonstrate the functions that are being
performed and hence the communication between the PC and the various devices associated.
Here the PC is sending message to the controller simply by serial communication that
desirably controls the load connected to it. GUI provides the process for transmission of
ASCII character data selected by the user to transcend the information. The converter that is
used here provides the communication between the RS232 port of the PC and USB port of
the microcontroller. All the load devices are connected via computer network preferably to
allow control by a PC, and it allow remote access through the internet. With the integration of
information technologies and the home environment, various systems and appliances are able
to communicate in an efficient manner which results in convenience, energy efficiency, and
safety benefits.