Search for notes by fellow students, in your own course and all over the country.

Browse our notes for titles which look like what you need, you can preview any of the notes via a sample of the contents. After you're happy these are the notes you're after simply pop them into your shopping cart.

My Basket

You have nothing in your shopping cart yet.

Title: EEE Unit 5 Arduino Interfacing Notes
Description: These notes are Useful for Second Year Mechanical Students of Pune University

Document Preview

Extracts from the notes are below, to see the PDF you'll receive please use the links above


Electrical and Electronics Engineering

SE Mech,Sem-II

UNIT-5 NOTES

For

ELECTRONICS AND ELECTRICAL ENGINEERING
(As per 2015 Revised Course of SPPU)

TAE,PUNE

Prof
...
G
...
General Input Output Port (GPIO) Structure:
[Q
...
It is 28 pin IC
...
Explain Port registers of ATMEGA328P]
1
...

2
...

1
...

DDRB - The Port B Data Direction Register - read/write
DDRC - The Port C Data Direction Register - read/write
DDRD - The Port D Data Direction Register - read/write
2
...
PIN register------ Reads the state of INPUT pins set to input
PINB - The Port B Input Pins Register - read only
PINC - The Port C Input Pins Register - read only
PIND - The Port D Input Pins Register - read only

TAE,PUNE

Prof
...
G
...
Thite T
...


3

Electrical and Electronics Engineering

SE Mech,Sem-II

Functions used to access GPIO
[Q
...
pinMode()
Configures the specified pin to behave either as an input or an output
...

Example
pinMode (11, OUTPUT);
2
...

Syntax:digitalWrite(pin, value)
Parameters
pin: the pin number
value: HIGH or LOW
Example
digitalWrite (11, HIGH);
3
...

Syntax: digitalRead (pin)
Parameters
pin: pin number whose value to be read
Example
byte Val = digitalRead (11);
4
...


TAE,PUNE

Prof
...
G
...
Explain interfacing of arduino uno with LED
...
write Sketch/program to interface arduino uno with LED
Q
...
Start
2
...

3
...

4
...

5
...

6
...

7
...
Stop
TAE,PUNE

Prof
...
G
...
Interfacing 16x2 LCD Display
[Q
...


Q
...
write algorithm to interface arduino uno with LCD]
THEORY
In recent years the LCD is finding widespread use replacing LED’s
...
The declining prices of LCD
...
The ability to display numbers, characters, and graphics
...

3
...
In contrast, the LED must be refreshed
by the CPU to keep displaying the data
...
Ease of programming for characters and graphics
...
The
LCD display can be interfaced either in 4-bit interface or 8-bit interface mode
...
Thite T
...


6

Electrical and Electronics Engineering

SE Mech,Sem-II

LCD pin descriptions:
Vcc, Vss and Vee:
While Vcc and Vss provide +5V and ground, respectively, Vee is used for
controlling LCD contrast
...
RS = 0: Used to select command code register
...
RS = 1: Used to select data register, allowing the user to send the data to be
displayed on the LCD
...

Enable (EN):
The enable pin is used by the LCD to latch information presented to its data
pins
...

Pin Assignment of 16x2 LCD
Pin
Symbol Level I/O Function
number
Vss
1
- Power supply (GND)
2
3

-

-

4

RS

0/1

I

5

R/W

0/1

I

6
7
8
9
10
TAE,PUNE

Vcc
Vee

E
DB0
DB1
DB2
DB3

1, 1->0
0/1
0/1
0/1
0/1

I
I/O
I/O
I/O
I/O

Power supply (+5V)
Contrast adjust
0 = Instruction input
1 = Data input
0 = Write to LCD module
1 = Read from LCD module
Enable signal
Data bus line 0 (LSB)
Data bus line 1
Data bus line 2
Data bus line 3

Prof
...
G
...
No
...

Force cursor to beginning of 2nd line
...


Code (Hex)
01
02
04
06
0A
0C
0E
10
14
80
C0
38

LCD FUNCTIONS
1
...

Syntax
lcd
...
begin(16,2);----initializes 16*2 LCD

TAE,PUNE

Prof
...
G
...
setCursor()
SETS the LCD cursor; that is, set the location at which subsequent text will be
displayed
...
setCursor(col, row)
Parameters
lcd: a variable of type LiquidCrystal
col: the column at which to position the cursor (with 0 being the first column)
row: the row at which to position the cursor (with 0 being the first row)
Example
Lcd
...
write()
Write a singlecharacter to the LCD
...
write(data)
Parameters
lcd: a variable of type LiquidCrystal
data: the character to write to the display
Example
Lcd
...
print()
Prints text to the LCD
...
print(data)
Parameters
lcd: a variable of type LiquidCrystal
data: the data to print (char, byte, int, long, or string)
Example
lcd
...
display()
Turns on the LCD display
Syntax
lcd
...
noDisplay()
Turns OFF the LCD display
Syntax
lcd
...
Thite T
...


9

Electrical and Electronics Engineering

SE Mech,Sem-II

INTERFACINGDIAGRAM:

ALGORITHM:
1
...
h)
2
...
In Setup function
a
...

