0% found this document useful (0 votes)
595 views14 pages

Arduino Embedded System Design

This document discusses designing an automatic home light and fan controller system using an Arduino microcontroller. It provides background on embedded systems and Arduino, describes the components used including an Arduino Mega microcontroller, light dependent resistor and temperature sensor. It presents the circuit diagram and Arduino code for the system, which controls lights and fans based on light level and temperature readings. The system was simulated using Proteus simulation software.

Uploaded by

abreham ashebir
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
595 views14 pages

Arduino Embedded System Design

This document discusses designing an automatic home light and fan controller system using an Arduino microcontroller. It provides background on embedded systems and Arduino, describes the components used including an Arduino Mega microcontroller, light dependent resistor and temperature sensor. It presents the circuit diagram and Arduino code for the system, which controls lights and fans based on light level and temperature readings. The system was simulated using Proteus simulation software.

Uploaded by

abreham ashebir
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 14

Bahir Dar University

Bahir Dar institute of Technology


Department of Software Engineering
Recent topics in Software engineering Assignment

Designing Embedded System


With Arduino
(Automatic Home light and Fan Controller)
Group Members
Name ID
Gizealew Abere ---------------------------- 0801667
Tamiru Agalneh ---------------------------- 0801805
Firehiwot Ertibu --------------------------- 0801646
Abreham Ashebir --------------------------- 0801532
Aynalem Teshome -------------------------- 0801569

Submitted to: Mr. Awol

Submission Date: 22/05/2012 E.C


Table of Contents
Introduction to Embedded System .................................................................................................. 1
Arduino Variants ............................................................................................................................. 2
Arduino IDE.................................................................................................................................... 3
Basic Functions ............................................................................................................................... 4
Structure .......................................................................................................................................... 4
Digital and Analog I/O Functions ................................................................................................... 5
Application areas of Embedded System ......................................................................................... 5
Automation Systems: .................................................................................................................. 6
Security Systems: ........................................................................................................................ 6
Appliances ................................................................................................................................... 6
Advantages of embedded systems: ................................................................................................. 6
Disadvantages of embedded systems: ............................................................................................. 7
Automatic Home Light and Fan Controller using Arduino With Proteus Simulation ................. 7
Components used for the System .................................................................................................... 7
Hardware Components ................................................................................................................ 7
Software Components ................................................................................................................. 7
How it Works .................................................................................................................................. 8
Circuit Diagram and simulation ...................................................................................................... 9
Arduino Code ................................................................................................................................ 10
REFERENCES ............................................................................................................................. 12

Table of Figure

Figure 1. Embedded system integration......................................................................................... 1

Figure 2. Arduino Mega board........................................................................................................ 3

Figure 3. Arduino IDE .................................................................................................................... 4

Figure 4. How LDR and T0 sensor works with Arduino ............................................................... 8

Figure 5. Proteus simulation of the system ..................................................................................... 9

i|
Designing Embedded System Using Arduino

Introduction to Embedded System

An embedded system is a microcontroller or microprocessor based system which is designed to


perform a specific task. It is a combination of computer software and hardware which is either
fixed in capability or programmable, and it can be either an independent system, or it can be a part
of a large system. It is mostly designed for a specific function or functions within a larger system
An embedded system has three components:
 Hardware: Processor, Timers, Interrupt controller, I/O Devices, Memories, Ports, etc.
 Application software: Which may perform concurrently the series of tasks or multiple
tasks.
 Real Time Operating system (RTOS): RTOS defines the way the system work. Which
supervise the application software. An embedded system is software designed to keep in
view three constraints:
 Available system memory
 Available processor speed
 The need to limit the power dissipation
When running the system continuously in cycles of wait for events, run, stop and wakeup. This
helps the system

Figure 1. Embedded system integration

1| Recent topics in Software Engineering


Designing Embedded System Using Arduino

A microcontroller is a functional computer system-on-a-chip. It contains a processor, memory,


and programmable input/output peripherals• Microcontrollers include an integrated CPU, memory
(a small amount of RAM, program memory, or both) and peripherals capable of input and output.
Arduino is an open-source microcontroller that enables programming and interaction; it is
programmed in C/C++ with an Arduino library to allow it to access the hardware. This allows for
more flexible programmability and the ability to use electronics that can interface with Arduino.
Because Arduino is open source, the plans for the circuits are available online for free to anyone
who wants to use and create their own board based on the schematics, as long as they share what
they create. This allows for considerable customizability in projects; till date, users have built
Arduinos of different sizes, shapes, and power levels to control their projects. Embedded systems
are computer systems that can either have a user interface like graphical user interfaces (GUI) or
no user interface at all. “Embedded systems can be microprocessor or microcontroller based. In
either case, there is an integrated circuit (IC) at the heart of the product that is generally designed
to carry out computation for real-time operations. Arduino is composed of two major parts:
1. The Arduino board, which is a piece of hardware you work on when you build your objects.
2. The Arduino IDE, which is a piece of software you run on your computer. You use the IDE to
create a sketch (a small computer program) that you upload to the Arduino board.

