13
Serial Communication & Arduino Interface Mohammed Innat 2k14 E.C. E.

Serial Communication & Embedded System Interface

Embed Size (px)

Citation preview

Page 1: Serial Communication & Embedded System Interface

Serial Communication &

Arduino Interface

Mohammed Innat 2k14

E.C.E.

Page 2: Serial Communication & Embedded System Interface

Content1. Serial Communication in Embedded System

2. Up and Running with Arduino for Serial Communication

3. Hardware implementation for serial communication

4. Connect :: Arduino & a. .. with C++ b. .. with Pythonc. .. with Java d. .. with Matlab

Page 3: Serial Communication & Embedded System Interface

Serial Communication

1

Process of sending data one bit a time sequentially over a Communication channel

Variation of Serial Communication

● Asynchronous SC● Synchronous SC

● RS 232 -- ● RS 485 -- ● USB -- ● Ethernet --● CAN -- ● SPI -- ● I2C --

Page 4: Serial Communication & Embedded System Interface

Serial CommunicationA . Transmitter and Receiver - TX & RX

C. Serial Type :

a) Simplex b) Half-Duplex c) Duplex

B. Communication in : Serial Interfaces

a) Synchronous Communication - Ex : SPI , I2C

b) Asynchronous Communication - Ex : UART

D. Bit time - Bit Rate 2

Page 5: Serial Communication & Embedded System Interface

Rules of SerialSerial Data Communication

● Baud rate -

a. How fast data transmitted

b. Expressed in bps

c . Baud rate ~ Speed of TX / RX

● Framing the Data :

* Data chunk

* Synchronization bits

* Parity bits3

Page 6: Serial Communication & Embedded System Interface

Wiring & Hardware

A serial bus consists of just two wires - one for sending data and another for receiving

Serial Communication in Embedded System

Hardware Implementation ● Microcontroller and other low-level ICs communicate serially at TTL

level .TTL serial signal exits between microcontroller ‘s voltage supply range usually 0v to 3.3v / 5v

● RS 232 , found on computer , is like TTL serial flipped on its head. RS 232 signals usually range between -13v and 13v.

4

Page 7: Serial Communication & Embedded System Interface

TTL Serial Signal - Passes data serially

A packet of Information or Frame of Data

5

Page 8: Serial Communication & Embedded System Interface

Up & Running : Serial Port of Arduino#. Initialize with ‘ begin()’ function

#. Bit per second or bps should be 9600 [ default ]○ void setup() {

○ serial.begin(9600) ; // Open serial ports ; set data rate to 9600 bps

○ }

○ void loop() { }

#. Both side of the serial connection need to be set to use the same speed

6

Page 9: Serial Communication & Embedded System Interface

The UART● Universal Asynchronous Receiver / Transmitter● The interface between microcontroller and serial port

Advanced UARTs provide some amount of buffering of data so that the computerand serial devices data streams remain coordinated.

● UARTs do exist as stand-alone ICs, but they’re more commonly found inside microcontrollers.

● ATmega328 - has just a single UART , one can found in Arduino Uno

7

Page 10: Serial Communication & Embedded System Interface

Common Pitfalls1. TX - to - RX ; RX - to -

TX

Connect both devices properly .

2. Baud Rate Mismatch

The two devices must speak with the same speed otherwise data either misinterpreted or completely missed. 8

Page 11: Serial Communication & Embedded System Interface

Arduino Serial Port

Connect( ) with Many ..

1. Arduino & Matlaba. connect with serial portb. read and write c. send instruction by .m code

2. Arduino & C++a. serial communication on

windows based system

3. Arduino & Pythona. install PySerial

4. Arduino & Javaa. arduino can communicate

with serial port via RXTX java library .

9

Page 12: Serial Communication & Embedded System Interface

ConclusionLet’s make a short summary for serial communication process :

1. Serial protocols separated between Synchronous and Asynchronous

2. Asynchronous is perfect but need to put some extra effort

3. Asynchronous protocols widely used in Embedded system

4. Rules of Serial ..

5. Microcontroller and other ICs communicate at TTL level [ 0v to 3.3v / 5v ]

6. UART is an interface between microcontroller and serial port

7. UART controls computer interface to its attached serial device.

10

Page 13: Serial Communication & Embedded System Interface

Q & AAsk any question related to this topic . Out of the topic question won’t

be answered.

THANK YOU ALL