b
...
Set Cursor of LCD to 2nd line first column
...
Print Message on second line of LCD
TAE,PUNE

Prof
...
G
...
In Loop function
a
...
Call the delay
c
...
Call the Delay
CODE/PROGRAM/SKETCH:
// include the library code:
#include ...
begin(16, 2);
lcd
...
setCursor(0, 2);
lcd
...
noDisplay(); // Turn off the display:
delay(500);
lcd
...
Thite T
...


11

Electrical and Electronics Engineering

SE Mech,Sem-II

3
...
Differentiate between serial and parallel communication]

THEORY
1
...
However, in many
situations, parallel data transfer is impractical
...
Hence, a serial communication is widely used in long
distance communication
...

The data byte is always transmitted with least significant bit first
...

Serial ports are controlled by a special chip call a UART (Universal Asynchronous
Receiver Transmitter) or USART (Universal synchronous Asynchronous Receiver
Transmitter)
1
...

a
...
The transmitter sends and the receiver receives the data
...
Half duplex communication link: In half duplex, the communication link can
be used for either transmission or reception
...

c
...
e
...
Thite T
...


12

Electrical and Electronics Engineering

SE Mech,Sem-II

Types of Serial communication:
Serial data communication uses two types of communication
...
Synchronous serial data communication: In this transmitter and receiver are
synchronized
...

b
...

Baud rate:
[Q
...
The
baud rate is the reciprocal of the time to send one bit
BAUD RATE=1/(time to send 1 bit)
Standard values of baud rates are 1200,2400,4800,9600 and so on
...
g if baud rate =9600
For bit transmission time = 1 second/ 9600 = 0
...

Serial Data Format
[Q
...
]
The serial data format includes one start bit, between five and eight data bits,
and one stop bit
...

Start bit =always ‘0’
Stop bit= always ‘1’
Parity bit=’0’, if no of 1’s in 8 bit data are odd
’1’, if no of 1’s in 8 bit data are even
TAE,PUNE

Prof
...
G
...


The format for serial port data is often expressed using the following notation:
Number of data bits - parity type - number of stop bits
...
Thite T
...


14

Electrical and Electronics Engineering

SE Mech,Sem-II

For example, 8-N-1 is interpreted as eight data bits, no parity bit, and one stop
bit, while 7-E-2 is interpreted as seven data bits, even parity, and two stop bits
...
The remaining bits are called framing bits because they
frame the data bits
...
Thite T
...


15

Electrical and Electronics Engineering

SE Mech,Sem-II

INTERFACINGDIAGRAM:

ALGORITHM:
1
...
Initialize the serial port with desired baud rate (e
...
9600)
b
...
In Loop function
a
...
Check for any data is received on serial port
c
...
Thite T
...


16

Electrical and Electronics Engineering

SE Mech,Sem-II

Functions used for serial communication
1
...
use one of these
rates: 300, 600, 1200, 2400, 4800, 9600, 14400, 19200, 28800, 38400, 57600, or 115200
Syntax
Serial
...
begin(9600);--- sets data rate to 9600 bps
2
...

Syntax
Serial
...
println(val)
Parameters
val: the value to print
Example
Serial
...
available()
Get the number of bytes (characters) available for reading from the serial port
...
available()
Returns
the number of bytes available to read
Example
if (Serial
...
read()
Reads incoming serial data
...
read()
Returns
the first byte of incoming serial data available
Example
if (Serial
...
read();
// read the incoming byte:
}
TAE,PUNE

Prof
...
G
...
write sketch to transmit and receive data serially from arduino uno]

void setup() {
Serial
...
println("Smart Logic Technologies");
Serial
...
println("Please send data");
}
void loop() {
// read from com port, and send it again
if (Serial
...
read();
Serial
...
Timers in Arduino uno
Timer is a circuit incide ATmega328 microcontroller of arduino uno
The Arduino UNO has three timers
 Timer0 - An 8 bit timer used by Arduino functions delay(), millis() and
micros()
...
Thite T
...


18


Title: EEE Unit 5 Arduino Interfacing Notes
Description: These notes are Useful for Second Year Mechanical Students of Pune University