Arduino Variants
Arduino is rapidly becoming one of the most popular microcontrollers used in robotics. There are
many different types of Arduino microcontrollers that differ not only in design and features, but
also in size and processing capabilities. However, there are only two models that use completely
different chips: the Standard and the
Mega. The Standard is the basic Arduino that uses the Atmega8/168/328 chip, whereas the Mega
is a different Arduino board with more I/O pins and uses the beefier Atmega1280 chip. These are
some of Arduino board types developed by the Arduino Company.

 Arduino Nano
 Arduino Uno
 Arduino Due
 Arduino Mega 2560
 Arduino Pro
 Arduino Ethernet

2| Recent topics in Software Engineering


Designing Embedded System Using Arduino

 Arduino Micro
 Arduino Leonardo
 Arduino Esplora
For our system we use Arduino Mega 2560 due to the fact that Arduino boards use SRAM
(Static Random-Access Memory). The Mega 2560 has the most SRAM space with 8 kB,
which is 4x more than the Uno, and 3.2x more than the Micro. With more SRAM space,
the Arduino has more space to create and manipulate variables when it runs. This the reason
behind which makes Arduino Mega2560 is widely used and available.

Figure 2. Arduino Mega board

Arduino IDE
The IDE is split up into the Toolbar across the top, the code, or Sketch Window in the center and
the Serial Output window at the bottom. The Toolbar consists of 5 buttons, underneath the Toolbar
is a tab, or a set of tabs, with the filename of the code within the tab. There is also one more button
on the far right hand side. Along the top is the file menu with drop-down menus with the headers
File, Edit, Sketch, Tools, and Help. The buttons in the Toolbar provide convenient access to the
most commonly used functions within this file menu.

3| Recent topics in Software Engineering


Designing Embedded System Using Arduino

Basic Functions
The code you learn to write for your Arduino is very similar to the code you write in any other
computer language. This implies that all the basic concepts remain the same and it is simply a
matter of learning a new dialect. In the case of Arduino, the language is based on the C/C++ and
can even be extended through C++ libraries. The IDE enables you to write a computer program,
which is a set of step-by-step instructions that you then upload to the Arduino. Your Arduino will
then carry out those instructions and interact with whatever you have connected to it. The Arduino
includes many basic embedded functions, such as the functions for reading and writing to digital
and analog input and output pins, interrupt functions, mathematical functions, and serial
communication functions. Arduino functions are a convenient way to write code such as those for
device drivers or commonly used utility functions.

Structure
The basic function of the Arduino programming language is fairly simple and runs in at least two
parts. These two required parts, or functions, enclose blocks of statements.

Figure 3. Arduino IDE

Setup(): A function present in every Arduino sketch. Run once before the loop() function. The
setup() function should follow the declaration of any variables at the very beginning of the
program. It is the first function to run in the program, is run only once, and is used to set pinMode
or initialize serial communication.

4| Recent topics in Software Engineering


Designing Embedded System Using Arduino

loop(): A function present in every single Arduino sketch. This code happens over and over
again—reading inputs, triggering outputs, etc. The loop() is where (almost) everything happens
and where the bulk of the work is performed.

Digital and Analog I/O Functions


Digital I/O will allow us to read the state of an input pin as well as produce a logical high or low
at an output pin. Each bit of a port can be programmed independently; some for input, some for
output, or all of them for the same purpose.
pinMode(pin, mode)
digitalWrite(pin, value)
digitalRead(pin)
analogRead(pin)
analogWrite(pin)
Delay (milis)
DelayMicroseconds (us)

Application areas of Embedded System

Applications of embedded systems are applicable in areas like


Space
Communication Education
Transportation Military
Robotic systems Industry
Home appliances

This document is intended to give information about the embedded system applications. Based on
the performance requirements, these systems are categorized into four types such as standalone,
networked, mobile and real time embedded systems.
Some of its application on selected areas are explained bel

5| Recent topics in Software Engineering


Designing Embedded System Using Arduino

Automation Systems:
In modern era, we are all aware of Automation systems. Whether you are at home or your office,
if things are not automated then it can make your work quite difficult. We don't need to go far, let's
take the example of remote control. IT has made our life so easy now we can turn things on or off
by simply clicking buttons on our remote control. Smart Home automation is a widely diverse
application of embedded systems. From curtains to doors, lights or fans, everything is controlled
by a simple remote for the ease of use.

