[go: up one dir, main page]

0% found this document useful (0 votes)
34 views10 pages

Experiment No 1

Its a experiment for embedded system students for practice

Uploaded by

mhrasim15
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)
34 views10 pages

Experiment No 1

Its a experiment for embedded system students for practice

Uploaded by

mhrasim15
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/ 10

Experiment No.

1
Introduction to Arduino Uno and its programming

Introduction
This lab describes the Arduino basic theory and software description that are commonly
used in embedded system. In this lab, we have to learn the basic steps in the software
which is used for programming in Arduino.
LAB Objectives
 Understand the basic theory of microcontroller (Arduino)
 Understand the basic hardware description of Arduino
 Understand the software which is used for programming in Arduino

LAB Outcomes
By the end of this experiment, student will have basic understanding the Arduino
features and its programming.

Theory Overview

Arduino is open-source electronics prototyping platform based on flexible, easy-to-use


hardware and software. It's intended for artists, designers, hobbyists and anyone interested
in creating interactive objects or environments. The Arduino is an open source
microcontroller platform that you use for sensing both digital and analog input signals
and for sending digital and analog output signals to control devices. That definition is
quite a mouthful. Before we delve into programming the Arduino, let’s take some time to
look at what it’s all about

 Arduino Hardware
The Arduino board is where your code is executed. The board can only control and
respond to electricity, so specific components are attached to it to enable it to
interact with the real world. These components can be sensors, which can be
convert some aspect of the physical world to electricity so that the board can sense
it or actuators, which get electricity from the board convert it in to something that
changes the world.
Figure 4.1 Arduino Board Description

Figure 4.2 Arduino Board Description

Examining the Arduino Uno


At the time of this writing, the Arduino Uno R3 is the current main board in the Arduino family.
It’s the most commonly used unit for interacting with projects that require a simple
microcontroller. The Uno R3 unit provides the following:
 14 digital I/O interfaces
 6 analog input interfaces
 6 PWM interfaces
 1 I2C controller interface
 1 SPI controller interface
 1 UART serial interface, connected to a USB interface

We need to be familiar with the Arduino pins, so these pins are discussed as follows
Each of the 14 digital pins on the Uno can be used as an input or output using pinMode(),
digitalWrite(), and digitalRead() functions. They operate at 5 volts. Each pin can
provide or receive a maximum of 40 mA and has an internal pull-up resistor (disconnected
by default) of 20-50 K ohms. In addition, some pins have specialized functions:

 Serial: 0 (RX) and 1 (TX). Used to receive (RX) and transmit (TX) TTL serial data.
These pins are connected to the corresponding pins of the ATmega8U2 USB-to- TTL
Serial chip.
 External Interrupts: 2 and 3. These pins can be configured to trigger an interrupt on a
low value, a rising or falling edge, or a change in value.
 PWM: 3, 5, 6, 9, 10, and 11. Provide 8-bit PWM output with the analogWrite ()
function.
 SPI: 10 (SS), 11 (MOSI), 12 (MISO), 13 (SCK). These pins support SPI
communication using the SPI library.
 LED: 13. There is a built-in LED connected to digital pin 13. When the pin is HIGH
value, the LED is on, when the pin is LOW, it's off.
The Uno has 6 analog inputs, labeled A0 through A5, each of which provide 10 bits of
resolution (i.e. 1024 different values). By default they measure from ground to 5 volts,
though is it possible to change the upper end of their range using the AREF pin and the
analogReference() function. Additionally, some pins have specialized functionality:
 AREF. Reference voltage for the analog inputs. Used with analogReference().
 Reset. Bring this line LOW to reset the microcontroller. Typically used
to add a reset button to shields which block the one on the board.

Examining the Arduino Architecture


