Upload
mohammed-innat
View
165
Download
7
Embed Size (px)
Serial Communication &
Arduino Interface
Mohammed Innat 2k14
E.C.E.
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
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 --
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
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
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
TTL Serial Signal - Passes data serially
A packet of Information or Frame of Data
5
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
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
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
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
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
Q & AAsk any question related to this topic . Out of the topic question won’t
be answered.
THANK YOU ALL