SlideShare a Scribd company logo
2
Most read
5
Most read
11
Most read
Arduino Based Applications
Part-2
By
Jawaher A.Fadhil
B.SC in Electronics Engineering
M.Tech in Computer Engineering
University of Duhok
College of Science
CS Department
Serial Communication
2
Introducing Serial Communication
The word serial comes from the way data is transmitted;
serial devices send bits one at a time on a single wire. This is
something that you have seen before; it is like a telephone
call. Both users pick up the telephone and a single wire
connects them together.
While serial devices send bits on a single wire, parallel
devices send multiple bits on multiple wires. Although
parallel communications can be faster than serial, they were
often more expensive, requiring more wires. There are also
speed limitations due to physical limitations of conductive
wiring. The next figure shows the difference between serial
and parallel communications.
3
Introducing Serial Communication
4
Serial versus parallel
Introducing Serial Communication
Serial ports are extremely simple. This simplicity is one reason
why they are used so often. Data is sent on one wire, the
transmit wire (TX), and received on another, the receive wire
(RX). On the other side of the cable, it is connected to another
computer with a TX pin and an RX pin. Inside the cable itself, the
TX and RX wires are inverted. The TX pin on one side is
connected to the RX pin on the other side. This is illustrated in
Figure.
5
Transmit and receive wires
Introducing Serial Communication
Arduinos use serial ports for communicating with computers
and other devices. The USB port of an Arduino is used for
serial communication with a computer, with the added
advantage that USB can also be used to power the device.
USB also has the advantage of auto-configuring most of the
parameters.
Some Arduinos have other hardware serial ports, enabling
communication with other devices. The USB communication
is sent to Arduino pins 0 and 1, meaning that those pins are
reserved if your device must communicate with a computer.
6
Starting a Serial Connection
To Start a Serial Connection you must first do some basic
configuration. To do this, you use the begin function of the
Serial object. Typically, 9,600 is an appropriate speed for
communicating. You are free to use any speed you want as long
as both devices are operating at the same speed.
void setup()
{
Serial.begin(9600); // Opens the serial port
}
Serial configuration is normally done in setup() because devices
tend to not change the speed at which they communicate over
time.
7
Sending Text
To send data to the serial device , use the function print(). The
data to be printed can be in any format.
Serial.print("Hello, world"); // Output an entire string
Serial.print('!'); // Output a single character
8
Serial Communication-writing
You need the following components:
• Arduino Uno
• USB cable
Serial Communication-writing
void setup( )
{
pinMode(13, OUTPUT);
Serial.begin(9600); // sets data rate to 9600 bps
}
void loop()
{
digitalWrite(13, HIGH);
Serial.println("LED is On");
delay(1000);
digitalWrite(13, LOW);
Serial.println("LED is Off");
delay(1000);
} 9
Serial Communication-Reading
Arduinos can also receive data. Receiving data can be used for
many projects; computers can send data, for example, to control
the brightness of an LED. To read data from the serial device , use
the function Serial.read( );
int ledPin=13;
int value;
void setup()
{
Serial.begin(9600);
pinMode(ledPin,OUTPUT);
}
10
Serial Communication-Reading
void loop ()
{value = Serial.read();
if (value == '1')
{
digitalWrite(ledPin,HIGH);
}
else if (value == '0')
{
digitalWrite(ledPin,LOW);
}
}
11
Reference
James A. Langbridge,” Arduino sketches tools and
techniques for programming wizardry”,2015.
12
13

More Related Content