The developers with the Arduino project have built a completely self-contained microcontroller
system on a single circuit board that you can plug into just about any embedded system. The core
of the Arduino project is the microcontroller chip that it uses. To be able to program the Arduino,
you’ll want to know a little about what’s going on “under the hood.”
The ATmega AVR Microcontroller Family
The Arduino developers selected the Atmel ATmega AVR family of microcontroller chips to
power the Arduino. The ATmega AVR microcontroller is an 8-bit computer that contains several
features built in: Flash memory for storing program code statements Static random-access memory
(SRAM) for storing program data Erasable electronic programmable read-only memory
(EEPROM) for storing long-term data Digital input and output ports Analog-to-digital converter
(ADC) for converting analog input signals to digital format The ATmega AVR chip is a complete
microcontroller system built in to a single chip. That allows the Arduino developers to create a
small circuit board with minimal external components. The Arduino series uses several different
ATmega processors. Table 1.1 shows the different ATmega processors you’ll find in Arduino
units.
Processor Flash SRAM EEPROM
ATmega48 4KB 512B 256B
ATmega88 8KB 1KB 512B
ATmega168 16KB 1KB 512B
ATmega328 32KB 2KB 1KB
ATmega32u4 32KB 2.5KB 1KB
Table 1.1 ATmega Processor Family

 Arduino Software
Software programs called sketches are created on a computer using Arduino integrated
development environment IDE. The IDE enables to edit or write a code and convert this
code in to instructions that Arduino hardware understands. The open-source Arduino
environment makes it easy to write code and upload it to the i/o board. This link you can
download the software needed from: http://Arduino.cc/en/Main/Software The software
doesn’t need to be setup jest run the program normally.

The following procedure shows how to use Arduino software.

Step 1- First start Arduino program then the following figure should appear as
shown in figure 4.2
\
\\\\\

Figure 4.2 default window for programming

Step 2- Click tools and check the board Arduino Uno is chosen (“This option
can be changed according to the Arduino’s type needed to be programmed”)
shown in figure 4.3

Figure 4.3 Selection of Board


Step 3- Start writing or choosing the program needed to be transferred to the
Arduino. Choose the program from the examples built in the software as shown in
figure 4.4

Figure 4.4 choose the examples

Step 4- Choose a simple example like blink as shown in figure 4.5


Figure 4.5 choose the example Blink

Step 5- New window will open as follows click upload button then the software will
compile the program for errors and then upload it to the Arduino as shown in figure 4.6

Upload button

Figure 4.6 After completion click the upload button


Lab Task
Make a project for blinking an LED which is attached on pin 13 Arduino with some delay.

Equipment / Apparatus
 Arduino Kit
 DC Power Supply 5 Volt
 Digital Multimeter
 Breadboard
 Resistors 10 Ω to 1kΩ
 LED’s
 Wires
Schematic Diagram

Figure 4.7 circuit diagram


Arduino C Program

int LED=13;
void setup ( )
{
pinMode(LED, OUTPUT);
}

void loop ( )
{
digitalWrite (LED, HIGH);
delay(500);
digitalWrite (LED, LOW);
delay(500);
}

Observation, Results and Discussion

After program the code inside Arduino check the status of LED on your
breadboard and fill the table 1.2

Table 1.2 LED blinking observation chart


Arduino digital input pin no:

Arduino voltage supply:

Resistor Value:

Time Delay :

LED blinking Yes


/ NO :

Precautions
Before you start to mess with a computer there are basic guidelines to be aware of,
such as turn the power off and watch out for static electricity. The three kind of
activity that requires touching the Arduino

 Setting up wire, component layout or breadboard.


 Debugging a running setup.
 Moving, mounting up the board somewhere.
LAB Review Questions

Question 1
Write a C code in Arduino for blinking an LED on pin number 8 in Arduino with some
specified delay. Also sketch the circuit diagram and paste the hardware resultalso

Question 2
Write a C code in Arduino for blinking an LED on pin number 8 ,7 in Arduino with some
specified delay. Also sketch the circuit diagram and paste the hardware result also.

Question 3
Write a C code in Arduino to perform a simple sequential program to turn ON and Turn
OFF 6 LEDS sequentially. Also sketch the circuit diagram and paste the hardware result
also.

LAB Assessment

Student Name LAB Rubrics CLO3 , P5, PLO3


Total Marks 10
Registration No Obtained Marks

Teacher Name Syed M Hamedoon

Date Signature

You might also like