Security Systems:
Now coming towards security systems, these are all the fruits of embedded systems. These days
we have sensors installed in our homes and even if you are not at home you can still get complete
visuals camera feeds on your mobile from anywhere in the world. That became possible just
because of embedded systems.
Appliances:
Most of our home appliances, like kitchen appliances which we normally called electronics
products are actually embedded products. Microwave Ovens, Toasters, Burners, in fact, even
modern irons are also embedded products.
Gaming routers, photocopiers, media players and music systems et, they are all in our hands
because of embedded systems. So, there's a lot of such real-life applications of embedded systems
and without them, we can't even take a single step. I hope you have enjoyed today's tutorial. Let
me know any application of embedded systems which has influenced your life in comments.

Advantages of embedded systems:


• Small, so they are faster to load
• Low price
• Low power consumption
• Easy to manage
• They have strongly built and constituted operating ranges which means they work
effectively in a large temperature range.

6| Recent topics in Software Engineering


Designing Embedded System Using Arduino

Disadvantages of embedded systems:


• Much harder to program and interact with since it means they have limited processing
resources
• Hard to upgrade and repair
• Difficult to transfer data from one system to another (Serial)
• The embedded system will lose a substantial amount of money if it shuts off

Automatic Home Light and Fan Controller using Arduino With


Proteus Simulation
It is a way of controlling room light and temperature fan automatically. To do this embedded
system application we use different sensors to act accordingly. We use LDR sensors to sense the
existence of light intensity level and used to turn room light ON and OFF, and Temperature sensor
to read the temperature of the room to turn the fan ON and OFF automatically depending the
threshold value provided by the programmer.

Components used for the System


We use different tools and components to simulate this embedded application. These are Hardware
and software components.
Hardware Components
Arduino Mega2560 LDR sensor
LED Wire
Temperature cooler (Fan) Breadboard
Resistor and LCD display
Software Components
Arduino IDE
Proteus 8.0

7| Recent topics in Software Engineering


Designing Embedded System Using Arduino

How it Works
This system works by sensing the intensity of light and the level of temperature in its environment.

Light
Temperature

LDR
T0 Sensor
Sensor

Arduino Mega2560

Relay

Figure 4. How LDR and T0 sensor works with Arduino

8| Recent topics in Software Engineering


Designing Embedded System Using Arduino

The sensor that can be used to detect light is an LDR and the sensor used to read level of
temperature is T0 sensor. When the sensor reading from the LDR sensor becomes higher than the
threshold provided, the room light becomes ON otherwise OFF.
When the sensor reading from the T0 sensor becomes higher than the threshold provided, the room
fan becomes ON otherwise OFF.

Circuit Diagram and simulation

Figure 5. Proteus simulation of the system

9| Recent topics in Software Engineering


Designing Embedded System Using Arduino

Arduino Code
#include <LiquidCrystal.h> // library for LCD display
int pin1=A1;
int val1;
int val;
int ldr=A2;
int led=A3;
const int rs = 12, en = 11, d4 = 5, d5 = 4, d6 = 3, d7 = 2;
LiquidCrystal lcd(rs, en, d4, d5, d6, d7);

void setup() {
lcd.begin(16, 2);
pinMode(10,OUTPUT);
pinMode(9,OUTPUT);
pinMode(8,OUTPUT);
pinMode(7,OUTPUT);
pinMode(13,OUTPUT);
pinMode(6,OUTPUT);
pinMode(led,OUTPUT);
}
void loop() {
digitalWrite(13, HIGH);
digitalWrite(6, HIGH);
val=analogRead(pin1);
val1=analogRead(ldr);;
float vm=(val/1024.0)*5000;
float cel=vm/10;
// set the cursor to column 0, line 1
// (note: line 1 is the second row, since counting begins with 0):
lcd.setCursor(0, 0);
lcd.print("Temp=");

10 | Recent topics in Software Engineering


Designing Embedded System Using Arduino

lcd.print(cel);
lcd.print( "*C");
lcd.setCursor(0, 1);
lcd.print("LDR=");
lcd.print(val1);

LDRsensor();// function calling for LDR sensor reading

if(cel>=37){
digitalWrite(8,LOW);
digitalWrite(7,LOW);
}
else{
digitalWrite(8,HIGH);
digitalWrite(7,HIGH);
}
}
void LDRsensor(){
if(val1<=200){
digitalWrite(led,HIGH);
}
else{
digitalWrite(led,LOW);
}
}

11 | Recent topics in Software Engineering


Designing Embedded System Using Arduino

REFERENCES
http://internetofthingsagenda.techtarget.com/definition/embedded-system
https://en.wikipedia.org/wiki/Embedded_system
https://en.wikipedia.org/wiki/Operating_temperature
https://en.wikipedia.org/wiki/Real-time_operating_system
https://simple.wikipedia.org/wiki/Real-time_operating_system
http://www.itrelease.com/2016/12/advantages-disadvantages-embedded-operating-system/
https://ubiquity.acm.org/article.cfm?id=1086450

12 | Recent topics in Software Engineering

You might also like