PPTX
Arduino and c programming
PPTX
Arduino Introduction (Blinking LED) Presentation (workshop #5)
PPS
What is Arduino ?
PPTX
Arduino slides
PPTX
Introduction to Arduino
PPS
Arduino Uno Pin Description
PPTX
Introduction to Arduino
PPTX
Introduction to Arduino Microcontroller
Arduino and c programming
Arduino Introduction (Blinking LED) Presentation (workshop #5)
What is Arduino ?
Arduino slides
Introduction to Arduino
Arduino Uno Pin Description
Introduction to Arduino
Introduction to Arduino Microcontroller

What's hot (20)

PDF
Serial Communication Interfaces
PPT
8051 instruction set
PDF
8051 interfacing
PPSX
Lect 2 ARM processor architecture
PPT
8086 pin details
PPTX
8251 USART
PPT
adder and subtractor
PPTX
Classification of embedded systems
PDF
Introduction to Arduino Programming
PDF
Programmable Peripheral Interface 8255
PDF
Introduction to microcontroller
PDF
Introduction in microcontroller
PDF
8051 Microcontroller I/O ports
PDF
Interfacing the Raspberry Pi to the World
PDF
[HK Roni] C Programming Lectures
PPTX
INTRODUCTION TO MICROCONTROLLER
PPT
Pass Transistor Logic
PPTX
Raspberry Pi (Introduction)
PPT
Ppt Digital Electronics
PPTX
Introduction to arduino ppt main
Serial Communication Interfaces
8051 instruction set
8051 interfacing
Lect 2 ARM processor architecture
8086 pin details
8251 USART
adder and subtractor
Classification of embedded systems
Introduction to Arduino Programming
Programmable Peripheral Interface 8255
Introduction to microcontroller
Introduction in microcontroller
8051 Microcontroller I/O ports
Interfacing the Raspberry Pi to the World
[HK Roni] C Programming Lectures
INTRODUCTION TO MICROCONTROLLER
Pass Transistor Logic
Raspberry Pi (Introduction)
Ppt Digital Electronics
Introduction to arduino ppt main
Ad

Similar to Arduino- Serial communication (20)

PDF
Device Operation using PC by Arduino (1).pdf
PPTX
Fund. of IoT LAB - CO 252.pptx
PPT
ARDUINO AND ITS PIN CONFIGURATION
PPT
Physical prototyping lab3-serious_serial
PPTX
Serial Communication in Internet of Things .pptx
PPTX
Serial Communication & Embedded System Interface
PPTX
PPTX
arduinoedit.pptx
PPT
Arduino wk2
PPT
Fundamentals of programming Arduino-Wk2.ppt
PDF
Arduino Workshop @ MSA University
PPT
introduction to arduino and digital input and output, Data representation and...
DOCX
Arduino Full Tutorial
PPT
Arduino is an open-source electronics platform that has an easy-to-use physic...
PDF
Arduino spooky projects_class3
PDF
Arduino guide
PDF
Intro to Arduino Programming.pdf
PDF
Syed IoT - module 5
PPTX
Micro_Controllers_lab1_Intro_to_Arduino.pptx
PPT
Introduction to Arduino 16822775 (2).ppt
Device Operation using PC by Arduino (1).pdf
Fund. of IoT LAB - CO 252.pptx
ARDUINO AND ITS PIN CONFIGURATION
Physical prototyping lab3-serious_serial
Serial Communication in Internet of Things .pptx
Serial Communication & Embedded System Interface
arduinoedit.pptx
Arduino wk2
Fundamentals of programming Arduino-Wk2.ppt
Arduino Workshop @ MSA University
introduction to arduino and digital input and output, Data representation and...
Arduino Full Tutorial
Arduino is an open-source electronics platform that has an easy-to-use physic...
Arduino spooky projects_class3
Arduino guide
Intro to Arduino Programming.pdf
Syed IoT - module 5
Micro_Controllers_lab1_Intro_to_Arduino.pptx
Introduction to Arduino 16822775 (2).ppt
Ad

More from Jawaher Abdulwahab Fadhil (20)

PDF
PPT
PDF
Add instruction-part1
PPTX
Dealing with 8086 memory
PPTX
MOV instruction part1
PDF
Cisco webex installation guide
PPTX
A survey on the applications of smart home
PPT
Flag register and add instruction
PDF
Computer Organization -part 1
PPTX
iOS Operating System
PPTX
Android Operating system
PPTX
Types of Mobile Applications
PDF
Ultrasonic with buzzer
PDF
Lecture6 modulation
PDF
Lecture 5: The Convolution Sum
PDF
Lecture 4: Classification of system
PDF
Lecture3: Operations of Ct signals
PDF
Lecture2 : Common continuous time signals
PDF
Lecture1: Introduction to signals
PDF
Arduino based Applications-part 6
Add instruction-part1
Dealing with 8086 memory
MOV instruction part1
Cisco webex installation guide
A survey on the applications of smart home
Flag register and add instruction
Computer Organization -part 1
iOS Operating System
Android Operating system
Types of Mobile Applications
Ultrasonic with buzzer
Lecture6 modulation
Lecture 5: The Convolution Sum
Lecture 4: Classification of system
Lecture3: Operations of Ct signals
Lecture2 : Common continuous time signals
Lecture1: Introduction to signals
Arduino based Applications-part 6

Recently uploaded (20)

PDF
Complications of Minimal Access Surgery at WLH
PPTX
IMMUNITY IMMUNITY refers to protection against infection, and the immune syst...
PPTX
Pharmacology of Heart Failure /Pharmacotherapy of CHF
PPTX
Pharma ospi slides which help in ospi learning
PPTX
Lesson notes of climatology university.
PDF
Insiders guide to clinical Medicine.pdf
PDF
grade 11-chemistry_fetena_net_5883.pdf teacher guide for all student
PDF
Microbial disease of the cardiovascular and lymphatic systems
PDF
FourierSeries-QuestionsWithAnswers(Part-A).pdf
PPTX
Institutional Correction lecture only . . .
PPTX
Renaissance Architecture: A Journey from Faith to Humanism
PDF
Chapter 2 Heredity, Prenatal Development, and Birth.pdf
PDF
Saundersa Comprehensive Review for the NCLEX-RN Examination.pdf
PDF
Classroom Observation Tools for Teachers
PDF
01-Introduction-to-Information-Management.pdf
PPTX
Final Presentation General Medicine 03-08-2024.pptx
PDF
RMMM.pdf make it easy to upload and study
PDF
The Lost Whites of Pakistan by Jahanzaib Mughal.pdf
PPTX
PPH.pptx obstetrics and gynecology in nursing
PPTX
Cell Structure & Organelles in detailed.
Complications of Minimal Access Surgery at WLH
IMMUNITY IMMUNITY refers to protection against infection, and the immune syst...
Pharmacology of Heart Failure /Pharmacotherapy of CHF
Pharma ospi slides which help in ospi learning
Lesson notes of climatology university.
Insiders guide to clinical Medicine.pdf
grade 11-chemistry_fetena_net_5883.pdf teacher guide for all student
Microbial disease of the cardiovascular and lymphatic systems
FourierSeries-QuestionsWithAnswers(Part-A).pdf
Institutional Correction lecture only . . .
Renaissance Architecture: A Journey from Faith to Humanism
Chapter 2 Heredity, Prenatal Development, and Birth.pdf
Saundersa Comprehensive Review for the NCLEX-RN Examination.pdf
Classroom Observation Tools for Teachers
01-Introduction-to-Information-Management.pdf
Final Presentation General Medicine 03-08-2024.pptx
RMMM.pdf make it easy to upload and study
The Lost Whites of Pakistan by Jahanzaib Mughal.pdf
PPH.pptx obstetrics and gynecology in nursing
Cell Structure & Organelles in detailed.

Arduino- Serial communication

  • 1. Arduino Based Applications Part-2 By Jawaher A.Fadhil B.SC in Electronics Engineering M.Tech in Computer Engineering University of Duhok College of Science CS Department
  • 3. Introducing Serial Communication The word serial comes from the way data is transmitted; serial devices send bits one at a time on a single wire. This is something that you have seen before; it is like a telephone call. Both users pick up the telephone and a single wire connects them together. While serial devices send bits on a single wire, parallel devices send multiple bits on multiple wires. Although parallel communications can be faster than serial, they were often more expensive, requiring more wires. There are also speed limitations due to physical limitations of conductive wiring. The next figure shows the difference between serial and parallel communications. 3
  • 5. Introducing Serial Communication Serial ports are extremely simple. This simplicity is one reason why they are used so often. Data is sent on one wire, the transmit wire (TX), and received on another, the receive wire (RX). On the other side of the cable, it is connected to another computer with a TX pin and an RX pin. Inside the cable itself, the TX and RX wires are inverted. The TX pin on one side is connected to the RX pin on the other side. This is illustrated in Figure. 5 Transmit and receive wires
  • 6. Introducing Serial Communication Arduinos use serial ports for communicating with computers and other devices. The USB port of an Arduino is used for serial communication with a computer, with the added advantage that USB can also be used to power the device. USB also has the advantage of auto-configuring most of the parameters. Some Arduinos have other hardware serial ports, enabling communication with other devices. The USB communication is sent to Arduino pins 0 and 1, meaning that those pins are reserved if your device must communicate with a computer. 6
  • 7. Starting a Serial Connection To Start a Serial Connection you must first do some basic configuration. To do this, you use the begin function of the Serial object. Typically, 9,600 is an appropriate speed for communicating. You are free to use any speed you want as long as both devices are operating at the same speed. void setup() { Serial.begin(9600); // Opens the serial port } Serial configuration is normally done in setup() because devices tend to not change the speed at which they communicate over time. 7
  • 8. Sending Text To send data to the serial device , use the function print(). The data to be printed can be in any format. Serial.print("Hello, world"); // Output an entire string Serial.print('!'); // Output a single character 8 Serial Communication-writing You need the following components: • Arduino Uno • USB cable
  • 9. Serial Communication-writing void setup( ) { pinMode(13, OUTPUT); Serial.begin(9600); // sets data rate to 9600 bps } void loop() { digitalWrite(13, HIGH); Serial.println("LED is On"); delay(1000); digitalWrite(13, LOW); Serial.println("LED is Off"); delay(1000); } 9
  • 10. Serial Communication-Reading Arduinos can also receive data. Receiving data can be used for many projects; computers can send data, for example, to control the brightness of an LED. To read data from the serial device , use the function Serial.read( ); int ledPin=13; int value; void setup() { Serial.begin(9600); pinMode(ledPin,OUTPUT); } 10
  • 11. Serial Communication-Reading void loop () {value = Serial.read(); if (value == '1') { digitalWrite(ledPin,HIGH); } else if (value == '0') { digitalWrite(ledPin,LOW); } } 11
  • 12. Reference James A. Langbridge,” Arduino sketches tools and techniques for programming wizardry”,2015. 12
  • 13. 13